From 1a290370bb8ced13d0c1a3f28265a952cfbea1a9 Mon Sep 17 00:00:00 2001 From: Dmytro Svyrydenko Date: Tue, 5 Dec 2023 18:50:00 +0200 Subject: [PATCH] chore: update preview-build --- .../assets/{index-b321b587.js => index-3e67d3a8.js} | 2 +- .../assets/{index-75e4cbc4.js => index-e2c1b9df.js} | 2 +- .../assets/{index-7f510ab1.js => index-eb9ef66c.js} | 2 +- .../assets/{index-e25ecac5.js => index-f54a1fc2.js} | 2 +- .../{punycode-e9579d2a.js => punycode-06c60053.js} | 2 +- ...d.esm-aaf40c80.js => solanaEmbed.esm-47ad5150.js} | 2 +- preview-build/assets/widget-7424685c.js | 12 ------------ preview-build/assets/widget-e5024a77.js | 12 ++++++++++++ preview-build/index.html | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) rename preview-build/assets/{index-b321b587.js => index-3e67d3a8.js} (99%) rename preview-build/assets/{index-75e4cbc4.js => index-e2c1b9df.js} (99%) rename preview-build/assets/{index-7f510ab1.js => index-eb9ef66c.js} (99%) rename preview-build/assets/{index-e25ecac5.js => index-f54a1fc2.js} (99%) rename preview-build/assets/{punycode-e9579d2a.js => punycode-06c60053.js} (99%) rename preview-build/assets/{solanaEmbed.esm-aaf40c80.js => solanaEmbed.esm-47ad5150.js} (99%) delete mode 100644 preview-build/assets/widget-7424685c.js create mode 100644 preview-build/assets/widget-e5024a77.js diff --git a/preview-build/assets/index-b321b587.js b/preview-build/assets/index-3e67d3a8.js similarity index 99% rename from preview-build/assets/index-b321b587.js rename to preview-build/assets/index-3e67d3a8.js index 0bd4c87..cfd0586 100644 --- a/preview-build/assets/index-b321b587.js +++ b/preview-build/assets/index-3e67d3a8.js @@ -1 +1 @@ -import{E as I,s as R,f as q,P as U}from"./index-e25ecac5.js";var D=globalThis&&globalThis.__extends||function(){var s=function(i,e){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},s(i,e)};return function(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");s(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}}(),W=function(s){D(i,s);function i(){return s!==null&&s.apply(this,arguments)||this}return i}(I),M=R.Buffer;function z(s){if(s.length>=255)throw new TypeError("Alphabet too long");for(var i=new Uint8Array(256),e=0;e>>0,p=new Uint8Array(y);v!==w;){for(var b=f[v],A=0,_=y-1;(b!==0||A>>0,p[_]=b%c>>>0,b=b/c>>>0;if(b!==0)throw new Error("Non-zero carry");m=A,v++}for(var g=y-m;g!==y&&p[g]===0;)g++;for(var S=l.repeat(d);g>>0,y=new Uint8Array(w);f[d];){var p=i[f.charCodeAt(d)];if(p===255)return;for(var b=0,A=w-1;(p!==0||b>>0,y[A]=p%256>>>0,p=p/256>>>0;if(p!==0)throw new Error("Non-zero carry");v=b,d++}for(var _=w-v;_!==w&&y[_]===0;)_++;var g=M.allocUnsafe(m+(w-_));g.fill(0,0,m);for(var S=m;_!==w;)g[S++]=y[_++];return g}function C(f){var d=h(f);if(d)return d;throw new Error("Non-base"+c+" character")}return{encode:a,decodeUnsafe:h,decode:C}}var $=z,H=$,L="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",B=H(L);const j=q(B);var T=globalThis&&globalThis.__awaiter||function(s,i,e,t){function r(n){return n instanceof e?n:new e(function(c){c(n)})}return new(e||(e=Promise))(function(n,c){function l(a){try{o(t.next(a))}catch(h){c(h)}}function u(a){try{o(t.throw(a))}catch(h){c(h)}}function o(a){a.done?n(a.value):r(a.value).then(l,u)}o((t=t.apply(s,i||[])).next())})};class F extends I{constructor(i,e){if(super(),this._network=e,this._publicKey=null,this._popup=null,this._handlerAdded=!1,this._nextRequestId=1,this._autoApprove=!1,this._responsePromises=new Map,this.handleMessage=t=>{var r;if(this._injectedProvider&&t.source===window||t.origin===((r=this._providerUrl)===null||r===void 0?void 0:r.origin)&&t.source===this._popup){if(t.data.method==="connected"){const n=new U(t.data.params.publicKey);(!this._publicKey||!this._publicKey.equals(n))&&(this._publicKey&&!this._publicKey.equals(n)&&this.handleDisconnect(),this._publicKey=n,this._autoApprove=!!t.data.params.autoApprove,this.emit("connect",this._publicKey))}else if(t.data.method==="disconnected")this.handleDisconnect();else if(t.data.result||t.data.error){const n=this._responsePromises.get(t.data.id);if(n){const[c,l]=n;t.data.result?c(t.data.result):l(new Error(t.data.error))}}}},this._beforeUnload=()=>{this.disconnect()},N(i))this._injectedProvider=i;else if(G(i))this._providerUrl=new URL(i),this._providerUrl.hash=new URLSearchParams({origin:window.location.origin,network:this._network}).toString();else throw new Error("provider parameter must be an injected provider or a URL string.")}handleConnect(){var i;return this._handlerAdded||(this._handlerAdded=!0,window.addEventListener("message",this.handleMessage),window.addEventListener("beforeunload",this._beforeUnload)),this._injectedProvider?new Promise(e=>{this.sendRequest("connect",{}),e()}):(window.name="parent",this._popup=window.open((i=this._providerUrl)===null||i===void 0?void 0:i.toString(),"_blank","location,resizable,width=460,height=675"),new Promise(e=>{this.once("connect",e)}))}handleDisconnect(){this._handlerAdded&&(this._handlerAdded=!1,window.removeEventListener("message",this.handleMessage),window.removeEventListener("beforeunload",this._beforeUnload)),this._publicKey&&(this._publicKey=null,this.emit("disconnect")),this._responsePromises.forEach(([,i],e)=>{this._responsePromises.delete(e),i(new Error("Wallet disconnected"))})}sendRequest(i,e){return T(this,void 0,void 0,function*(){if(i!=="connect"&&!this.connected)throw new Error("Wallet not connected");const t=this._nextRequestId;return++this._nextRequestId,new Promise((r,n)=>{var c,l,u,o;this._responsePromises.set(t,[r,n]),this._injectedProvider?this._injectedProvider.postMessage({jsonrpc:"2.0",id:t,method:i,params:Object.assign({network:this._network},e)}):((c=this._popup)===null||c===void 0||c.postMessage({jsonrpc:"2.0",id:t,method:i,params:e},(u=(l=this._providerUrl)===null||l===void 0?void 0:l.origin)!==null&&u!==void 0?u:""),this.autoApprove||(o=this._popup)===null||o===void 0||o.focus())})})}get publicKey(){return this._publicKey}get connected(){return this._publicKey!==null}get autoApprove(){return this._autoApprove}connect(){return T(this,void 0,void 0,function*(){this._popup&&this._popup.close(),yield this.handleConnect()})}disconnect(){return T(this,void 0,void 0,function*(){this._injectedProvider&&(yield this.sendRequest("disconnect",{})),this._popup&&this._popup.close(),this.handleDisconnect()})}sign(i,e){return T(this,void 0,void 0,function*(){if(!(i instanceof Uint8Array))throw new Error("Data must be an instance of Uint8Array");const t=yield this.sendRequest("sign",{data:i,display:e}),r=j.decode(t.signature),n=new U(t.publicKey);return{signature:r,publicKey:n}})}signTransaction(i){return T(this,void 0,void 0,function*(){const e=yield this.sendRequest("signTransaction",{message:j.encode(i.serializeMessage())}),t=j.decode(e.signature),r=new U(e.publicKey);return i.addSignature(r,t),i})}signAllTransactions(i){return T(this,void 0,void 0,function*(){const e=yield this.sendRequest("signAllTransactions",{messages:i.map(n=>j.encode(n.serializeMessage()))}),t=e.signatures.map(n=>j.decode(n)),r=new U(e.publicKey);return i=i.map((n,c)=>(n.addSignature(r,t[c]),n)),i})}diffieHellman(i){return T(this,void 0,void 0,function*(){if(!(i instanceof Uint8Array))throw new Error("Data must be an instance of Uint8Array");return yield this.sendRequest("diffieHellman",{publicKey:i})})}}function G(s){return typeof s=="string"}function N(s){return J(s)&&"postMessage"in s&&typeof s.postMessage=="function"}function J(s){return typeof s=="object"&&s!==null}var Q=globalThis&&globalThis.__extends||function(){var s=function(i,e){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},s(i,e)};return function(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");s(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}}(),O=globalThis&&globalThis.__awaiter||function(s,i,e,t){function r(n){return n instanceof e?n:new e(function(c){c(n)})}return new(e||(e=Promise))(function(n,c){function l(a){try{o(t.next(a))}catch(h){c(h)}}function u(a){try{o(t.throw(a))}catch(h){c(h)}}function o(a){a.done?n(a.value):r(a.value).then(l,u)}o((t=t.apply(s,i||[])).next())})},k=globalThis&&globalThis.__generator||function(s,i){var e={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},t,r,n,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(o){return function(a){return u([o,a])}}function u(o){if(t)throw new TypeError("Generator is already executing.");for(;e;)try{if(t=1,r&&(n=o[0]&2?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[o[0]&2,n.value]),o[0]){case 0:case 1:n=o;break;case 4:return e.label++,{value:o[1],done:!1};case 5:e.label++,r=o[1],o=[0];continue;case 7:o=e.ops.pop(),e.trys.pop();continue;default:if(n=e.trys,!(n=n.length>0&&n[n.length-1])&&(o[0]===6||o[0]===2)){e=0;continue}if(o[0]===3&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])&&(o[0]===6||o[0]===2)){e=0;continue}if(o[0]===3&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])&&(o[0]===6||o[0]===2)){e=0;continue}if(o[0]===3&&(!n||o[1]>n[0]&&o[1]=255)throw new TypeError("Alphabet too long");for(var i=new Uint8Array(256),e=0;e>>0,p=new Uint8Array(y);v!==w;){for(var b=f[v],A=0,_=y-1;(b!==0||A>>0,p[_]=b%c>>>0,b=b/c>>>0;if(b!==0)throw new Error("Non-zero carry");m=A,v++}for(var g=y-m;g!==y&&p[g]===0;)g++;for(var S=l.repeat(d);g>>0,y=new Uint8Array(w);f[d];){var p=i[f.charCodeAt(d)];if(p===255)return;for(var b=0,A=w-1;(p!==0||b>>0,y[A]=p%256>>>0,p=p/256>>>0;if(p!==0)throw new Error("Non-zero carry");v=b,d++}for(var _=w-v;_!==w&&y[_]===0;)_++;var g=M.allocUnsafe(m+(w-_));g.fill(0,0,m);for(var S=m;_!==w;)g[S++]=y[_++];return g}function C(f){var d=h(f);if(d)return d;throw new Error("Non-base"+c+" character")}return{encode:a,decodeUnsafe:h,decode:C}}var $=z,H=$,L="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",B=H(L);const j=q(B);var T=globalThis&&globalThis.__awaiter||function(s,i,e,t){function r(n){return n instanceof e?n:new e(function(c){c(n)})}return new(e||(e=Promise))(function(n,c){function l(a){try{o(t.next(a))}catch(h){c(h)}}function u(a){try{o(t.throw(a))}catch(h){c(h)}}function o(a){a.done?n(a.value):r(a.value).then(l,u)}o((t=t.apply(s,i||[])).next())})};class F extends I{constructor(i,e){if(super(),this._network=e,this._publicKey=null,this._popup=null,this._handlerAdded=!1,this._nextRequestId=1,this._autoApprove=!1,this._responsePromises=new Map,this.handleMessage=t=>{var r;if(this._injectedProvider&&t.source===window||t.origin===((r=this._providerUrl)===null||r===void 0?void 0:r.origin)&&t.source===this._popup){if(t.data.method==="connected"){const n=new U(t.data.params.publicKey);(!this._publicKey||!this._publicKey.equals(n))&&(this._publicKey&&!this._publicKey.equals(n)&&this.handleDisconnect(),this._publicKey=n,this._autoApprove=!!t.data.params.autoApprove,this.emit("connect",this._publicKey))}else if(t.data.method==="disconnected")this.handleDisconnect();else if(t.data.result||t.data.error){const n=this._responsePromises.get(t.data.id);if(n){const[c,l]=n;t.data.result?c(t.data.result):l(new Error(t.data.error))}}}},this._beforeUnload=()=>{this.disconnect()},N(i))this._injectedProvider=i;else if(G(i))this._providerUrl=new URL(i),this._providerUrl.hash=new URLSearchParams({origin:window.location.origin,network:this._network}).toString();else throw new Error("provider parameter must be an injected provider or a URL string.")}handleConnect(){var i;return this._handlerAdded||(this._handlerAdded=!0,window.addEventListener("message",this.handleMessage),window.addEventListener("beforeunload",this._beforeUnload)),this._injectedProvider?new Promise(e=>{this.sendRequest("connect",{}),e()}):(window.name="parent",this._popup=window.open((i=this._providerUrl)===null||i===void 0?void 0:i.toString(),"_blank","location,resizable,width=460,height=675"),new Promise(e=>{this.once("connect",e)}))}handleDisconnect(){this._handlerAdded&&(this._handlerAdded=!1,window.removeEventListener("message",this.handleMessage),window.removeEventListener("beforeunload",this._beforeUnload)),this._publicKey&&(this._publicKey=null,this.emit("disconnect")),this._responsePromises.forEach(([,i],e)=>{this._responsePromises.delete(e),i(new Error("Wallet disconnected"))})}sendRequest(i,e){return T(this,void 0,void 0,function*(){if(i!=="connect"&&!this.connected)throw new Error("Wallet not connected");const t=this._nextRequestId;return++this._nextRequestId,new Promise((r,n)=>{var c,l,u,o;this._responsePromises.set(t,[r,n]),this._injectedProvider?this._injectedProvider.postMessage({jsonrpc:"2.0",id:t,method:i,params:Object.assign({network:this._network},e)}):((c=this._popup)===null||c===void 0||c.postMessage({jsonrpc:"2.0",id:t,method:i,params:e},(u=(l=this._providerUrl)===null||l===void 0?void 0:l.origin)!==null&&u!==void 0?u:""),this.autoApprove||(o=this._popup)===null||o===void 0||o.focus())})})}get publicKey(){return this._publicKey}get connected(){return this._publicKey!==null}get autoApprove(){return this._autoApprove}connect(){return T(this,void 0,void 0,function*(){this._popup&&this._popup.close(),yield this.handleConnect()})}disconnect(){return T(this,void 0,void 0,function*(){this._injectedProvider&&(yield this.sendRequest("disconnect",{})),this._popup&&this._popup.close(),this.handleDisconnect()})}sign(i,e){return T(this,void 0,void 0,function*(){if(!(i instanceof Uint8Array))throw new Error("Data must be an instance of Uint8Array");const t=yield this.sendRequest("sign",{data:i,display:e}),r=j.decode(t.signature),n=new U(t.publicKey);return{signature:r,publicKey:n}})}signTransaction(i){return T(this,void 0,void 0,function*(){const e=yield this.sendRequest("signTransaction",{message:j.encode(i.serializeMessage())}),t=j.decode(e.signature),r=new U(e.publicKey);return i.addSignature(r,t),i})}signAllTransactions(i){return T(this,void 0,void 0,function*(){const e=yield this.sendRequest("signAllTransactions",{messages:i.map(n=>j.encode(n.serializeMessage()))}),t=e.signatures.map(n=>j.decode(n)),r=new U(e.publicKey);return i=i.map((n,c)=>(n.addSignature(r,t[c]),n)),i})}diffieHellman(i){return T(this,void 0,void 0,function*(){if(!(i instanceof Uint8Array))throw new Error("Data must be an instance of Uint8Array");return yield this.sendRequest("diffieHellman",{publicKey:i})})}}function G(s){return typeof s=="string"}function N(s){return J(s)&&"postMessage"in s&&typeof s.postMessage=="function"}function J(s){return typeof s=="object"&&s!==null}var Q=globalThis&&globalThis.__extends||function(){var s=function(i,e){return s=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,r){t.__proto__=r}||function(t,r){for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])},s(i,e)};return function(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");s(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}}(),O=globalThis&&globalThis.__awaiter||function(s,i,e,t){function r(n){return n instanceof e?n:new e(function(c){c(n)})}return new(e||(e=Promise))(function(n,c){function l(a){try{o(t.next(a))}catch(h){c(h)}}function u(a){try{o(t.throw(a))}catch(h){c(h)}}function o(a){a.done?n(a.value):r(a.value).then(l,u)}o((t=t.apply(s,i||[])).next())})},k=globalThis&&globalThis.__generator||function(s,i){var e={label:0,sent:function(){if(n[0]&1)throw n[1];return n[1]},trys:[],ops:[]},t,r,n,c;return c={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(c[Symbol.iterator]=function(){return this}),c;function l(o){return function(a){return u([o,a])}}function u(o){if(t)throw new TypeError("Generator is already executing.");for(;e;)try{if(t=1,r&&(n=o[0]&2?r.return:o[0]?r.throw||((n=r.return)&&n.call(r),0):r.next)&&!(n=n.call(r,o[1])).done)return n;switch(r=0,n&&(o=[o[0]&2,n.value]),o[0]){case 0:case 1:n=o;break;case 4:return e.label++,{value:o[1],done:!1};case 5:e.label++,r=o[1],o=[0];continue;case 7:o=e.ops.pop(),e.trys.pop();continue;default:if(n=e.trys,!(n=n.length>0&&n[n.length-1])&&(o[0]===6||o[0]===2)){e=0;continue}if(o[0]===3&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])&&(o[0]===6||o[0]===2)){e=0;continue}if(o[0]===3&&(!n||o[1]>n[0]&&o[1]0&&n[n.length-1])&&(o[0]===6||o[0]===2)){e=0;continue}if(o[0]===3&&(!n||o[1]>n[0]&&o[1]o.equals(t));s>=0&&(i.signatures[s]=e)}}var D=globalThis&&globalThis.__awaiter||function(i,t,e,n){function s(o){return o instanceof e?o:new e(function(d){d(o)})}return new(e||(e=Promise))(function(o,d){function u(r){try{a(n.next(r))}catch(c){d(c)}}function h(r){try{a(n.throw(r))}catch(c){d(c)}}function a(r){r.done?o(r.value):s(r.value).then(u,h)}a((n=n.apply(i,t||[])).next())})};function H(i){return D(this,void 0,void 0,function*(){try{return yield i.request({method:"wallet_getSnaps"}),!0}catch{return!1}})}function oe(){return D(this,void 0,void 0,function*(){try{const i=window.ethereum;if(!i)return null;if(i.providers&&Array.isArray(i.providers)){const t=i.providers;for(const e of t)if(yield H(e))return e}if(i.detected&&Array.isArray(i.detected)){const t=i.detected;for(const e of t)if(yield H(e))return e}return(yield H(i))?i:null}catch(i){return console.error(i),null}})}const ae="solana:mainnet",ce="solana:devnet",le="solana:testnet",de="solana:localnet",$=[ae,ce,le,de];function L(i){return $.includes(i)}var E=globalThis&&globalThis.__classPrivateFieldGet||function(i,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?i!==t||!n:!t.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(i):n?n.value:t.get(i)},A=globalThis&&globalThis.__classPrivateFieldSet||function(i,t,e,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?i!==t||!s:!t.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(i,e):s?s.value=e:t.set(i,e),e},T,C,I,K,k,O;const he=$,ue=[G,J,Q];class j{get address(){return E(this,T,"f")}get publicKey(){return E(this,C,"f").slice()}get chains(){return E(this,I,"f").slice()}get features(){return E(this,K,"f").slice()}get label(){return E(this,k,"f")}get icon(){return E(this,O,"f")}constructor({address:t,publicKey:e,label:n,icon:s}){T.set(this,void 0),C.set(this,void 0),I.set(this,void 0),K.set(this,void 0),k.set(this,void 0),O.set(this,void 0),new.target===j&&Object.freeze(this),A(this,T,t,"f"),A(this,C,e,"f"),A(this,I,he,"f"),A(this,K,ue,"f"),A(this,k,n,"f"),A(this,O,s,"f")}}T=new WeakMap,C=new WeakMap,I=new WeakMap,K=new WeakMap,k=new WeakMap,O=new WeakMap;var g=globalThis&&globalThis.__awaiter||function(i,t,e,n){function s(o){return o instanceof e?o:new e(function(d){d(o)})}return new(e||(e=Promise))(function(o,d){function u(r){try{a(n.next(r))}catch(c){d(c)}}function h(r){try{a(n.throw(r))}catch(c){d(c)}}function a(r){r.done?o(r.value):s(r.value).then(u,h)}a((n=n.apply(i,t||[])).next())})};class W extends Z{constructor(t){super(),this._network="mainnet-beta",this._iframeParams={},this._element=null,this._iframe=null,this._publicKey=null,this._account=null,this._isConnected=!1,this._connectHandler=null,this._messageHandlers={},this._handleEvent=e=>{var n,s;switch(e.type){case"connect":{this._collapseIframe(),!((n=e.data)===null||n===void 0)&&n.publicKey?(this._publicKey=e.data.publicKey,this._isConnected=!0,this._connectHandler&&(this._connectHandler.resolve(),this._connectHandler=null),this._connected()):(this._connectHandler&&(this._connectHandler.reject(),this._connectHandler=null),this._disconnected());return}case"disconnect":{this._connectHandler&&(this._connectHandler.reject(),this._connectHandler=null),this._disconnected();return}case"accountChanged":{!((s=e.data)===null||s===void 0)&&s.publicKey?(this._publicKey=e.data.publicKey,this.emit("accountChanged",this.publicKey),this._standardConnected()):(this.emit("accountChanged",void 0),this._standardDisconnected());return}default:return}},this._handleResize=e=>{e.resizeMode==="full"?e.params.mode==="fullscreen"?this._expandIframe():e.params.mode==="hide"&&this._collapseIframe():e.resizeMode==="coordinates"&&this._resizeIframe(e.params)},this._handleMessage=e=>{var n;if(((n=e.data)===null||n===void 0?void 0:n.channel)!=="solflareIframeToWalletAdapter")return;const s=e.data.data||{};if(s.type==="event")this._handleEvent(s.event);else if(s.type==="resize")this._handleResize(s);else if(s.type==="response"&&this._messageHandlers[s.id]){const{resolve:o,reject:d}=this._messageHandlers[s.id];delete this._messageHandlers[s.id],s.error?d(s.error):o(s.result)}},this._removeElement=()=>{this._element&&(this._element.remove(),this._element=null)},this._removeDanglingElements=()=>{const e=document.getElementsByClassName("solflare-metamask-wallet-adapter-iframe");for(const n of e)n.parentElement&&n.remove()},this._injectElement=()=>{this._removeElement(),this._removeDanglingElements();const e=Object.assign(Object.assign({},this._iframeParams),{mm:!0,v:1,cluster:this._network||"mainnet-beta",origin:window.location.origin||"",title:document.title||""}),n=Object.keys(e).map(o=>`${o}=${encodeURIComponent(e[o])}`).join("&"),s=`${W.IFRAME_URL}?${n}`;this._element=document.createElement("div"),this._element.className="solflare-metamask-wallet-adapter-iframe",this._element.innerHTML=` +import{f as q,d as B,M as G,O as J,Q,P as X,J as b,V as z}from"./index-f54a1fc2.js";var R={exports:{}};(function(i){var t=Object.prototype.hasOwnProperty,e="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(e=!1));function s(h,a,r){this.fn=h,this.context=a,this.once=r||!1}function o(h,a,r,c,v){if(typeof r!="function")throw new TypeError("The listener must be a function");var p=new s(r,c||h,v),f=e?e+a:a;return h._events[f]?h._events[f].fn?h._events[f]=[h._events[f],p]:h._events[f].push(p):(h._events[f]=p,h._eventsCount++),h}function d(h,a){--h._eventsCount===0?h._events=new n:delete h._events[a]}function u(){this._events=new n,this._eventsCount=0}u.prototype.eventNames=function(){var a=[],r,c;if(this._eventsCount===0)return a;for(c in r=this._events)t.call(r,c)&&a.push(e?c.slice(1):c);return Object.getOwnPropertySymbols?a.concat(Object.getOwnPropertySymbols(r)):a},u.prototype.listeners=function(a){var r=e?e+a:a,c=this._events[r];if(!c)return[];if(c.fn)return[c.fn];for(var v=0,p=c.length,f=new Array(p);vo.equals(t));s>=0&&(i.signatures[s]=e)}}var D=globalThis&&globalThis.__awaiter||function(i,t,e,n){function s(o){return o instanceof e?o:new e(function(d){d(o)})}return new(e||(e=Promise))(function(o,d){function u(r){try{a(n.next(r))}catch(c){d(c)}}function h(r){try{a(n.throw(r))}catch(c){d(c)}}function a(r){r.done?o(r.value):s(r.value).then(u,h)}a((n=n.apply(i,t||[])).next())})};function H(i){return D(this,void 0,void 0,function*(){try{return yield i.request({method:"wallet_getSnaps"}),!0}catch{return!1}})}function oe(){return D(this,void 0,void 0,function*(){try{const i=window.ethereum;if(!i)return null;if(i.providers&&Array.isArray(i.providers)){const t=i.providers;for(const e of t)if(yield H(e))return e}if(i.detected&&Array.isArray(i.detected)){const t=i.detected;for(const e of t)if(yield H(e))return e}return(yield H(i))?i:null}catch(i){return console.error(i),null}})}const ae="solana:mainnet",ce="solana:devnet",le="solana:testnet",de="solana:localnet",$=[ae,ce,le,de];function L(i){return $.includes(i)}var E=globalThis&&globalThis.__classPrivateFieldGet||function(i,t,e,n){if(e==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof t=="function"?i!==t||!n:!t.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?n:e==="a"?n.call(i):n?n.value:t.get(i)},A=globalThis&&globalThis.__classPrivateFieldSet||function(i,t,e,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof t=="function"?i!==t||!s:!t.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(i,e):s?s.value=e:t.set(i,e),e},T,C,I,K,k,O;const he=$,ue=[G,J,Q];class j{get address(){return E(this,T,"f")}get publicKey(){return E(this,C,"f").slice()}get chains(){return E(this,I,"f").slice()}get features(){return E(this,K,"f").slice()}get label(){return E(this,k,"f")}get icon(){return E(this,O,"f")}constructor({address:t,publicKey:e,label:n,icon:s}){T.set(this,void 0),C.set(this,void 0),I.set(this,void 0),K.set(this,void 0),k.set(this,void 0),O.set(this,void 0),new.target===j&&Object.freeze(this),A(this,T,t,"f"),A(this,C,e,"f"),A(this,I,he,"f"),A(this,K,ue,"f"),A(this,k,n,"f"),A(this,O,s,"f")}}T=new WeakMap,C=new WeakMap,I=new WeakMap,K=new WeakMap,k=new WeakMap,O=new WeakMap;var g=globalThis&&globalThis.__awaiter||function(i,t,e,n){function s(o){return o instanceof e?o:new e(function(d){d(o)})}return new(e||(e=Promise))(function(o,d){function u(r){try{a(n.next(r))}catch(c){d(c)}}function h(r){try{a(n.throw(r))}catch(c){d(c)}}function a(r){r.done?o(r.value):s(r.value).then(u,h)}a((n=n.apply(i,t||[])).next())})};class W extends Z{constructor(t){super(),this._network="mainnet-beta",this._iframeParams={},this._element=null,this._iframe=null,this._publicKey=null,this._account=null,this._isConnected=!1,this._connectHandler=null,this._messageHandlers={},this._handleEvent=e=>{var n,s;switch(e.type){case"connect":{this._collapseIframe(),!((n=e.data)===null||n===void 0)&&n.publicKey?(this._publicKey=e.data.publicKey,this._isConnected=!0,this._connectHandler&&(this._connectHandler.resolve(),this._connectHandler=null),this._connected()):(this._connectHandler&&(this._connectHandler.reject(),this._connectHandler=null),this._disconnected());return}case"disconnect":{this._connectHandler&&(this._connectHandler.reject(),this._connectHandler=null),this._disconnected();return}case"accountChanged":{!((s=e.data)===null||s===void 0)&&s.publicKey?(this._publicKey=e.data.publicKey,this.emit("accountChanged",this.publicKey),this._standardConnected()):(this.emit("accountChanged",void 0),this._standardDisconnected());return}default:return}},this._handleResize=e=>{e.resizeMode==="full"?e.params.mode==="fullscreen"?this._expandIframe():e.params.mode==="hide"&&this._collapseIframe():e.resizeMode==="coordinates"&&this._resizeIframe(e.params)},this._handleMessage=e=>{var n;if(((n=e.data)===null||n===void 0?void 0:n.channel)!=="solflareIframeToWalletAdapter")return;const s=e.data.data||{};if(s.type==="event")this._handleEvent(s.event);else if(s.type==="resize")this._handleResize(s);else if(s.type==="response"&&this._messageHandlers[s.id]){const{resolve:o,reject:d}=this._messageHandlers[s.id];delete this._messageHandlers[s.id],s.error?d(s.error):o(s.result)}},this._removeElement=()=>{this._element&&(this._element.remove(),this._element=null)},this._removeDanglingElements=()=>{const e=document.getElementsByClassName("solflare-metamask-wallet-adapter-iframe");for(const n of e)n.parentElement&&n.remove()},this._injectElement=()=>{this._removeElement(),this._removeDanglingElements();const e=Object.assign(Object.assign({},this._iframeParams),{mm:!0,v:1,cluster:this._network||"mainnet-beta",origin:window.location.origin||"",title:document.title||""}),n=Object.keys(e).map(o=>`${o}=${encodeURIComponent(e[o])}`).join("&"),s=`${W.IFRAME_URL}?${n}`;this._element=document.createElement("div"),this._element.className="solflare-metamask-wallet-adapter-iframe",this._element.innerHTML=` `,document.body.appendChild(this._element),this._iframe=this._element.querySelector("iframe"),window.addEventListener("message",this._handleMessage,!1)},this._collapseIframe=()=>{this._iframe&&(this._iframe.style.top="",this._iframe.style.right="",this._iframe.style.height="2px",this._iframe.style.width="2px")},this._expandIframe=()=>{this._iframe&&(this._iframe.style.top="0px",this._iframe.style.bottom="0px",this._iframe.style.left="0px",this._iframe.style.right="0px",this._iframe.style.width="100%",this._iframe.style.height="100%")},this._resizeIframe=e=>{this._iframe&&(this._iframe.style.top=isFinite(e.top)?`${e.top}px`:"",this._iframe.style.bottom=isFinite(e.bottom)?`${e.bottom}px`:"",this._iframe.style.left=isFinite(e.left)?`${e.left}px`:"",this._iframe.style.right=isFinite(e.right)?`${e.right}px`:"",this._iframe.style.width=isFinite(e.width)?`${e.width}px`:e.width,this._iframe.style.height=isFinite(e.height)?`${e.height}px`:e.height)},this._sendIframeMessage=e=>{if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");return new Promise((n,s)=>{var o,d;const u=se();this._messageHandlers[u]={resolve:n,reject:s},(d=(o=this._iframe)===null||o===void 0?void 0:o.contentWindow)===null||d===void 0||d.postMessage({channel:"solflareWalletAdapterToIframe",data:Object.assign({id:u},e)},"*")})},this._connected=()=>{this._isConnected=!0,this.emit("connect",this.publicKey),this._standardConnected()},this._disconnected=()=>{this._publicKey=null,this._isConnected=!1,window.removeEventListener("message",this._handleMessage,!1),this._removeElement(),this.emit("disconnect"),this._standardDisconnected()},this._standardConnected=()=>{if(!this.publicKey)return;const e=this.publicKey.toString();(!this._account||this._account.address!==e)&&(this._account=new j({address:e,publicKey:this.publicKey.toBytes()}),this.emit("standard_change",{accounts:this.standardAccounts}))},this._standardDisconnected=()=>{this._account&&(this._account=null,this.emit("standard_change",{accounts:this.standardAccounts}))},t!=null&&t.network&&(this._network=t==null?void 0:t.network),window.SolflareMetaMaskParams&&(this._iframeParams=Object.assign(Object.assign({},this._iframeParams),window.SolflareMetaMaskParams)),t!=null&&t.params&&(this._iframeParams=Object.assign(Object.assign({},this._iframeParams),t==null?void 0:t.params))}get publicKey(){return this._publicKey?new X(this._publicKey):null}get standardAccount(){return this._account}get standardAccounts(){return this._account?[this._account]:[]}get isConnected(){return this._isConnected}get connected(){return this.isConnected}get autoApprove(){return!1}connect(){return g(this,void 0,void 0,function*(){this.connected||(this._injectElement(),yield new Promise((t,e)=>{this._connectHandler={resolve:t,reject:e}}))})}disconnect(){return g(this,void 0,void 0,function*(){yield this._sendIframeMessage({method:"disconnect"}),this._disconnected()})}signTransaction(t){var e;return g(this,void 0,void 0,function*(){if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");try{const n=F(t),{signature:s}=yield this._sendIframeMessage({method:"signTransaction",params:{message:b.encode(n)}});return U(t,this.publicKey,b.decode(s)),t}catch(n){throw new Error(((e=n==null?void 0:n.toString)===null||e===void 0?void 0:e.call(n))||"Failed to sign transaction")}})}signAllTransactions(t){var e;return g(this,void 0,void 0,function*(){if(!this.connected||!this.publicKey)throw new Error("Wallet not connected");try{const n=t.map(o=>F(o)),{signatures:s}=yield this._sendIframeMessage({method:"signAllTransactions",params:{messages:n.map(o=>b.encode(o))}});for(let o=0;o1)for(const n of t)e.push(...yield this.standardSignAndSendTransaction(n));return e})}standardSignTransaction(...t){return g(this,void 0,void 0,function*(){if(!this.connected)throw new Error("not connected");const e=[];if(t.length===1){const{transaction:n,account:s,chain:o}=t[0];if(s!==this._account)throw new Error("invalid account");if(o&&!L(o))throw new Error("invalid chain");const d=yield this.signTransaction(z.deserialize(n));e.push({signedTransaction:d.serialize()})}else if(t.length>1){let n;for(const d of t){if(d.account!==this._account)throw new Error("invalid account");if(d.chain){if(!L(d.chain))throw new Error("invalid chain");if(n){if(d.chain!==n)throw new Error("conflicting chain")}else n=d.chain}}const s=t.map(({transaction:d})=>z.deserialize(d)),o=yield this.signAllTransactions(s);e.push(...o.map(d=>({signedTransaction:d.serialize()})))}return e})}standardSignMessage(...t){return g(this,void 0,void 0,function*(){if(!this.connected)throw new Error("not connected");const e=[];if(t.length===1){const{message:n,account:s}=t[0];if(s!==this._account)throw new Error("invalid account");const o=yield this.signMessage(n);e.push({signedMessage:n,signature:o})}else if(t.length>1)for(const n of t)e.push(...yield this.standardSignMessage(n));return e})}}W.IFRAME_URL="https://widget.solflare.com/";export{j as StandardSolflareMetaMaskWalletAccount,W as default}; diff --git a/preview-build/assets/index-7f510ab1.js b/preview-build/assets/index-eb9ef66c.js similarity index 99% rename from preview-build/assets/index-7f510ab1.js rename to preview-build/assets/index-eb9ef66c.js index 8b51b2f..a21c1b1 100644 --- a/preview-build/assets/index-7f510ab1.js +++ b/preview-build/assets/index-eb9ef66c.js @@ -1,3 +1,3 @@ -import{f as V,P,J as v,d as C}from"./index-e25ecac5.js";var D={exports:{}};(function(a){var s=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function t(u,i,l){this.fn=u,this.context=i,this.once=l||!1}function e(u,i,l,f,y){if(typeof l!="function")throw new TypeError("The listener must be a function");var g=new t(l,f||u,y),h=r?r+i:i;return u._events[h]?u._events[h].fn?u._events[h]=[u._events[h],g]:u._events[h].push(g):(u._events[h]=g,u._eventsCount++),u}function o(u,i){--u._eventsCount===0?u._events=new n:delete u._events[i]}function c(){this._events=new n,this._eventsCount=0}c.prototype.eventNames=function(){var i=[],l,f;if(this._eventsCount===0)return i;for(f in l=this._events)s.call(l,f)&&i.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(l)):i},c.prototype.listeners=function(i){var l=r?r+i:i,f=this._events[l];if(!f)return[];if(f.fn)return[f.fn];for(var y=0,g=f.length,h=new Array(g);y0&&e[e.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!e||i[1]>e[0]&&i[1]0)&&!(t=n.next()).done;)e.push(t.value)}catch(c){o={error:c}}finally{try{t&&!t.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return e},J=function(a){B(s,a);function s(r,n){var t=a.call(this)||this;if(t._handleMessage=function(e){if(t._injectedProvider&&e.source===window||e.origin===t._providerUrl.origin&&e.source===t._popup){if(e.data.method==="connected"){var o=new P(e.data.params.publicKey);(!t._publicKey||!t._publicKey.equals(o))&&(t._publicKey&&!t._publicKey.equals(o)&&t._handleDisconnect(),t._publicKey=o,t._autoApprove=!!e.data.params.autoApprove,t.emit("connect",t._publicKey))}else if(e.data.method==="disconnected")t._handleDisconnect();else if((e.data.result||e.data.error)&&t._responsePromises.has(e.data.id)){var c=H(t._responsePromises.get(e.data.id),2),u=c[0],i=c[1];e.data.result?u(e.data.result):i(new Error(e.data.error))}}},t._handleConnect=function(){return t._handlerAdded||(t._handlerAdded=!0,window.addEventListener("message",t._handleMessage),window.addEventListener("beforeunload",t.disconnect)),t._injectedProvider?new Promise(function(e){t._sendRequest("connect",{}),e()}):(window.name="parent",t._popup=window.open(t._providerUrl.toString(),"_blank","location,resizable,width=460,height=675"),new Promise(function(e){t.once("connect",e)}))},t._handleDisconnect=function(){t._handlerAdded&&(t._handlerAdded=!1,window.removeEventListener("message",t._handleMessage),window.removeEventListener("beforeunload",t.disconnect)),t._publicKey&&(t._publicKey=null,t.emit("disconnect")),t._responsePromises.forEach(function(e,o){var c=H(e,2);c[0];var u=c[1];t._responsePromises.delete(o),u("Wallet disconnected")})},t._sendRequest=function(e,o){return E(t,void 0,void 0,function(){var c,u=this;return I(this,function(i){if(e!=="connect"&&!this.connected)throw new Error("Wallet not connected");return c=this._nextRequestId,++this._nextRequestId,[2,new Promise(function(l,f){u._responsePromises.set(c,[l,f]),u._injectedProvider?u._injectedProvider.postMessage({jsonrpc:"2.0",id:c,method:e,params:W({network:u._network},o)}):(u._popup.postMessage({jsonrpc:"2.0",id:c,method:e,params:o},u._providerUrl.origin),u.autoApprove||u._popup.focus())})]})})},t.connect=function(){return t._popup&&t._popup.close(),t._handleConnect()},t.disconnect=function(){return E(t,void 0,void 0,function(){return I(this,function(e){switch(e.label){case 0:return this._injectedProvider?[4,this._sendRequest("disconnect",{})]:[3,2];case 1:e.sent(),e.label=2;case 2:return this._popup&&this._popup.close(),this._handleDisconnect(),[2]}})})},t.sign=function(e,o){return E(t,void 0,void 0,function(){var c,u,i;return I(this,function(l){switch(l.label){case 0:if(!(e instanceof Uint8Array))throw new Error("Data must be an instance of Uint8Array");return[4,this._sendRequest("sign",{data:e,display:o})];case 1:return c=l.sent(),u=v.decode(c.signature),i=new P(c.publicKey),[2,{signature:u,publicKey:i}]}})})},t.signTransaction=function(e){return E(t,void 0,void 0,function(){var o,c,u;return I(this,function(i){switch(i.label){case 0:return[4,this._sendRequest("signTransaction",{message:v.encode(e.serializeMessage())})];case 1:return o=i.sent(),c=v.decode(o.signature),u=new P(o.publicKey),e.addSignature(u,c),[2,e]}})})},t.signAllTransactions=function(e){return E(t,void 0,void 0,function(){var o,c,u;return I(this,function(i){switch(i.label){case 0:return[4,this._sendRequest("signAllTransactions",{messages:e.map(function(l){return v.encode(l.serializeMessage())})})];case 1:return o=i.sent(),c=o.signatures.map(function(l){return v.decode(l)}),u=new P(o.publicKey),e=e.map(function(l,f){return l.addSignature(u,c[f]),l}),[2,e]}})})},t.signAndSendTransaction=function(e,o){return o===void 0&&(o={}),E(t,void 0,void 0,function(){var c,u,i;return I(this,function(l){switch(l.label){case 0:return[4,this._sendRequest("signAndSendTransaction",W({transaction:v.encode(e.serialize({requireAllSignatures:!1,verifySignatures:!1}))},o))];case 1:return c=l.sent(),u=c.publicKey,i=c.signature,[2,{publicKey:new P(u),signature:i}]}})})},X(r))t._injectedProvider=r;else if(Q(r))t._providerUrl=new URL(r),t._providerUrl.hash=new URLSearchParams({origin:window.location.origin,network:n}).toString();else throw new Error("provider parameter must be an injected provider or a URL string.");return t._network=n,t._publicKey=null,t._autoApprove=!1,t._popup=null,t._handlerAdded=!1,t._nextRequestId=1,t._responsePromises=new Map,t}return Object.defineProperty(s.prototype,"publicKey",{get:function(){return this._publicKey},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"connected",{get:function(){return this._publicKey!==null},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"autoApprove",{get:function(){return this._autoApprove},enumerable:!1,configurable:!0}),s}(U);function Q(a){return typeof a=="string"}function X(a){return Y(a)&&Z(a.postMessage)}function Y(a){return typeof a=="object"&&a!==null}function Z(a){return typeof a=="function"}var ee=globalThis&&globalThis.__extends||function(){var a=function(s,r){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])},a(s,r)};return function(s,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");a(s,r);function n(){this.constructor=s}s.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),A=globalThis&&globalThis.__awaiter||function(a,s,r,n){function t(e){return e instanceof r?e:new r(function(o){o(e)})}return new(r||(r=Promise))(function(e,o){function c(l){try{i(n.next(l))}catch(f){o(f)}}function u(l){try{i(n.throw(l))}catch(f){o(f)}}function i(l){l.done?e(l.value):t(l.value).then(c,u)}i((n=n.apply(a,s||[])).next())})},S=globalThis&&globalThis.__generator||function(a,s){var r={label:0,sent:function(){if(e[0]&1)throw e[1];return e[1]},trys:[],ops:[]},n,t,e,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(i){return function(l){return u([i,l])}}function u(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(r=0)),r;)try{if(n=1,t&&(e=i[0]&2?t.return:i[0]?t.throw||((e=t.return)&&e.call(t),0):t.next)&&!(e=e.call(t,i[1])).done)return e;switch(t=0,e&&(i=[i[0]&2,e.value]),i[0]){case 0:case 1:e=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,t=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(e=r.trys,!(e=e.length>0&&e[e.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!e||i[1]>e[0]&&i[1]0&&e[e.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!e||i[1]>e[0]&&i[1]0&&e[e.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!e||i[1]>e[0]&&i[1]=a.length&&(a=void 0),{value:a&&a[n++],done:!a}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")},de=function(a){le(s,a);function s(r){var n=a.call(this)||this;return n._network="mainnet-beta",n._provider=null,n._iframeParams={},n._adapterInstance=null,n._element=null,n._iframe=null,n._connectHandler=null,n._flutterHandlerInterval=null,n._handleEvent=function(t){var e,o,c,u;switch(t.type){case"connect_native_web":{n._collapseIframe(),n._adapterInstance=new ne(n._iframe,n._network,((e=t.data)===null||e===void 0?void 0:e.provider)||n._provider||"https://solflare.com/provider"),n._adapterInstance.on("connect",n._webConnected),n._adapterInstance.on("disconnect",n._webDisconnected),n._adapterInstance.connect(),n._setPreferredAdapter("native_web");return}case"connect":{n._collapseIframe(),n._adapterInstance=new z(n._iframe,((o=t.data)===null||o===void 0?void 0:o.publicKey)||""),n._adapterInstance.connect(),n._setPreferredAdapter((c=t.data)===null||c===void 0?void 0:c.adapter),n._connectHandler&&(n._connectHandler.resolve(),n._connectHandler=null),n.emit("connect",n.publicKey);return}case"disconnect":{n._connectHandler&&(n._connectHandler.reject(),n._connectHandler=null),n._disconnected(),n.emit("disconnect");return}case"accountChanged":{!((u=t.data)===null||u===void 0)&&u.publicKey?(n._adapterInstance=new z(n._iframe,t.data.publicKey),n._adapterInstance.connect(),n.emit("accountChanged",n.publicKey)):n.emit("accountChanged",void 0);return}case"collapse":{n._collapseIframe();return}default:return}},n._handleResize=function(t){t.resizeMode==="full"?t.params.mode==="fullscreen"?n._expandIframe():t.params.mode==="hide"&&n._collapseIframe():t.resizeMode==="coordinates"&&n._iframe&&(n._iframe.style.top=isFinite(t.params.top)?"".concat(t.params.top,"px"):"",n._iframe.style.bottom=isFinite(t.params.bottom)?"".concat(t.params.bottom,"px"):"",n._iframe.style.left=isFinite(t.params.left)?"".concat(t.params.left,"px"):"",n._iframe.style.right=isFinite(t.params.right)?"".concat(t.params.right,"px"):"",n._iframe.style.width=isFinite(t.params.width)?"".concat(t.params.width,"px"):t.params.width,n._iframe.style.height=isFinite(t.params.height)?"".concat(t.params.height,"px"):t.params.height)},n._handleMessage=function(t){var e;if(((e=t.data)===null||e===void 0?void 0:e.channel)==="solflareIframeToWalletAdapter"){var o=t.data.data||{};o.type==="event"?n._handleEvent(o.event):o.type==="resize"?n._handleResize(o):o.type==="response"&&n._adapterInstance&&n._adapterInstance.handleMessage(o)}},n._removeElement=function(){n._flutterHandlerInterval!==null&&(clearInterval(n._flutterHandlerInterval),n._flutterHandlerInterval=null),n._element&&(n._element.remove(),n._element=null)},n._removeDanglingElements=function(){var t,e,o=document.getElementsByClassName("solflare-wallet-adapter-iframe");try{for(var c=ue(o),u=c.next();!u.done;u=c.next()){var i=u.value;i.parentElement&&i.remove()}}catch(l){t={error:l}}finally{try{u&&!u.done&&(e=c.return)&&e.call(c)}finally{if(t)throw t.error}}},n._injectElement=function(){n._removeElement(),n._removeDanglingElements();var t=k(k({},n._iframeParams),{cluster:n._network||"mainnet-beta",origin:window.location.origin||"",title:document.title||"",version:1,sdkVersion:ce}),e=n._getPreferredAdapter();e&&(t.adapter=e),n._provider&&(t.provider=n._provider);var o=Object.keys(t).map(function(u){return"".concat(u,"=").concat(encodeURIComponent(t[u]))}).join("&"),c="".concat(s.IFRAME_URL,"?").concat(o);n._element=document.createElement("div"),n._element.className="solflare-wallet-adapter-iframe",n._element.innerHTML=` +import{f as V,P,J as v,d as C}from"./index-f54a1fc2.js";var D={exports:{}};(function(a){var s=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function t(u,i,l){this.fn=u,this.context=i,this.once=l||!1}function e(u,i,l,f,y){if(typeof l!="function")throw new TypeError("The listener must be a function");var g=new t(l,f||u,y),h=r?r+i:i;return u._events[h]?u._events[h].fn?u._events[h]=[u._events[h],g]:u._events[h].push(g):(u._events[h]=g,u._eventsCount++),u}function o(u,i){--u._eventsCount===0?u._events=new n:delete u._events[i]}function c(){this._events=new n,this._eventsCount=0}c.prototype.eventNames=function(){var i=[],l,f;if(this._eventsCount===0)return i;for(f in l=this._events)s.call(l,f)&&i.push(r?f.slice(1):f);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(l)):i},c.prototype.listeners=function(i){var l=r?r+i:i,f=this._events[l];if(!f)return[];if(f.fn)return[f.fn];for(var y=0,g=f.length,h=new Array(g);y0&&e[e.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!e||i[1]>e[0]&&i[1]0)&&!(t=n.next()).done;)e.push(t.value)}catch(c){o={error:c}}finally{try{t&&!t.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return e},J=function(a){B(s,a);function s(r,n){var t=a.call(this)||this;if(t._handleMessage=function(e){if(t._injectedProvider&&e.source===window||e.origin===t._providerUrl.origin&&e.source===t._popup){if(e.data.method==="connected"){var o=new P(e.data.params.publicKey);(!t._publicKey||!t._publicKey.equals(o))&&(t._publicKey&&!t._publicKey.equals(o)&&t._handleDisconnect(),t._publicKey=o,t._autoApprove=!!e.data.params.autoApprove,t.emit("connect",t._publicKey))}else if(e.data.method==="disconnected")t._handleDisconnect();else if((e.data.result||e.data.error)&&t._responsePromises.has(e.data.id)){var c=H(t._responsePromises.get(e.data.id),2),u=c[0],i=c[1];e.data.result?u(e.data.result):i(new Error(e.data.error))}}},t._handleConnect=function(){return t._handlerAdded||(t._handlerAdded=!0,window.addEventListener("message",t._handleMessage),window.addEventListener("beforeunload",t.disconnect)),t._injectedProvider?new Promise(function(e){t._sendRequest("connect",{}),e()}):(window.name="parent",t._popup=window.open(t._providerUrl.toString(),"_blank","location,resizable,width=460,height=675"),new Promise(function(e){t.once("connect",e)}))},t._handleDisconnect=function(){t._handlerAdded&&(t._handlerAdded=!1,window.removeEventListener("message",t._handleMessage),window.removeEventListener("beforeunload",t.disconnect)),t._publicKey&&(t._publicKey=null,t.emit("disconnect")),t._responsePromises.forEach(function(e,o){var c=H(e,2);c[0];var u=c[1];t._responsePromises.delete(o),u("Wallet disconnected")})},t._sendRequest=function(e,o){return E(t,void 0,void 0,function(){var c,u=this;return I(this,function(i){if(e!=="connect"&&!this.connected)throw new Error("Wallet not connected");return c=this._nextRequestId,++this._nextRequestId,[2,new Promise(function(l,f){u._responsePromises.set(c,[l,f]),u._injectedProvider?u._injectedProvider.postMessage({jsonrpc:"2.0",id:c,method:e,params:W({network:u._network},o)}):(u._popup.postMessage({jsonrpc:"2.0",id:c,method:e,params:o},u._providerUrl.origin),u.autoApprove||u._popup.focus())})]})})},t.connect=function(){return t._popup&&t._popup.close(),t._handleConnect()},t.disconnect=function(){return E(t,void 0,void 0,function(){return I(this,function(e){switch(e.label){case 0:return this._injectedProvider?[4,this._sendRequest("disconnect",{})]:[3,2];case 1:e.sent(),e.label=2;case 2:return this._popup&&this._popup.close(),this._handleDisconnect(),[2]}})})},t.sign=function(e,o){return E(t,void 0,void 0,function(){var c,u,i;return I(this,function(l){switch(l.label){case 0:if(!(e instanceof Uint8Array))throw new Error("Data must be an instance of Uint8Array");return[4,this._sendRequest("sign",{data:e,display:o})];case 1:return c=l.sent(),u=v.decode(c.signature),i=new P(c.publicKey),[2,{signature:u,publicKey:i}]}})})},t.signTransaction=function(e){return E(t,void 0,void 0,function(){var o,c,u;return I(this,function(i){switch(i.label){case 0:return[4,this._sendRequest("signTransaction",{message:v.encode(e.serializeMessage())})];case 1:return o=i.sent(),c=v.decode(o.signature),u=new P(o.publicKey),e.addSignature(u,c),[2,e]}})})},t.signAllTransactions=function(e){return E(t,void 0,void 0,function(){var o,c,u;return I(this,function(i){switch(i.label){case 0:return[4,this._sendRequest("signAllTransactions",{messages:e.map(function(l){return v.encode(l.serializeMessage())})})];case 1:return o=i.sent(),c=o.signatures.map(function(l){return v.decode(l)}),u=new P(o.publicKey),e=e.map(function(l,f){return l.addSignature(u,c[f]),l}),[2,e]}})})},t.signAndSendTransaction=function(e,o){return o===void 0&&(o={}),E(t,void 0,void 0,function(){var c,u,i;return I(this,function(l){switch(l.label){case 0:return[4,this._sendRequest("signAndSendTransaction",W({transaction:v.encode(e.serialize({requireAllSignatures:!1,verifySignatures:!1}))},o))];case 1:return c=l.sent(),u=c.publicKey,i=c.signature,[2,{publicKey:new P(u),signature:i}]}})})},X(r))t._injectedProvider=r;else if(Q(r))t._providerUrl=new URL(r),t._providerUrl.hash=new URLSearchParams({origin:window.location.origin,network:n}).toString();else throw new Error("provider parameter must be an injected provider or a URL string.");return t._network=n,t._publicKey=null,t._autoApprove=!1,t._popup=null,t._handlerAdded=!1,t._nextRequestId=1,t._responsePromises=new Map,t}return Object.defineProperty(s.prototype,"publicKey",{get:function(){return this._publicKey},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"connected",{get:function(){return this._publicKey!==null},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"autoApprove",{get:function(){return this._autoApprove},enumerable:!1,configurable:!0}),s}(U);function Q(a){return typeof a=="string"}function X(a){return Y(a)&&Z(a.postMessage)}function Y(a){return typeof a=="object"&&a!==null}function Z(a){return typeof a=="function"}var ee=globalThis&&globalThis.__extends||function(){var a=function(s,r){return a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(n[e]=t[e])},a(s,r)};return function(s,r){if(typeof r!="function"&&r!==null)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");a(s,r);function n(){this.constructor=s}s.prototype=r===null?Object.create(r):(n.prototype=r.prototype,new n)}}(),A=globalThis&&globalThis.__awaiter||function(a,s,r,n){function t(e){return e instanceof r?e:new r(function(o){o(e)})}return new(r||(r=Promise))(function(e,o){function c(l){try{i(n.next(l))}catch(f){o(f)}}function u(l){try{i(n.throw(l))}catch(f){o(f)}}function i(l){l.done?e(l.value):t(l.value).then(c,u)}i((n=n.apply(a,s||[])).next())})},S=globalThis&&globalThis.__generator||function(a,s){var r={label:0,sent:function(){if(e[0]&1)throw e[1];return e[1]},trys:[],ops:[]},n,t,e,o;return o={next:c(0),throw:c(1),return:c(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function c(i){return function(l){return u([i,l])}}function u(i){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,i[0]&&(r=0)),r;)try{if(n=1,t&&(e=i[0]&2?t.return:i[0]?t.throw||((e=t.return)&&e.call(t),0):t.next)&&!(e=e.call(t,i[1])).done)return e;switch(t=0,e&&(i=[i[0]&2,e.value]),i[0]){case 0:case 1:e=i;break;case 4:return r.label++,{value:i[1],done:!1};case 5:r.label++,t=i[1],i=[0];continue;case 7:i=r.ops.pop(),r.trys.pop();continue;default:if(e=r.trys,!(e=e.length>0&&e[e.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!e||i[1]>e[0]&&i[1]0&&e[e.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!e||i[1]>e[0]&&i[1]0&&e[e.length-1])&&(i[0]===6||i[0]===2)){r=0;continue}if(i[0]===3&&(!e||i[1]>e[0]&&i[1]=a.length&&(a=void 0),{value:a&&a[n++],done:!a}}};throw new TypeError(s?"Object is not iterable.":"Symbol.iterator is not defined.")},de=function(a){le(s,a);function s(r){var n=a.call(this)||this;return n._network="mainnet-beta",n._provider=null,n._iframeParams={},n._adapterInstance=null,n._element=null,n._iframe=null,n._connectHandler=null,n._flutterHandlerInterval=null,n._handleEvent=function(t){var e,o,c,u;switch(t.type){case"connect_native_web":{n._collapseIframe(),n._adapterInstance=new ne(n._iframe,n._network,((e=t.data)===null||e===void 0?void 0:e.provider)||n._provider||"https://solflare.com/provider"),n._adapterInstance.on("connect",n._webConnected),n._adapterInstance.on("disconnect",n._webDisconnected),n._adapterInstance.connect(),n._setPreferredAdapter("native_web");return}case"connect":{n._collapseIframe(),n._adapterInstance=new z(n._iframe,((o=t.data)===null||o===void 0?void 0:o.publicKey)||""),n._adapterInstance.connect(),n._setPreferredAdapter((c=t.data)===null||c===void 0?void 0:c.adapter),n._connectHandler&&(n._connectHandler.resolve(),n._connectHandler=null),n.emit("connect",n.publicKey);return}case"disconnect":{n._connectHandler&&(n._connectHandler.reject(),n._connectHandler=null),n._disconnected(),n.emit("disconnect");return}case"accountChanged":{!((u=t.data)===null||u===void 0)&&u.publicKey?(n._adapterInstance=new z(n._iframe,t.data.publicKey),n._adapterInstance.connect(),n.emit("accountChanged",n.publicKey)):n.emit("accountChanged",void 0);return}case"collapse":{n._collapseIframe();return}default:return}},n._handleResize=function(t){t.resizeMode==="full"?t.params.mode==="fullscreen"?n._expandIframe():t.params.mode==="hide"&&n._collapseIframe():t.resizeMode==="coordinates"&&n._iframe&&(n._iframe.style.top=isFinite(t.params.top)?"".concat(t.params.top,"px"):"",n._iframe.style.bottom=isFinite(t.params.bottom)?"".concat(t.params.bottom,"px"):"",n._iframe.style.left=isFinite(t.params.left)?"".concat(t.params.left,"px"):"",n._iframe.style.right=isFinite(t.params.right)?"".concat(t.params.right,"px"):"",n._iframe.style.width=isFinite(t.params.width)?"".concat(t.params.width,"px"):t.params.width,n._iframe.style.height=isFinite(t.params.height)?"".concat(t.params.height,"px"):t.params.height)},n._handleMessage=function(t){var e;if(((e=t.data)===null||e===void 0?void 0:e.channel)==="solflareIframeToWalletAdapter"){var o=t.data.data||{};o.type==="event"?n._handleEvent(o.event):o.type==="resize"?n._handleResize(o):o.type==="response"&&n._adapterInstance&&n._adapterInstance.handleMessage(o)}},n._removeElement=function(){n._flutterHandlerInterval!==null&&(clearInterval(n._flutterHandlerInterval),n._flutterHandlerInterval=null),n._element&&(n._element.remove(),n._element=null)},n._removeDanglingElements=function(){var t,e,o=document.getElementsByClassName("solflare-wallet-adapter-iframe");try{for(var c=ue(o),u=c.next();!u.done;u=c.next()){var i=u.value;i.parentElement&&i.remove()}}catch(l){t={error:l}}finally{try{u&&!u.done&&(e=c.return)&&e.call(c)}finally{if(t)throw t.error}}},n._injectElement=function(){n._removeElement(),n._removeDanglingElements();var t=k(k({},n._iframeParams),{cluster:n._network||"mainnet-beta",origin:window.location.origin||"",title:document.title||"",version:1,sdkVersion:ce}),e=n._getPreferredAdapter();e&&(t.adapter=e),n._provider&&(t.provider=n._provider);var o=Object.keys(t).map(function(u){return"".concat(u,"=").concat(encodeURIComponent(t[u]))}).join("&"),c="".concat(s.IFRAME_URL,"?").concat(o);n._element=document.createElement("div"),n._element.className="solflare-wallet-adapter-iframe",n._element.innerHTML=` `),document.body.appendChild(n._element),n._iframe=n._element.querySelector("iframe"),window.fromFlutter=n._handleMobileMessage,n._flutterHandlerInterval=setInterval(function(){window.fromFlutter=n._handleMobileMessage},100),window.addEventListener("message",n._handleMessage,!1)},n._collapseIframe=function(){n._iframe&&(n._iframe.style.top="",n._iframe.style.right="",n._iframe.style.height="2px",n._iframe.style.width="2px")},n._expandIframe=function(){n._iframe&&(n._iframe.style.top="0px",n._iframe.style.bottom="0px",n._iframe.style.left="0px",n._iframe.style.right="0px",n._iframe.style.width="100%",n._iframe.style.height="100%")},n._getPreferredAdapter=function(){return localStorage&&localStorage.getItem("solflarePreferredWalletAdapter")||null},n._setPreferredAdapter=function(t){localStorage&&t&&localStorage.setItem("solflarePreferredWalletAdapter",t)},n._clearPreferredAdapter=function(){localStorage&&localStorage.removeItem("solflarePreferredWalletAdapter")},n._webConnected=function(){n._connectHandler&&(n._connectHandler.resolve(),n._connectHandler=null),n.emit("connect",n.publicKey)},n._webDisconnected=function(){n._connectHandler&&(n._connectHandler.reject(),n._connectHandler=null),n._disconnected(),n.emit("disconnect")},n._disconnected=function(){window.removeEventListener("message",n._handleMessage,!1),n._removeElement(),n._clearPreferredAdapter(),n._adapterInstance=null},n._handleMobileMessage=function(t){var e,o;(o=(e=n._iframe)===null||e===void 0?void 0:e.contentWindow)===null||o===void 0||o.postMessage({channel:"solflareMobileToIframe",data:t},"*")},r!=null&&r.network&&(n._network=r==null?void 0:r.network),r!=null&&r.provider&&(n._provider=r==null?void 0:r.provider),r!=null&&r.params&&(n._iframeParams=k({},r==null?void 0:r.params)),n}return Object.defineProperty(s.prototype,"publicKey",{get:function(){var r;return((r=this._adapterInstance)===null||r===void 0?void 0:r.publicKey)||null},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"isConnected",{get:function(){var r;return!!(!((r=this._adapterInstance)===null||r===void 0)&&r.connected)},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"connected",{get:function(){return this.isConnected},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"autoApprove",{get:function(){return!1},enumerable:!1,configurable:!0}),s.prototype.connect=function(){return b(this,void 0,void 0,function(){var r=this;return x(this,function(n){switch(n.label){case 0:return this.connected?[2]:(this._injectElement(),[4,new Promise(function(t,e){r._connectHandler={resolve:t,reject:e}})]);case 1:return n.sent(),[2]}})})},s.prototype.disconnect=function(){return b(this,void 0,void 0,function(){return x(this,function(r){switch(r.label){case 0:return this._adapterInstance?[4,this._adapterInstance.disconnect()]:[2];case 1:return r.sent(),this._disconnected(),this.emit("disconnect"),[2]}})})},s.prototype.signTransaction=function(r){return b(this,void 0,void 0,function(){var n,t,e,o,c=this;return x(this,function(u){switch(u.label){case 0:if(!this.connected)throw new Error("Wallet not connected");return n=K(r)?r.serializeMessage():r.message.serialize(),[4,this._adapterInstance.signTransaction(n)];case 1:return t=u.sent(),K(r)?r.addSignature(this.publicKey,C.Buffer.from(t)):(e=r.message.staticAccountKeys.slice(0,r.message.header.numRequiredSignatures),o=e.findIndex(function(i){return i.equals(c.publicKey)}),o>=0&&(r.signatures[o]=t)),[2,r]}})})},s.prototype.signAllTransactions=function(r){return b(this,void 0,void 0,function(){var n,t,e,o,c,u,i=this;return x(this,function(l){switch(l.label){case 0:if(!this.connected)throw new Error("Wallet not connected");return n=r.map(function(f){return K(f)?f.serializeMessage():f.message.serialize()}),[4,this._adapterInstance.signAllTransactions(n)];case 1:for(t=l.sent(),e=0;e=0&&(o.signatures[u]=t[e]));return[2,r]}})})},s.prototype.signAndSendTransaction=function(r,n){return b(this,void 0,void 0,function(){var t;return x(this,function(e){switch(e.label){case 0:if(!this.connected)throw new Error("Wallet not connected");return t=K(r)?r.serialize({verifySignatures:!1,requireAllSignatures:!1}):r.serialize(),[4,this._adapterInstance.signAndSendTransaction(t,n)];case 1:return[2,e.sent()]}})})},s.prototype.signMessage=function(r,n){return n===void 0&&(n="utf8"),b(this,void 0,void 0,function(){return x(this,function(t){switch(t.label){case 0:if(!this.connected)throw new Error("Wallet not connected");return[4,this._adapterInstance.signMessage(r,n)];case 1:return[2,t.sent()]}})})},s.prototype.sign=function(r,n){return n===void 0&&(n="utf8"),b(this,void 0,void 0,function(){return x(this,function(t){switch(t.label){case 0:return[4,this.signMessage(r,n)];case 1:return[2,t.sent()]}})})},s.prototype.detectWallet=function(r){var n;return r===void 0&&(r=10),b(this,void 0,void 0,function(){return x(this,function(t){return window.SolflareApp||!((n=window.solflare)===null||n===void 0)&&n.isSolflare?[2,!0]:[2,new Promise(function(e){var o,c;o=setInterval(function(){var u;(window.SolflareApp||!((u=window.solflare)===null||u===void 0)&&u.isSolflare)&&(clearInterval(o),clearTimeout(c),e(!0))},500),c=setTimeout(function(){clearInterval(o),e(!1)},r*1e3)})]})})},s.IFRAME_URL="https://connect.solflare.com/",s}(U);export{de as default}; diff --git a/preview-build/assets/index-e25ecac5.js b/preview-build/assets/index-f54a1fc2.js similarity index 99% rename from preview-build/assets/index-e25ecac5.js rename to preview-build/assets/index-f54a1fc2.js index 1bcd421..9cf58bc 100644 --- a/preview-build/assets/index-e25ecac5.js +++ b/preview-build/assets/index-f54a1fc2.js @@ -47,4 +47,4 @@ Error generating stack: `+o.message+` `,n)}try{window.addEventListener("wallet-standard:app-ready",({detail:n})=>e(n))}catch(n){console.error(`wallet-standard:app-ready event listener could not be added `,n)}}class RT extends Event{constructor(e){super("wallet-standard:register-wallet",{bubbles:!1,cancelable:!1,composed:!1}),Al.set(this,void 0),jT(this,Al,e,"f")}get detail(){return UT(this,Al,"f")}get type(){return"wallet-standard:register-wallet"}preventDefault(){throw new Error("preventDefault cannot be called")}stopImmediatePropagation(){throw new Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw new Error("stopPropagation cannot be called")}}Al=new WeakMap;globalThis&&globalThis.__classPrivateFieldSet;globalThis&&globalThis.__classPrivateFieldGet;function CT(t,e){if(t===e)return!0;const n=t.length;if(n!==e.length)return!1;for(let r=0;r=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n>>0,w=new Uint8Array(M);D!==I;){for(var j=v[D],C=0,U=M-1;(j!==0||C>>0,w[U]=j%s>>>0,j=j/s>>>0;if(j!==0)throw new Error("Non-zero carry");k=C,D++}for(var O=M-k;O!==M&&w[O]===0;)O++;for(var B=a.repeat(A);O>>0,M=new Uint8Array(I);v[A];){var w=e[v.charCodeAt(A)];if(w===255)return;for(var j=0,C=I-1;(w!==0||j>>0,M[C]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");D=j,A++}for(var U=I-D;U!==I&&M[U]===0;)U++;var O=ul.allocUnsafe(k+(I-U));O.fill(0,0,k);for(var B=k;U!==I;)O[B++]=M[U++];return O}function x(v){var A=y(v);if(A)return A;throw new Error("Non-base"+s+" character")}return{encode:g,decodeUnsafe:y,decode:x}}var BT=OT,FT=BT,WT="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",VT=FT(WT);const PT=Or(VT);var Ft=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(t,n):i?i.value=n:e.set(t,n),n},pe=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},on,An,oo,so,Hi,Ks,hc,Ce,pc,Zf,Dl,Yf,sa,Gf,oy,sy,ay,ly;class QT extends SM{constructor({wallet:e}){super(),on.add(this),An.set(this,void 0),oo.set(this,void 0),so.set(this,void 0),Hi.set(this,void 0),Ks.set(this,void 0),hc.set(this,void 0),Ce.set(this,void 0),pc.set(this,typeof window>"u"||typeof document>"u"?$.Unsupported:$.Installed),Gf.set(this,n=>{if("accounts"in n){const r=pe(this,Ce,"f").accounts[0];pe(this,An,"f")&&!pe(this,Hi,"f")&&r!==pe(this,An,"f")&&(r?pe(this,on,"m",Dl).call(this,r):(this.emit("error",new Vr),pe(this,on,"m",Yf).call(this)))}"features"in n&&pe(this,on,"m",sa).call(this)}),Ft(this,Ce,e,"f"),Ft(this,An,null,"f"),Ft(this,oo,null,"f"),Ft(this,so,!1,"f"),Ft(this,Hi,!1,"f"),Ft(this,Ks,pe(this,Ce,"f").features[W0].on("change",pe(this,Gf,"f")),"f"),pe(this,on,"m",sa).call(this)}get name(){return pe(this,Ce,"f").name}get url(){return"https://github.com/solana-labs/wallet-standard"}get icon(){return pe(this,Ce,"f").icon}get readyState(){return pe(this,pc,"f")}get publicKey(){return pe(this,oo,"f")}get connecting(){return pe(this,so,"f")}get supportedTransactionVersions(){return pe(this,hc,"f")}get wallet(){return pe(this,Ce,"f")}get standard(){return!0}destroy(){Ft(this,An,null,"f"),Ft(this,oo,null,"f"),Ft(this,so,!1,"f"),Ft(this,Hi,!1,"f");const e=pe(this,Ks,"f");e&&(Ft(this,Ks,null,"f"),e())}async autoConnect(){return pe(this,on,"m",Zf).call(this,{silent:!0})}async connect(){return pe(this,on,"m",Zf).call(this)}async disconnect(){if(Wf in pe(this,Ce,"f").features)try{Ft(this,Hi,!0,"f"),await pe(this,Ce,"f").features[Wf].disconnect()}catch(e){this.emit("error",new Pr(e==null?void 0:e.message,e))}finally{Ft(this,Hi,!1,"f")}pe(this,on,"m",Yf).call(this)}async sendTransaction(e,n,r={}){try{const i=pe(this,An,"f");if(!i)throw new me;let o;if(qr in pe(this,Ce,"f").features)if(i.features.includes(qr))o=qr;else if(Kt in pe(this,Ce,"f").features&&i.features.includes(Kt))o=Kt;else throw new qt;else if(Kt in pe(this,Ce,"f").features){if(!i.features.includes(Kt))throw new qt;o=Kt}else throw new Ei;const s=zT(n.rpcEndpoint);if(!i.chains.includes(s))throw new mr;try{const{signers:a,...l}=r;let d;if(xi(e)?(a!=null&&a.length&&e.sign(a),d=e.serialize()):(e=await this.prepareTransaction(e,n,l),a!=null&&a.length&&e.partialSign(...a),d=new Uint8Array(e.serialize({requireAllSignatures:!1,verifySignatures:!1}))),o===qr){const[g]=await pe(this,Ce,"f").features[qr].signAndSendTransaction({account:i,chain:s,transaction:d,options:{preflightCommitment:kd(l.preflightCommitment||n.commitment),skipPreflight:l.skipPreflight,maxRetries:l.maxRetries,minContextSlot:l.minContextSlot}});return PT.encode(g.signature)}else{const[g]=await pe(this,Ce,"f").features[Kt].signTransaction({account:i,chain:s,transaction:d,options:{preflightCommitment:kd(l.preflightCommitment||n.commitment),minContextSlot:l.minContextSlot}});return await n.sendRawTransaction(g.signedTransaction,{...l,preflightCommitment:kd(l.preflightCommitment||n.commitment)})}}catch(a){throw a instanceof Qt?a:new mr(a==null?void 0:a.message,a)}}catch(i){throw this.emit("error",i),i}}}An=new WeakMap,oo=new WeakMap,so=new WeakMap,Hi=new WeakMap,Ks=new WeakMap,hc=new WeakMap,Ce=new WeakMap,pc=new WeakMap,Gf=new WeakMap,on=new WeakSet,Zf=async function(e){try{if(this.connected||this.connecting)return;if(pe(this,pc,"f")!==$.Installed)throw new en;if(Ft(this,so,!0,"f"),!pe(this,Ce,"f").accounts.length)try{await pe(this,Ce,"f").features[F0].connect(e)}catch(r){throw new lr(r==null?void 0:r.message,r)}const n=pe(this,Ce,"f").accounts[0];if(!n)throw new qt;pe(this,on,"m",Dl).call(this,n)}catch(n){throw this.emit("error",n),n}finally{Ft(this,so,!1,"f")}},Dl=function(e){let n;try{n=new X(e.address)}catch(r){throw new Sn(r==null?void 0:r.message,r)}Ft(this,An,e,"f"),Ft(this,oo,n,"f"),pe(this,on,"m",sa).call(this),this.emit("connect",n)},Yf=function(){Ft(this,An,null,"f"),Ft(this,oo,null,"f"),pe(this,on,"m",sa).call(this),this.emit("disconnect")},sa=function(){var n,r;const e=qr in pe(this,Ce,"f").features?pe(this,Ce,"f").features[qr].supportedTransactionVersions:pe(this,Ce,"f").features[Kt].supportedTransactionVersions;Ft(this,hc,CT(e,["legacy"])?null:new Set(e),"f"),Kt in pe(this,Ce,"f").features&&((n=pe(this,An,"f"))!=null&&n.features.includes(Kt))?(this.signTransaction=pe(this,on,"m",oy),this.signAllTransactions=pe(this,on,"m",sy)):(delete this.signTransaction,delete this.signAllTransactions),Uo in pe(this,Ce,"f").features&&((r=pe(this,An,"f"))!=null&&r.features.includes(Uo))?this.signMessage=pe(this,on,"m",ay):delete this.signMessage,Nd in pe(this,Ce,"f").features?this.signIn=pe(this,on,"m",ly):delete this.signIn},oy=async function(e){try{const n=pe(this,An,"f");if(!n)throw new me;if(!(Kt in pe(this,Ce,"f").features))throw new Ei;if(!n.features.includes(Kt))throw new qt;try{const i=(await pe(this,Ce,"f").features[Kt].signTransaction({account:n,transaction:xi(e)?e.serialize():new Uint8Array(e.serialize({requireAllSignatures:!1,verifySignatures:!1}))}))[0].signedTransaction;return xi(e)?ws.deserialize(i):Ue.from(i)}catch(r){throw r instanceof Qt?r:new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}},sy=async function(e){try{const n=pe(this,An,"f");if(!n)throw new me;if(!(Kt in pe(this,Ce,"f").features))throw new Ei;if(!n.features.includes(Kt))throw new qt;try{const r=await pe(this,Ce,"f").features[Kt].signTransaction(...e.map(i=>({account:n,transaction:xi(i)?i.serialize():new Uint8Array(i.serialize({requireAllSignatures:!1,verifySignatures:!1}))})));return e.map((i,o)=>{const s=r[o].signedTransaction;return xi(i)?ws.deserialize(s):Ue.from(s)})}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}},ay=async function(e){try{const n=pe(this,An,"f");if(!n)throw new me;if(!(Uo in pe(this,Ce,"f").features))throw new Ei;if(!n.features.includes(Uo))throw new qt;try{return(await pe(this,Ce,"f").features[Uo].signMessage({account:n,message:e}))[0].signature}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}},ly=async function(e={}){try{if(!(Nd in pe(this,Ce,"f").features))throw new Ei;let n;try{[n]=await pe(this,Ce,"f").features[Nd].signIn(e)}catch(r){throw new qg(r==null?void 0:r.message,r)}if(!n)throw new qg;return pe(this,on,"m",Dl).call(this,n.account),n}catch(n){throw this.emit("error",n),n}};const ZT=Wx;var YT=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(t,n):i?i.value=n:e.set(t,n),n},GT=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},Ll;let Fn;const zl=new Set,Ko={};function HT(){if(Fn||(Fn=Object.freeze({register:cy,get:KT,on:JT}),typeof window>"u"))return Fn;const t=Object.freeze({register:cy});try{window.addEventListener("wallet-standard:register-wallet",({detail:e})=>e(t))}catch(e){console.error(`wallet-standard:register-wallet event listener could not be added `,e)}try{window.dispatchEvent(new XT(t))}catch(e){console.error(`wallet-standard:app-ready event could not be dispatched -`,e)}return Fn}function cy(...t){var e;return t=t.filter(n=>!zl.has(n)),t.length?(t.forEach(n=>zl.add(n)),(e=Ko.register)==null||e.forEach(n=>Hf(()=>n(...t))),function(){var r;t.forEach(i=>zl.delete(i)),(r=Ko.unregister)==null||r.forEach(i=>Hf(()=>i(...t)))}):()=>{}}function KT(){return[...zl]}function JT(t,e){var n;return(n=Ko[t])!=null&&n.push(e)||(Ko[t]=[e]),function(){var i;Ko[t]=(i=Ko[t])==null?void 0:i.filter(o=>e!==o)}}function Hf(t){try{t()}catch(e){console.error(e)}}class XT extends Event{constructor(e){super("wallet-standard:app-ready",{bubbles:!1,cancelable:!1,composed:!1}),Ll.set(this,void 0),YT(this,Ll,e,"f")}get detail(){return GT(this,Ll,"f")}get type(){return"wallet-standard:app-ready"}preventDefault(){throw new Error("preventDefault cannot be called")}stopImmediatePropagation(){throw new Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw new Error("stopPropagation cannot be called")}}Ll=new WeakMap;function qT(){if(Fn||(Fn=HT(),typeof window>"u"))return Fn;const t=window.navigator.wallets||[];if(!Array.isArray(t))return console.error("window.navigator.wallets is not an array"),Fn;const{register:e}=Fn,n=(...r)=>r.forEach(i=>Hf(()=>i({register:e})));try{Object.defineProperty(window.navigator,"wallets",{value:Object.freeze({push:n})})}catch{return console.error("window.navigator.wallets could not be set"),Fn}return n(...t),Fn}function $T(t){const e=uy(()=>new Set),{get:n,on:r}=uy(()=>qT()),[i,o]=oe.useState(()=>dy(n()));oe.useEffect(()=>{const a=[r("register",(...l)=>o(d=>[...d,...dy(l)])),r("unregister",(...l)=>o(d=>d.filter(g=>l.some(y=>y===g.wallet))))];return()=>a.forEach(l=>l())},[r]);const s=e4(i);return oe.useEffect(()=>{if(!s)return;const a=new Set(i);new Set(s.filter(d=>!a.has(d))).forEach(d=>d.destroy())},[s,i]),oe.useEffect(()=>()=>i.forEach(a=>a.destroy()),[]),oe.useMemo(()=>[...i,...t.filter(({name:a})=>i.some(l=>l.name===a)?(e.has(a)||(e.add(a),console.warn(`${a} was registered as a Standard Wallet. The Wallet Adapter for ${a} can be removed from your app.`)),!1):!0)],[i,t,e])}function uy(t){const e=oe.useRef();return e.current||(e.current={value:t()}),e.current.value}function e4(t){const e=oe.useRef();return oe.useEffect(()=>{e.current=t}),e.current}function dy(t){return t.filter(ZT).map(e=>new QT({wallet:e}))}var ss;(function(t){t[t.DESKTOP_WEB=0]="DESKTOP_WEB",t[t.MOBILE_WEB=1]="MOBILE_WEB"})(ss||(ss={}));function t4(t){return/(WebView|Version\/.+(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+)|; wv\).+(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+))/i.test(t)}function n4({adapters:t,userAgentString:e}){return t.some(n=>n.name!==Mi&&n.readyState===$.Installed)?ss.DESKTOP_WEB:e&&/android/i.test(e)&&!t4(e)?ss.MOBILE_WEB:ss.DESKTOP_WEB}function r4(t){return t?/devnet/i.test(t)?"devnet":/testnet/i.test(t)?"testnet":"mainnet-beta":"mainnet-beta"}function i4({children:t,wallets:e,adapter:n,isUnloadingRef:r,onAutoConnectRequest:i,onConnectError:o,onError:s,onSelectWallet:a}){const l=oe.useRef(!1),[d,g]=oe.useState(!1),y=oe.useRef(!1),[x,v]=oe.useState(!1),[A,k]=oe.useState(()=>(n==null?void 0:n.publicKey)??null),[D,I]=oe.useState(()=>(n==null?void 0:n.connected)??!1),M=oe.useRef(s);oe.useEffect(()=>(M.current=s,()=>{M.current=void 0}),[s]);const w=oe.useRef((p,S)=>(r.current||(M.current?M.current(p,S):(console.error(p,S),p instanceof en&&typeof window<"u"&&S&&window.open(S.url,"_blank"))),p)),[j,C]=oe.useState(()=>e.map(p=>({adapter:p,readyState:p.readyState})).filter(({readyState:p})=>p!==$.Unsupported));oe.useEffect(()=>{C(S=>e.map((z,b)=>{const N=S[b];return N&&N.adapter===z&&N.readyState===z.readyState?N:{adapter:z,readyState:z.readyState}}).filter(({readyState:z})=>z!==$.Unsupported));function p(S){C(z=>{const b=z.findIndex(({adapter:T})=>T===this);if(b===-1)return z;const{adapter:N}=z[b];return[...z.slice(0,b),{adapter:N,readyState:S},...z.slice(b+1)].filter(({readyState:T})=>T!==$.Unsupported)})}return e.forEach(S=>S.on("readyStateChange",p,S)),()=>{e.forEach(S=>S.off("readyStateChange",p,S))}},[n,e]);const U=oe.useMemo(()=>j.find(p=>p.adapter===n)??null,[n,j]);oe.useEffect(()=>{if(!n)return;const p=b=>{k(b),l.current=!1,g(!1),I(!0),y.current=!1,v(!1)},S=()=>{r.current||(k(null),l.current=!1,g(!1),I(!1),y.current=!1,v(!1))},z=b=>{w.current(b,n)};return n.on("connect",p),n.on("disconnect",S),n.on("error",z),()=>{n.off("connect",p),n.off("disconnect",S),n.off("error",z),S()}},[n,r]);const O=oe.useRef(!1);oe.useEffect(()=>()=>{O.current=!1},[n]),oe.useEffect(()=>{O.current||l.current||D||!i||!((U==null?void 0:U.readyState)===$.Installed||(U==null?void 0:U.readyState)===$.Loadable)||(l.current=!0,g(!0),O.current=!0,async function(){try{await i()}catch{o()}finally{g(!1),l.current=!1}}())},[D,i,o,U]);const B=oe.useCallback(async(p,S,z)=>{if(!n)throw w.current(new ey);if(!D)throw w.current(new me,n);return await n.sendTransaction(p,S,z)},[n,D]),Y=oe.useMemo(()=>n&&"signTransaction"in n?async p=>{if(!D)throw w.current(new me,n);return await n.signTransaction(p)}:void 0,[n,D]),G=oe.useMemo(()=>n&&"signAllTransactions"in n?async p=>{if(!D)throw w.current(new me,n);return await n.signAllTransactions(p)}:void 0,[n,D]),q=oe.useMemo(()=>n&&"signMessage"in n?async p=>{if(!D)throw w.current(new me,n);return await n.signMessage(p)}:void 0,[n,D]),ie=oe.useMemo(()=>n&&"signIn"in n?async p=>await n.signIn(p):void 0,[n]),R=oe.useCallback(async()=>{if(l.current||y.current||U!=null&&U.adapter.connected)return;if(!U)throw w.current(new ey);const{adapter:p,readyState:S}=U;if(!(S===$.Installed||S===$.Loadable))throw w.current(new en,p);l.current=!0,g(!0);try{await p.connect()}catch(z){throw o(),z}finally{g(!1),l.current=!1}},[o,U]),c=oe.useCallback(async()=>{if(!y.current&&n){y.current=!0,v(!0);try{await n.disconnect()}finally{v(!1),y.current=!1}}},[n]);return te.createElement(bM.Provider,{value:{autoConnect:!!i,wallets:j,wallet:U,publicKey:A,connected:D,connecting:d,disconnecting:x,select:a,connect:R,disconnect:c,sendTransaction:B,signTransaction:Y,signAllTransactions:G,signMessage:q,signIn:ie}},t)}let Ed;function o4(){var t;return Ed===void 0&&(Ed=((t=globalThis.navigator)==null?void 0:t.userAgent)??null),Ed}function dl(t){const e=o4();return n4({adapters:t,userAgentString:e})===ss.MOBILE_WEB}function s4(){const t=globalThis.location;if(t)return`${t.protocol}//${t.host}`}function a4({children:t,wallets:e,autoConnect:n,localStorageKey:r="walletName",onError:i}){const{connection:o}=Ox(),s=$T(e),a=oe.useMemo(()=>{if(!dl(s))return null;const M=s.find(w=>w.name===Mi);return M||new kT({addressSelector:ET(),appIdentity:{uri:s4()},authorizationResultCache:xT(),cluster:r4(o==null?void 0:o.rpcEndpoint),onWalletNotFound:AT()})},[s,o==null?void 0:o.rpcEndpoint]),l=oe.useMemo(()=>a==null||s.indexOf(a)!==-1?s:[a,...s],[s,a]),[d,g]=Px(r,dl(s)?Mi:null),y=oe.useMemo(()=>l.find(M=>M.name===d)??null,[l,d]),x=oe.useCallback(M=>{d!==M&&(y&&y.name!==Mi&&y.disconnect(),g(M))},[y,g,d]);oe.useEffect(()=>{if(!y)return;function M(){k.current||d===Mi&&dl(s)||g(null)}return y.on("disconnect",M),()=>{y.off("disconnect",M)}},[y,s,g,d]);const v=oe.useRef(!1),A=oe.useMemo(()=>{if(!(!n||!y))return async()=>{(n===!0||await n(y))&&(v.current?await y.connect():await y.autoConnect())}},[n,y]),k=oe.useRef(!1);oe.useEffect(()=>{if(d===Mi&&dl(s)){k.current=!1;return}function M(){k.current=!0}return window.addEventListener("beforeunload",M),()=>{window.removeEventListener("beforeunload",M)}},[s,d]);const D=oe.useCallback(()=>{y&&y.name!==Mi&&x(null)},[y,x]),I=oe.useCallback(M=>{v.current=!0,x(M)},[x]);return te.createElement(i4,{wallets:l,adapter:y,isUnloadingRef:k,onAutoConnectRequest:A,onConnectError:D,onError:i,onSelectWallet:I},t)}const l4="BitKeep";class c4 extends Xn{constructor(e={}){super(),this.name=l4,this.url="https://bitkeep.com",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiByeD0iNjQiIGZpbGw9IiM3NTI0RjkiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMDIgNDUuNjAyN1Y0OS44MjA0QzEwMi4wMDEgNTAuMjI4MyAxMDEuODkzIDUwLjYyOTIgMTAxLjY4NyA1MC45ODI3QzEwMS40ODEgNTEuMzM2MSAxMDEuMTg1IDUxLjYyOTYgMTAwLjgyOCA1MS44MzM1TDg3LjA5MDggNTkuNjgwMUw5OS4zNjMzIDY2LjY3MUMxMDAuMTY1IDY3LjEyOTUgMTAwLjgzMSA2Ny43ODkyIDEwMS4yOTQgNjguNTgzNkMxMDEuNzU3IDY5LjM3OCAxMDIuMDAxIDcwLjI3OTEgMTAyIDcxLjE5NjJWODIuNDQyNEMxMDIuMDAxIDgzLjM2IDEwMS43NTggODQuMjYxNyAxMDEuMjk1IDg1LjA1NjdDMTAwLjgzMiA4NS44NTE2IDEwMC4xNjYgODYuNTExNyA5OS4zNjMzIDg2Ljk3MDVMNjcuMDg2OSAxMDUuM0M2Ni4yODUzIDEwNS43NTkgNjUuMzc1OSAxMDYgNjQuNDUwMiAxMDZDNjMuNTI0NSAxMDYgNjIuNjE1MSAxMDUuNzU5IDYxLjgxMzUgMTA1LjNMNTEuMjUyIDk5LjI2MTFDNTEuMDczNyA5OS4xNTkzIDUwLjkyNTYgOTkuMDEyOCA1MC44MjI3IDk4LjgzNjNDNTAuNzE5OCA5OC42NTk5IDUwLjY2NTYgOTguNDU5NyA1MC42NjU2IDk4LjI1NkM1MC42NjU2IDk4LjA1MjIgNTAuNzE5OCA5Ny44NTIgNTAuODIyNyA5Ny42NzU2QzUwLjkyNTYgOTcuNDk5MSA1MS4wNzM3IDk3LjM1MjcgNTEuMjUyIDk3LjI1MDhMODYuMTE1MiA3Ny4zODM1Qzg2LjIwNCA3Ny4zMzI1IDg2LjI3NzcgNzcuMjU5MyA4Ni4zMjkgNzcuMTcxMkM4Ni4zODAyIDc3LjA4MzIgODYuNDA3MiA3Ni45ODMzIDg2LjQwNzIgNzYuODgxN0M4Ni40MDcyIDc2Ljc4IDg2LjM4MDIgNzYuNjgwMiA4Ni4zMjkgNzYuNTkyMUM4Ni4yNzc3IDc2LjUwNCA4Ni4yMDQgNzYuNDMwOCA4Ni4xMTUyIDc2LjM3OThMNzMuMTcxOSA2OC45NzcxQzcyLjgxNTYgNjguNzczNCA3Mi40MTE0IDY4LjY2NjIgNzIgNjguNjY2MkM3MS41ODg2IDY4LjY2NjIgNzEuMTg0NCA2OC43NzM0IDcwLjgyODEgNjguOTc3MUwzNS40MTcgODkuMTcyMkMzNS4xNDk4IDg5LjMyNSAzNC44NDY3IDg5LjQwNTQgMzQuNTM4MSA4OS40MDU0QzM0LjIyOTUgODkuNDA1NCAzMy45MjY0IDg5LjMyNSAzMy42NTkyIDg5LjE3MjJMMjkuNjQ4NCA4Ni45MDA5QzI4Ljg0MjQgODYuNDQyOCAyOC4xNzI5IDg1Ljc4MiAyNy43MDc4IDg0Ljk4NTNDMjcuMjQyNyA4NC4xODg2IDI2Ljk5ODUgODMuMjg0MyAyNyA4Mi4zNjQxVjc3Ljc2NjRDMjYuOTk5OCA3Ny40NjA3IDI3LjA4MDkgNzcuMTYwMyAyNy4yMzUyIDc2Ljg5NTVDMjcuMzg5NSA3Ni42MzA3IDI3LjYxMTUgNzYuNDEwOSAyNy44Nzg5IDc2LjI1OEw3OC42NTA0IDQ3LjM2OTNDNzguNzM5MiA0Ny4zMTgzIDc4LjgxMjkgNDcuMjQ1MSA3OC44NjQxIDQ3LjE1N0M3OC45MTU0IDQ3LjA2ODkgNzguOTQyMyA0Ni45NjkxIDc4Ljk0MjMgNDYuODY3NEM3OC45NDIzIDQ2Ljc2NTggNzguOTE1NCA0Ni42NjU5IDc4Ljg2NDEgNDYuNTc3OUM3OC44MTI5IDQ2LjQ4OTggNzguNzM5MiA0Ni40MTY2IDc4LjY1MDQgNDYuMzY1Nkw2NS42ODY1IDM4LjkzNjdDNjUuMzMwMiAzOC43MzMxIDY0LjkyNjEgMzguNjI1OCA2NC41MTQ2IDM4LjYyNThDNjQuMTAzMiAzOC42MjU4IDYzLjY5OTEgMzguNzMzMSA2My4zNDI4IDM4LjkzNjdMMjguNzU3OCA1OC42M0MyOC41Nzk4IDU4LjczMTggMjguMzc3OCA1OC43ODU0IDI4LjE3MjIgNTguNzg1NUMyNy45NjY2IDU4Ljc4NTUgMjcuNzY0NiA1OC43MzIgMjcuNTg2NSA1OC42MzAzQzI3LjQwODQgNTguNTI4NiAyNy4yNjA0IDU4LjM4MjMgMjcuMTU3NSA1OC4yMDYxQzI3LjA1NDUgNTguMDI5OSAyNy4wMDAyIDU3LjgzIDI3IDU3LjYyNjRWNDUuNTQ3NkMyNi45OTg5IDQ0LjYzIDI3LjI0MiA0My43MjgzIDI3LjcwNDkgNDIuOTMzNEMyOC4xNjc4IDQyLjEzODQgMjguODM0MSA0MS40NzgzIDI5LjYzNjcgNDEuMDE5NUw2MS45MDcyIDIyLjY5NTRDNjIuNzA3MSAyMi4yMzk4IDYzLjYxMzggMjIgNjQuNTM2NiAyMkM2NS40NTk0IDIyIDY2LjM2NjEgMjIuMjM5OCA2Ny4xNjYgMjIuNjk1NEw5OS4zNjMzIDQxLjA4MzNDMTAwLjE2NSA0MS41NDE0IDEwMC44MyA0Mi4yMDAxIDEwMS4yOTMgNDIuOTkzNEMxMDEuNzU2IDQzLjc4NjcgMTAyIDQ0LjY4NjYgMTAyIDQ1LjYwMjdaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n,r;return(r=(n=window.bitkeep)==null?void 0:n.solana)!=null&&r.isBitKeep?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.bitkeep.solana;let n;try{n=await e.getAccount()}catch(i){throw new qt(i==null?void 0:i.message,i)}let r;try{r=new X(n)}catch(i){throw new Sn(i==null?void 0:i.message,i)}this._wallet=e,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const u4="modulepreload",d4=function(t){return"/sns-widget/"+t},fy={},Ba=function(e,n,r){if(!n||n.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(n.map(o=>{if(o=d4(o),o in fy)return;fy[o]=!0;const s=o.endsWith(".css"),a=s?'[rel="stylesheet"]':"";if(!!r)for(let g=i.length-1;g>=0;g--){const y=i[g];if(y.href===o&&(!s||y.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${a}`))return;const d=document.createElement("link");if(d.rel=s?"stylesheet":u4,s||(d.as="script",d.crossOrigin=""),d.href=o,document.head.appendChild(d),s)return new Promise((g,y)=>{d.addEventListener("load",g),d.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>e()).catch(o=>{const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o})},f4="Clover";class h4 extends Xn{constructor(e={}){super(),this.name=f4,this.url="https://clv.org",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTM2LjQ4IDBIMTEuNTJDNS4xNTc2OCAwIDAgNS4xNTc2OCAwIDExLjUyVjM2LjQ4QzAgNDIuODQyMyA1LjE1NzY4IDQ4IDExLjUyIDQ4SDM2LjQ4QzQyLjg0MjMgNDggNDggNDIuODQyMyA0OCAzNi40OFYxMS41MkM0OCA1LjE1NzY4IDQyLjg0MjMgMCAzNi40OCAwWiIgZmlsbD0idXJsKCNwYWludDBfbGluZWFyXzc5MTBfMTYzMzUxKSIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTI0LjAwMDYgMzkuMzYwNkMzMi40ODM3IDM5LjM2MDYgMzkuMzYwNiAzMi40ODM3IDM5LjM2MDYgMjQuMDAwNkMzOS4zNjA2IDE1LjUxNzUgMzIuNDgzNyA4LjY0MDYyIDI0LjAwMDYgOC42NDA2MkMxNS41MTc1IDguNjQwNjIgOC42NDA2MiAxNS41MTc1IDguNjQwNjIgMjQuMDAwNkM4LjY0MDYyIDMyLjQ4MzcgMTUuNTE3NSAzOS4zNjA2IDI0LjAwMDYgMzkuMzYwNlpNMjEuMjg5OSAxNS44Njg4SDI2LjcxMVYyMS4zNDdIMjEuMjkwNFYyNi42NTRIMjYuNzExVjMyLjEzMjJIMjEuMjg5OVYyNi44MjUySDE1Ljg2OTNWMjEuMzQ3SDIxLjI4OTlWMTUuODY4OFpNMjYuNzEyIDIxLjM0N0gzMi4xMzMxVjI2LjgyNTJIMjYuNzEyVjIxLjM0N1oiIGZpbGw9ImJsYWNrIi8+CjxkZWZzPgo8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfNzkxMF8xNjMzNTEiIHgxPSI0OCIgeTE9Ii0xLjQzMDUxZS0wNiIgeDI9IjEuNDMwNTFlLTA2IiB5Mj0iNDgiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0E5RkZFMCIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiM4NkQ1RkYiLz4KPC9saW5lYXJHcmFkaWVudD4KPC9kZWZzPgo8L3N2Zz4=",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n;return(n=window.clover_solana)!=null&&n.isCloverWallet?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.clover_solana;let n;try{n=await e.getAccount()}catch(i){throw new qt(i==null?void 0:i.message,i)}let r;try{r=new X(n)}catch(i){throw new Sn(i==null?void 0:i.message,i)}this._wallet=e,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){this._wallet&&(this._wallet=null,this._publicKey=null),this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return Uint8Array.from(r)}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}var fl=_c.Buffer;function p4(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n>>0,w=new Uint8Array(M);D!==I;){for(var j=v[D],C=0,U=M-1;(j!==0||C>>0,w[U]=j%s>>>0,j=j/s>>>0;if(j!==0)throw new Error("Non-zero carry");k=C,D++}for(var O=M-k;O!==M&&w[O]===0;)O++;for(var B=a.repeat(A);O>>0,M=new Uint8Array(I);v[A];){var w=e[v.charCodeAt(A)];if(w===255)return;for(var j=0,C=I-1;(w!==0||j>>0,M[C]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");D=j,A++}for(var U=I-D;U!==I&&M[U]===0;)U++;var O=fl.allocUnsafe(k+(I-U));O.fill(0,0,k);for(var B=k;U!==I;)O[B++]=M[U++];return O}function x(v){var A=y(v);if(A)return A;throw new Error("Non-base"+s+" character")}return{encode:g,decodeUnsafe:y,decode:x}}var g4=p4,y4=g4,m4="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",w4=y4(m4);const xd=Or(w4),M4="Coin98";class N4 extends Xn{constructor(e={}){super(),this.name=M4,this.url="https://coin98.com",this.icon="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA3NiA3NSI+CiAgPGRlZnM+CiAgICA8bGluZWFyR3JhZGllbnQgaWQ9ImEiIHgxPSIxMDEuNjgxJSIgeDI9Ii0xLjU1NyUiIHkxPSIxNS4yNjglIiB5Mj0iODQuOTE3JSI+CiAgICAgIDxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiNGMUQ5NjEiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjQ0RBMTQ2Ii8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogIDwvZGVmcz4KICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgPHJlY3Qgd2lkdGg9Ijc1IiBoZWlnaHQ9Ijc1IiBmaWxsPSIjMDAwIiByeD0iMTYiLz4KICAgIDxwYXRoIGZpbGw9InVybCgjYSkiIGZpbGwtcnVsZT0ibm9uemVybyIgZD0iTTYxLjQ0IDBhMTMuNzE0IDEzLjcxNCAwIDAgMSA5LjY4IDQuMDEgMTMuNjYxIDEzLjY2MSAwIDAgMSA0LjAwOCA5LjY2OHY0Ny42NDZhMTMuNjYgMTMuNjYgMCAwIDEtNC4wMDcgOS42NjZBMTMuNzEzIDEzLjcxMyAwIDAgMSA2MS40NCA3NUgxMy42ODZhMTMuNzEzIDEzLjcxMyAwIDAgMS05LjY4LTQuMDFBMTMuNjYgMTMuNjYgMCAwIDEgMCA2MS4zMjRWMTMuNjc4YzAtMy42MjUgMS40NC03LjEwMiA0LjAwNy05LjY2N0ExMy43MTQgMTMuNzE0IDAgMCAxIDEzLjY4NyAwWk0yMC4wNjMgNDYuMjMxaC00LjgyNWExMC4wMzIgMTAuMDMyIDAgMCAwIDIuOTQ2IDcuMDg2IDEwLjA3IDEwLjA3IDAgMCAwIDcuMSAyLjk0MiAxMC4wNjUgMTAuMDY1IDAgMCAwIDcuMTA4LTIuOTM1IDEwLjAzIDEwLjAzIDAgMCAwIDIuOTQ2LTcuMDkzaC00LjgyNGE1LjIwNyA1LjIwNyAwIDAgMS0xLjUzIDMuNjg4IDUuMjI1IDUuMjI1IDAgMCAxLTMuNjk2IDEuNTI4IDUuMjM0IDUuMjM0IDAgMCAxLTMuNjk1LTEuNTI4IDUuMjEzIDUuMjEzIDAgMCAxLTEuNTMtMy42ODhaTTU0LjMzIDMzLjcxNmExMS43NjMgMTEuNzYzIDAgMCAwLTEyLjc5OSAyLjUzOEExMS42OTcgMTEuNjk3IDAgMCAwIDM4Ljk5IDQ5LjAzYTExLjcyMyAxMS43MjMgMCAwIDAgNC4zMjggNS4yNTkgMTEuNzU3IDExLjc1NyAwIDAgMCA2LjUyNiAxLjk3IDExLjc2NiAxMS43NjYgMCAwIDAgOC4yOS0zLjQzNSAxMS43MiAxMS43MiAwIDAgMCAzLjQ0Mi04LjI3NCAxMS43MDIgMTEuNzAyIDAgMCAwLTEuOTc1LTYuNTE0IDExLjczNiAxMS43MzYgMCAwIDAtNS4yNjktNC4zMlptLTQuNDg4IDMuOTJhNi45MzcgNi45MzcgMCAwIDEgNC45IDIuMDI1IDYuOTEgNi45MSAwIDAgMSAyLjAyOCA0Ljg5MiA2Ljg5NyA2Ljg5NyAwIDAgMS0xLjE3IDMuODM0IDYuOTMyIDYuOTMyIDAgMCAxLTEwLjY0MyAxLjA0MiA2LjkwMiA2LjkwMiAwIDAgMS0xLjUtNy41MjIgNi45MDkgNi45MDkgMCAwIDEgMi41NDQtMy4xIDYuOTI4IDYuOTI4IDAgMCAxIDMuODQxLTEuMTY3Wm0uMTcgNC41NTJhMi40MzEgMi40MzEgMCAwIDAtMi4yNDEgMS4xNTQgMi40MTggMi40MTggMCAwIDAtLjM1NiAxLjI1NyAyLjM5NSAyLjM5NSAwIDAgMCAxLjYxOSAyLjI5djEuNzUzaDEuNjE4di0xLjc1NGEyLjQyNyAyLjQyNyAwIDAgMCAxLjU5NC0xLjk1IDIuNDE4IDIuNDE4IDAgMCAwLTEtMi4zMSAyLjQzMSAyLjQzMSAwIDAgMC0xLjIzNC0uNDRabS0yMC4yMi0yMi41NTJhMTEuNzYyIDExLjc2MiAwIDAgMC0xMi43OTYgMi41MzEgMTEuNjk3IDExLjY5NyAwIDAgMC0yLjU1NCAxMi43NjkgMTEuNzIzIDExLjcyMyAwIDAgMCA0LjMyIDUuMjYyIDExLjc1NyAxMS43NTcgMCAwIDAgMTQuODI1LTEuNDQ2IDExLjcxNyAxMS43MTcgMCAwIDAgMy40NDUtOC4yODQgMTEuNzAzIDExLjcwMyAwIDAgMC0xLjk3NC02LjUxMiAxMS43MzYgMTEuNzM2IDAgMCAwLTUuMjY2LTQuMzJabS00LjUxIDMuOTE3YTYuOTQ1IDYuOTQ1IDAgMCAxIDQuODk3IDIuMDI5IDYuOTE4IDYuOTE4IDAgMCAxIDIuMDMyIDQuODg2IDYuOTA2IDYuOTA2IDAgMCAxLTEuMTY4IDMuODQyIDYuOTQgNi45NCAwIDAgMS0xMC42NiAxLjA0OCA2LjkxMSA2LjkxMSAwIDAgMS0xLjUtNy41MzYgNi45MTggNi45MTggMCAwIDEgMi41NS0zLjEwMyA2LjkzNyA2LjkzNyAwIDAgMSAzLjg1LTEuMTY2Wm0yNC41Ni00LjgxYTEwLjA1OSAxMC4wNTkgMCAwIDAtNy4xMDMgMi45NCAxMC4wMiAxMC4wMiAwIDAgMC0yLjk0IDcuMDkgOS45IDkuOSAwIDAgMCAxLjIzIDQuNzk1IDEzLjU3NSAxMy41NzUgMCAwIDEgNC4yMTQtMi4zMjIgNS4wODIgNS4wODIgMCAwIDEtLjYyNS0yLjQ3NyA1LjIwNiA1LjIwNiAwIDAgMSAxLjUwMy0zLjczNiA1LjIyMyA1LjIyMyAwIDAgMSAzLjcyMi0xLjU1NCA1LjIzNCA1LjIzNCAwIDAgMSAzLjcyIDEuNTU0IDUuMjEzIDUuMjEzIDAgMCAxIDEuNTA1IDMuNzM2IDUuMjc5IDUuMjc5IDAgMCAxLS42MjMgMi40NzMgMTMuNTc0IDEzLjU3NCAwIDAgMSA0LjIxMyAyLjMyMiA5LjkwMyA5LjkwMyAwIDAgMCAxLjIzLTQuNzk1IDEwLjAzMiAxMC4wMzIgMCAwIDAtMi45NDYtNy4wODYgMTAuMDcgMTAuMDcgMCAwIDAtNy4xLTIuOTRabS0yMy43NSA3Ljk5aC0xLjYxN3YxLjc1YTIuNDE5IDIuNDE5IDAgMCAwLTEuNTgyIDIuNjg3IDIuNDE0IDIuNDE0IDAgMCAwIDIuMzkgMi4wMDYgMi40NSAyLjQ1IDAgMCAwIDEuNTU1LS41NzQgMi40MTQgMi40MTQgMCAwIDAtLjc0Ni00LjExOXYtMS43NVoiLz4KICA8L2c+Cjwvc3ZnPgo=",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n;return(n=window.coin98)!=null&&n.sol?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isConnected())}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.coin98.sol;let n;try{n=(await e.connect())[0]}catch(i){throw new qt(i==null?void 0:i.message,i)}let r;try{r=new X(n)}catch(i){throw new Sn(i==null?void 0:i.message,i)}this._wallet=e,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{const r=await n.request({method:"sol_sign",params:[e]}),i=new X(r.publicKey),o=xd.decode(r.signature);return e.addSignature(i,o),e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{const r=await n.request({method:"sol_signAllTransactions",params:[e]}),i=new X(r.publicKey),o=r.signatures;return e.map((s,a)=>{const l=xd.decode(o[a]);return s.addSignature(i,l),s})}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const r=await n.request({method:"sol_signMessage",params:[e]});return xd.decode(r.signature)}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const v4="Coinbase Wallet";class S4 extends Xn{constructor(e={}){super(),this.name=v4,this.url="https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8Y2lyY2xlIGN4PSI1MTIiIGN5PSI1MTIiIHI9IjUxMiIgZmlsbD0iIzAwNTJGRiIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTE1MiA1MTJDMTUyIDcxMC44MjMgMzEzLjE3NyA4NzIgNTEyIDg3MkM3MTAuODIzIDg3MiA4NzIgNzEwLjgyMyA4NzIgNTEyQzg3MiAzMTMuMTc3IDcxMC44MjMgMTUyIDUxMiAxNTJDMzEzLjE3NyAxNTIgMTUyIDMxMy4xNzcgMTUyIDUxMlpNNDIwIDM5NkM0MDYuNzQ1IDM5NiAzOTYgNDA2Ljc0NSAzOTYgNDIwVjYwNEMzOTYgNjE3LjI1NSA0MDYuNzQ1IDYyOCA0MjAgNjI4SDYwNEM2MTcuMjU1IDYyOCA2MjggNjE3LjI1NSA2MjggNjA0VjQyMEM2MjggNDA2Ljc0NSA2MTcuMjU1IDM5NiA2MDQgMzk2SDQyMFoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>window!=null&&window.coinbaseSolana?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1)}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.coinbaseSolana;try{await e.connect()}catch(r){throw new lr(r==null?void 0:r.message,r)}if(!e.publicKey)throw new qt;let n;try{n=new X(e.publicKey.toBytes())}catch(r){throw new Sn(r==null?void 0:r.message,r)}e.on("disconnect",this._disconnected),this._wallet=e,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async sendTransaction(e,n,r={}){try{const i=this._wallet;if(!i)throw new me;try{const{signers:o,...s}=r;e=await this.prepareTransaction(e,n,s),o!=null&&o.length&&e.partialSign(...o),s.preflightCommitment=s.preflightCommitment||n.commitment;const{signature:a}=await i.signAndSendTransaction(e,s);return a}catch(o){throw o instanceof Qt?o:new mr(o==null?void 0:o.message,o)}}catch(i){throw this.emit("error",i),i}}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const I4="HuobiWallet";class b4 extends Xn{constructor(e={}){super(),this.name=I4,this.url="https://www.huobiwallet.io",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjI0IiBoZWlnaHQ9IjIyNCIgdmlld0JveD0iMCAwIDIyNCAyMjQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMCAwTDIyNCAwVjIyNEgwTDAgMFoiIGZpbGw9IiMyMTU3RTIiLz4KPHBhdGggZD0iTTEzMS4wNTkgODEuMTc3MUMxMzEuMDU5IDU3Ljc1MzEgMTE5LjQ1OCAzNy42MzE1IDExMC42MjUgMzEuMDcyOEMxMTAuNjI1IDMxLjA3MjggMTA5Ljk1MyAzMC43MDQyIDExMCAzMS42MjU4VjMxLjYyNThDMTA5LjI2NSA3Ni44MzAzIDg1Ljc2NzIgODkuMDg3NSA3Mi44MzggMTA1LjU4NEM0My4wMjQxIDE0My42NzcgNzAuNzU4NyAxODUuNDU2IDk4Ljk5MzUgMTkzLjEzNkMxMTQuNzk5IDE5Ny40NTIgOTUuMzUwOCAxODUuNDU2IDkyLjg0OTQgMTYwLjIzNUM4OS44MDA3IDEyOS43NDUgMTMxLjA1OSAxMDYuNDQ0IDEzMS4wNTkgODEuMTc3MVoiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl8xMTAxXzEyNSkiLz4KPHBhdGggZD0iTTE0My41OTcgOTYuMzE3NEMxNDMuNDA5IDk2LjE5NDMgMTQzLjE1OCA5Ni4xMDIgMTQyLjk4NiA5Ni4zOTQzQzE0Mi40ODQgMTAyLjEwMiAxMzYuNTYgMTE0LjI4NiAxMjkuMDM3IDEyNS40ODZDMTAzLjU1MiAxNjMuNDU1IDExOC4wNjUgMTgxLjc2MiAxMjYuMjQ3IDE5MS42MzlDMTMwLjk0OSAxOTcuMzQ3IDEyNi4yNDcgMTkxLjYzOSAxMzguMDk2IDE4NS44MDhDMTUyLjczNSAxNzcuMDkyIDE2Mi4yMzQgMTYyLjAyIDE2My42NDMgMTQ1LjI3QzE2NS4yMzMgMTI2Ljc1OCAxNTcuNzk4IDEwOC42IDE0My41OTcgOTYuMzE3NFoiIGZpbGw9InVybCgjcGFpbnQxX2xpbmVhcl8xMTAxXzEyNSkiLz4KPGRlZnM+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQwX2xpbmVhcl8xMTAxXzEyNSIgeDE9IjEyMi40MDEiIHkxPSIyMDkuMjk1IiB4Mj0iMTc4LjY2MiIgeTI9IjExMC40NDciIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0Y3RjZGRiIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IndoaXRlIi8+CjwvbGluZWFyR3JhZGllbnQ+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQxX2xpbmVhcl8xMTAxXzEyNSIgeDE9IjE1Ny44NjEiIHkxPSIyMDMuMTc3IiB4Mj0iMTg5LjAxNCIgeTI9IjE0MC4wMjIiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0Y3RjZGRiIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IndoaXRlIi8+CjwvbGluZWFyR3JhZGllbnQ+CjwvZGVmcz4KPC9zdmc+Cg==",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n;return(n=window.huobiWallet)!=null&&n.isHuobiWallet?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isConnected)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.huobiWallet;try{await e.connect()}catch(r){throw new lr(r==null?void 0:r.message,r)}if(!e.publicKey)throw new qt;let n;try{n=new X(e.publicKey.toBytes())}catch(r){throw new Sn(r==null?void 0:r.message,r)}e.on("disconnect",this._disconnected),this._wallet=e,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;e&&(e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("disconnect"))}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const k4="MathWallet";class E4 extends IM{constructor(e={}){super(),this.name=k4,this.url="https://mathwallet.org",this.icon="data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIHdpZHRoPSIxMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJtMCAwaDEyOHYxMjhoLTEyOHoiIG9wYWNpdHk9IjAiLz48cGF0aCBkPSJtOTAuODQ3MDA4NiA1Ny43NjEwMDIzYy0yLjI3NzAzNjMtMi4yNzcwMzYzLTIuMjc3MDM2My01Ljk2ODg0MTYgMC04LjI0NTg3NzggMi4yNzcwMzYyLTIuMjc3MDM2MyA1Ljk2ODg0MTUtMi4yNzcwMzYzIDguMjQ1ODc3OCAwIDIuMjc3MDM2NiAyLjI3NzAzNjIgMi4yNzcwMzY2IDUuOTY4ODQxNSAwIDguMjQ1ODc3OC0yLjI3NzAzNjMgMi4yNzcwMzYyLTUuOTY4ODQxNiAyLjI3NzAzNjItOC4yNDU4Nzc4IDB6bS0xOS41ODM5NTk4IDE5LjU4Mzk1OTdjLTEuNzA3Nzc3Mi0xLjcwNzc3NzItMS43MDc3NzcyLTQuNDc2NjMxMSAwLTYuMTg0NDA4M3M0LjQ3NjYzMTEtMS43MDc3NzcyIDYuMTg0NDA4MyAwIDEuNzA3Nzc3MiA0LjQ3NjYzMTEgMCA2LjE4NDQwODMtNC40NzY2MzExIDEuNzA3Nzc3Mi02LjE4NDQwODMgMHptMzAuOTIyMDQyMi0xMC4zMDczNDcyYy0xLjcwNzc3OC0xLjcwNzc3NzItMS43MDc3NzgtNC40NzY2MzEyIDAtNi4xODQ0MDg0IDEuNzA3Nzc3LTEuNzA3Nzc3MiA0LjQ3NjYzMS0xLjcwNzc3NzIgNi4xODQ0MDggMHMxLjcwNzc3NyA0LjQ3NjYzMTIgMCA2LjE4NDQwODQtNC40NzY2MzEgMS43MDc3NzcyLTYuMTg0NDA4IDB6bS0xMC4zMDczNDc3IDEwLjMwNzM0NzJjLTEuNzA3Nzc3Mi0xLjcwNzc3NzItMS43MDc3NzcyLTQuNDc2NjMxMSAwLTYuMTg0NDA4M3M0LjQ3NjYzMTEtMS43MDc3NzcyIDYuMTg0NDA4MyAwIDEuNzA3Nzc3MiA0LjQ3NjYzMTEgMCA2LjE4NDQwODMtNC40NzY2MzExIDEuNzA3Nzc3Mi02LjE4NDQwODMgMHptMjEuNjQ1NDI4Ny0xLjAzMDczNDdjLTEuMTM4NTE4LTEuMTM4NTE4MS0xLjEzODUxOC0yLjk4NDQyMDggMC00LjEyMjkzODkgMS4xMzg1MTktMS4xMzg1MTgxIDIuOTg0NDIxLTEuMTM4NTE4MSA0LjEyMjkzOSAwIDEuMTM4NTE5IDEuMTM4NTE4MSAxLjEzODUxOSAyLjk4NDQyMDggMCA0LjEyMjkzODktMS4xMzg1MTggMS4xMzg1MTgxLTIuOTg0NDIgMS4xMzg1MTgxLTQuMTIyOTM5IDB6bS0xMC4zMDczNDcgMTAuMzA3MzQ3MmMtMS4xMzg1MTgtMS4xMzg1MTgxLTEuMTM4NTE4LTIuOTg0NDIwNyAwLTQuMTIyOTM4OSAxLjEzODUxOC0xLjEzODUxODEgMi45ODQ0MjEtMS4xMzg1MTgxIDQuMTIyOTM5IDAgMS4xMzg1MTggMS4xMzg1MTgyIDEuMTM4NTE4IDIuOTg0NDIwOCAwIDQuMTIyOTM4OS0xLjEzODUxOCAxLjEzODUxODItMi45ODQ0MjEgMS4xMzg1MTgyLTQuMTIyOTM5IDB6bS0yMi42NzYxNjM3LTE4LjU1MzIyNWMtMi4yNzcwMzYzLTIuMjc3MDM2My0yLjI3NzAzNjMtNS45Njg4NDE1IDAtOC4yNDU4Nzc4czUuOTY4ODQxNS0yLjI3NzAzNjMgOC4yNDU4Nzc4IDAgMi4yNzcwMzYzIDUuOTY4ODQxNSAwIDguMjQ1ODc3OC01Ljk2ODg0MTUgMi4yNzcwMzYzLTguMjQ1ODc3OCAwem0wLTIwLjYxNDY5NDVjLTIuMjc3MDM2My0yLjI3NzAzNjMtMi4yNzcwMzYzLTUuOTY4ODQxNSAwLTguMjQ1ODc3OHM1Ljk2ODg0MTUtMi4yNzcwMzYzIDguMjQ1ODc3OCAwIDIuMjc3MDM2MyA1Ljk2ODg0MTUgMCA4LjI0NTg3NzgtNS45Njg4NDE1IDIuMjc3MDM2My04LjI0NTg3NzggMHptLTEwLjMwNzM0NzIgMTAuMzA3MzQ3M2MtMi4yNzcwMzYzLTIuMjc3MDM2My0yLjI3NzAzNjMtNS45Njg4NDE2IDAtOC4yNDU4Nzc4IDIuMjc3MDM2Mi0yLjI3NzAzNjMgNS45Njg4NDE1LTIuMjc3MDM2MyA4LjI0NTg3NzggMCAyLjI3NzAzNjIgMi4yNzcwMzYyIDIuMjc3MDM2MiA1Ljk2ODg0MTUgMCA4LjI0NTg3NzgtMi4yNzcwMzYzIDIuMjc3MDM2Mi01Ljk2ODg0MTYgMi4yNzcwMzYyLTguMjQ1ODc3OCAwem0tMjAuNzEwNTA2IDBjLTIuMjc3MDM2Mi0yLjI3NzAzNjMtMi4yNzcwMzYyLTUuOTY4ODQxNiAwLTguMjQ1ODc3OCAyLjI3NzAzNjMtMi4yNzcwMzYzIDUuOTY4ODQxNi0yLjI3NzAzNjMgOC4yNDU4Nzc4IDAgMi4yNzcwMzYzIDIuMjc3MDM2MiAyLjI3NzAzNjMgNS45Njg4NDE1IDAgOC4yNDU4Nzc4LTIuMjc3MDM2MiAyLjI3NzAzNjItNS45Njg4NDE1IDIuMjc3MDM2Mi04LjI0NTg3NzggMHptLTE5LjU4Mzk1OTcgMTkuNTgzOTU5N2MtMS43MDc3NzcyLTEuNzA3Nzc3Mi0xLjcwNzc3NzItNC40NzY2MzExIDAtNi4xODQ0MDgzczQuNDc2NjMxMS0xLjcwNzc3NzIgNi4xODQ0MDgzIDAgMS43MDc3NzcyIDQuNDc2NjMxMSAwIDYuMTg0NDA4My00LjQ3NjYzMTEgMS43MDc3NzcyLTYuMTg0NDA4MyAwem0zMC45MjIwNDE3LTEwLjMwNzM0NzJjLTEuNzA3Nzc3Mi0xLjcwNzc3NzItMS43MDc3NzcyLTQuNDc2NjMxMiAwLTYuMTg0NDA4NHM0LjQ3NjYzMTItMS43MDc3NzcyIDYuMTg0NDA4NCAwIDEuNzA3Nzc3MiA0LjQ3NjYzMTIgMCA2LjE4NDQwODQtNC40NzY2MzEyIDEuNzA3Nzc3Mi02LjE4NDQwODQgMHptLTEwLjMwNzM0NzIgMTAuMzA3MzQ3MmMtMS43MDc3NzcyLTEuNzA3Nzc3Mi0xLjcwNzc3NzItNC40NzY2MzExIDAtNi4xODQ0MDgzczQuNDc2NjMxMS0xLjcwNzc3NzIgNi4xODQ0MDgzIDAgMS43MDc3NzcyIDQuNDc2NjMxMSAwIDYuMTg0NDA4My00LjQ3NjYzMTEgMS43MDc3NzcyLTYuMTg0NDA4MyAwem0tNDAuMTk4NjU0My0xLjAzMDczNDdjLTEuMTM4NTE4MTMtMS4xMzg1MTgxLTEuMTM4NTE4MTMtMi45ODQ0MjA4IDAtNC4xMjI5Mzg5IDEuMTM4NTE4MS0xLjEzODUxODEgMi45ODQ0MjA4LTEuMTM4NTE4MSA0LjEyMjkzODkgMHMxLjEzODUxODEgMi45ODQ0MjA4IDAgNC4xMjI5Mzg5LTIuOTg0NDIwOCAxLjEzODUxODEtNC4xMjI5Mzg5IDB6bTEwLjMwNzM0NzMgMTAuMzA3MzQ3MmMtMS4xMzg1MTgyLTEuMTM4NTE4MS0xLjEzODUxODItMi45ODQ0MjA3IDAtNC4xMjI5Mzg5IDEuMTM4NTE4MS0xLjEzODUxODEgMi45ODQ0MjA3LTEuMTM4NTE4MSA0LjEyMjkzODggMCAxLjEzODUxODIgMS4xMzg1MTgyIDEuMTM4NTE4MiAyLjk4NDQyMDggMCA0LjEyMjkzODktMS4xMzg1MTgxIDEuMTM4NTE4Mi0yLjk4NDQyMDcgMS4xMzg1MTgyLTQuMTIyOTM4OCAwem00MS4yMjkzODg5IDBjLTEuMTM4NTE4MS0xLjEzODUxODEtMS4xMzg1MTgxLTIuOTg0NDIwNyAwLTQuMTIyOTM4OSAxLjEzODUxODItMS4xMzg1MTgxIDIuOTg0NDIwOC0xLjEzODUxODEgNC4xMjI5Mzg5IDAgMS4xMzg1MTgyIDEuMTM4NTE4MiAxLjEzODUxODIgMi45ODQ0MjA4IDAgNC4xMjI5Mzg5LTEuMTM4NTE4MSAxLjEzODUxODItMi45ODQ0MjA3IDEuMTM4NTE4Mi00LjEyMjkzODkgMHptLTQyLjI2MDEyMzctMTkuNTgzOTU5N2MtMS43MDc3NzcyLTEuNzA3Nzc3Mi0xLjcwNzc3NzItNC40NzY2MzEyIDAtNi4xODQ0MDg0czQuNDc2NjMxMi0xLjcwNzc3NzIgNi4xODQ0MDg0IDAgMS43MDc3NzcyIDQuNDc2NjMxMiAwIDYuMTg0NDA4NC00LjQ3NjYzMTIgMS43MDc3NzcyLTYuMTg0NDA4NCAwem0xOS41ODM5NTk4IDEuMDMwNzM0N2MtMi4yNzcwMzYzLTIuMjc3MDM2My0yLjI3NzAzNjMtNS45Njg4NDE1IDAtOC4yNDU4Nzc4czUuOTY4ODQxNS0yLjI3NzAzNjMgOC4yNDU4Nzc4IDAgMi4yNzcwMzYzIDUuOTY4ODQxNSAwIDguMjQ1ODc3OC01Ljk2ODg0MTUgMi4yNzcwMzYzLTguMjQ1ODc3OCAwem0wLTIwLjYxNDY5NDVjLTIuMjc3MDM2My0yLjI3NzAzNjMtMi4yNzcwMzYzLTUuOTY4ODQxNSAwLTguMjQ1ODc3OHM1Ljk2ODg0MTUtMi4yNzcwMzYzIDguMjQ1ODc3OCAwIDIuMjc3MDM2MyA1Ljk2ODg0MTUgMCA4LjI0NTg3NzgtNS45Njg4NDE1IDIuMjc3MDM2My04LjI0NTg3NzggMHptLTEwLjMwNzM0NzMgMTAuMzA3MzQ3M2MtMi4yNzcwMzYyLTIuMjc3MDM2My0yLjI3NzAzNjItNS45Njg4NDE2IDAtOC4yNDU4Nzc4IDIuMjc3MDM2My0yLjI3NzAzNjMgNS45Njg4NDE2LTIuMjc3MDM2MyA4LjI0NTg3NzggMCAyLjI3NzAzNjMgMi4yNzcwMzYyIDIuMjc3MDM2MyA1Ljk2ODg0MTUgMCA4LjI0NTg3NzgtMi4yNzcwMzYyIDIuMjc3MDM2Mi01Ljk2ODg0MTUgMi4yNzcwMzYyLTguMjQ1ODc3OCAweiIvPjwvZz48L3N2Zz4=",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._messaged=n=>{const r=n.data;r&&r.origin==="mathwallet_internal"&&r.type==="lockStatusChanged"&&!r.payload&&this._disconnected()},this._disconnected=()=>{this._wallet&&(window.removeEventListener("message",this._messaged),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n;return(n=window.solana)!=null&&n.isMathWallet?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.solana;let n;try{n=await e.getAccount()}catch(i){throw new qt(i==null?void 0:i.message,i)}let r;try{r=new X(n)}catch(i){throw new Sn(i==null?void 0:i.message,i)}window.addEventListener("message",this._messaged),this._wallet=e,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){this._wallet&&(window.removeEventListener("message",this._messaged),this._wallet=null,this._publicKey=null),this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const x4="Neko";class T4 extends Xn{constructor(e={}){super(),this.name=x4,this.url="https://nekowallet.com",this.icon="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSIyNDRweCIgaGVpZ2h0PSIyNjBweCIgdmlld0JveD0iMCAwIDI0NCAyNjAiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDI0NCAyNjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPiAgPGltYWdlIGlkPSJpbWFnZTAiIHdpZHRoPSIyNDQiIGhlaWdodD0iMjYwIiB4PSIwIiB5PSIwIgogICAgaHJlZj0iZGF0YTppbWFnZS9wbmc7YmFzZTY0LGlWQk9SdzBLR2dvQUFBQU5TVWhFVWdBQUFQUUFBQUVFQ0FNQUFBQW9GT2xoQUFBQUJHZEJUVUVBQUxHUEMveGhCUUFBQUNCalNGSk4KQUFCNkpnQUFnSVFBQVBvQUFBQ0E2QUFBZFRBQUFPcGdBQUE2bUFBQUYzQ2N1bEU4QUFBQjQxQk1WRVVBQUFEL2Z5RC9jQ0QvZ0NyLwpmeXIvZ0VEL2dBRC9iU1QvY0JEM2JCajViUnI0YlJuNGJScjViaHI0YmhuNWJCbjRiaG40YlJyNmJodjNiQmo0YlJyM2NCajRiUm41CmJoci9jUno0Ynh2NWJocjNhQmovY3huNWJocjFhaHYzYkJyL2JSdjNiUnIyYkJ2M2JSdjRiQnI0YmhydmNDRDRiUm40YlJyM2NCajQKYmhmM2JSdjRieG4zYkJyM2JCbjRiQm41YlJyNWJScjRiQm4vZGgzNGJocjZhaHY0YXhuL2RTRDNiaHIzYlJqL2JCMzNhQmowYWh2MwpiUnIvYnhINGJCbjRiUnYvYnhENGJSbjZhaFg0YlJyMWJCbjRiUnI2YmhqNGJScjRiUm40YkJuNGJCcjNiUmo0YmhuNGJCcjRiUnI0CmJodjRiUnY5MnNiN3Y1cjVkaWo2bW1INnJYNzh5S245MGJqOHY1djd0b3o1aUVYKzQ5VCs3T1ArOXZILy8vLzVrVlA1ZGluN28zRDcKdG8zNnBIRDVpRWI1ZnpiKzdlTDdyWC81ZnpmLzl2SCs3ZVA3djV2KzdlSC8vLzcrNU5UN3BIRCs0OVA4dG8zOTJzWDZtMkw1ZnpqLwo5dkQ1Z0RqN3JYNzZwSEg4eUtqKzdPSC8vdjc4djVuNGRpbi85ZkQ4djVyNmlFYjd0b3Y5NDlQOHRveis1TlA5MExmNmtWUDRkeW42CmtWVDZtbUQ0ZGlqOTBiZis3T0Q3dFl2KzlmRDdtbUQ4dnBuOHRZdjgwYmo2bzNEOTVOVDZtbUw3bzNIKzl2RDZpRVg4ckgvNm0ySDcKcllEOTI4WDdtbUg4ckg3N3JIN1dKTE5MQUFBQVQzUlNUbE1BQUFBQUFBQUFBQkJBbjkvdno1QlFiOTlmUWQ0Z3YzOEJqODRnQVlBeApnQUh1a0dIUHpoQncvaUZQWUkrZ29JK2VyNzRCenpCd0FZQmdBU0V3N3hDUWp4QytNTEJRcjErdTNyK3VYNC9Pd0xqT0dBQUFBQUZpClMwZEVYM1BSVVMwQUFBQUpjRWhaY3dBQUN4TUFBQXNUQVFDYW5CZ0FBQUFIZEVsTlJRZm1CaHdHRkNaaGFHR2lBQUFPMTBsRVFWUjQKMnUyZCsyTVVWeFhIbDFacU5vWGF0QW1VaDRhdEJiYUNiVVNMSWxTMFZTeDlPTTAweXo2U3pTNGh6UVBMMGhwVEVaWUVBelZxMGFxawppbS8rVkdkMlp2WTVNK2Q3WnM2ZG05MzAreVBNenIyZm5Edm5mdStkZSsra1Vnd05wWWVmM0dQczJUdWM1dnhLb1hhbG43SXFaT3dkCi9vcXlJcDYyN3U5cTVCbmR2RGJ5c3lQTkNvMnFxZERZUHFOZCszVWpwNTQ3MEZHaGc0Y1VNSThZblJyV3pIeDR1S3RDbytMVVE5M00KdW1QOTJGZDdLalE2SkZ6R0FhTlhPdFBaNDEvenFkQzRiQmxqUGtVWSt6UkNIeG54cVZCR050VFArMEZyRFBXWHZ1NWJJZGxRditCYgp4b2cyYU45QUc4WlJ5VEtPR2Y0NnJvazVJTkJHVnJKOXB3T2c5MGpuUzB5N1h4d0pnSmJzdFlLZ3BmTWxLSi91eW9YK2htQXBKNEtnCnRZUjY5NHRCMWNtZUVDeG1QS2dVNDZRRzZNUGZES3lPWk10N0tiQVVRNEhqSlJRY2FNTjRXYkNjZmNIRkpPOVFRZ0p0VENRRG5iaEQKMmZWc1NHVWtPK3FSa0hLU0R2V1JzTXFNQ2haa2hDblpVQWY1RWtkWnVZTEdRcUgzSmdvZEdtaEpTNVlPaFRhU25Eb0tEN1NrSlNPZwpFM1FvZ1FiVWc1YXpaQ2ZDb1JNMG80RUcxSU9XczJUakJIUmlvUTd6SmRKLy8rZVRLeXBjWWI3RWtad2wreFpWVkVKbWxBNjBvQ1hiClI1YVZ6SHd3SFdqamxGaGhJMlJaaVRnVTN4blFMc2xaTXJxc1JNem90NzlEMXlNalZkZ3h1cXdrUWszNEVrZGlsdXdWQkZwOXFJOEEKVDVtY0pVc0RoYWszbzFDZ2pheFVpNk1NbWFNUnhRNEZDclNjSlJ1SG9CVTdGTXFBZXRDbmhjb2pEWmtqcFdhVUdtazBKV1hKYUVPbQpQdFNBTDNFMElWUWdiY2pjVUtzem80QUJkU1ZseWNDR3BkS013b0VXczJSb2Vlb2NDaDVvS1VzR0dUSkhxaHpLZDlFblRNeVNRWVpNCmFhZ3hYK0pDeXlRV3pKQ3BERFhtUzF4b21iODdac2hjcVRDam5FQkxXYkp4RHJRS004b0p0SlFsQXcyWkszbUhBaHBRVHpLV0REVmsKanNUTktHeEFYVTJJbElwM0YwcENqZnNTUnpLV2pQZUhsamFqREYvaVNNYVNNUXNWTnFQY1FCdVpKd1JLWlJneVY1SU9oUjFvR1V2RwpNV1NPSkIwS3c0QjYwQktQRjhlUWlZZWE1VXRjYUluU1dZWk1PdFFzWCtKQ1MxaXljVDYwOGIwelFqckFMMXZFa3ZFTTJUYVFoQ1hqCkdiSnRvQWtCYUhiNjFDMEpTOFpQSlpvbFljbDBNN0FsWU1uNGhreTNCQ3daMzVEcGxvQWxpMkRJZEVQSHQyUVJESmx1NlBpV2JGdzMKQXg4NnZpWHJPME1tWWNuNnpwQkpXTEsrTTJTV0pkc1Zrem5kZDRiTWNpZnB4Mkl4NzljTkVFblovZC9mSFJsNXFBL2J0cU9EWjZOUwpuK3ZEcHUxcDlPeVhJekUvc3lkKzJmcjA2dkVvRDNaL1BzNHRaZmZ6cWZ1ZDJhWitic2N4V3pwNW1NVThITC9FN2FCaERuV0VtZGZ0CnFXRzhoUTlFMjNaMEVzMW1BOFJzWlRPc3YzNWFkMFZscVk4anc0LytteDhpcU5PMEl4M3JZKy9wcjh4WmFrNTRhT0NZZ2RPckJxYXoKYXRkd2VESWJyQ1RtS1hzODdMRWU2K3VCVmJBeVowT2dCL0NCZG5RdzJLTU1raXZwMG5oUUF4K0xmMjlWZXJkZGs1T1Q3QnNFdnVBaQo5bSthb041ci9XUXFkeWxmc1A0cFh5emxwcm4xdEg4OFU1NnRkR3UyYkJaSzFjdE04SDMrR1p4NmExVUJOZWRWK29yWldkbkMvQlJjCngycHhoaWhtcHZnK2h6dDczTStpa0xZRWhWNXdrV2Q5L2krL0FNWFk5N2U5V3B5L2pGTm5maEFsaTRITVp1UGlwYUJxMDlqTGVReTUKZ1gxbEdhWWU3dzAxbmNYQWV0aXRlOG9NL3YrclMrRlJMc0xFYnJUUlJ1NXp3T1pMNUkvQVdsaVJYUDU1NkJVZmhEemFTM2lVUFYxRApnMzF5Tnp2UUlMUkpNbHM1S0lqNnNnbVYwYVhhRWwxNVd6M2RGaDFvRUhxT1pnNmtmcC8rcGI4K3dKcjQrU2U0Z1FhaEY0enJ3RlY1CnZ3SSs1RGR0VHg5QmFid3JnZjlRQ3JwZy9BSzZ6cWRGWWo4TUVQWmdkeVp3WktRQkZUNVh4U3A1dGFmbmlzVU14anJ6STRZWnc2R24KME1mU2xHV3VWRllBaEk0MU9OQjdhS1RrQWw3M2FzZk5meG1YMmNwbUFNTnJqek9IVjBqQkpieU9IYUZlalo3RG1rSjZydXpyVFdocwoyUlJRN3RVOG81SnR3NjdKcUgxVmh6NEdqUDA0SzQxQjBOVElxRU9sMXExalA5Q09nTWM2NDAzOWc5UDdNaFZyYWJGNTUxOEozUkZvCjRNMkZvK0NpUUdub1p2dVdhZHkyUHFZSDdPZGQ2QmZJSzlWQTMzQnYvR3U1VzVaSWl0SGRyS2t4Y2VpYnJFRFhrSXZvVUx1akRuUngKc3pqMExVNmdiODFEbDVHaGR2MEp1dVJWSExyZUNNc2tOcHk4dlFaZHRrNWkvTGdCamI3VmtJZHU5S3RZNnE3bHNLZWdWcVV3TXZaRApEVy9TRUlldTVlemIzc0d1clU0V29BdnpGRWJqb2Y2SlB1aDVBMDVqOWFsSnpPMlI3YnV4MndGZXVpOFBiZmRadjhHdXJSc0c1dXZyCnBCYzlqNDZ3bEVCWE5xeTdMbUdYV3BuK2hoRDBhNHc4aGtNWDBlazlDeHA4VWl0M0RRUHJzOGptYldjeWZJY2RERDEvandIOUNYYnAKQ2pyay9pM0pZV1V5ZkRFUkRyMkpRLzhPdk5TQy9qMXlYZTBQTlBUcmpNMW1NSFQxVXh3YXpHT1YreUQwSDJrT0szMlBLNEEyd0dIVApCa2hTYWZoMHhNWFFhY3l3SnhLQVdYNCtORGlCc29HUHNERG8rcDhRa0FuR3Zpc0dOSlpvYldpd3g4S2dNV2JqZ2dyb0JXTVpoa1puCkVoRm9rTms0eWxoUXhJQTJzTWxOV2VqUC9neUNqQ3FDeHV5SlpQT3Uvd1ZlMnpIS09QSUFocmF1eGV3Skk1RVZER00xK0g5cm4vMFYKV3RmaEtLc0lHck1uRzR3M0d5Vmo3VUhBUXpPYnorRXJlQlJDWS9hRVlVNHNlMkxGY25xdWFKYmIvN0g4b0xqRlhxdWxDaHF6Snd3YgphdW1xTi8rMU1MM1owSUovazZibkJoVkFOeWJ4SVh1eXdaenpYbHdpbjl5RlMrWXRiZENRUGJHaE9XKy9MSm56d2R6VFczbTc3ZC9YCkJnM1pFOFlrUXB0bThwZXFuZVJUMC9hS1NqZk4xVzVRSUNxZ1AyOWNqZGdUR3hyUFpKMHFtNlpaeU9kTmM2YmMrUjgxTXJHcGdIWmUKUENQMnhJYVdlNUhsaW55a0ZVSWo5bVFEdlpDam14cWhFWHZTZ0VaSDFLRG8xcTBFdXRDNEdyRW5EV2p3dFE0cXVuVXJnWGJmTVFEUAphZ1BhK0pza2MyMk9CbEVJRFhUQURyUm9LZ01DclFUNmpuTTVZRThjYU9QdmNzeElvSlZBdXhZWnNDY3V0T0JUalFSYUpUUmdUMXhvCnVRUU9wRzdGMEhUOFBHandkUzJ0MnhDSUNtalArOUt1b3dtOXhscUFGcWhiMkZ5Q0N1aDU5M3JhbmpTaFJaWkpWaDZDVTBZcW9XbDcKMG9LVzZLeHJINElnS3FCejNnL0kvcmNOV3NDQ2I2QWdLcUNiUzExSWU5SlJ6YmpVTUxOYWFITHBRR2M5NDFIanpHcWgvOEdzNkQragpJOVBUSllxaFd3YUJTc25kMFltOFJlbmhKb05aQ1hTcjQ2RHNTVStUWEgwUWlYbUY4WHBET1RSbHRIeWV3emwrc0djNVRWczk5TC80CjBNWXljMDY0Y3BQMVNrY1ZkT3NYbEQzeHo3Z3M3QUw3cFk1cWFNcWVCSFV6eTNtc2tjL2VZMGM1QVdnaVppRjk2MmFlR29PVWk2eVUKblJ3MFlVL0NEY1Z5cnZUQUxQdjhyRHlUTC9KZXprYUhIaGg5QWIxVDlBWDBUaEVIdXN5Ui95Mm10MHI1d2t6WlRzbmw4b3haS0FWYgppNm5wcldMZTlMbXo5YlBpcFdxTTVLMW16VW1sZDB1NEJWRXRtajJqcnFDNStlb1ZreHFoelJUSmZUbEpRM2VOQWFhMi9DRjhOeFJOClhTbGpoU3plNUkydVZFTjNOTnRxTVNoczlkNVdXbVVOT0ZhaWhGc1I5R0xiejZvaG8rcTczV1h3QjlUTXNiUkM2TmFPc09WUWlxNkYKUU9qcFZKMWlOM0pGME0zOFJCeEYxR20rbzg0V1hadkhJUlJDdTMvN1pXSytxSlpydi8rL295SGJvcmROcTRkMkZsVVpWYXF4dHI5awp2TXlkTWVuUVI1d21yZ2JhZVMxUEw0dGJiMk8rSG9mWmF1SzZsejQ3TTkvQWlSYXQweXBXWXpLenFOVkFnOHl0MThtWEJaYWQ0TlJLCm9HMFBpaXo1Ykw2V21Md2VuNWxCclFUYVlwbEdydk5NNkNUeldNRWdJVWMyS1lPZVJnNmZxN1JNYUl5K3FsUHZZU0NLbGo1ank0WGMKcFVBaXF4QWFvZzlFVUFhZFJ6ZmdPYzFSY3UwY3R1aEVCZlFjMXJnOUV5cld1RzFCRFZ6SnV5elFXemttZEZWMHZUZlV3QlZBZnc1dQp0SFJNS0hjUEJ5WG8wRDE1NkRzb1J0MitLWG9xMXl6WUlKQlFLNENHYy9GZFRxRHo2UDVFSU5TcXBvc1EyVE1JYU9xdTVkQW1VYWNUCnVFYm9oZ2xGNDFlYmZoZHRRZlF5STUzUVZjYWk1enJlbmE5dloyaTdIY0k3TFcvQnA4QUFxVXdqdEIwUmVDUHhDcU52STl1M1J1Z1YKVGllOWdoOGtRT2R2amRDMzhUTjhHanZNWUdneWYrdUR0bDlqNFp1bmJ6TE9uQ1QzTkdpRXJuTDJiakJPVDNET2R0dWUwTFlKeFk5Ngo1a0NUT3puMFFkc21GRDhqbW5IS0ViM0ZWQiswYlVMeFRUb3NhQ3A5NjRObUhRMWdQNlk0OUYwQ1JCOTBUaDAwdFExUEUvVHN6SU9GCkhRTnRMM0RjeWkyNDdtSEFvV2ZOZk1tQzdicWhLdWh0a3NnS3ZqZGtRTi9vUTJqN0tUYUxwYTNxZEljdlZ0UlBVNmU3SkovSUxQcTgKVFcvZkVUZFpuUE9zdHE4ajQ1d0RYR0Y2YjJvamkxNUhwbWlVUlUyZDZJTmVOeml2c1FabFBGM2xwTy83REdqS2hlcWNPV0VkVWNXWgpJeVBQOGRFN1I3Ynpaa1B0UncrZTkxN25YTHFOb1J0dmF0SDJYVitBMzNEb09hVUtsZTBoMWtDVVdnNTlFb0RYbGpxaDdjRVFuSjVLCnFDSFRja3JWOWYrZzBJMnp1RkZIdlhnZHUwN1BLVlVsZENHQ1l4ZUZUeVBUZEVwVkNWeFBWWEdIZ0ZJZkNIUC9rSHBPcVNxQjM4dW8KZUoyTDFMbEZEWkZuaHFxQy9oVHRYSnhFdXlhNHZBZzZzbDhKdElGNkovZWxxdURKaXRoaEowcWcwYzl3ZVBNNllnMGNYQkdyQkJvOAp2TDQ1Q0p5VU9aZ0xYdnVzQmhvOWtNZDd2eWl6YWhBOW1Vc1JOTnkrUFo4c1FWMkRqMGhRQXcxMzFldmV2ZU5UdzZlUktZTkd1K3BXCkZ4T1grdUYvY1JCRjBPZ1hoZG9tTHVOUlgrT2M4WklWL3c2SHN4a09iZDl0bmN4YWpQWEFuN0MyVzJiRW9aMk5hR2dxVzIrZnVmeGYKMUgwTjJNbVpUUjJGUCtXSlFqc2JhbEVyMmpua1g0VzlYRWVZdVNmYm5NSS9kc2lDaGwxV1Y1RDRKM094RCtZeWpKZkZ2NHptUXFQdAp1MmVTbW9jZDVjaW03RS94RDVqeW9OR1BvL204anBpRGQ4dWJqNkljZ21GL1YxNzRFNDhlTkdoRmZWZTZMYytSaDE5WXhQZWlIUU5oCkplOFUvajA0SGpUYVZRZk4yRzQrS3BvQnAyQ1VaL0tQTnFNZmRETEIrUHkwSGkzMEtNNnhMcmFzUnpxVk9nYTM3OEZRcHZIOWFielQKR2doTk5LRHhiNWdPZ3R4dnlqTStlRGdBdXVBdzc2aFFlNEZPcFM3b3JrcHltdkNZVTJNN0pvRm5tb0ZPcFU3cnJreEN5cDVPdFdtSAo1TEkzMnBsVHg1N1VYWjhrZFBGUUIzVHEzQTU0ckROZHpEdWgzOHFlUy9Yb2pPNUtxV1kra2ZKUmVxQmJlQ2FkOHRYWUFHZXppK2RTCkFSb2JXR3QyYWlnVnJOTUQyY1F6cDFPaEdvTm5qL3BIYnh4S1VYcmxUZDJWbE5XYmFSTFppZmJBTlBKWG44S1FiUTJkZVN1VHplcXUKY1R4bHM1bUp0NGRnWkVmbnpyeHo2bWNXZWovcTRzVzMzbms3c0pOSy9SOXZRRFNYcURYRjdRQUFBQ1YwUlZoMFpHRjBaVHBqY21WaApkR1VBTWpBeU1pMHdOaTB5T0ZRd05Eb3lNRG96T0Nzd01qb3dNSmVEK2JFQUFBQWxkRVZZZEdSaGRHVTZiVzlrYVdaNUFESXdNakl0Ck1EWXRNamhVTURRNk1qQTZNemdyTURJNk1ERG0za0VOQUFBQUFFbEZUa1N1UW1DQyIgLz4KPC9zdmc+Cg==",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n;return(n=window.neko)!=null&&n.isNeko?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isConnected)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.neko;if(!e.isConnected)try{await e.connect()}catch(r){throw new lr(r==null?void 0:r.message,r)}if(!e.publicKey)throw new qt;let n;try{n=new X(e.publicKey.toBytes())}catch(r){throw new Sn(r==null?void 0:r.message,r)}e.on("disconnect",this._disconnected),this._wallet=e,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const A4="Nightly";class D4 extends Xn{constructor(){super(),this.name=A4,this.url="https://nightly.app",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTQ4IDk2Qzc0LjUwOTcgOTYgOTYgNzQuNTA5NyA5NiA0OEM5NiAyMS40OTAzIDc0LjUwOTcgMCA0OCAwQzIxLjQ5MDMgMCAwIDIxLjQ5MDMgMCA0OEMwIDc0LjUwOTcgMjEuNDkwMyA5NiA0OCA5NloiIGZpbGw9IiM2RDczRjgiLz4KPHBhdGggZD0iTTQ4IDg1LjYzNTZDNDggODUuNjM1NiA1Mi40NTMzIDg1LjYzNTYgNTUuNDQgODIuNTg2N0M1OC45MTU1IDc5LjI4MDEgNTcuMzUxMSA3NS40MzEyIDYyLjI3NTUgNzEuNDMxMkM2Ni45ODY2IDY3LjY0NDUgNzIuOTI0NCA3MC4zMzc5IDcyLjkyNDQgNzAuMzM3OUM3Ny4wMjIyIDYyLjEyNDUgNzQuNzkxMSA1Mi41NjkgNzQuNzkxMSA1Mi41NjlDODEuNzY4OCAzNC4yNTc5IDc1Ljk2NDQgMjEuMTU1NyA3NC40NDQ0IDE3LjM2MDFDNjkuNDQ4OCAyNC4zMzc5IDYzLjE5MTEgMjkuMTczNCA1NS43OTU1IDMyLjQwOUM1My4yMjY2IDMxLjcwNjggNTAuNTk1NSAzMS4zMzM0IDQ4IDMxLjM2MDFDNDUuNDEzMyAzMS4zMzM0IDQyLjc3MzMgMzEuNzA2OCA0MC4yMDQ0IDMyLjQwOUMzMi44MTc3IDI5LjE2NDUgMjYuNTUxMSAyNC4zMzc5IDIxLjU1NTUgMTcuMzYwMUMyMC4wMzU1IDIxLjE1NTcgMTQuMjMxMSAzNC4yNTc5IDIxLjIwODkgNTIuNTY5QzIxLjIwODkgNTIuNTY5IDE4Ljk3NzggNjIuMTI0NSAyMy4wNzU1IDcwLjMzNzlDMjMuMDc1NSA3MC4zMzc5IDI5LjAxMzMgNjcuNjQ0NSAzMy43MjQ0IDcxLjQzMTJDMzguNjU3NyA3NS40MzEyIDM3LjA4NDQgNzkuMjgwMSA0MC41NiA4Mi41ODY3QzQzLjU0NjYgODUuNjM1NiA0OCA4NS42MzU2IDQ4IDg1LjYzNTZaIiBmaWxsPSJ3aGl0ZSIvPgo8cGF0aCBkPSJNNDIuNDc5OSA2NS4yOThDNDIuMjkzMyA1OS4yMTggMzYuMzAyMSA1Ny4yNjI0IDMyLjIxMzMgNTkuODIyNEMzMi4yMTMzIDU5LjgyMjQgMzIuODUzMyA2Mi40MzU4IDM1LjgzOTkgNjMuNzUxM0MzOC4yNzU1IDY0LjgyNjkgMzkuMzI0NCA2My4zODY5IDQyLjQ3OTkgNjUuMjk4WiIgZmlsbD0iIzdCODFGOSIvPgo8cGF0aCBkPSJNMjIuNDk3NyAyMy4wOTM1QzIwLjA4ODggMzEuNTQ2OCAyMS4xMjg4IDQyLjI0MDIgMjQuOTMzMyA1MC4wMjY5QzI4LjgyNjYgNDcuMjcxMyAzMi45MTU1IDQzLjAxMzUgMzUuMDkzMyAzOC41MDY5QzI5Ljk2NDQgMzQuNzExMyAyNS42NjIyIDMxLjEwMjQgMjIuNDk3NyAyMy4wOTM1WiIgZmlsbD0iIzdCODFGOSIvPgo8cGF0aCBkPSJNNTMuNTE5OSA2NS4yOThDNTMuNzA2NiA1OS4yMTggNTkuNjk3NyA1Ny4yNjI0IDYzLjc4NjYgNTkuODIyNEM2My43ODY2IDU5LjgyMjQgNjMuMTQ2NiA2Mi40MzU4IDYwLjE1OTkgNjMuNzUxM0M1Ny43MjQzIDY0LjgyNjkgNTYuNjc1NSA2My4zODY5IDUzLjUxOTkgNjUuMjk4WiIgZmlsbD0iIzdCODFGOSIvPgo8cGF0aCBkPSJNNzMuNTAyMiAyMy4wOTM1Qzc1LjkxMTEgMzEuNTQ2OCA3NC44NzExIDQyLjI0MDIgNzEuMDY2NiA1MC4wMjY5QzY3LjE3MzMgNDcuMjcxMyA2My4wODQ0IDQzLjAxMzUgNjAuOTA2NiAzOC41MDY5QzY2LjAzNTUgMzQuNzExMyA3MC4zMzc3IDMxLjEwMjQgNzMuNTAyMiAyMy4wOTM1WiIgZmlsbD0iIzdCODFGOSIvPgo8cGF0aCBkPSJNNDcuOTk5OSA4NS4zMDY5QzUwLjE0MDQgODUuMzA2OSA1MS44NzU1IDgzLjc3ODcgNTEuODc1NSA4MS44OTM2QzUxLjg3NTUgODAuMDA4NCA1MC4xNDA0IDc4LjQ4MDIgNDcuOTk5OSA3OC40ODAyQzQ1Ljg1OTUgNzguNDgwMiA0NC4xMjQ0IDgwLjAwODQgNDQuMTI0NCA4MS44OTM2QzQ0LjEyNDQgODMuNzc4NyA0NS44NTk1IDg1LjMwNjkgNDcuOTk5OSA4NS4zMDY5WiIgZmlsbD0iIzdCODFGOSIvPgo8L3N2Zz4K",this.supportedTransactionVersions=new Set(["legacy",0]),this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._connecting=!1,this._publicKey=null,this._wallet=null,this._readyState!==$.Unsupported&&cr(()=>{var e;return(e=window==null?void 0:window.nightly)!=null&&e.solana?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get connecting(){return this._connecting}get readyState(){return this._readyState}get publicKey(){return this._publicKey}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.nightly.solana;try{await e.connect()}catch(r){throw new lr(r==null?void 0:r.message,r)}if(e.publicKey.toString()==="11111111111111111111111111111111")throw new qt;let n;try{n=new X(e.publicKey.toBytes())}catch(r){throw new Sn(r==null?void 0:r.message,r)}this._wallet=e,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch{this.emit("error",new Vr)}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{return n.signMessage(new TextDecoder().decode(e))}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const L4="Salmon";class z4 extends Xn{constructor({network:e=Vf.Mainnet}={}){super(),this.name=L4,this.url="https://salmonwallet.io",this.icon="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iODgiIGhlaWdodD0iODgiIHZpZXdCb3g9IjAgMCA4OCA4OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijg4IiBoZWlnaHQ9Ijg4IiByeD0iMzAiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl84NTVfNTgwKSIvPgo8cGF0aCBkPSJNNTkuODA1NSAyNy42M0M1Ni43OTU1IDI1LjgyMzkgNTMuNjIyMiAyNC41Mzg4IDUwLjM1OTcgMjMuODE0NEw0Ni45MDQyIDE2LjEyODdDNDYuNDkzMyAxNC44NTg1IDQ1LjMwMDIgMTQuMDAwMSA0My45NTM3IDE0LjAwMDFINDMuODE1QzQyLjQ2ODUgMTQuMDAwMSA0MS4yNzU0IDE0Ljg2MzUgNDAuODY0NSAxNi4xMjg3TDM3LjQwOSAyMy44MDk1QzM0LjE0MTYgMjQuNTM4OCAzMC45NTgzIDI1LjgyODkgMjcuOTQzNCAyNy42MzQ5QzIxLjk1MzIgMzkuMjYwMyAyMC4zMjk0IDUwLjU5MjggMjEuMTQxMyA2MS43NjY2QzI0LjY1MTMgNjUuMTY1NCAzMi40MzM2IDY5LjM2OCAzNi42MDcgNzEuMDMwMkMzOS4wNTI2IDcyLjAwMjcgMzkuODAwMSA3Mi40OTM5IDQyLjI1MDYgNzIuOTAwN0M0NC40Mjg5IDczLjUxNiA0NS4wODczIDczLjI3NzggNDYuNzU1NyA3My4xMDQyQzQ5LjMyNTEgNzIuNDE5NSA1MC4zOTQ0IDcxLjcyNDggNTEuNDM0IDcxLjE2NDFDNTUuODQ5OSA2OC44NzY4IDYzLjExNzQgNjUuMTcwNCA2Ni42Mjc0IDYxLjc3MTZDNjcuNTc3OSA0OC44MTE2IDY0Ljk5ODYgMzcuNTgzMiA1OS44MDU1IDI3LjYyNVYyNy42M1pNMzcuNTI3OCA1MS4xNDg1QzM1LjY0MTYgNTEuMTQ4NSAzNC4wODIyIDQ4LjkwMDkgMzQuMDgyMiA0Ni4xMzIyQzM0LjA4MjIgNDMuMzYzNiAzNS41ODcxIDQxLjA5NjEgMzcuNTE3OSA0MS4wOTYxQzM5LjQ0ODYgNDEuMDk2MSA0MC45OTgxIDQzLjM2MzYgNDAuOTYzNSA0Ni4xMzIyQzQwLjkyODggNDguOTAwOSAzOS40NDM3IDUxLjE0ODUgMzcuNTIyOCA1MS4xNDg1SDM3LjUyNzhaTTUwLjIzMSA1MS4xNDg1QzQ4LjMzOTkgNTEuMTQ4NSA0Ni43OTAzIDQ4LjkwMDkgNDYuNzkwMyA0Ni4xMzIyQzQ2Ljc5MDMgNDMuMzYzNiA0OC4yOTUzIDQxLjA5NjEgNTAuMjMxIDQxLjA5NjFDNTIuMTY2NyA0MS4wOTYxIDUzLjcwMTQgNDMuMzYzNiA1My42NjY3IDQ2LjEzMjJDNTMuNjMyMSA0OC45MDA5IDUyLjE1MTggNTEuMTQ4NSA1MC4yMzEgNTEuMTQ4NVoiIGZpbGw9IiNGQ0ZDRkMiLz4KPHBhdGggZD0iTTc1LjQwNTEgNTYuMTIwM0w3MC45NzkzIDQyLjE3MjlDNzAuNDM0NyA0MC40NjYxIDY4Ljg1NTUgMzkuMzA1MSA2Ny4wNjMzIDM5LjMwNTFDNjYuNTI4NyAzOS4zMDUxIDY2LjAwODkgMzkuNDA5MiA2NS41Mjg3IDM5LjYwMjhDNjcuNTQ4NSA0Ni4zMjU5IDY4LjM2MDQgNTMuNTc5OSA2Ny43MjY3IDYxLjQ4NEg3MS40ODQyQzc0LjI2NjUgNjEuNDg0IDc2LjI0MTcgNTguNzc0OSA3NS40MDAxIDU2LjEyMDNINzUuNDA1MVoiIGZpbGw9IiNGQ0ZDRkMiLz4KPHBhdGggZD0iTTEyLjE5MDggNTYuMzgzNUwxNi42MTY2IDQyLjQzNjFDMTcuMTYxMiA0MC43MjkyIDE4Ljc0MDUgMzkuNTY4MiAyMC41MzI2IDM5LjU2ODJDMjEuMDY3MiAzOS41NjgyIDIxLjU4NyAzOS42NzI0IDIyLjA2NzMgMzkuODY1OUMyMC4wNDc0IDQ2LjU4OSAxOS4yMzU1IDUzLjg0MzEgMTkuODY5MiA2MS43NDcxSDE2LjExMTdDMTMuMzI5NSA2MS43NDcxIDExLjM1NDIgNTkuMDM4IDEyLjE5NTggNTYuMzgzNUgxMi4xOTA4WiIgZmlsbD0iI0ZDRkNGQyIvPgo8ZGVmcz4KPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDBfbGluZWFyXzg1NV81ODAiIHgxPSI0NCIgeTE9IjAiIHgyPSI0NCIgeTI9Ijg4IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CjxzdG9wIHN0b3AtY29sb3I9IiNGRjgxNzAiLz4KPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjRkY1QzQ1Ii8+CjwvbGluZWFyR3JhZGllbnQ+CjwvZGVmcz4KPC9zdmc+",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.Loadable,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._network=e,this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>window.salmon?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1)}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.connected)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Loadable&&this._readyState!==$.Installed)throw new en;this._connecting=!0;let e;try{e=(await Ba(()=>import("./index-b321b587.js"),[])).default}catch(i){throw new B0(i==null?void 0:i.message,i)}let n;try{n=new e({network:this._network})}catch(i){throw new Ei(i==null?void 0:i.message,i)}if(!n.connected)try{await n.connect()}catch(i){throw new lr(i==null?void 0:i.message,i)}if(!n.publicKey)throw new qt;let r;try{r=new X(n.publicKey.toBytes())}catch(i){throw new Sn(i==null?void 0:i.message,i)}n.on("disconnect",this._disconnected),this._wallet=n,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signMessage(e,"utf8")}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const j4="data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjMxIiB2aWV3Qm94PSIwIDAgMzEgMzEiIHdpZHRoPSIzMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGxpbmVhckdyYWRpZW50IGlkPSJhIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjIwLjI1IiB4Mj0iMjYuNTcxIiB5MT0iMjcuMTczIiB5Mj0iMTkuODU4Ij48c3RvcCBvZmZzZXQ9Ii4wOCIgc3RvcC1jb2xvcj0iIzk5NDVmZiIvPjxzdG9wIG9mZnNldD0iLjMiIHN0b3AtY29sb3I9IiM4NzUyZjMiLz48c3RvcCBvZmZzZXQ9Ii41IiBzdG9wLWNvbG9yPSIjNTQ5N2Q1Ii8+PHN0b3Agb2Zmc2V0PSIuNiIgc3RvcC1jb2xvcj0iIzQzYjRjYSIvPjxzdG9wIG9mZnNldD0iLjcyIiBzdG9wLWNvbG9yPSIjMjhlMGI5Ii8+PHN0b3Agb2Zmc2V0PSIuOTciIHN0b3AtY29sb3I9IiMxOWZiOWIiLz48L2xpbmVhckdyYWRpZW50PjxnIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iLjA5NCI+PHBhdGggZD0ibTI2LjEwOSAzLjY0My05LjM2OSA2Ljk1OSAxLjczMy00LjEwNSA3LjYzNy0yLjg1M3oiIGZpbGw9IiNlMjc2MWIiIHN0cm9rZT0iI2UyNzYxYiIvPjxnIGZpbGw9IiNlNDc2MWIiIHN0cm9rZT0iI2U0NzYxYiI+PHBhdGggZD0ibTQuNDgxIDMuNjQzIDkuMjk0IDcuMDI0LTEuNjQ4LTQuMTcxem0xOC4yNTggMTYuMTMtMi40OTUgMy44MjMgNS4zMzkgMS40NjkgMS41MzUtNS4yMDctNC4zNzgtLjA4NXptLTE5LjI0Ny4wODUgMS41MjUgNS4yMDcgNS4zMzktMS40NjktMi40OTUtMy44MjN6Ii8+PHBhdGggZD0ibTEwLjA1NSAxMy4zMTMtMS40ODggMi4yNTEgNS4zMDEuMjM1LS4xODgtNS42OTd6bTEwLjQ4IDAtMy42NzItMy4yNzctLjEyMiA1Ljc2MyA1LjI5Mi0uMjM1LTEuNDk3LTIuMjUxem0tMTAuMTc4IDEwLjI4MyAzLjE4My0xLjU1NC0yLjc0OS0yLjE0Ny0uNDMzIDMuNzAxem02LjY5NS0xLjU1NCAzLjE5MiAxLjU1NC0uNDQzLTMuNzAxeiIvPjwvZz48cGF0aCBkPSJtMjAuMjQ0IDIzLjU5Ni0zLjE5Mi0xLjU1NC4yNTQgMi4wODEtLjAyOC44NzZ6bS05Ljg4NyAwIDIuOTY2IDEuNDAzLS4wMTktLjg3Ni4yMzUtMi4wODEtMy4xODMgMS41NTR6IiBmaWxsPSIjZDdjMWIzIiBzdHJva2U9IiNkN2MxYjMiLz48cGF0aCBkPSJtMTMuMzY5IDE4LjUyMS0yLjY1NS0uNzgxIDEuODc0LS44NTd6bTMuODUxIDAgLjc4MS0xLjYzOCAxLjg4My44NTctMi42NjUuNzgxeiIgZmlsbD0iIzIzMzQ0NyIgc3Ryb2tlPSIjMjMzNDQ3Ii8+PHBhdGggZD0ibTEwLjM1NyAyMy41OTYuNDUyLTMuODIzLTIuOTQ3LjA4NXptOS40MzUtMy44MjMuNDUyIDMuODIzIDIuNDk1LTMuNzM4em0yLjI0MS00LjIwOS01LjI5Mi4yMzUuNDkgMi43MjEuNzgyLTEuNjM4IDEuODgzLjg1N3ptLTExLjMxOCAyLjE3NSAxLjg4My0uODU3Ljc3MiAxLjYzOC40OTktMi43MjEtNS4zMDEtLjIzNXoiIGZpbGw9IiNjZDYxMTYiIHN0cm9rZT0iI2NkNjExNiIvPjxwYXRoIGQ9Im04LjU2NyAxNS41NjQgMi4yMjIgNC4zMzEtLjA3NS0yLjE1NnptMTEuMzI4IDIuMTc1LS4wOTQgMi4xNTYgMi4yMzItNC4zMzEtMi4xMzcgMi4xNzV6bS02LjAyNi0xLjk0LS40OTkgMi43MjEuNjIxIDMuMjExLjE0MS00LjIyOC0uMjY0LTEuNzA0em0yLjg3MiAwLS4yNTQgMS42OTUuMTEzIDQuMjM3LjYzMS0zLjIxMXoiIGZpbGw9IiNlNDc1MWYiIHN0cm9rZT0iI2U0NzUxZiIvPjxwYXRoIGQ9Im0xNy4yMyAxOC41Mi0uNjMxIDMuMjExLjQ1Mi4zMTEgMi43NS0yLjE0Ny4wOTQtMi4xNTZ6bS02LjUxNi0uNzgxLjA3NSAyLjE1NiAyLjc1IDIuMTQ3LjQ1Mi0uMzExLS42MjItMy4yMTF6IiBmaWxsPSIjZjY4NTFiIiBzdHJva2U9IiNmNjg1MWIiLz48cGF0aCBkPSJtMTcuMjc3IDI0Ljk5OS4wMjgtLjg3Ni0uMjM1LS4yMDdoLTMuNTVsLS4yMTcuMjA3LjAxOS44NzYtMi45NjYtMS40MDMgMS4wMzYuODQ4IDIuMSAxLjQ1OWgzLjYwNmwyLjEwOS0xLjQ1OSAxLjAzNi0uODQ4eiIgZmlsbD0iI2MwYWQ5ZSIgc3Ryb2tlPSIjYzBhZDllIi8+PHBhdGggZD0ibTE3LjA1MSAyMi4wNDItLjQ1Mi0uMzExaC0yLjYwOGwtLjQ1Mi4zMTEtLjIzNSAyLjA4MS4yMTctLjIwN2gzLjU1bC4yMzUuMjA3LS4yNTQtMi4wODF6IiBmaWxsPSIjMTYxNjE2IiBzdHJva2U9IiMxNjE2MTYiLz48cGF0aCBkPSJtMjYuNTA1IDExLjA1My44LTMuODQyLTEuMTk2LTMuNTY5LTkuMDU4IDYuNzIzIDMuNDg0IDIuOTQ3IDQuOTI1IDEuNDQxIDEuMDkyLTEuMjcxLS40NzEtLjMzOS43NTMtLjY4Ny0uNTg0LS40NTIuNzUzLS41NzQtLjQ5OS0uMzc3em0tMjMuMjExLTMuODQxLjggMy44NDItLjUwOC4zNzcuNzUzLjU3NC0uNTc0LjQ1Mi43NTMuNjg3LS40NzEuMzM5IDEuMDgzIDEuMjcxIDQuOTI1LTEuNDQxIDMuNDg0LTIuOTQ3LTkuMDU5LTYuNzIzeiIgZmlsbD0iIzc2M2QxNiIgc3Ryb2tlPSIjNzYzZDE2Ii8+PHBhdGggZD0ibTI1LjQ2IDE0Ljc1NC00LjkyNS0xLjQ0MSAxLjQ5NyAyLjI1MS0yLjIzMiA0LjMzMSAyLjkzOC0uMDM4aDQuMzc4bC0xLjY1Ny01LjEwNHptLTE1LjQwNS0xLjQ0MS00LjkyNSAxLjQ0MS0xLjYzOCA1LjEwNGg0LjM2OWwyLjkyOC4wMzgtMi4yMjItNC4zMzEgMS40ODgtMi4yNTF6bTYuNjg1IDIuNDg2LjMxMS01LjQzMyAxLjQzMS0zLjg3aC02LjM1NmwxLjQxMyAzLjg3LjMyOSA1LjQzMy4xMTMgMS43MTQuMDA5IDQuMjE5aDIuNjFsLjAxOS00LjIxOS4xMjItMS43MTR6IiBmaWxsPSIjZjY4NTFiIiBzdHJva2U9IiNmNjg1MWIiLz48L2c+PGNpcmNsZSBjeD0iMjMuNSIgY3k9IjIzLjUiIGZpbGw9IiMwMDAiIHI9IjYuNSIvPjxwYXRoIGQ9Im0yNy40NzMgMjUuNTQ1LTEuMzEgMS4zNjhjLS4wMjkuMDMtLjA2My4wNTMtLjEwMS4wN2EuMzEuMzEgMCAwIDEgLS4xMjEuMDI0aC02LjIwOWMtLjAzIDAtLjA1OS0uMDA4LS4wODMtLjAyNGEuMTUuMTUgMCAwIDEgLS4wNTYtLjA2NWMtLjAxMi0uMDI2LS4wMTUtLjA1Ni0uMDEtLjA4NHMuMDE4LS4wNTUuMDM5LS4wNzZsMS4zMTEtMS4zNjhjLjAyOC0uMDMuMDYzLS4wNTMuMTAxLS4wNjlhLjMxLjMxIDAgMCAxIC4xMjEtLjAyNWg2LjIwOGMuMDMgMCAuMDU5LjAwOC4wODMuMDI0YS4xNS4xNSAwIDAgMSAuMDU2LjA2NWMuMDEyLjAyNi4wMTUuMDU2LjAxLjA4NHMtLjAxOC4wNTUtLjAzOS4wNzZ6bS0xLjMxLTIuNzU2Yy0uMDI5LS4wMy0uMDYzLS4wNTMtLjEwMS0uMDdhLjMxLjMxIDAgMCAwIC0uMTIxLS4wMjRoLTYuMjA5Yy0uMDMgMC0uMDU5LjAwOC0uMDgzLjAyNHMtLjA0NC4wMzgtLjA1Ni4wNjUtLjAxNS4wNTYtLjAxLjA4NC4wMTguMDU1LjAzOS4wNzZsMS4zMTEgMS4zNjhjLjAyOC4wMy4wNjMuMDUzLjEwMS4wNjlhLjMxLjMxIDAgMCAwIC4xMjEuMDI1aDYuMjA4Yy4wMyAwIC4wNTktLjAwOC4wODMtLjAyNGEuMTUuMTUgMCAwIDAgLjA1Ni0uMDY1Yy4wMTItLjAyNi4wMTUtLjA1Ni4wMS0uMDg0cy0uMDE4LS4wNTUtLjAzOS0uMDc2em0tNi40MzEtLjk4M2g2LjIwOWEuMzEuMzEgMCAwIDAgLjEyMS0uMDI0Yy4wMzgtLjAxNi4wNzMtLjA0LjEwMS0uMDdsMS4zMS0xLjM2OGMuMDItLjAyMS4wMzQtLjA0Ny4wMzktLjA3NnMuMDAxLS4wNTgtLjAxLS4wODRhLjE1LjE1IDAgMCAwIC0uMDU2LS4wNjVjLS4wMjUtLjAxNi0uMDU0LS4wMjQtLjA4My0uMDI0aC02LjIwOGEuMzEuMzEgMCAwIDAgLS4xMjEuMDI1Yy0uMDM4LjAxNi0uMDcyLjA0LS4xMDEuMDY5bC0xLjMxIDEuMzY4Yy0uMDIuMDIxLS4wMzQuMDQ3LS4wMzkuMDc2cy0uMDAxLjA1OC4wMS4wODQuMDMxLjA0OS4wNTYuMDY1LjA1NC4wMjQuMDgzLjAyNHoiIGZpbGw9InVybCgjYSkiLz48L3N2Zz4=";var Qe=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},U4=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(t,n):i?i.value=n:e.set(t,n),n},jl,ao,Kf,Jf,Xf,Mn,qf,zM,jM,$f,eh,th,nh,rh;class _4{constructor(){jl.add(this),ao.set(this,{}),Kf.set(this,"1.0.0"),Jf.set(this,"MetaMask"),Xf.set(this,j4),Mn.set(this,null),qf.set(this,(e,n)=>{var r;return(r=Qe(this,ao,"f")[e])!=null&&r.push(n)||(Qe(this,ao,"f")[e]=[n]),()=>Qe(this,jl,"m",jM).call(this,e,n)}),$f.set(this,async()=>{if(!Qe(this,Mn,"f")){let e;try{e=(await Ba(()=>import("./index-75e4cbc4.js"),[])).default}catch{throw new Error("Unable to load Solflare MetaMask SDK")}U4(this,Mn,new e,"f"),Qe(this,Mn,"f").on("standard_change",n=>Qe(this,jl,"m",zM).call(this,"change",n))}return this.accounts.length||await Qe(this,Mn,"f").connect(),{accounts:this.accounts}}),eh.set(this,async()=>{Qe(this,Mn,"f")&&await Qe(this,Mn,"f").disconnect()}),th.set(this,async(...e)=>{if(!Qe(this,Mn,"f"))throw new me;return await Qe(this,Mn,"f").standardSignAndSendTransaction(...e)}),nh.set(this,async(...e)=>{if(!Qe(this,Mn,"f"))throw new me;return await Qe(this,Mn,"f").standardSignTransaction(...e)}),rh.set(this,async(...e)=>{if(!Qe(this,Mn,"f"))throw new me;return await Qe(this,Mn,"f").standardSignMessage(...e)})}get version(){return Qe(this,Kf,"f")}get name(){return Qe(this,Jf,"f")}get icon(){return Qe(this,Xf,"f")}get chains(){return[Qf,DM,LM]}get features(){return{[F0]:{version:"1.0.0",connect:Qe(this,$f,"f")},[Wf]:{version:"1.0.0",disconnect:Qe(this,eh,"f")},[W0]:{version:"1.0.0",on:Qe(this,qf,"f")},[qr]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:Qe(this,th,"f")},[Kt]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:Qe(this,nh,"f")},[Uo]:{version:"1.0.0",signMessage:Qe(this,rh,"f")}}}get accounts(){return Qe(this,Mn,"f")?Qe(this,Mn,"f").standardAccounts:[]}}ao=new WeakMap,Kf=new WeakMap,Jf=new WeakMap,Xf=new WeakMap,Mn=new WeakMap,qf=new WeakMap,$f=new WeakMap,eh=new WeakMap,th=new WeakMap,nh=new WeakMap,rh=new WeakMap,jl=new WeakSet,zM=function(e,...n){var r;(r=Qe(this,ao,"f")[e])==null||r.forEach(i=>i.apply(null,n))},jM=function(e,n){var r;Qe(this,ao,"f")[e]=(r=Qe(this,ao,"f")[e])==null?void 0:r.filter(i=>n!==i)};let hy=!1;function R4(){hy||(_T(new _4),hy=!0)}async function C4(){const t="solflare-detect-metamask";function e(){window.postMessage({target:"metamask-contentscript",data:{name:"metamask-provider",data:{id:t,jsonrpc:"2.0",method:"wallet_getSnaps"}}},window.location.origin)}function n(r){var o,s;const i=r.data;(i==null?void 0:i.target)==="metamask-inpage"&&((o=i.data)==null?void 0:o.name)==="metamask-provider"&&(((s=i.data.data)==null?void 0:s.id)===t?(window.removeEventListener("message",n),i.data.data.error||R4()):e())}window.addEventListener("message",n),window.setTimeout(()=>window.removeEventListener("message",n),5e3),e()}const O4="Solflare";class B4 extends Xn{constructor(e={}){super(),this.name=O4,this.url="https://solflare.com",this.icon="data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjUwIiB2aWV3Qm94PSIwIDAgNTAgNTAiIHdpZHRoPSI1MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGxpbmVhckdyYWRpZW50IGlkPSJhIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiNmZmMxMGIiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNmYjNmMmUiLz48L2xpbmVhckdyYWRpZW50PjxsaW5lYXJHcmFkaWVudCBpZD0iYiIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI2LjQ3ODM1IiB4Mj0iMzQuOTEwNyIgeGxpbms6aHJlZj0iI2EiIHkxPSI3LjkyIiB5Mj0iMzMuNjU5MyIvPjxyYWRpYWxHcmFkaWVudCBpZD0iYyIgY3g9IjAiIGN5PSIwIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDQuOTkyMTg4MzIgMTIuMDYzODc5NjMgLTEyLjE4MTEzNjU1IDUuMDQwNzEwNzQgMjIuNTIwMiAyMC42MTgzKSIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHI9IjEiIHhsaW5rOmhyZWY9IiNhIi8+PHBhdGggZD0ibTI1LjE3MDggNDcuOTEwNGMuNTI1IDAgLjk1MDcuNDIxLjk1MDcuOTQwM3MtLjQyNTcuOTQwMi0uOTUwNy45NDAyLS45NTA3LS40MjA5LS45NTA3LS45NDAyLjQyNTctLjk0MDMuOTUwNy0uOTQwM3ptLTEuMDMyOC00NC45MTU2NWMuNDY0Ni4wMzgzNi44Mzk4LjM5MDQuOTAyNy44NDY4MWwxLjEzMDcgOC4yMTU3NGMuMzc5OCAyLjcxNDMgMy42NTM1IDMuODkwNCA1LjY3NDMgMi4wNDU5bDExLjMyOTEtMTAuMzExNThjLjI3MzMtLjI0ODczLjY5ODktLjIzMTQ5Ljk1MDcuMDM4NTEuMjMwOS4yNDc3Mi4yMzc5LjYyNjk3LjAxNjEuODgyNzdsLTkuODc5MSAxMS4zOTU4Yy0xLjgxODcgMi4wOTQyLS40NzY4IDUuMzY0MyAyLjI5NTYgNS41OTc4bDguNzE2OC44NDAzYy40MzQxLjA0MTguNzUxNy40MjM0LjcwOTMuODUyNC0uMDM0OS4zNTM3LS4zMDc0LjYzOTUtLjY2MjguNjk0OWwtOS4xNTk0IDEuNDMwMmMtMi42NTkzLjM2MjUtMy44NjM2IDMuNTExNy0yLjEzMzkgNS41NTc2bDMuMjIgMy43OTYxYy4yNTk0LjMwNTguMjE4OC43NjE1LS4wOTA4IDEuMDE3OC0uMjYyMi4yMTcyLS42NDE5LjIyNTYtLjkxMzguMDIwM2wtMy45Njk0LTIuOTk3OGMtMi4xNDIxLTEuNjEwOS01LjIyOTctLjI0MTctNS40NTYxIDIuNDI0M2wtLjg3NDcgMTAuMzk3NmMtLjAzNjIuNDI5NS0uNDE3OC43NDg3LS44NTI1LjcxMy0uMzY5LS4wMzAzLS42NjcxLS4zMDk3LS43MTcxLS42NzIxbC0xLjM4NzEtMTAuMDQzN2MtLjM3MTctMi43MTQ0LTMuNjQ1NC0zLjg5MDQtNS42NzQzLTIuMDQ1OWwtMTIuMDUxOTUgMTAuOTc0Yy0uMjQ5NDcuMjI3MS0uNjM4MDkuMjExNC0uODY4LS4wMzUtLjIxMDk0LS4yMjYyLS4yMTczNS0uNTcyNC0uMDE0OTMtLjgwNmwxMC41MTgxOC0xMi4xMzg1YzEuODE4Ny0yLjA5NDIuNDg0OS01LjM2NDQtMi4yODc2LTUuNTk3OGwtOC43MTg3Mi0uODQwNWMtLjQzNDEzLS4wNDE4LS43NTE3Mi0uNDIzNS0uNzA5MzYtLjg1MjQuMDM0OTMtLjM1MzcuMzA3MzktLjYzOTQuNjYyNy0uNjk1bDkuMTUzMzgtMS40Mjk5YzIuNjU5NC0uMzYyNSAzLjg3MTgtMy41MTE3IDIuMTQyMS01LjU1NzZsLTIuMTkyLTIuNTg0MWMtLjMyMTctLjM3OTItLjI3MTMtLjk0NDMuMTEyNi0xLjI2MjEuMzI1My0uMjY5NC43OTYzLS4yNzk3IDEuMTMzNC0uMDI0OWwyLjY5MTggMi4wMzQ3YzIuMTQyMSAxLjYxMDkgNS4yMjk3LjI0MTcgNS40NTYxLTIuNDI0M2wuNzI0MS04LjU1OTk4Yy4wNDU3LS41NDA4LjUyNjUtLjk0MjU3IDEuMDczOS0uODk3Mzd6bS0yMy4xODczMyAyMC40Mzk2NWMuNTI1MDQgMCAuOTUwNjcuNDIxLjk1MDY3Ljk0MDNzLS40MjU2My45NDAzLS45NTA2Ny45NDAzYy0uNTI1MDQxIDAtLjk1MDY3LS40MjEtLjk1MDY3LS45NDAzcy40MjU2MjktLjk0MDMuOTUwNjctLjk0MDN6bTQ3LjY3OTczLS45NTQ3Yy41MjUgMCAuOTUwNy40MjEuOTUwNy45NDAzcy0uNDI1Ny45NDAyLS45NTA3Ljk0MDItLjk1MDctLjQyMDktLjk1MDctLjk0MDIuNDI1Ny0uOTQwMy45NTA3LS45NDAzem0tMjQuNjI5Ni0yMi40Nzk3Yy41MjUgMCAuOTUwNi40MjA5NzMuOTUwNi45NDAyNyAwIC41MTkzLS40MjU2Ljk0MDI3LS45NTA2Ljk0MDI3LS41MjUxIDAtLjk1MDctLjQyMDk3LS45NTA3LS45NDAyNyAwLS41MTkyOTcuNDI1Ni0uOTQwMjcuOTUwNy0uOTQwMjd6IiBmaWxsPSJ1cmwoI2IpIi8+PHBhdGggZD0ibTI0LjU3MSAzMi43NzkyYzQuOTU5NiAwIDguOTgwMi0zLjk3NjUgOC45ODAyLTguODgxOSAwLTQuOTA1My00LjAyMDYtOC44ODE5LTguOTgwMi04Ljg4MTlzLTguOTgwMiAzLjk3NjYtOC45ODAyIDguODgxOWMwIDQuOTA1NCA0LjAyMDYgOC44ODE5IDguOTgwMiA4Ljg4MTl6IiBmaWxsPSJ1cmwoI2MpIi8+PC9zdmc+",this.supportedTransactionVersions=new Set(["legacy",0]),this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.Loadable,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._accountChanged=n=>{if(!n)return;const r=this._publicKey;if(r){try{n=new X(n.toBytes())}catch(i){this.emit("error",new Sn(i==null?void 0:i.message,i));return}r.equals(n)||(this._publicKey=n,this.emit("connect",n))}},this._connecting=!1,this._publicKey=null,this._wallet=null,this._config=e,this._readyState!==$.Unsupported&&(cr(()=>{var n;return(n=window.solflare)!=null&&n.isSolflare||window.SolflareApp?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1}),C4())}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.connected)}get readyState(){return this._readyState}async autoConnect(){this.readyState===$.Loadable&&$g()||await this.connect()}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Loadable&&this._readyState!==$.Installed)throw new en;if(this.readyState===$.Loadable&&$g()){const i=encodeURIComponent(window.location.href),o=encodeURIComponent(window.location.origin);window.location.href=`https://solflare.com/ul/v1/browse/${i}?ref=${o}`;return}let e;try{e=(await Ba(()=>import("./index-7f510ab1.js"),[])).default}catch(i){throw new B0(i==null?void 0:i.message,i)}let n;try{n=new e({network:this._config.network})}catch(i){throw new Ei(i==null?void 0:i.message,i)}if(this._connecting=!0,!n.connected)try{await n.connect()}catch(i){throw new lr(i==null?void 0:i.message,i)}if(!n.publicKey)throw new lr;let r;try{r=new X(n.publicKey.toBytes())}catch(i){throw new Sn(i==null?void 0:i.message,i)}n.on("disconnect",this._disconnected),n.on("accountChanged",this._accountChanged),this._wallet=n,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}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(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async sendTransaction(e,n,r={}){try{const i=this._wallet;if(!i)throw new me;try{const{signers:o,...s}=r;return xi(e)?o!=null&&o.length&&e.sign(o):(e=await this.prepareTransaction(e,n,s),o!=null&&o.length&&e.partialSign(...o)),s.preflightCommitment=s.preflightCommitment||n.commitment,await i.signAndSendTransaction(e,s)}catch(o){throw o instanceof Qt?o:new mr(o==null?void 0:o.message,o)}}catch(i){throw this.emit("error",i),i}}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signMessage(e,"utf8")}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const F4="Torus";class W4 extends Xn{constructor({params:e={showTorusButton:!1}}={params:{showTorusButton:!1}}){super(),this.name=F4,this.url="https://tor.us",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzMiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMyAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMTYuNSIgY3k9IjE2IiByPSIxNiIgZmlsbD0iIzAzNjRGRiIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTExLjIxODYgOS40OTIxOUMxMC40NTM5IDkuNDkyMTkgOS44MzM5OCAxMC4xMTIxIDkuODMzOTggMTAuODc2OFYxMi40ODk4QzkuODMzOTggMTMuMjU0NSAxMC40NTM5IDEzLjg3NDQgMTEuMjE4NiAxMy44NzQ0SDEzLjY2ODRWMjIuODk3NkMxMy42Njg0IDIzLjY2MjMgMTQuMjg4MyAyNC4yODIyIDE1LjA1MyAyNC4yODIySDE2LjY2NkMxNy40MzA3IDI0LjI4MjIgMTguMDUwNiAyMy42NjIzIDE4LjA1MDYgMjIuODk3NlYxMi41MDE1QzE4LjA1MDYgMTIuNDk3NiAxOC4wNTA2IDEyLjQ5MzcgMTguMDUwNiAxMi40ODk4VjEwLjg3NjhDMTguMDUwNiAxMC4xMTIxIDE3LjQzMDcgOS40OTIxOSAxNi42NjYgOS40OTIxOUgxNS4wNTNIMTEuMjE4NloiIGZpbGw9IndoaXRlIi8+CjxwYXRoIGQ9Ik0yMS4zMzc2IDEzLjg3NDRDMjIuNTQ3NyAxMy44NzQ0IDIzLjUyODcgMTIuODkzNCAyMy41Mjg3IDExLjY4MzNDMjMuNTI4NyAxMC40NzMyIDIyLjU0NzcgOS40OTIxOSAyMS4zMzc2IDkuNDkyMTlDMjAuMTI3NSA5LjQ5MjE5IDE5LjE0NjUgMTAuNDczMiAxOS4xNDY1IDExLjY4MzNDMTkuMTQ2NSAxMi44OTM0IDIwLjEyNzUgMTMuODc0NCAyMS4zMzc2IDEzLjg3NDRaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.Loadable,this._connecting=!1,this._wallet=null,this._publicKey=null,this._params=e}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isLoggedIn)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Loadable)throw new en;this._connecting=!0;let e;try{e=(await Ba(()=>import("./solanaEmbed.esm-aaf40c80.js"),["assets/solanaEmbed.esm-aaf40c80.js","assets/punycode-e9579d2a.js"])).default}catch(o){throw new B0(o==null?void 0:o.message,o)}let n;try{n=window.torus||new e}catch(o){throw new Ei(o==null?void 0:o.message,o)}if(!n.isInitialized)try{await n.init(this._params)}catch(o){throw new lr(o==null?void 0:o.message,o)}let r;try{r=await n.login()}catch(o){throw new qt(o==null?void 0:o.message,o)}let i;try{i=new X(r[0])}catch(o){throw new Sn(o==null?void 0:o.message,o)}this._wallet=n,this._publicKey=i,this.emit("connect",i)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){this._wallet=null,this._publicKey=null;try{e.isLoggedIn&&await e.cleanUp()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async sendTransaction(e,n,r={}){try{const i=this._wallet;if(!i)throw new me;try{const{signers:o,...s}=r;e=await this.prepareTransaction(e,n,s),o!=null&&o.length&&e.partialSign(...o),s.preflightCommitment=s.preflightCommitment||n.commitment;const{signature:a}=await i.signAndSendTransaction(e,s);return a}catch(o){throw o instanceof Qt?o:new mr(o==null?void 0:o.message,o)}}catch(i){throw this.emit("error",i),i}}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signMessage(e)}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const V4="Trust";class P4 extends Xn{constructor(e={}){super(),this.name=V4,this.url="https://trustwallet.com",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAyIiBoZWlnaHQ9IjQwMiIgdmlld0JveD0iMCAwIDQwMiA0MDIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgo8cmVjdCB3aWR0aD0iNDAyIiBoZWlnaHQ9IjQwMiIgZmlsbD0idXJsKCNwYXR0ZXJuMCkiLz4KPGRlZnM+CjxwYXR0ZXJuIGlkPSJwYXR0ZXJuMCIgcGF0dGVybkNvbnRlbnRVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giIHdpZHRoPSIxIiBoZWlnaHQ9IjEiPgo8dXNlIHhsaW5rOmhyZWY9IiNpbWFnZTBfMTY5NF8xODk2NyIgdHJhbnNmb3JtPSJzY2FsZSgwLjAwMjQ4NzU2KSIvPgo8L3BhdHRlcm4+CjxpbWFnZSBpZD0iaW1hZ2UwXzE2OTRfMTg5NjciIHdpZHRoPSI0MDIiIGhlaWdodD0iNDAyIiB4bGluazpocmVmPSJkYXRhOmltYWdlL2pwZWc7YmFzZTY0LC85ai80QUFRU2taSlJnQUJBUUFBQVFBQkFBRC8yd0JEQUFjRkJRWUZCQWNHQmdZSUJ3Y0lDeElMQ3dvS0N4WVBFQTBTR2hZYkdoa1dHUmdjSUNnaUhCNG1IaGdaSXpBa0ppb3JMUzR0R3lJeU5URXNOU2dzTFN6LzJ3QkRBUWNJQ0FzSkN4VUxDeFVzSFJrZExDd3NMQ3dzTEN3c0xDd3NMQ3dzTEN3c0xDd3NMQ3dzTEN3c0xDd3NMQ3dzTEN3c0xDd3NMQ3dzTEN3c0xDd3NMQ3ovd2dBUkNBR1NBWklEQVNJQUFoRUJBeEVCLzhRQUd3QUJBQUlEQVFFQUFBQUFBQUFBQUFBQUFBRUdCQVVIQXdML3hBQVpBUUVBQXdFQkFBQUFBQUFBQUFBQUFBQUFBUU1FQlFMLzJnQU1Bd0VBQWhBREVBQUFBZWtBQUFFRXhJaEloSWhJaEloSWhJaEloSWhJaEloSWhJaEloSWhJaElJRWdBQUFBQVFrQUFBQUFBQUFBQUFBQUFBQUFBQWlVRWdBQUFRa0FBQUFBQUFBQUFBQUFBQUFBQUFBQWlVRWdBRUVnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQWlZa0FJa0FBQUFBQUFBQUFBQUFBQUFBQUFBQUFBUk1FZ2lZa0FBQUFBQUFBQUFQT29XVjduWFZWdXg5TXllWTNYTG8zSXo2QUFBQUFBQUFBRVNENUV6RWdBQUFBQUFCR0xNWmJSNmUydTVWK3BlT25QazR4cXpCTUFicTE4NlVYOVZjNzNlVFRhV3J6NmJmVWVmUUFBQUFBQUdPSmozbUppUUFBQUFOTlVQckE2Zk95Zm53WFZ6Qk1BZ0EyOXFvdXJtNjNyRnI1cGk5U3JlbWlvc2pIMVpnbUFQdjF4MFRrN0RUUFBycUhyWGJGeStpSGoyQUFBQmppWTk1aVlrQUFBQURtMkhuWVBZNVFzTVRYbCt5cUx1YzdMb0UxV1ZiZTVpaTRLN0FBSTArNWV2TksxWFNtaWpsVHArSGJYenhlNlpkVmppMnE0V1d1V1BsZElLclFBQUFNY1RIdk1URWdBQUFBYzYxK3kxdlg1YTMxQzIxMldnY3pvQUFBQUFBQUFPYTlLNW5yeTR3MzRycFlkRHZ1VjB3cXNBQUFBeHhNZTh4TVNBQUFBQnovVmJuVGRibUxWVmJONTlXOGN2b2dBQUFBQUFBT1lkUDVac3lmSTNZNzF1OVB1T1Qwd3JzQUFBQXh4TWU4eE1TQUFBQUJSOUZZcTcxZWFzVmQzaGVSeXVrQUFBQUFBQUI4OHM2ZHpIZGpEWms2RnM4SE80L1ZEejZBQUFBeHhNZTh4TVNBQUFBQlVxdmNLZjArYzIycHo3UEhSaHlPb0FBQUFBQUFCaGMzNkJ6L29ZUTFaK201RVR4dXFFU0FBQUJqaVk5NWlZa0FBQUFEUlVmb1hQZWpnZTNpMDBkVmVYcnhlcUNRQUFBQUFBTkRTTFpVK2x6M3Y0Ykc2cm9nNC9WQUFBQUF4eE1lOHhNU0FBQUFCNDh3NnJ6TGJreHh0eDlDMmRic25KNllWMkFBQUFBQUFValE1bUgxK1czMmh0dmoxYUJ5K2tBQUFBQmppWTk1aVlrQUFBQUJSYjFYYjZhWU9uenQzZXVXZE53YmZZWk5RQUFBQUFERnlxdlpYVWgxdVk2QlErbjQ5WDBNTzBBQUFBREhFeDd6RXhJQUFBQUR3OXlPV2ZOaHIzWDVpeTFvZFZWeXg4cm9oNTlnQUFBRHhRNXZtNnZwWUEwVWIrN1lHZnl1a0ZWb0FBQUFHT0pqM21KaVFBQUFBQU1mbkhUOVhvbzU4Ky9qcFlHOTBUelBUTW5sdG13N0xZOC9UTG9CSUJyYWpkVFphZGpOK01MYWxrd2I3azFmUXdiUUFBQUFBTWNUSHZNVEVnQUFBQUFBYTZqZEs4NzZlWExQV3VoaCtSNzhlOXRwYXF6cXJudTZ4Yk4vVWRMNTZzNGFNNHpZbkNzTzgzR0xYOC9SajFnQUFBQUFBWTRtUGVZbUpBQUFBQUFBQVl1VW1LUm9lcTYzWGw1NDJXdDI1UW55UHBQemtiKzFaZEdoc01zT3NQUHNBQUFBQUFBUWZEMElpWWxJQUFBQUFBQUFBRVZ1eXZmamxuejB2QjJaYWxkczM2elhoVGNBQUFBQUFBQUFpWUpBaVlKQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFSSUFCRW9KQUFBQUFBQUFBQUFBQUFBQUFBQUFBaVlKQUFBQkVvSkFBQUFBQUFBQUFBQUFBQUFBQUFRRWdBQUFBQkNRUUpSSUFBQUFBQUFBQUFBQUFJSlFKaVFBQUFBQUFBQUErUkhpSkFBQUFBQUFBQUFBQWVub1FCSUFBQUFILzhRQUx4QUFBQVVFQWdFQ0JBVUZBQUFBQUFBQUFBRUNBd1FGRVRBeEVFQVNJRFFURkNGQklpUXpOV0FqTWxCd2dQL2FBQWdCQVFBQkJRTEhZV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVc1di9OTi81TGYrbC92L0FDVDcvd0FLazFOcGhTYTE5V0pEY2h2ckhvRjFsdUpiUk1xaW5PV1hsc09SS2kzSTY5d1d1bXBTVUprVmR0QWVrT3lGZW1OVTNXQXhPWWtkVTlsclBld1ZLWVFIS3RIU0hhdzZvT1BPUEhoWm55R1EzV2lDS2xGV0V1dHI2SjdMV09mUCtWSmN5UXMvbVh3YnpwZ3pNOEVXbHVQQitsTXVOdnhuWTZ2V1Mxa1BtSGg4eStJOVRmYVUyNGwxdkdleTFqbktOYzdDeFRYM2hHZ014dVZJU3RNaWpwTU94M1dEdzBaUm5HeG5zdFk1ZnZmU2xLbEczVHBMZ2FveEJtSXd4NnpJbEU5UzQ3Z2NvN3lRdUsrMTY2TCtqalBaYXh6ZmZjVTZFMUpiS2x4U0NZY2RBSWlJc3FtVzNBcW54VkE2VEZNU0VFMUk0bzN0OFo3TFdPZjcvaWkvcGRPWDd6aWplMHhuc3RZNmorNGNVWCszcHlQZGNVZjJXTTlsckhVLzNIaWlkUjM2dmNVbjJPTTlsckhWZmY4QUZGL1Y2YXZxcmlsL3QrTTlsckhWeS9POFVZL3pQU1VkazgwNHJVL0dleTFqckpmbWVLUWRwdlNmTzBmbUVWb09NOWxySFdpL0Z4VER0VU9sTk8wTG1PVm8yTTlsckhXaS9wY1FUOFozU3FSMnAvSkZaT005bHJIVnl2QzRhVjR2ZEtzS3RENFlUNVNNaDdMV09vcDhvSExTdk5ubzFwWDA0cDZmS2ZrUFpheHZKODJPYWN2emdkR3JyOHBuRklUZVprUFpheVNFZkRrOFVaeTdIUmxyK0pNNG9xUHdaRDJXc2xXYjhKdkZLZCtITTZFbDM0TWJtbXQvRGdaRDJXc2xZYThtT0VxTkMyWENlWnoxaC84QUR3MmczSEVwSktjaDdMV1I1c25tRkpOS3VLVEs4RlpublVzTlBPcWZlNHBEUG5KeW5zdFphdEg4SHVZRlNKd3NqcnFHVVRacXBhK1lVZjVhTmxQWmF5dnNwZlplYVV3N3pGcWJqSVprTnlFNFpWVGFZRDhoeVF2bWxSUE5lWTlsck5OaEpsTnJRcHRmS0ZxYlZHcTRRNGgxUHBrem1Zd2sxQjZSNllNRlVwYVVraE9ZOWxyUExoTnlreUl6a1pmb2FmY1lWRnF5SE9YcERjZEVtcU9PK3FIVEZPaEtTUW5PZXkxMEZvUzRpVlNESUtTYUZlaUxPZGpCK3NGNExjVTZ2MFI0ajBrNHRPYWo5STlscnBQeG1wQlNhVTYxaFpZY2ZWR3BLRUFpSWk2VnV0SmdzeVJKZ3V4dlNTVFVjV2tHWVEybHRQVCt3Ky9WTXJsTHBSS0NrcVFvUllUc280ME5xS25ybjJIb3pNZ0pwY1ZKa1JKTHJmZi9BSnd2M2I5Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN3bkwvQVAvRUFDY1JBQUlCQWdVRkFBSURBQUFBQUFBQUFBRUNBd0FSQkJBd01USVNJQ0ZBUVJSd0lsRlMvOW9BQ0FFREFRRS9BZjBhN2hONk03VkhNRzhIMWIyb3lxS2FjbmF0ODFtWmFXZFRRWUhiMEpKQ1RWejJKQ3pVSWxBdFR3RWNhMnp2UVlpa1BVTDZyYjBxbGpZVitPMUREajdTeHF1M1lWQjNvNGRmbEhEbis2ZU1wdmxGd0dxL0kxRHowc1JzTW8rQTFYNUdvZVkwc1I4eWo0alZsNW1vK1kwc1I4eVhpTldiblNjaHBZamxrTlhFY3RPZm5TK1RyWWdiSEtNM1VhTG03RTFFTHVOYVlYWExEdDR0b08zU3Q4c09QTjlkbDZUYWxicE42Vmd3dU8rV1RxOERLSmVsZGVXUHE4akpXSzdVazRQTHNlVlZwNUMrVU1kLzVIMFpJZzlNaFhmSkpDbTFDZFNQTlBNVzJ5QXZ0U1FmVzlNaTlQQi9taUNOODBnSjNwVkM3ZXN5aHQ2T0hQeWtpQ2ZvL3dEL3hBQWtFUUFDQVFNRUFnTUJBUUFBQUFBQUFBQUJBZ01BQkJFUU1ERXlFaUVnUUVFaWNQL2FBQWdCQWdFQlB3SC9BQTFJeS9GQzNURlNRRmZZK3FBVFN3dWFTMkE3VUJqVjRGYW10M0hGRlNPZm9SUmhWckErRHpxdE5NNU9hUzRCN1VEblhBb29wNUZPdmkyTjFlQlRNRUdUUnVWbzNSL0JUU00zSitDc1Y0b1hMRG1oZEQ5RkpLSDQwbTduZFRxS242YlZyeWRKZTUzWStncWZvZHExL2RKTzUzWXVncVhvZHExL2RIN0hkZzZDbjZuYXR1dWgzYlkveHQyNC9pbU9CbmV0VHlOSlJoenN4akNnVk1jSWQ2QnNQcGNyNzh0aU5mSnNhWFRlZ043aWtieUdhZGZNWU5NaFE0UHpoaThCazZTdjV0bmZobDhEZzhhTW9iMGFlM0k2L0JJV2VraVZOSjVjZnlQb3h6RlBWSTRmalI0bGZtbXQyQndLamdDODZFZ2MxSmNmaWZUQnh4U1hQNDFBZyt4ckpjQWVscG5MYy9XVnluc1VMbGNlNmttTC93Q0gvd0QveEFBM0VBQUJBUVFHQndZR0FnTUFBQUFBQUFBQkFnQURFUklRSUNFaVFGRXhRVkpoY1hLQkV5TXdVR0toQkRJemtaS3hRb0tBa1BELzJnQUlBUUVBQmo4Qy93QkMwcVIyaXR6WG5ObTR0TTdNZkw1bHFDUXhRNXVvejFtbWQyWUZwVlhIbVdmbGtWRUFiMmc1RTV6MU5GNHFOYVZmZUkzNld1cmdySStUM255UHUxMlpmQU4zYVFqM2FMeFpWeDhLeGNSa3ExdTlkZFV0OVNYaTExYVZjRGpwVTJ2RDdORXZsOURCdnJQUHlhMTR2N3RhZkFtZTkyajNMQU8rN1VHZzhURGZxUGdXS0k2dDlWZjVOOVo1K1RYMWRvbmV3V2d4QnhMMG5haDRVU096VG1wb3dtWHRHbVZRQkJ6YUxoVXZwTFFlSUtmQ1duSldKZmN4clFTQ2VEZlRsNXJHNzE1MFMxeDJBYzY4Q0lockIyWjlMWEZKWDdOZmRLSFN1ODVzUzk1cVZLZVJzT3B2a2oxYXh5ajdOWUllTmZkcFZ4RGZSSFJ0Q2gxWjRoT2hKaFN2bXhMM2pTOTQ0Ujl6bWxmUGlYdEwzcGhIdk1hVHo0bDUwL1ZMN3BoRjh4cC9zY1NyZ0tYdkRDRTBvNjRrY3RLeDZjR1RVZGY5cnhLRDZhZUtjRzhQcE5SMXk0bHllTktOOGYxZzMzTFVkREpJeExzNzZYWE5nM25UOTFBTXNUSEpWS0ZaS0J3WUdhcVhhYzFERlBmdlVRck1Sd1RwUEUwdWh2amlscHpTUlVkN3JNRkxzcHBKMlU0dDRqSlZLMFpHT0NlcTMwdlY5TVhOdGlOTXVwWWhnVnZNaFVSNnJjV2w1c0drS0drV3NsNG5Rb1lCTGtjVFNsQTBxTUdDUm9GbUxXN1A4Z3hTZElwN0Jac1Y4dmpsNHMyQmxQRmFUU1hoMEkvZU43WWZLdlR4cUIwK01GNmpuNHBXdFVBMlRzYUJVU2orV2s0MVR0V2dzWGE5SXFCTHkrajNEVE8xUjhLVkhlTDltbWVLalU3ZFl1ajVjZms4R2dzVUxFQ0treUZGSjNNRS9FRCt3YVpDZ29icTBDWmxiSWFFWkVaQ3JFMk9ocExCS1JBRHlDMnhlcFRRZUo2MVpuYWlscFgxeFdlcW1aNHFEU3V1N1Q3MWd0OWRSbHJMQktSQUR5S1ZhUW9NVmZEMmpaTFFVQ0R2cXdqTWpaTGR5bThkclUweTFGUnEzRTJablEweHZyelBrMEhpWTcybWRkNG4zOEdWMmtxYVo4WnpscWFBRUI1VEVpQzlvTkVpS05vVllKRVMwM3hGbnBEU29TRWpkNVpBdFA4QUQzVHN0S29RSW91aUNkb3RkRVZiUjh3N3hFZDdSbEo0bG9KRUIvbkovOFFBS2hBQUFRSUVCQVlEQVFFQkFBQUFBQUFBQVFBUklURmhjUkF3UVZFZ1FJR1JvYkZRNGZEQjhkSC8yZ0FJQVFFQUFUOGh5Q1FFNTI3cGp1bUtnRlFDb0JVQXFBVkFLZ0ZRQ29CVUFxQVZBS2dGUUNvQlVBcUFWQUtnRlFDb0JVQXFBVkFLZ0ZRQ1ltcVZHNlpia0NXVVRPQ0FiNEpta24zaG11OHBib0J2aG9pb1U4cncrSmJVSUY4ancrTEkxRTBJOFJpVzcvR21CZnZ3a3NnR0h4d2hEZ203YjQ4K3NTV0NBWWZJQ0RqQXlmSW1Zd0V6ekI4WUdZSmdPcSsvbFFGV28xRitaSk9XTmhEcVZHWElQNk5pSE1ieW1kamNTczVjQUFGSjVRb0hjeVRCT0Zab2ZaUEg3Um9PbkVPRmlLQ3hUUUJFcG5sWmlrMjVBZ0RrZ0NxbDRwR1U3eE5nZVU1Z2Z1WWs4UjFaVE9Eam9FWkFncVA0SzBtV3drTHduQjVHYmRTYlpnQkRBcnhrRzY4UFFlRi9wRk5GYzBSY2h2a05EMngrR1FnV0xBemU2Y2MyQjREa2VGNUFHUStwZjZSQVFKcWlNOUNtbmpjWmsyNmsyek5FUXV5R1RNcHY3a095WmcvWmh0aVp6YkFFOHZuUjdxOFdhSHJsRkJLRjFHWk51cE5zeUg4VWVKMUYyQjFxME4wQk1YNkg5SzZqQkU5K001Q0pNRUozSnV5N0o2SW51VW9MZUlkK01JOUhyTW0zVW0yWURYV01ieTJITXAwZDVyMzJkN1RLRUd3R2Q0b2txYkJ1STlLUVdpdTFQUWZIOTlNeWJkU2JaZ05peWhVK3VVSi8weHhDSlY2R1pOdXBOc3dHdUQwTVRoMS9ybERjbS91eEJxcGVobVRicVRiTUJxdjhNU2lQN1BsRGQ3K3pFV0d1WVRicVRiTUZxM294S0J1SEtGVkRpTFZEN1prMjZrMnpHaWJpZkp4dlova2NuUVFQd05LaFBsbVRicVRiTXZKdms0d0hjSHJrNkhFOGNEUm9PWk51cE5zeThRSHJHMHdlWEp1YXNjRkRWNHpKdDFKdG1PN2N4NCtzWFRRTzhPVHZ4bmhpQTVZS2xCc3liZFNiWmpmc2o3R1A2NkR5ZEJNZURqUWdlYzJiZFNiWmpHMkE3RHdVWi9Ea3V2eWVNYUVlQVBtemJxVGJNL053T0J5Nmg0bHVTYWRnUDdqWDBQOEFNMmJkU2Jac0FHZUFzK01ZNCtkL25KYThnbUJZUXhZM0pBL3V1Yk51cE5zMXgwQi9qK1l0SkdLNjVqa2Q3b1Y5T0NNSnVQcjlObXpicVRiTmFlYkJzY1Rqc2NBYXJWMEZ1UWFMeFAxNHlDUUNsT0lETm0zVW0yYkxRWXNnSXNSaU1RbGFFY2pvZHM5bVFQdlJUd0Y3WXN5Z3d1L0hPbTNVbTJjY1lmU3hTSzBNUVdYM3pRRWg2bFFDL3dEdHppQVNXRVNuRW03dWROdXBOczZRaXoyTzZEWXhlOWVBYTZHaHFzZFJxTGpLY0dOZ0dDNVZqQU5CYmdza1IxTytmTnVwTnM5NUJoZnFLT2hoaUR3QW9CMUprVVJFZnR3aGtvNmx4T25kcjEyVHZHUDJUcndnSXlSY29FT2dFd0EwejV0MUp0eUdnOUkwVUdRYUJJOEwxWlNSVEdJZDUvNGdRUTRMZzROUmpvTlRaUDdubGY4QUZNOEo0TXpoK2pJZEFaZ0JweUUyNmsyNUUrTU13VTRyVWVqMEtMQlhNQXg0UzREOFNHeVp3ZGlKL0RvME9PcDRlcXJDQk05bklDdzVLYmZsQm5zdEpDT3FlYkNKZW1xSUlMR0J5SE96WFlKbm92Si8xQVFBSkFjbkhIZENaNVVTZTZqN1J1aXBIMXdpNWhwQUJ5VXdtWjF1cFF1QWRBNVF6S1FYdHl3Q0FCQjBLZjJOWFNiYkk3TG5nY0pCT2NqN1U0Uk9ZZVdPZ3drNWdaQ01Ta0k2cDBxV0NoOFFVZ0F3SExpSkhFUWg4ZVN3UURERTc3Zkh6TnVHUnA4YWRoTlNIRE5EWS9Ga3NnTy9HUTZCME0vaVNXUUdwbmtrT25hZmY0ZDlCTkFkOHhtbDJUN3crRGRsRTBVczl0aW5PbzdKbS9PczNUN0JNVE05a0EzS0FBSktvVlVLcUZWQ3FoVlFxb1ZVS3FGVkNxaFZRcW9WVUtxRlZDcWhWUXFvVlVLcUZWQ3FoVlFxb1ZVS2luSE4vOW9BREFNQkFBSUFBd0FBQUJEenp6UlR6enp6enp6enp6enp6enp6VHp6enp6eVJ6enp6enp6enp6enp6enp6enp3elR6enlUenp6enp6enp6enp6enp6enp6enp5anp5aHp6enp6enp6enp6enp6enp6enp6enp4end6enp6enp6enp6enp6enp6enp6enp6enl6enp6enp6enp6enp6OVBmenp6enp6enp6enpEenp6enp6enp6UW9NTU9EN0h6enp6enp6ekx6enp6enl1QUFNTTkrNHNNUE9MM3p6enp3THp6enp6eUVJV1kzenp3MjAwd1A4QTg4ODg4Qzg4ODg4OEtRODg4ODg4ODg4NkQwODg4ODhDODg4ODg4cUU4ODg4ODg4ODhyRGQ4ODg4OEM4ODg4ODhxRzg4ODg4ODg4OGdEVzg4ODg4Qzg4ODg4OGpTODg4ODg4ODg4SkdWODg4ODhDODg4ODg4cEEvODg4ODg4ODhDSDg4ODg4OEM4ODg4ODhNRDE4ODg4ODg4OEpIODg4ODg4Qzg4ODg4OG9EYjg4ODg4ODg1REQ4ODg4ODhDODg4ODg4L0NDLzhBUFBQUFB3UjkvUFBQUFBBdlBQUFBQUE9DQWZ0L1BPOEF5dlBQUFBQUEF2UFBQUFBQUERqUTQwcUF4VDNQUFBQUFBQQXZQUFBQUFBQUExmUUF3RGovQUR6enp6enp6elB6enp6enp6enp6eTJLL3dBODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODhFODhVODg4ODg4ODg4ODg4ODg4ODg4ODg4MGM4OHN3ODg4ODg4ODg4ODg4ODg4ODg4OHM4ODg4ODhjODg4ODg4ODg4ODg4ODg4ODhFODg4ODg4ODg4akJCQkJCQkJCQkJCQkIvOEFQUFBQUFAvRUFDWVJBUUFDQVFNRUFnSURBUUFBQUFBQUFBRUFFU0VRTURGQVFXRnhJS0ZSY0lHUnNmRC8yZ0FJQVFNQkFUOFEvUm8xd2xzYW5ZQjZWSEpuZjc5VEdHb3FyZGNRNUp5V0p5UytnYmw0SjV2aGtPQ1k0dVpUSWlLcDFFY01Xc1pTL251OHZ2U1FkeElMbE9BZkF1aGNaeXFkbkExNzZmWVp4ZFRKajdtZjhQVzF4L2xwOUxkRlFkYlE4ajNvYUR3YnBwUlVuazJuZ2VOQlFHNktMNGcwM0JzdlpWcnhCU2VlZ2l4YlB1amZoZjhBak9saS9IWXVORjYzcUNVeGxVY3g4OUNnV3k3MkRTbUhuZnI5d2lWaGlGcVlUQitvSTVOY0x5emx1UHhvNjdIUTVRd3h1aG9sbGlYREJtT3dORVZDVmY0empvZ0ZNRnovQUVqdEN0Y2ppZmNIbzdWYmg5Q1djc1ROY3Y2UC84UUFKaEVCQUFJQUJRUURBQU1CQUFBQUFBQUFBUUFSRUNFd01WRkJZWEdoSUVDeFlIQ0I4UC9hQUFnQkFnRUJQeEQralg2MmN3bEV1ZFpUNnV3RnpvdGVabVN1QUtESE16Sm5LcHM1UG9ER3JXZHI0WkdOc3BScVpabGZVQVdPS201Q2FoZGNkWDFpZE1VSHNNYjB2aTR0YnFiVUdkU1I5TmZ2V0p2L0FPZnVsNldIdmFydndrRi85ZGRJNXJ4Zzc4anF1L0ZEZmkwaGt2R0N0TzdxdS84QWI5aHN1enBITTk4RmF1cmNqaGlXVkVwclJvTHpMbmdmUUNtZDlIdzVyeXF1K1dGWUhYUXI4RkhKMWhWWkJNOVlLeXFEOGdWb25NRGhjamJwcjh3SU41a0hwdVovbVBjUkduSFBOam1iVHZ6Z1o2N3Y5SFAyWkJyZUJPVFBtYmtEbVp2bmNBYlZFdjhBMG0vMGtWcW1NZnJEYkxNZXJqNmpkdTlLOVJxMk95RzVrZXh4L09qV2ZuLy94QUFxRUFFQUFRSUNDUVVCQVFFQUFBQUFBQUFCRVFBaE1hRVFNRUZSWVhHQmtmRWdRTEhCOEZEUjRmL2FBQWdCQVFBQlB4RFVXUmI3akdwY0ljMVNZdm9SVzhsNXJYaXE4VlhpcThWWGlxOFZYaXE4VlhpcThWWGlxOFZYaXE4VlhpcThWWGlxOFZYaXE4VlhpcThWWGlxOFZYaXE4Vlc0STVNVk13NjE2azRoeVdva2hsYm4yQXFNWGNWR0lodVA5b0JZaitDZ2tKSlU4V09EY292Z1N5ZGJMZGZpMUJnUDRxQ1FralVZTTdqYVVJSkdUVXFCS3dGUTNOdHpmei9rcUhBZHB2b0JicWJ0UVhTNE1PUEgrV2srUlNCSjZ1U0g0ZnpjRndmeDlNUzJMWXF3ZnpyeTlsemw2QzVzV0gzL0FEemFURzRvUkJMam9tVXgyYzZnRGQvUXZibTV5MFhCdXY4QTBiRzMyZEZ6OVAzZjNDUERpWWU1dXZ5R2tTUU51ekE1SmZ1VUV2MkVJWGNObnQ4UjJsKzJqYTcxYy9iWTJvM2c1Y1hoUXEzWE5nNGJtZkxEU2tXeWRvTnliU2pIcXRKZTR2cHZ6OXVSTGNJcktudE1KS2lCMWFMZkd3YUw4NU9kVHFSd2VXTEhxa2dDeFlQNHN6MG9NQlByelk5RjlyTEQydFpWN0JxTllxZ281a1RFRHNGNkhFWmg4aEJ5bzVXNFd2dkJrMWNsTWtxSEl3T21xSi94d2k5em9sRkN2YkRaSHpRUkRPNXZXSXpvc3VtSDBqN0hPcXlyV1JXNkRxVGZ3T0hkS1V1eFE2UUsvYi9kRHdMeFgzVW9EdlUrc0ZZTHRQRmJjUkJjQndjWHRRVVlReU9YdDU0MHpPTEY5eFBveDFHelgzeDhWa3JIOTErMys2ZHgwblFtL0VubkpWMll6OVBFYmF6T3F5cldNVEtUd0xHUnFRUUFWYkFWZkNkZ2lPR042d2NhTWhyWVNqd1lmTGpwTGUwU2cxdkhHUlh5eEhXZVpVMkU0SW5rQ3ozMVN0ek80UUpPNVBYV1oxV1Zhd29IZjV2VURXOXBYWXBzUlBhRU9qZktuRmQrRWZqaFJBbE5sUDFYN2VzSW13TWljUnBGZWJWaTVyZG9wM1laRmw2TnM2ZVlWak4yRW5yNWtEV002ckt0WVFUZjU2UmZaQ2hSQTdxL08zNEpTUXlEQk5uV1ZGaVhBUVphNmF1TzFqTXFSbUg4S0tZZXJuM05PUXBKU3dPM1NTZmF3eTZ6T3F5cldRQ0l2ZTRhWnQwWDg2ZTBCWnVzK21MZkEvZlBXWjFXVmF5RzhidTJtYmQzN24rUGFZM1hkK2ZUTU41eWZyV1oxV1ZheTJON3B1YlJlMDdkWkdNN1dtVWJ4OEgxck02ckt0WktONitIMXBqM3Q5bC8zMmwwcGxjOU1vakhaejYxbWRWbFdzL1djSDFwZzN4N1A5dlo3S3ArdzlIR0R1ays5Wm5WWlZySWZISCsybWQ4bVgxN1B4ano5SEZydkwvZXN6cXNxMWtjVDZaWDNwanV4RHVmWHM3cVJQZEVmZm90NUdUSFdaMVdWYXkwKzJlY3RLNjhUK0p6OW54M0Y2L1JPbERDVllDakp3QWREV1oxV1ZhenlnNTltbTlrWERrSDJkeTd3WEFUNk5OaUp0dk1HdHpxc3Exa0tsek9nL0I2TGd6ZnQ4aCsvWlFCY1F1VUQ1ZE5ucGw3ajZhM09xeXJXUitTa2RVZWlWMlVyaElNZzlsRVRaZzRxL0JOTStscGJpcDhGMXVkVmxXdGUzQVRtUmxHa0c3RVRnSStWMzlrWmpJamZZWkJwbkV4NXlGZmhyYzZyS3RiQVJFejJTWGZCNjZUaHJnQ0grQ2RmWWhKUW5yMnpKU3F5M2RMUVVkOUxaTmF6cXNxMXJuWit6dmNPK25oWXJJTWxZSlFKdmJUb3lkUFlIYzFpTmdXSGVYb2FjMVlCWW9HNENOd0VHdHpxc3ExcmhRc3U5c2VqRDBwTGJ6c1JHRTAzOENCYmE5V3pqejE5eTFFYlZzSEZwRDlqVFlZQWNBZzAzVU1lMnlCMkpkdGRuVlpWcnRpMW9iRSt3bm1Pa1VFVVM0bEFaSFlYQVhaOHVldHhlejRpN2cydkNqb0VMbUw5bnhtNkFRS01BWFZvekppNXY0blFnNmE3T3F5clhCMWdBRjlrT0kxWkVwT3diQndmUWFka0ZiWEJjVGc5eW9LTkd3ZmRpR3FscU8yS2Z4WXlwUzVtSFk5dzJmUG9jcnZzTVA0SHp5MStkVmxXdkpZb0hCUGkrTzhwWU9HdWZ0L293UWdzUjJwelloQmM0N1RtZHF3c3VURGs3bmg2aDRaTFhPcGgxWDRVWTJCVFluYytIRDA3cUZybVptOTJVR2RRMEFOZm5WWlY3QzBrV0RTOENiVGgycVRSSGJ1Vy9XUHBCYlNSZEJNSHJTRFJzSE1tL1ZialFNQUpFWkUwVFlEaXZ1R0xVZmxrS052aS9BNzBxaXFyZFgwOEZCUVAweithZ3ppZUFld3pxc3E5amdxamNsU1EzbFlPRzA1TitMVFRsaFFPWStsMnhOMnNjMjFsd3JFZXdWbnVBeFpjNnhwaHZMeTRIRDB4RjRNWm9iWGdTMDRBSzVlT1J6dSt5MzNhcXdHNjNzNENjUUhaaS9UQ3BTSlhnc2NmbzdVaUJCaEVoSFVRd25FRWN4YkZObURmQWJqdHlIQ2piREFZQTRIc3drNTFXanVaOXJaUjFyZlZzSFB1VS9GTkYzMUdLNTkzMHNkdUZrY0FvcGw3aVhmQnlMOFNzRE9FUS82OGZhT0VNWXRRUUJnV3BzWGNqOW43WU1MUWhJbERHdVZHT2UydUdIS2xHWkE0UjBTT1pRYXpnYjNBNnhVTWpVRW5oRzQ0R2Z0cjNlTTl2eG9HSXhMME1rbUQ3Y1dERUJQSkMvU2pjSFpGUFlSUFdqTzNBd09BZTM0QUxIMys0YWJ6dTRjdjU5NEx1QnpxQU5KYkRITVVJZ2x4L25HUHNzT2ZwTUxhdzRPNythM0V1eU45QUFHQjZVQkRoU1IybXgzL3dBdUJoSzRHK29MdDFpK3NCR0c1M1VrNEh5L2toeExnYjZTY1JaYWtCRFV0K2ZsL3dDTzN3VGtLZ3VzcmJySjduaXcvd0NVR1lFdHp0L2hvc2NkMjJveGJOeGpRQWdJTmNna0pKVXpFT0RjcURhOFZXOWh6dDcxRmhFN3FtNHJ6dFc0QnUvMVFZQ1BhS1VBN3dwdmZOWG1xODFYbXE4MVhtcTgxWG1xODFYbXE4MVhtcTgxWG1xODFYbXE4MVhtcTgxWG1xODFYbXE4MVhtcTgxVjQrYWdHUjFYb0FJQURXZi9aIi8+CjwvZGVmcz4KPC9zdmc+Cg==",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n,r;return(r=(n=window.trustwallet)==null?void 0:n.solana)!=null&&r.isTrust?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isConnected)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.trustwallet.solana;if(!e.isConnected)try{await e.connect()}catch(r){throw new lr(r==null?void 0:r.message,r)}if(!e.publicKey)throw new qt;let n;try{n=new X(e.publicKey.toBytes())}catch(r){throw new Sn(r==null?void 0:r.message,r)}e.on("disconnect",this._disconnected),this._wallet=e,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async sendTransaction(e,n,r={}){try{const i=this._wallet;if(!i)throw new me;try{const{signers:o,...s}=r;e=await this.prepareTransaction(e,n,s),o!=null&&o.length&&e.partialSign(...o),s.preflightCommitment=s.preflightCommitment||n.commitment;const{signature:a}=await i.signAndSendTransaction(e,s);return a}catch(o){throw o instanceof Qt?o:new mr(o==null?void 0:o.message,o)}}catch(i){throw this.emit("error",i),i}}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const Q4="FoxWallet";class Z4 extends Xn{constructor(e={}){super(),this.name=Q4,this.url="https://foxwallet.com",this.icon="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI1LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9ImZveHdhbGxldCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiCgkgdmlld0JveD0iMCAwIDEyMDAgMTIwMCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTIwMCAxMjAwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+Cgkuc3Qwe2ZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO2ZpbGw6I0ZGRkZGRjt9Cgkuc3Qxe2ZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO2ZpbGw6dXJsKCNTVkdJRF8xXyk7fQoJLnN0MntmaWxsLXJ1bGU6ZXZlbm9kZDtjbGlwLXJ1bGU6ZXZlbm9kZDtmaWxsOnVybCgjU1ZHSURfMl8pO30KCS5zdDN7ZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7ZmlsbDp1cmwoI1NWR0lEXzNfKTt9Cgkuc3Q0e2ZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO2ZpbGw6dXJsKCNTVkdJRF80Xyk7fQoJLnN0NXtmaWxsLXJ1bGU6ZXZlbm9kZDtjbGlwLXJ1bGU6ZXZlbm9kZDtmaWxsOnVybCgjU1ZHSURfNV8pO30KCS5zdDZ7ZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7ZmlsbDojNzIyQjAwO30KCS5zdDd7ZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7ZmlsbDp1cmwoI1NWR0lEXzZfKTt9Cjwvc3R5bGU+CjxnPgoJPHBhdGggY2xhc3M9InN0MCIgZD0iTTQ4NS43LDY3Ny40YzIuNSwwLjgsNS4xLDEuNCw3LjcsMS43YzAsMC0xMC45LDQuMS0zMy40LTMuNmMwLDAtMTYuOS02LjktMjkuNS01LjcKCQljLTE0LjcsMS4zLTI0LjgsMjAuNC0yNC44LDIwLjRjMi45LTEuNiw2LTIuOCw5LjItMy42YzEwLTIsNi42LTAuMyw2LjYtMC4zcy0xOS4yLDguMS0yMC41LDE1LjJjLTAuMywxLjgsNS4xLTMuMywxOS4zLTIuOAoJCWMxNy41LDAuNSwzMi43LDEwLjcsMzguOSwxMi40YzEyLjgsMy40LDMxLjEsNC4yLDQ4LTljMCwwLDE1LjUtOS43LDIwLjMtMjcuN2MxLjItNSwyLTEwLjEsMi4yLTE1LjJjMC4xLTQuNS0wLjQtOS0xLjQtMTMuNQoJCUM1MjguMiw2NDUuNiw1MTkuMSw2NjYuNyw0ODUuNyw2NzcuNHoiLz4KCgkJPGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8xXyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI2MTYuMjE1MSIgeTE9Ijc0Ni4yNjQzIiB4Mj0iNjMzLjU3ODciIHkyPSIzMTUuMzk3OSIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDEyMDIpIj4KCQk8c3RvcCAgb2Zmc2V0PSIwIiBzdHlsZT0ic3RvcC1jb2xvcjojREFEQjQ4Ii8+CgkJPHN0b3AgIG9mZnNldD0iMC42NTYyIiBzdHlsZT0ic3RvcC1jb2xvcjojNjM3NjIxIi8+Cgk8L2xpbmVhckdyYWRpZW50PgoJPHBhdGggY2xhc3M9InN0MSIgZD0iTTgxNi4xLDg3NC45YzMzLjktNDIuNSw1Mi4zLTk1LjIsNTIuMy0xNDkuNmMwLTU0LjMtMTguNS0xMDcuMS01Mi4zLTE0OS42bDIxNy4xLTIzLjljMCwwLDIyLjYsNjEuOSwyOC41LDk1CgkJYzAuOCw0LjIsMi4xLDEyLjgsMi4xLDEyLjhzLTMzLjcsODEuOC04NS40LDEyNi43QzkwOSw4NDYuNyw4MTYuMSw4NzQuOSw4MTYuMSw4NzQuOXogTTMwMiw4NzEuOWwtODMuMiwxNS40CgkJYy0yNi40LTY2LjktMzYuMS0xMzkuMi0yOC4xLTIxMC42YzcuOS03MS41LDMzLjMtMTM5LjksNzMuNy0xOTkuM2MxLjgtMi42LDUuNC03LjcsNS40LTcuN2w5MS45LDI1OC45TDMwMiw4NzEuOXoiLz4KCgkJPGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8yXyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI2MjYuMjQ4IiB5MT0iOTcwLjIzNzEiIHgyPSI0MTUuMTU0MyIgeTI9Ijk3MC4yMzcxIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIC0xIDAgMTIwMikiPgoJCTxzdG9wICBvZmZzZXQ9IjAiIHN0eWxlPSJzdG9wLWNvbG9yOiNFQzZGMDEiLz4KCQk8c3RvcCAgb2Zmc2V0PSIxIiBzdHlsZT0ic3RvcC1jb2xvcjojRjRCMjNEIi8+Cgk8L2xpbmVhckdyYWRpZW50PgoJPHBhdGggY2xhc3M9InN0MiIgZD0iTTYwMy4xLDM0MC45YzAuMy0wLjQsMC41LTAuNSwwLjgtMC45YzIuMi0yLjQsNTMuOS01Ny45LTcuNy0xNTJjLTQ1LjUtNjkuMy0xNjEuMi02Ny40LTIwOC41LTEwMy41CgkJYzMuNSwyNy44LDMwLjcsNTIuOSwyNy44LDkwLjljLTEuMiwxMi42LTMuNSwyNS03LDM3LjFjLTUuNiwyMS43LTEwLjgsNDIuNC0zLDgyLjljNi4xLDMxLjYsMjAuNSw1NC42LDQyLjgsNjguNQoJCWMyNS42LDE1LjgsNjEsMTkuMyw5Ny4zLDkuNUM1NjkuOCwzNjYuOCw1OTEuNCwzNTQuNiw2MDMuMSwzNDAuOUw2MDMuMSwzNDAuOXoiLz4KCgkJPGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8zXyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI2MDkuMTIyMSIgeTE9IjkzNC43NDkiIHgyPSI1OTYuNjQ0MSIgeTI9IjExMzguNTYzNSIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDEyMDIpIj4KCQk8c3RvcCAgb2Zmc2V0PSIwIiBzdHlsZT0ic3RvcC1jb2xvcjojRjRCMzNFIi8+CgkJPHN0b3AgIG9mZnNldD0iMSIgc3R5bGU9InN0b3AtY29sb3I6I0ZCNkYxQiIvPgoJPC9saW5lYXJHcmFkaWVudD4KCTxwYXRoIGNsYXNzPSJzdDMiIGQ9Ik02ODAuMiwzMDAuM2MxMy4zLTIyLjksMTUuOC00OS42LDcuNi03OS4yYy0xMS40LTQxLjQtMzMtNjguNi01MC41LTkwLjRjLTUuNS02LjktMTAuNi0xMy4zLTE0LjgtMTkuNAoJCWMtMTYuNi0yNC40LTIzLjgtNTQtMjAuMi04My4yYy0yMS4xLDE1LjItNjEuNyw0My44LTg3LjYsNzQuM2MzNy41LDE4LDY2LjgsMzcuNiw4OS45LDcyLjljMzkuNSw2MC4yLDM4LjgsMTA4LjgsMzEuMywxMzkKCQljLTIuMSw4LjMsMTMuOCwxNS43LDEwLjksMjIuMUM2NjAuMywzMjYuOCw2NzEuNiwzMTQuNSw2ODAuMiwzMDAuM3oiLz4KCgkJPGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF80XyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSIyMzEuMDYzMyIgeTE9Ijc0My41NDg2IiB4Mj0iOTczLjUyOTIiIHkyPSI0NTAuMzA1MyIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDEyMDIpIj4KCQk8c3RvcCAgb2Zmc2V0PSIwIiBzdHlsZT0ic3RvcC1jb2xvcjojRkI2RDFBIi8+CgkJPHN0b3AgIG9mZnNldD0iMSIgc3R5bGU9InN0b3AtY29sb3I6I0YzQjIzRSIvPgoJPC9saW5lYXJHcmFkaWVudD4KCTxwYXRoIGNsYXNzPSJzdDQiIGQ9Ik05NjcuNyw1NTAuM2MtNDQuMS00LjItMTMzLjQtMTUuMS0xMzMuNC0xNS4xYy0yMDAuOS0xMS4yLTMxNC45LDQ5LjEtNDAwLjksMTI4Yy02Ni40LDY2LTEyNS42LDIzNy0xMjUuNiwyMzcKCQlsLTcxLjktMy45YzAsMCwyMi45LTY4LjIsNDkuNC0xMTcuOWMzMC40LTU2LjksMzcuMi01Mi4zLDMwLjMtNjEuN2MtMzIuMS00NC4xLTQ3LjItNzguOC02MC4xLTE1M2MwLDAsMTUuMSwxMS45LDI2LjUsNC42CgkJYzAsMC0yNS45LTQ1LTI5LjktOTMuNmMtNy4xLTg2LjEsMzMuMi0yMDMuNywzNC4yLTIwNi40Yy0wLjQsMS4yLTIuNSwxMS4zLDIxLjEsMjYuNGMxLjctNy4xLDMuNS0xNC4xLDUuNC0yMC45CgkJYzguMy00MC42LDMwLjYtMTI5LjMsNzUuMS0xODkuNGMwLDAsMjQuOSw4Ni45LDg3LjQsMTI2LjNjMTIxLjcsNzYuOCwxOTcuOSw3Ny4yLDE5Ny45LDc3LjJjMTcxLjksMTkuMiwyNDUuMywxMDMuNiwyNDUuMywxMDMuNgoJCUMxMDQxLjksNTI0LjYsMTE1NCw1MjMuNCwxMTU0LDUyMy40QzExMTMuNyw1NjEuOSw5NjcuNyw1NTAuMyw5NjcuNyw1NTAuM3ogTTI4Ni4yLDI2OC4zYzAsMCwwLTAuMSwwLTAuMUwyODYuMiwyNjguM3oiLz4KCgkJPGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF81XyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSIzOTcuNDM0OCIgeTE9IjMxNC44MjYxIiB4Mj0iMTEwMi40NjUyIiB5Mj0iNjI0LjcwNjYiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMCAxMjAyKSI+CgkJPHN0b3AgIG9mZnNldD0iMCIgc3R5bGU9InN0b3AtY29sb3I6I0YzQjYzRiIvPgoJCTxzdG9wICBvZmZzZXQ9IjEiIHN0eWxlPSJzdG9wLWNvbG9yOiNGQjcwMUMiLz4KCTwvbGluZWFyR3JhZGllbnQ+Cgk8cGF0aCBjbGFzcz0ic3Q1IiBkPSJNMTE1Ni4xLDUyMy40YzAsMC0xNy41LDk2LjgtMTA5LjIsMTA4LjFjMCwwLTMzMi42LTIuMS0zNTYuOSwzMDBsLTUuNiw4NC45bC0zOTktMTE2LjMKCQljMCwwLDM3LjYtMTI4LjMsMTE5LjktMjMxLjNjMCwwLDEzOS43LTE5Ny4zLDUzNy43LTE0NS4zYzAsMCw0Ni41LDkuNCwxMTEuNywxNS41QzExMDkuNyw1NDQuMSwxMTU2LjEsNTIzLjQsMTE1Ni4xLDUyMy40eiIvPgoJPHBhdGggY2xhc3M9InN0NiIgZD0iTTkyOS44LDQ3Ny4zYzAsMC04Ni40LTQ0LjktMTkzLjktNDAuN2MwLDAsNTguNS00NS43LDEzNy41LTM0LjVMOTI5LjgsNDc3LjN6Ii8+CgoJCTxsaW5lYXJHcmFkaWVudCBpZD0iU1ZHSURfNl8iIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iMzI0Ljc0IiB5MT0iODYuNzMzMyIgeDI9IjkzNS4xNDM4IiB5Mj0iNDY3LjMyNjYiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMCAxMjAyKSI+CgkJPHN0b3AgIG9mZnNldD0iMCIgc3R5bGU9InN0b3AtY29sb3I6I0VDNkYwMCIvPgoJCTxzdG9wICBvZmZzZXQ9IjEiIHN0eWxlPSJzdG9wLWNvbG9yOiNGNEIzM0UiLz4KCTwvbGluZWFyR3JhZGllbnQ+Cgk8cGF0aCBjbGFzcz0ic3Q3IiBkPSJNNzExLjMsODkwLjFjMCwwLDI4LjEsMTkuNCw3Mi43LDkuMWMwLDAtNzIuMSw0MS44LTIyNC4xLTE1LjVjMCwwLTE1Ni43LTcwLjEtMjY3LTU0LjEKCQljLTcwLjksMTAuMy0xMzMuNSw2Ni42LTE3MS41LDEwOS40Yy00NS44LDUxLjgtNDAuMSwyNy42LDc1LDEzLjNjMjcuNy0zLjQsMTEuNyw0LjQsMTEuNyw0LjRTNTQuNCwxMDIxLjIsNDQsMTA3OC41CgkJYy0yLjYsMTQuMyw0MC41LTI2LjEsMTU0LjItMjIuNWMxMzkuNiw0LjQsMjYxLDg1LjQsMzEwLjksOTguOGMxMDIuMiwyNy4zLDI0OC44LDMzLjYsMzgzLjMtNzEuOWMwLDAsMTI0LjEtNzcuOSwxNjIuNS0yMjEuOAoJCWMxMC0zOS45LDE1LjktODAuOCwxNy42LTEyMS45YzItNTMuNi0xNC4zLTExMC0xNC4zLTExMFM5NjcuNiw4MzAuMyw3MTEuMyw4OTAuMXoiLz4KPC9nPgo8L3N2Zz4K",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n,r;return(r=(n=window.foxwallet)==null?void 0:n.solana)!=null&&r.isFoxWallet?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isConnected)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.foxwallet.solana;let n;try{n=await e.getAccount()}catch(i){throw new qt(i==null?void 0:i.message,i)}let r;try{r=new X(n)}catch(i){throw new Sn(i==null?void 0:i.message,i)}this._wallet=e,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const UM={setVisible(t){console.error(_M("call","setVisible"))},visible:!1};Object.defineProperty(UM,"visible",{get(){return console.error(_M("read","visible")),!1}});function _M(t,e){return`You have tried to ${t} "${e}" on a WalletModalContext without providing one. Make sure to render a WalletModalProvider as an ancestor of the component that uses WalletModalContext`}const RM=oe.createContext(UM);function CM(){return oe.useContext(RM)}const Y4=t=>te.createElement("button",{className:`wallet-adapter-button ${t.className||""}`,disabled:t.disabled,style:t.style,onClick:t.onClick,tabIndex:t.tabIndex||0,type:"button"},t.startIcon&&te.createElement("i",{className:"wallet-adapter-button-start-icon"},t.startIcon),t.children,t.endIcon&&te.createElement("i",{className:"wallet-adapter-button-end-icon"},t.endIcon)),G4=({wallet:t,...e})=>t&&te.createElement("img",{src:t.adapter.icon,alt:`${t.adapter.name} icon`,...e}),py=({id:t,children:e,expanded:n=!1})=>{const r=oe.useRef(null),i=oe.useRef(!0),o="height 250ms ease-out",s=()=>{const l=r.current;l&&requestAnimationFrame(()=>{l.style.height=l.scrollHeight+"px"})},a=()=>{const l=r.current;l&&requestAnimationFrame(()=>{l.style.height=l.offsetHeight+"px",l.style.overflow="hidden",requestAnimationFrame(()=>{l.style.height="0"})})};return oe.useLayoutEffect(()=>{n?s():a()},[n]),oe.useLayoutEffect(()=>{const l=r.current;if(!l)return;function d(){l&&(l.style.overflow=n?"initial":"hidden",n&&(l.style.height="auto"))}function g(y){l&&y.target===l&&y.propertyName==="height"&&d()}return i.current&&(d(),i.current=!1),l.addEventListener("transitionend",g),()=>l.removeEventListener("transitionend",g)},[n]),te.createElement("div",{className:"wallet-adapter-collapse",id:t,ref:r,role:"region",style:{height:0,transition:i.current?void 0:o}},e)},Td=({handleClick:t,tabIndex:e,wallet:n})=>te.createElement("li",null,te.createElement(Y4,{onClick:t,startIcon:te.createElement(G4,{wallet:n}),tabIndex:e},n.adapter.name,n.readyState===$.Installed&&te.createElement("span",null,"Detected"))),H4=()=>te.createElement("svg",{width:"97",height:"96",viewBox:"0 0 97 96",fill:"none",xmlns:"http://www.w3.org/2000/svg"},te.createElement("circle",{cx:"48.5",cy:"48",r:"48",fill:"url(#paint0_linear_880_5115)",fillOpacity:"0.1"}),te.createElement("circle",{cx:"48.5",cy:"48",r:"47",stroke:"url(#paint1_linear_880_5115)",strokeOpacity:"0.4",strokeWidth:"2"}),te.createElement("g",{clipPath:"url(#clip0_880_5115)"},te.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)"}),te.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)"})),te.createElement("defs",null,te.createElement("linearGradient",{id:"paint0_linear_880_5115",x1:"3.41664",y1:"98.0933",x2:"103.05",y2:"8.42498",gradientUnits:"userSpaceOnUse"},te.createElement("stop",{stopColor:"#9945FF"}),te.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),te.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),te.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),te.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),te.createElement("stop",{offset:"1",stopColor:"#00D18C"})),te.createElement("linearGradient",{id:"paint1_linear_880_5115",x1:"3.41664",y1:"98.0933",x2:"103.05",y2:"8.42498",gradientUnits:"userSpaceOnUse"},te.createElement("stop",{stopColor:"#9945FF"}),te.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),te.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),te.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),te.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),te.createElement("stop",{offset:"1",stopColor:"#00D18C"})),te.createElement("linearGradient",{id:"paint2_linear_880_5115",x1:"25.9583",y1:"68.7101",x2:"67.2337",y2:"23.7879",gradientUnits:"userSpaceOnUse"},te.createElement("stop",{stopColor:"#9945FF"}),te.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),te.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),te.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),te.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),te.createElement("stop",{offset:"1",stopColor:"#00D18C"})),te.createElement("linearGradient",{id:"paint3_linear_880_5115",x1:"58.3326",y1:"49.4467",x2:"61.0002",y2:"45.4453",gradientUnits:"userSpaceOnUse"},te.createElement("stop",{stopColor:"#9945FF"}),te.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),te.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),te.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),te.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),te.createElement("stop",{offset:"1",stopColor:"#00D18C"})),te.createElement("clipPath",{id:"clip0_880_5115"},te.createElement("rect",{width:"48",height:"48",fill:"white",transform:"translate(24.5 24)"})))),K4=({className:t="",container:e="body"})=>{const n=oe.useRef(null),{wallets:r,select:i}=kM(),{setVisible:o}=CM(),[s,a]=oe.useState(!1),[l,d]=oe.useState(!1),[g,y]=oe.useState(null),[x,v]=oe.useMemo(()=>{const w=[],j=[],C=[];for(const B of r)B.readyState===$.NotDetected?C.push(B):B.readyState===$.Loadable?j.push(B):B.readyState===$.Installed&&w.push(B);let U=[],O=[];return w.length?(U=w,O=[...j,...C]):(j.length&&(U=j),O=C),[U,O]},[r]),A=oe.useCallback(()=>{d(!1),setTimeout(()=>o(!1),150)},[o]),k=oe.useCallback(w=>{w.preventDefault(),A()},[A]),D=oe.useCallback((w,j)=>{i(j),k(w)},[i,k]),I=oe.useCallback(()=>a(!s),[s]),M=oe.useCallback(w=>{const j=n.current;if(!j)return;const C=j.querySelectorAll("button"),U=C[0],O=C[C.length-1];w.shiftKey?document.activeElement===U&&(O.focus(),w.preventDefault()):document.activeElement===O&&(U.focus(),w.preventDefault())},[n]);return oe.useLayoutEffect(()=>{const w=C=>{C.key==="Escape"?A():C.key==="Tab"&&M(C)},{overflow:j}=window.getComputedStyle(document.body);return setTimeout(()=>d(!0),0),document.body.style.overflow="hidden",window.addEventListener("keydown",w,!1),()=>{document.body.style.overflow=j,window.removeEventListener("keydown",w,!1)}},[A,M]),oe.useLayoutEffect(()=>y(document.querySelector(e)),[e]),g&&Lw.createPortal(te.createElement("div",{"aria-labelledby":"wallet-adapter-modal-title","aria-modal":"true",className:`wallet-adapter-modal ${l&&"wallet-adapter-modal-fade-in"} ${t}`,ref:n,role:"dialog"},te.createElement("div",{className:"wallet-adapter-modal-container"},te.createElement("div",{className:"wallet-adapter-modal-wrapper"},te.createElement("button",{onClick:k,className:"wallet-adapter-modal-button-close"},te.createElement("svg",{width:"14",height:"14"},te.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"}))),x.length?te.createElement(te.Fragment,null,te.createElement("h1",{className:"wallet-adapter-modal-title"},"Connect a wallet on Solana to continue"),te.createElement("ul",{className:"wallet-adapter-modal-list"},x.map(w=>te.createElement(Td,{key:w.adapter.name,handleClick:j=>D(j,w.adapter.name),wallet:w})),v.length?te.createElement(py,{expanded:s,id:"wallet-adapter-modal-collapse"},v.map(w=>te.createElement(Td,{key:w.adapter.name,handleClick:j=>D(j,w.adapter.name),tabIndex:s?0:-1,wallet:w}))):null),v.length?te.createElement("button",{className:"wallet-adapter-modal-list-more",onClick:I,tabIndex:0},te.createElement("span",null,s?"Less ":"More ","options"),te.createElement("svg",{width:"13",height:"7",viewBox:"0 0 13 7",xmlns:"http://www.w3.org/2000/svg",className:`${s?"wallet-adapter-modal-list-more-icon-rotate":""}`},te.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):te.createElement(te.Fragment,null,te.createElement("h1",{className:"wallet-adapter-modal-title"},"You'll need a wallet on Solana to continue"),te.createElement("div",{className:"wallet-adapter-modal-middle"},te.createElement(H4,null)),v.length?te.createElement(te.Fragment,null,te.createElement("button",{className:"wallet-adapter-modal-list-more",onClick:I,tabIndex:0},te.createElement("span",null,s?"Hide ":"Already have a wallet? View ","options"),te.createElement("svg",{width:"13",height:"7",viewBox:"0 0 13 7",xmlns:"http://www.w3.org/2000/svg",className:`${s?"wallet-adapter-modal-list-more-icon-rotate":""}`},te.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"}))),te.createElement(py,{expanded:s,id:"wallet-adapter-modal-collapse"},te.createElement("ul",{className:"wallet-adapter-modal-list"},v.map(w=>te.createElement(Td,{key:w.adapter.name,handleClick:j=>D(j,w.adapter.name),tabIndex:s?0:-1,wallet:w}))))):null))),te.createElement("div",{className:"wallet-adapter-modal-overlay",onMouseDown:k})),g)},J4=({children:t,...e})=>{const[n,r]=oe.useState(!1);return te.createElement(RM.Provider,{value:{visible:n,setVisible:r}},t,n&&te.createElement(K4,{...e}))};const V0="-";function X4(t){const e=$4(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;function i(s){const a=s.split(V0);return a[0]===""&&a.length!==1&&a.shift(),OM(a,e)||q4(s)}function o(s,a){const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}return{getClassGroupId:i,getConflictingClassGroupIds:o}}function OM(t,e){var s;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?OM(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const o=t.join(V0);return(s=e.validators.find(({validator:a})=>a(o)))==null?void 0:s.classGroupId}const gy=/^\[(.+)\]$/;function q4(t){if(gy.test(t)){const e=gy.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}}function $4(t){const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return t2(Object.entries(t.classGroups),n).forEach(([o,s])=>{ih(s,r,o,e)}),r}function ih(t,e,n,r){t.forEach(i=>{if(typeof i=="string"){const o=i===""?e:yy(e,i);o.classGroupId=n;return}if(typeof i=="function"){if(e2(i)){ih(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,s])=>{ih(s,yy(e,o),n,r)})})}function yy(t,e){let n=t;return e.split(V0).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function e2(t){return t.isThemeGetter}function t2(t,e){return e?t.map(([n,r])=>{const i=r.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,a])=>[e+s,a])):o);return[n,i]}):t}function n2(t){if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;function i(o,s){n.set(o,s),e++,e>t&&(e=0,r=n,n=new Map)}return{get(o){let s=n.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){n.has(o)?n.set(o,s):i(o,s)}}}const BM="!";function r2(t){const e=t.separator,n=e.length===1,r=e[0],i=e.length;return function(s){const a=[];let l=0,d=0,g;for(let k=0;kd?g-d:void 0;return{modifiers:a,hasImportantModifier:x,baseClassName:v,maybePostfixModifierPosition:A}}}function i2(t){if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e}function o2(t){return{cache:n2(t.cacheSize),splitModifiers:r2(t),...X4(t)}}const s2=/\s+/;function a2(t,e){const{splitModifiers:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,o=new Set;return t.trim().split(s2).map(s=>{const{modifiers:a,hasImportantModifier:l,baseClassName:d,maybePostfixModifierPosition:g}=n(s);let y=r(g?d.substring(0,g):d),x=!!g;if(!y){if(!g)return{isTailwindClass:!1,originalClassName:s};if(y=r(d),!y)return{isTailwindClass:!1,originalClassName:s};x=!1}const v=i2(a).join(":");return{isTailwindClass:!0,modifierId:l?v+BM:v,classGroupId:y,originalClassName:s,hasPostfixModifier:x}}).reverse().filter(s=>{if(!s.isTailwindClass)return!0;const{modifierId:a,classGroupId:l,hasPostfixModifier:d}=s,g=a+l;return o.has(g)?!1:(o.add(g),i(l,d).forEach(y=>o.add(a+y)),!0)}).reverse().map(s=>s.originalClassName).join(" ")}function l2(){let t=0,e,n,r="";for(;ty(g),t());return n=o2(d),r=n.cache.get,i=n.cache.set,o=a,a(l)}function a(l){const d=r(l);if(d)return d;const g=a2(l,n);return i(l,g),g}return function(){return o(l2.apply(null,arguments))}}function it(t){const e=n=>n[t]||[];return e.isThemeGetter=!0,e}const WM=/^\[(?:([a-z-]+):)?(.+)\]$/i,u2=/^\d+\/\d+$/,d2=new Set(["px","full","screen"]),f2=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,h2=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,p2=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,g2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function fr(t){return lo(t)||d2.has(t)||u2.test(t)}function gi(t){return Ds(t,"length",I2)}function lo(t){return!!t&&!Number.isNaN(Number(t))}function hl(t){return Ds(t,"number",lo)}function Vs(t){return!!t&&Number.isInteger(Number(t))}function y2(t){return t.endsWith("%")&&lo(t.slice(0,-1))}function be(t){return WM.test(t)}function yi(t){return f2.test(t)}const m2=new Set(["length","size","percentage"]);function w2(t){return Ds(t,m2,VM)}function M2(t){return Ds(t,"position",VM)}const N2=new Set(["image","url"]);function v2(t){return Ds(t,N2,k2)}function S2(t){return Ds(t,"",b2)}function Ps(){return!0}function Ds(t,e,n){const r=WM.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1}function I2(t){return h2.test(t)}function VM(){return!1}function b2(t){return p2.test(t)}function k2(t){return g2.test(t)}function E2(){const t=it("colors"),e=it("spacing"),n=it("blur"),r=it("brightness"),i=it("borderColor"),o=it("borderRadius"),s=it("borderSpacing"),a=it("borderWidth"),l=it("contrast"),d=it("grayscale"),g=it("hueRotate"),y=it("invert"),x=it("gap"),v=it("gradientColorStops"),A=it("gradientColorStopPositions"),k=it("inset"),D=it("margin"),I=it("opacity"),M=it("padding"),w=it("saturate"),j=it("scale"),C=it("sepia"),U=it("skew"),O=it("space"),B=it("translate"),Y=()=>["auto","contain","none"],G=()=>["auto","hidden","clip","visible","scroll"],q=()=>["auto",be,e],ie=()=>[be,e],R=()=>["",fr,gi],c=()=>["auto",lo,be],p=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],S=()=>["solid","dashed","dotted","double","none"],z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"],b=()=>["start","end","center","between","around","evenly","stretch"],N=()=>["","0",be],T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],m=()=>[lo,hl],u=()=>[lo,be];return{cacheSize:500,separator:":",theme:{colors:[Ps],spacing:[fr,gi],blur:["none","",yi,be],brightness:m(),borderColor:[t],borderRadius:["none","","full",yi,be],borderSpacing:ie(),borderWidth:R(),contrast:m(),grayscale:N(),hueRotate:u(),invert:N(),gap:ie(),gradientColorStops:[t],gradientColorStopPositions:[y2,gi],inset:q(),margin:q(),opacity:m(),padding:ie(),saturate:m(),scale:m(),sepia:N(),skew:u(),space:ie(),translate:ie()},classGroups:{aspect:[{aspect:["auto","square","video",be]}],container:["container"],columns:[{columns:[yi]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...p(),be]}],overflow:[{overflow:G()}],"overflow-x":[{"overflow-x":G()}],"overflow-y":[{"overflow-y":G()}],overscroll:[{overscroll:Y()}],"overscroll-x":[{"overscroll-x":Y()}],"overscroll-y":[{"overscroll-y":Y()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[k]}],"inset-x":[{"inset-x":[k]}],"inset-y":[{"inset-y":[k]}],start:[{start:[k]}],end:[{end:[k]}],top:[{top:[k]}],right:[{right:[k]}],bottom:[{bottom:[k]}],left:[{left:[k]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Vs,be]}],basis:[{basis:q()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",be]}],grow:[{grow:N()}],shrink:[{shrink:N()}],order:[{order:["first","last","none",Vs,be]}],"grid-cols":[{"grid-cols":[Ps]}],"col-start-end":[{col:["auto",{span:["full",Vs,be]},be]}],"col-start":[{"col-start":c()}],"col-end":[{"col-end":c()}],"grid-rows":[{"grid-rows":[Ps]}],"row-start-end":[{row:["auto",{span:[Vs,be]},be]}],"row-start":[{"row-start":c()}],"row-end":[{"row-end":c()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",be]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",be]}],gap:[{gap:[x]}],"gap-x":[{"gap-x":[x]}],"gap-y":[{"gap-y":[x]}],"justify-content":[{justify:["normal",...b()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...b(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...b(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[M]}],px:[{px:[M]}],py:[{py:[M]}],ps:[{ps:[M]}],pe:[{pe:[M]}],pt:[{pt:[M]}],pr:[{pr:[M]}],pb:[{pb:[M]}],pl:[{pl:[M]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[O]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[O]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",be,e]}],"min-w":[{"min-w":["min","max","fit",be,fr]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[yi]},yi,be]}],h:[{h:[be,e,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",fr,be]}],"max-h":[{"max-h":[be,e,"min","max","fit"]}],"font-size":[{text:["base",yi,gi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",hl]}],"font-family":[{font:[Ps]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",be]}],"line-clamp":[{"line-clamp":["none",lo,hl]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",fr,be]}],"list-image":[{"list-image":["none",be]}],"list-style-type":[{list:["none","disc","decimal",be]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[I]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[I]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...S(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",fr,gi]}],"underline-offset":[{"underline-offset":["auto",fr,be]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:ie()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",be]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[I]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...p(),M2]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",w2]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},v2]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[A]}],"gradient-via-pos":[{via:[A]}],"gradient-to-pos":[{to:[A]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[I]}],"border-style":[{border:[...S(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[I]}],"divide-style":[{divide:S()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...S()]}],"outline-offset":[{"outline-offset":[fr,be]}],"outline-w":[{outline:[fr,gi]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:R()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[I]}],"ring-offset-w":[{"ring-offset":[fr,gi]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",yi,S2]}],"shadow-color":[{shadow:[Ps]}],opacity:[{opacity:[I]}],"mix-blend":[{"mix-blend":z()}],"bg-blend":[{"bg-blend":z()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",yi,be]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[g]}],invert:[{invert:[y]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[g]}],"backdrop-invert":[{"backdrop-invert":[y]}],"backdrop-opacity":[{"backdrop-opacity":[I]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",be]}],duration:[{duration:u()}],ease:[{ease:["linear","in","out","in-out",be]}],delay:[{delay:u()}],animate:[{animate:["none","spin","ping","pulse","bounce",be]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[Vs,be]}],"translate-x":[{"translate-x":[B]}],"translate-y":[{"translate-y":[B]}],"skew-x":[{"skew-x":[U]}],"skew-y":[{"skew-y":[U]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",be]}],accent:[{accent:["auto",t]}],appearance:["appearance-none"],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",be]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ie()}],"scroll-mx":[{"scroll-mx":ie()}],"scroll-my":[{"scroll-my":ie()}],"scroll-ms":[{"scroll-ms":ie()}],"scroll-me":[{"scroll-me":ie()}],"scroll-mt":[{"scroll-mt":ie()}],"scroll-mr":[{"scroll-mr":ie()}],"scroll-mb":[{"scroll-mb":ie()}],"scroll-ml":[{"scroll-ml":ie()}],"scroll-p":[{"scroll-p":ie()}],"scroll-px":[{"scroll-px":ie()}],"scroll-py":[{"scroll-py":ie()}],"scroll-ps":[{"scroll-ps":ie()}],"scroll-pe":[{"scroll-pe":ie()}],"scroll-pt":[{"scroll-pt":ie()}],"scroll-pr":[{"scroll-pr":ie()}],"scroll-pb":[{"scroll-pb":ie()}],"scroll-pl":[{"scroll-pl":ie()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",be]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[fr,gi,hl]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}const x2=c2(E2),T2=t=>at.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 56 64",...t,children:[at.jsx("path",{stroke:"currentColor",strokeLinejoin:"round",d:"m28 4 .015 13.1M52.46 46.01l-11.137-6.555M4.099 46.01l11.137-6.555"}),at.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M28.009 32.01 15 24.49l13.009-7.518L41 24.52l-12.991 7.49Z"}),at.jsx("path",{stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"2",d:"m28.02 46.969-13.003-7.463L15 24.49l13.02 7.52V46.97Z"}),at.jsx("path",{stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"2",d:"m28 46.969 13.003-7.43V24.521L28 32.01v14.958Z"}),at.jsx("path",{stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"3",d:"M52 46.01V18.032L28 4.042 4 18.032V46.01L28 60l24-13.99Z"}),at.jsx("path",{stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"3",d:"M4.04 18.056 28 32.047l24.04-13.99"}),at.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"3",d:"M28 32.046V60"})]}),A2=oe.lazy(()=>Ba(()=>import("./widget-7424685c.js"),["assets/widget-7424685c.js","assets/punycode-e9579d2a.js"])),D2=({rootWrapperClassNames:t,rootWrapperStyles:e,isDark:n,...r})=>{const[i,o]=oe.useState(!1);return at.jsxs("div",{className:x2("bonfida-widget-root sns-bw",t,n&&"dark"),style:e,children:[at.jsx("button",{onClick:()=>o(!i),className:"w-[50px] h-[50px] rounded-full bg-background-primary overflow-hidden text-text-primary p-2 flex items-center justify-center shadow-xl dark:border dark:border-interactive-border",type:"button","aria-label":i?"Close SNS widget":"Open SNS widget","aria-haspopup":"true",tabIndex:0,children:at.jsx(T2,{className:"w-full h-full"})}),i&&at.jsx(oe.Suspense,{children:at.jsx(A2,{...r})})]})};const L2="https://helius-proxy.bonfida.com",z2=({children:t})=>at.jsx(a4,{autoConnect:!0,wallets:[new B4,new W4,new E4,new N4,new h4,new b4,new S4,new c4,new T4,new P4,new D4,new z4,new Z4],children:at.jsx(J4,{children:t})}),j2=()=>{const t=kM(),{visible:e,setVisible:n}=CM(),[r,i]=oe.useState(!1);return at.jsxs("div",{className:"p-10",children:[at.jsx("h1",{className:"text-[40px] text-center text-white font-medium",children:"SNS Widget Demo"}),at.jsx("div",{className:"mt-10",children:at.jsx("button",{className:"p-3 bg-white rounded-[24px] font-medium",onClick:()=>i(!r),children:"Toggle dark"})}),at.jsx(D2,{endpoint:L2,passthroughWallet:{...t,visible:e,setVisible:n},isDark:r})]})};function U2(){return at.jsx(z2,{children:at.jsx(j2,{})})}const _2="/sns-widget/assets/preview-bg-7f26f3aa.png";Ad.createRoot(document.getElementById("root")).render(at.jsx(te.StrictMode,{children:at.jsx("div",{style:{backgroundImage:`url(${_2})`,backgroundSize:"cover",height:"100vh",width:"100vw"},children:at.jsx(U2,{})})}));export{Tf as A,C2 as B,Mx as C,R2 as D,Fx as E,Ue as F,mT as G,x2 as H,Le as I,wT as J,_I as K,Rx as L,qr as M,_f as N,Kt as O,X as P,Uo as Q,te as R,B4 as S,Xe as T,ws as V,a4 as W,Cx as a,ye as b,vr as c,Wt as d,t1 as e,Or as f,my as g,kM as h,V2 as i,at as j,CM as k,J4 as l,st as m,L1 as n,_e as o,de as p,ue as q,oe as r,_c as s,sb as t,Ox as u,cn as v,fg as w,Ms as x,Lr as y,Rf as z}; +`,e)}return Fn}function cy(...t){var e;return t=t.filter(n=>!zl.has(n)),t.length?(t.forEach(n=>zl.add(n)),(e=Ko.register)==null||e.forEach(n=>Hf(()=>n(...t))),function(){var r;t.forEach(i=>zl.delete(i)),(r=Ko.unregister)==null||r.forEach(i=>Hf(()=>i(...t)))}):()=>{}}function KT(){return[...zl]}function JT(t,e){var n;return(n=Ko[t])!=null&&n.push(e)||(Ko[t]=[e]),function(){var i;Ko[t]=(i=Ko[t])==null?void 0:i.filter(o=>e!==o)}}function Hf(t){try{t()}catch(e){console.error(e)}}class XT extends Event{constructor(e){super("wallet-standard:app-ready",{bubbles:!1,cancelable:!1,composed:!1}),Ll.set(this,void 0),YT(this,Ll,e,"f")}get detail(){return GT(this,Ll,"f")}get type(){return"wallet-standard:app-ready"}preventDefault(){throw new Error("preventDefault cannot be called")}stopImmediatePropagation(){throw new Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw new Error("stopPropagation cannot be called")}}Ll=new WeakMap;function qT(){if(Fn||(Fn=HT(),typeof window>"u"))return Fn;const t=window.navigator.wallets||[];if(!Array.isArray(t))return console.error("window.navigator.wallets is not an array"),Fn;const{register:e}=Fn,n=(...r)=>r.forEach(i=>Hf(()=>i({register:e})));try{Object.defineProperty(window.navigator,"wallets",{value:Object.freeze({push:n})})}catch{return console.error("window.navigator.wallets could not be set"),Fn}return n(...t),Fn}function $T(t){const e=uy(()=>new Set),{get:n,on:r}=uy(()=>qT()),[i,o]=oe.useState(()=>dy(n()));oe.useEffect(()=>{const a=[r("register",(...l)=>o(d=>[...d,...dy(l)])),r("unregister",(...l)=>o(d=>d.filter(g=>l.some(y=>y===g.wallet))))];return()=>a.forEach(l=>l())},[r]);const s=e4(i);return oe.useEffect(()=>{if(!s)return;const a=new Set(i);new Set(s.filter(d=>!a.has(d))).forEach(d=>d.destroy())},[s,i]),oe.useEffect(()=>()=>i.forEach(a=>a.destroy()),[]),oe.useMemo(()=>[...i,...t.filter(({name:a})=>i.some(l=>l.name===a)?(e.has(a)||(e.add(a),console.warn(`${a} was registered as a Standard Wallet. The Wallet Adapter for ${a} can be removed from your app.`)),!1):!0)],[i,t,e])}function uy(t){const e=oe.useRef();return e.current||(e.current={value:t()}),e.current.value}function e4(t){const e=oe.useRef();return oe.useEffect(()=>{e.current=t}),e.current}function dy(t){return t.filter(ZT).map(e=>new QT({wallet:e}))}var ss;(function(t){t[t.DESKTOP_WEB=0]="DESKTOP_WEB",t[t.MOBILE_WEB=1]="MOBILE_WEB"})(ss||(ss={}));function t4(t){return/(WebView|Version\/.+(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+)|; wv\).+(Chrome)\/(\d+)\.(\d+)\.(\d+)\.(\d+))/i.test(t)}function n4({adapters:t,userAgentString:e}){return t.some(n=>n.name!==Mi&&n.readyState===$.Installed)?ss.DESKTOP_WEB:e&&/android/i.test(e)&&!t4(e)?ss.MOBILE_WEB:ss.DESKTOP_WEB}function r4(t){return t?/devnet/i.test(t)?"devnet":/testnet/i.test(t)?"testnet":"mainnet-beta":"mainnet-beta"}function i4({children:t,wallets:e,adapter:n,isUnloadingRef:r,onAutoConnectRequest:i,onConnectError:o,onError:s,onSelectWallet:a}){const l=oe.useRef(!1),[d,g]=oe.useState(!1),y=oe.useRef(!1),[x,v]=oe.useState(!1),[A,k]=oe.useState(()=>(n==null?void 0:n.publicKey)??null),[D,I]=oe.useState(()=>(n==null?void 0:n.connected)??!1),M=oe.useRef(s);oe.useEffect(()=>(M.current=s,()=>{M.current=void 0}),[s]);const w=oe.useRef((p,S)=>(r.current||(M.current?M.current(p,S):(console.error(p,S),p instanceof en&&typeof window<"u"&&S&&window.open(S.url,"_blank"))),p)),[j,C]=oe.useState(()=>e.map(p=>({adapter:p,readyState:p.readyState})).filter(({readyState:p})=>p!==$.Unsupported));oe.useEffect(()=>{C(S=>e.map((z,b)=>{const N=S[b];return N&&N.adapter===z&&N.readyState===z.readyState?N:{adapter:z,readyState:z.readyState}}).filter(({readyState:z})=>z!==$.Unsupported));function p(S){C(z=>{const b=z.findIndex(({adapter:T})=>T===this);if(b===-1)return z;const{adapter:N}=z[b];return[...z.slice(0,b),{adapter:N,readyState:S},...z.slice(b+1)].filter(({readyState:T})=>T!==$.Unsupported)})}return e.forEach(S=>S.on("readyStateChange",p,S)),()=>{e.forEach(S=>S.off("readyStateChange",p,S))}},[n,e]);const U=oe.useMemo(()=>j.find(p=>p.adapter===n)??null,[n,j]);oe.useEffect(()=>{if(!n)return;const p=b=>{k(b),l.current=!1,g(!1),I(!0),y.current=!1,v(!1)},S=()=>{r.current||(k(null),l.current=!1,g(!1),I(!1),y.current=!1,v(!1))},z=b=>{w.current(b,n)};return n.on("connect",p),n.on("disconnect",S),n.on("error",z),()=>{n.off("connect",p),n.off("disconnect",S),n.off("error",z),S()}},[n,r]);const O=oe.useRef(!1);oe.useEffect(()=>()=>{O.current=!1},[n]),oe.useEffect(()=>{O.current||l.current||D||!i||!((U==null?void 0:U.readyState)===$.Installed||(U==null?void 0:U.readyState)===$.Loadable)||(l.current=!0,g(!0),O.current=!0,async function(){try{await i()}catch{o()}finally{g(!1),l.current=!1}}())},[D,i,o,U]);const B=oe.useCallback(async(p,S,z)=>{if(!n)throw w.current(new ey);if(!D)throw w.current(new me,n);return await n.sendTransaction(p,S,z)},[n,D]),Y=oe.useMemo(()=>n&&"signTransaction"in n?async p=>{if(!D)throw w.current(new me,n);return await n.signTransaction(p)}:void 0,[n,D]),G=oe.useMemo(()=>n&&"signAllTransactions"in n?async p=>{if(!D)throw w.current(new me,n);return await n.signAllTransactions(p)}:void 0,[n,D]),q=oe.useMemo(()=>n&&"signMessage"in n?async p=>{if(!D)throw w.current(new me,n);return await n.signMessage(p)}:void 0,[n,D]),ie=oe.useMemo(()=>n&&"signIn"in n?async p=>await n.signIn(p):void 0,[n]),R=oe.useCallback(async()=>{if(l.current||y.current||U!=null&&U.adapter.connected)return;if(!U)throw w.current(new ey);const{adapter:p,readyState:S}=U;if(!(S===$.Installed||S===$.Loadable))throw w.current(new en,p);l.current=!0,g(!0);try{await p.connect()}catch(z){throw o(),z}finally{g(!1),l.current=!1}},[o,U]),c=oe.useCallback(async()=>{if(!y.current&&n){y.current=!0,v(!0);try{await n.disconnect()}finally{v(!1),y.current=!1}}},[n]);return te.createElement(bM.Provider,{value:{autoConnect:!!i,wallets:j,wallet:U,publicKey:A,connected:D,connecting:d,disconnecting:x,select:a,connect:R,disconnect:c,sendTransaction:B,signTransaction:Y,signAllTransactions:G,signMessage:q,signIn:ie}},t)}let Ed;function o4(){var t;return Ed===void 0&&(Ed=((t=globalThis.navigator)==null?void 0:t.userAgent)??null),Ed}function dl(t){const e=o4();return n4({adapters:t,userAgentString:e})===ss.MOBILE_WEB}function s4(){const t=globalThis.location;if(t)return`${t.protocol}//${t.host}`}function a4({children:t,wallets:e,autoConnect:n,localStorageKey:r="walletName",onError:i}){const{connection:o}=Ox(),s=$T(e),a=oe.useMemo(()=>{if(!dl(s))return null;const M=s.find(w=>w.name===Mi);return M||new kT({addressSelector:ET(),appIdentity:{uri:s4()},authorizationResultCache:xT(),cluster:r4(o==null?void 0:o.rpcEndpoint),onWalletNotFound:AT()})},[s,o==null?void 0:o.rpcEndpoint]),l=oe.useMemo(()=>a==null||s.indexOf(a)!==-1?s:[a,...s],[s,a]),[d,g]=Px(r,dl(s)?Mi:null),y=oe.useMemo(()=>l.find(M=>M.name===d)??null,[l,d]),x=oe.useCallback(M=>{d!==M&&(y&&y.name!==Mi&&y.disconnect(),g(M))},[y,g,d]);oe.useEffect(()=>{if(!y)return;function M(){k.current||d===Mi&&dl(s)||g(null)}return y.on("disconnect",M),()=>{y.off("disconnect",M)}},[y,s,g,d]);const v=oe.useRef(!1),A=oe.useMemo(()=>{if(!(!n||!y))return async()=>{(n===!0||await n(y))&&(v.current?await y.connect():await y.autoConnect())}},[n,y]),k=oe.useRef(!1);oe.useEffect(()=>{if(d===Mi&&dl(s)){k.current=!1;return}function M(){k.current=!0}return window.addEventListener("beforeunload",M),()=>{window.removeEventListener("beforeunload",M)}},[s,d]);const D=oe.useCallback(()=>{y&&y.name!==Mi&&x(null)},[y,x]),I=oe.useCallback(M=>{v.current=!0,x(M)},[x]);return te.createElement(i4,{wallets:l,adapter:y,isUnloadingRef:k,onAutoConnectRequest:A,onConnectError:D,onError:i,onSelectWallet:I},t)}const l4="BitKeep";class c4 extends Xn{constructor(e={}){super(),this.name=l4,this.url="https://bitkeep.com",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTI4IiBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIxMjgiIGhlaWdodD0iMTI4IiByeD0iNjQiIGZpbGw9IiM3NTI0RjkiLz4KPHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xMDIgNDUuNjAyN1Y0OS44MjA0QzEwMi4wMDEgNTAuMjI4MyAxMDEuODkzIDUwLjYyOTIgMTAxLjY4NyA1MC45ODI3QzEwMS40ODEgNTEuMzM2MSAxMDEuMTg1IDUxLjYyOTYgMTAwLjgyOCA1MS44MzM1TDg3LjA5MDggNTkuNjgwMUw5OS4zNjMzIDY2LjY3MUMxMDAuMTY1IDY3LjEyOTUgMTAwLjgzMSA2Ny43ODkyIDEwMS4yOTQgNjguNTgzNkMxMDEuNzU3IDY5LjM3OCAxMDIuMDAxIDcwLjI3OTEgMTAyIDcxLjE5NjJWODIuNDQyNEMxMDIuMDAxIDgzLjM2IDEwMS43NTggODQuMjYxNyAxMDEuMjk1IDg1LjA1NjdDMTAwLjgzMiA4NS44NTE2IDEwMC4xNjYgODYuNTExNyA5OS4zNjMzIDg2Ljk3MDVMNjcuMDg2OSAxMDUuM0M2Ni4yODUzIDEwNS43NTkgNjUuMzc1OSAxMDYgNjQuNDUwMiAxMDZDNjMuNTI0NSAxMDYgNjIuNjE1MSAxMDUuNzU5IDYxLjgxMzUgMTA1LjNMNTEuMjUyIDk5LjI2MTFDNTEuMDczNyA5OS4xNTkzIDUwLjkyNTYgOTkuMDEyOCA1MC44MjI3IDk4LjgzNjNDNTAuNzE5OCA5OC42NTk5IDUwLjY2NTYgOTguNDU5NyA1MC42NjU2IDk4LjI1NkM1MC42NjU2IDk4LjA1MjIgNTAuNzE5OCA5Ny44NTIgNTAuODIyNyA5Ny42NzU2QzUwLjkyNTYgOTcuNDk5MSA1MS4wNzM3IDk3LjM1MjcgNTEuMjUyIDk3LjI1MDhMODYuMTE1MiA3Ny4zODM1Qzg2LjIwNCA3Ny4zMzI1IDg2LjI3NzcgNzcuMjU5MyA4Ni4zMjkgNzcuMTcxMkM4Ni4zODAyIDc3LjA4MzIgODYuNDA3MiA3Ni45ODMzIDg2LjQwNzIgNzYuODgxN0M4Ni40MDcyIDc2Ljc4IDg2LjM4MDIgNzYuNjgwMiA4Ni4zMjkgNzYuNTkyMUM4Ni4yNzc3IDc2LjUwNCA4Ni4yMDQgNzYuNDMwOCA4Ni4xMTUyIDc2LjM3OThMNzMuMTcxOSA2OC45NzcxQzcyLjgxNTYgNjguNzczNCA3Mi40MTE0IDY4LjY2NjIgNzIgNjguNjY2MkM3MS41ODg2IDY4LjY2NjIgNzEuMTg0NCA2OC43NzM0IDcwLjgyODEgNjguOTc3MUwzNS40MTcgODkuMTcyMkMzNS4xNDk4IDg5LjMyNSAzNC44NDY3IDg5LjQwNTQgMzQuNTM4MSA4OS40MDU0QzM0LjIyOTUgODkuNDA1NCAzMy45MjY0IDg5LjMyNSAzMy42NTkyIDg5LjE3MjJMMjkuNjQ4NCA4Ni45MDA5QzI4Ljg0MjQgODYuNDQyOCAyOC4xNzI5IDg1Ljc4MiAyNy43MDc4IDg0Ljk4NTNDMjcuMjQyNyA4NC4xODg2IDI2Ljk5ODUgODMuMjg0MyAyNyA4Mi4zNjQxVjc3Ljc2NjRDMjYuOTk5OCA3Ny40NjA3IDI3LjA4MDkgNzcuMTYwMyAyNy4yMzUyIDc2Ljg5NTVDMjcuMzg5NSA3Ni42MzA3IDI3LjYxMTUgNzYuNDEwOSAyNy44Nzg5IDc2LjI1OEw3OC42NTA0IDQ3LjM2OTNDNzguNzM5MiA0Ny4zMTgzIDc4LjgxMjkgNDcuMjQ1MSA3OC44NjQxIDQ3LjE1N0M3OC45MTU0IDQ3LjA2ODkgNzguOTQyMyA0Ni45NjkxIDc4Ljk0MjMgNDYuODY3NEM3OC45NDIzIDQ2Ljc2NTggNzguOTE1NCA0Ni42NjU5IDc4Ljg2NDEgNDYuNTc3OUM3OC44MTI5IDQ2LjQ4OTggNzguNzM5MiA0Ni40MTY2IDc4LjY1MDQgNDYuMzY1Nkw2NS42ODY1IDM4LjkzNjdDNjUuMzMwMiAzOC43MzMxIDY0LjkyNjEgMzguNjI1OCA2NC41MTQ2IDM4LjYyNThDNjQuMTAzMiAzOC42MjU4IDYzLjY5OTEgMzguNzMzMSA2My4zNDI4IDM4LjkzNjdMMjguNzU3OCA1OC42M0MyOC41Nzk4IDU4LjczMTggMjguMzc3OCA1OC43ODU0IDI4LjE3MjIgNTguNzg1NUMyNy45NjY2IDU4Ljc4NTUgMjcuNzY0NiA1OC43MzIgMjcuNTg2NSA1OC42MzAzQzI3LjQwODQgNTguNTI4NiAyNy4yNjA0IDU4LjM4MjMgMjcuMTU3NSA1OC4yMDYxQzI3LjA1NDUgNTguMDI5OSAyNy4wMDAyIDU3LjgzIDI3IDU3LjYyNjRWNDUuNTQ3NkMyNi45OTg5IDQ0LjYzIDI3LjI0MiA0My43MjgzIDI3LjcwNDkgNDIuOTMzNEMyOC4xNjc4IDQyLjEzODQgMjguODM0MSA0MS40NzgzIDI5LjYzNjcgNDEuMDE5NUw2MS45MDcyIDIyLjY5NTRDNjIuNzA3MSAyMi4yMzk4IDYzLjYxMzggMjIgNjQuNTM2NiAyMkM2NS40NTk0IDIyIDY2LjM2NjEgMjIuMjM5OCA2Ny4xNjYgMjIuNjk1NEw5OS4zNjMzIDQxLjA4MzNDMTAwLjE2NSA0MS41NDE0IDEwMC44MyA0Mi4yMDAxIDEwMS4yOTMgNDIuOTkzNEMxMDEuNzU2IDQzLjc4NjcgMTAyIDQ0LjY4NjYgMTAyIDQ1LjYwMjdaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n,r;return(r=(n=window.bitkeep)==null?void 0:n.solana)!=null&&r.isBitKeep?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.bitkeep.solana;let n;try{n=await e.getAccount()}catch(i){throw new qt(i==null?void 0:i.message,i)}let r;try{r=new X(n)}catch(i){throw new Sn(i==null?void 0:i.message,i)}this._wallet=e,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const u4="modulepreload",d4=function(t){return"/sns-widget/"+t},fy={},Ba=function(e,n,r){if(!n||n.length===0)return e();const i=document.getElementsByTagName("link");return Promise.all(n.map(o=>{if(o=d4(o),o in fy)return;fy[o]=!0;const s=o.endsWith(".css"),a=s?'[rel="stylesheet"]':"";if(!!r)for(let g=i.length-1;g>=0;g--){const y=i[g];if(y.href===o&&(!s||y.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${o}"]${a}`))return;const d=document.createElement("link");if(d.rel=s?"stylesheet":u4,s||(d.as="script",d.crossOrigin=""),d.href=o,document.head.appendChild(d),s)return new Promise((g,y)=>{d.addEventListener("load",g),d.addEventListener("error",()=>y(new Error(`Unable to preload CSS for ${o}`)))})})).then(()=>e()).catch(o=>{const s=new Event("vite:preloadError",{cancelable:!0});if(s.payload=o,window.dispatchEvent(s),!s.defaultPrevented)throw o})},f4="Clover";class h4 extends Xn{constructor(e={}){super(),this.name=f4,this.url="https://clv.org",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDgiIGhlaWdodD0iNDgiIHZpZXdCb3g9IjAgMCA0OCA0OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTM2LjQ4IDBIMTEuNTJDNS4xNTc2OCAwIDAgNS4xNTc2OCAwIDExLjUyVjM2LjQ4QzAgNDIuODQyMyA1LjE1NzY4IDQ4IDExLjUyIDQ4SDM2LjQ4QzQyLjg0MjMgNDggNDggNDIuODQyMyA0OCAzNi40OFYxMS41MkM0OCA1LjE1NzY4IDQyLjg0MjMgMCAzNi40OCAwWiIgZmlsbD0idXJsKCNwYWludDBfbGluZWFyXzc5MTBfMTYzMzUxKSIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTI0LjAwMDYgMzkuMzYwNkMzMi40ODM3IDM5LjM2MDYgMzkuMzYwNiAzMi40ODM3IDM5LjM2MDYgMjQuMDAwNkMzOS4zNjA2IDE1LjUxNzUgMzIuNDgzNyA4LjY0MDYyIDI0LjAwMDYgOC42NDA2MkMxNS41MTc1IDguNjQwNjIgOC42NDA2MiAxNS41MTc1IDguNjQwNjIgMjQuMDAwNkM4LjY0MDYyIDMyLjQ4MzcgMTUuNTE3NSAzOS4zNjA2IDI0LjAwMDYgMzkuMzYwNlpNMjEuMjg5OSAxNS44Njg4SDI2LjcxMVYyMS4zNDdIMjEuMjkwNFYyNi42NTRIMjYuNzExVjMyLjEzMjJIMjEuMjg5OVYyNi44MjUySDE1Ljg2OTNWMjEuMzQ3SDIxLjI4OTlWMTUuODY4OFpNMjYuNzEyIDIxLjM0N0gzMi4xMzMxVjI2LjgyNTJIMjYuNzEyVjIxLjM0N1oiIGZpbGw9ImJsYWNrIi8+CjxkZWZzPgo8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfNzkxMF8xNjMzNTEiIHgxPSI0OCIgeTE9Ii0xLjQzMDUxZS0wNiIgeDI9IjEuNDMwNTFlLTA2IiB5Mj0iNDgiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0E5RkZFMCIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiM4NkQ1RkYiLz4KPC9saW5lYXJHcmFkaWVudD4KPC9kZWZzPgo8L3N2Zz4=",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n;return(n=window.clover_solana)!=null&&n.isCloverWallet?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.clover_solana;let n;try{n=await e.getAccount()}catch(i){throw new qt(i==null?void 0:i.message,i)}let r;try{r=new X(n)}catch(i){throw new Sn(i==null?void 0:i.message,i)}this._wallet=e,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){this._wallet&&(this._wallet=null,this._publicKey=null),this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return Uint8Array.from(r)}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}var fl=_c.Buffer;function p4(t){if(t.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n>>0,w=new Uint8Array(M);D!==I;){for(var j=v[D],C=0,U=M-1;(j!==0||C>>0,w[U]=j%s>>>0,j=j/s>>>0;if(j!==0)throw new Error("Non-zero carry");k=C,D++}for(var O=M-k;O!==M&&w[O]===0;)O++;for(var B=a.repeat(A);O>>0,M=new Uint8Array(I);v[A];){var w=e[v.charCodeAt(A)];if(w===255)return;for(var j=0,C=I-1;(w!==0||j>>0,M[C]=w%256>>>0,w=w/256>>>0;if(w!==0)throw new Error("Non-zero carry");D=j,A++}for(var U=I-D;U!==I&&M[U]===0;)U++;var O=fl.allocUnsafe(k+(I-U));O.fill(0,0,k);for(var B=k;U!==I;)O[B++]=M[U++];return O}function x(v){var A=y(v);if(A)return A;throw new Error("Non-base"+s+" character")}return{encode:g,decodeUnsafe:y,decode:x}}var g4=p4,y4=g4,m4="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",w4=y4(m4);const xd=Or(w4),M4="Coin98";class N4 extends Xn{constructor(e={}){super(),this.name=M4,this.url="https://coin98.com",this.icon="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA3NiA3NSI+CiAgPGRlZnM+CiAgICA8bGluZWFyR3JhZGllbnQgaWQ9ImEiIHgxPSIxMDEuNjgxJSIgeDI9Ii0xLjU1NyUiIHkxPSIxNS4yNjglIiB5Mj0iODQuOTE3JSI+CiAgICAgIDxzdG9wIG9mZnNldD0iMCUiIHN0b3AtY29sb3I9IiNGMUQ5NjEiLz4KICAgICAgPHN0b3Agb2Zmc2V0PSIxMDAlIiBzdG9wLWNvbG9yPSIjQ0RBMTQ2Ii8+CiAgICA8L2xpbmVhckdyYWRpZW50PgogIDwvZGVmcz4KICA8ZyBmaWxsPSJub25lIiBmaWxsLXJ1bGU9ImV2ZW5vZGQiPgogICAgPHJlY3Qgd2lkdGg9Ijc1IiBoZWlnaHQ9Ijc1IiBmaWxsPSIjMDAwIiByeD0iMTYiLz4KICAgIDxwYXRoIGZpbGw9InVybCgjYSkiIGZpbGwtcnVsZT0ibm9uemVybyIgZD0iTTYxLjQ0IDBhMTMuNzE0IDEzLjcxNCAwIDAgMSA5LjY4IDQuMDEgMTMuNjYxIDEzLjY2MSAwIDAgMSA0LjAwOCA5LjY2OHY0Ny42NDZhMTMuNjYgMTMuNjYgMCAwIDEtNC4wMDcgOS42NjZBMTMuNzEzIDEzLjcxMyAwIDAgMSA2MS40NCA3NUgxMy42ODZhMTMuNzEzIDEzLjcxMyAwIDAgMS05LjY4LTQuMDFBMTMuNjYgMTMuNjYgMCAwIDEgMCA2MS4zMjRWMTMuNjc4YzAtMy42MjUgMS40NC03LjEwMiA0LjAwNy05LjY2N0ExMy43MTQgMTMuNzE0IDAgMCAxIDEzLjY4NyAwWk0yMC4wNjMgNDYuMjMxaC00LjgyNWExMC4wMzIgMTAuMDMyIDAgMCAwIDIuOTQ2IDcuMDg2IDEwLjA3IDEwLjA3IDAgMCAwIDcuMSAyLjk0MiAxMC4wNjUgMTAuMDY1IDAgMCAwIDcuMTA4LTIuOTM1IDEwLjAzIDEwLjAzIDAgMCAwIDIuOTQ2LTcuMDkzaC00LjgyNGE1LjIwNyA1LjIwNyAwIDAgMS0xLjUzIDMuNjg4IDUuMjI1IDUuMjI1IDAgMCAxLTMuNjk2IDEuNTI4IDUuMjM0IDUuMjM0IDAgMCAxLTMuNjk1LTEuNTI4IDUuMjEzIDUuMjEzIDAgMCAxLTEuNTMtMy42ODhaTTU0LjMzIDMzLjcxNmExMS43NjMgMTEuNzYzIDAgMCAwLTEyLjc5OSAyLjUzOEExMS42OTcgMTEuNjk3IDAgMCAwIDM4Ljk5IDQ5LjAzYTExLjcyMyAxMS43MjMgMCAwIDAgNC4zMjggNS4yNTkgMTEuNzU3IDExLjc1NyAwIDAgMCA2LjUyNiAxLjk3IDExLjc2NiAxMS43NjYgMCAwIDAgOC4yOS0zLjQzNSAxMS43MiAxMS43MiAwIDAgMCAzLjQ0Mi04LjI3NCAxMS43MDIgMTEuNzAyIDAgMCAwLTEuOTc1LTYuNTE0IDExLjczNiAxMS43MzYgMCAwIDAtNS4yNjktNC4zMlptLTQuNDg4IDMuOTJhNi45MzcgNi45MzcgMCAwIDEgNC45IDIuMDI1IDYuOTEgNi45MSAwIDAgMSAyLjAyOCA0Ljg5MiA2Ljg5NyA2Ljg5NyAwIDAgMS0xLjE3IDMuODM0IDYuOTMyIDYuOTMyIDAgMCAxLTEwLjY0MyAxLjA0MiA2LjkwMiA2LjkwMiAwIDAgMS0xLjUtNy41MjIgNi45MDkgNi45MDkgMCAwIDEgMi41NDQtMy4xIDYuOTI4IDYuOTI4IDAgMCAxIDMuODQxLTEuMTY3Wm0uMTcgNC41NTJhMi40MzEgMi40MzEgMCAwIDAtMi4yNDEgMS4xNTQgMi40MTggMi40MTggMCAwIDAtLjM1NiAxLjI1NyAyLjM5NSAyLjM5NSAwIDAgMCAxLjYxOSAyLjI5djEuNzUzaDEuNjE4di0xLjc1NGEyLjQyNyAyLjQyNyAwIDAgMCAxLjU5NC0xLjk1IDIuNDE4IDIuNDE4IDAgMCAwLTEtMi4zMSAyLjQzMSAyLjQzMSAwIDAgMC0xLjIzNC0uNDRabS0yMC4yMi0yMi41NTJhMTEuNzYyIDExLjc2MiAwIDAgMC0xMi43OTYgMi41MzEgMTEuNjk3IDExLjY5NyAwIDAgMC0yLjU1NCAxMi43NjkgMTEuNzIzIDExLjcyMyAwIDAgMCA0LjMyIDUuMjYyIDExLjc1NyAxMS43NTcgMCAwIDAgMTQuODI1LTEuNDQ2IDExLjcxNyAxMS43MTcgMCAwIDAgMy40NDUtOC4yODQgMTEuNzAzIDExLjcwMyAwIDAgMC0xLjk3NC02LjUxMiAxMS43MzYgMTEuNzM2IDAgMCAwLTUuMjY2LTQuMzJabS00LjUxIDMuOTE3YTYuOTQ1IDYuOTQ1IDAgMCAxIDQuODk3IDIuMDI5IDYuOTE4IDYuOTE4IDAgMCAxIDIuMDMyIDQuODg2IDYuOTA2IDYuOTA2IDAgMCAxLTEuMTY4IDMuODQyIDYuOTQgNi45NCAwIDAgMS0xMC42NiAxLjA0OCA2LjkxMSA2LjkxMSAwIDAgMS0xLjUtNy41MzYgNi45MTggNi45MTggMCAwIDEgMi41NS0zLjEwMyA2LjkzNyA2LjkzNyAwIDAgMSAzLjg1LTEuMTY2Wm0yNC41Ni00LjgxYTEwLjA1OSAxMC4wNTkgMCAwIDAtNy4xMDMgMi45NCAxMC4wMiAxMC4wMiAwIDAgMC0yLjk0IDcuMDkgOS45IDkuOSAwIDAgMCAxLjIzIDQuNzk1IDEzLjU3NSAxMy41NzUgMCAwIDEgNC4yMTQtMi4zMjIgNS4wODIgNS4wODIgMCAwIDEtLjYyNS0yLjQ3NyA1LjIwNiA1LjIwNiAwIDAgMSAxLjUwMy0zLjczNiA1LjIyMyA1LjIyMyAwIDAgMSAzLjcyMi0xLjU1NCA1LjIzNCA1LjIzNCAwIDAgMSAzLjcyIDEuNTU0IDUuMjEzIDUuMjEzIDAgMCAxIDEuNTA1IDMuNzM2IDUuMjc5IDUuMjc5IDAgMCAxLS42MjMgMi40NzMgMTMuNTc0IDEzLjU3NCAwIDAgMSA0LjIxMyAyLjMyMiA5LjkwMyA5LjkwMyAwIDAgMCAxLjIzLTQuNzk1IDEwLjAzMiAxMC4wMzIgMCAwIDAtMi45NDYtNy4wODYgMTAuMDcgMTAuMDcgMCAwIDAtNy4xLTIuOTRabS0yMy43NSA3Ljk5aC0xLjYxN3YxLjc1YTIuNDE5IDIuNDE5IDAgMCAwLTEuNTgyIDIuNjg3IDIuNDE0IDIuNDE0IDAgMCAwIDIuMzkgMi4wMDYgMi40NSAyLjQ1IDAgMCAwIDEuNTU1LS41NzQgMi40MTQgMi40MTQgMCAwIDAtLjc0Ni00LjExOXYtMS43NVoiLz4KICA8L2c+Cjwvc3ZnPgo=",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n;return(n=window.coin98)!=null&&n.sol?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isConnected())}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.coin98.sol;let n;try{n=(await e.connect())[0]}catch(i){throw new qt(i==null?void 0:i.message,i)}let r;try{r=new X(n)}catch(i){throw new Sn(i==null?void 0:i.message,i)}this._wallet=e,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{const r=await n.request({method:"sol_sign",params:[e]}),i=new X(r.publicKey),o=xd.decode(r.signature);return e.addSignature(i,o),e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{const r=await n.request({method:"sol_signAllTransactions",params:[e]}),i=new X(r.publicKey),o=r.signatures;return e.map((s,a)=>{const l=xd.decode(o[a]);return s.addSignature(i,l),s})}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const r=await n.request({method:"sol_signMessage",params:[e]});return xd.decode(r.signature)}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const v4="Coinbase Wallet";class S4 extends Xn{constructor(e={}){super(),this.name=v4,this.url="https://chrome.google.com/webstore/detail/coinbase-wallet-extension/hnfanknocfeofbddgcijnmhnfnkdnaad",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8Y2lyY2xlIGN4PSI1MTIiIGN5PSI1MTIiIHI9IjUxMiIgZmlsbD0iIzAwNTJGRiIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTE1MiA1MTJDMTUyIDcxMC44MjMgMzEzLjE3NyA4NzIgNTEyIDg3MkM3MTAuODIzIDg3MiA4NzIgNzEwLjgyMyA4NzIgNTEyQzg3MiAzMTMuMTc3IDcxMC44MjMgMTUyIDUxMiAxNTJDMzEzLjE3NyAxNTIgMTUyIDMxMy4xNzcgMTUyIDUxMlpNNDIwIDM5NkM0MDYuNzQ1IDM5NiAzOTYgNDA2Ljc0NSAzOTYgNDIwVjYwNEMzOTYgNjE3LjI1NSA0MDYuNzQ1IDYyOCA0MjAgNjI4SDYwNEM2MTcuMjU1IDYyOCA2MjggNjE3LjI1NSA2MjggNjA0VjQyMEM2MjggNDA2Ljc0NSA2MTcuMjU1IDM5NiA2MDQgMzk2SDQyMFoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>window!=null&&window.coinbaseSolana?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1)}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.coinbaseSolana;try{await e.connect()}catch(r){throw new lr(r==null?void 0:r.message,r)}if(!e.publicKey)throw new qt;let n;try{n=new X(e.publicKey.toBytes())}catch(r){throw new Sn(r==null?void 0:r.message,r)}e.on("disconnect",this._disconnected),this._wallet=e,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async sendTransaction(e,n,r={}){try{const i=this._wallet;if(!i)throw new me;try{const{signers:o,...s}=r;e=await this.prepareTransaction(e,n,s),o!=null&&o.length&&e.partialSign(...o),s.preflightCommitment=s.preflightCommitment||n.commitment;const{signature:a}=await i.signAndSendTransaction(e,s);return a}catch(o){throw o instanceof Qt?o:new mr(o==null?void 0:o.message,o)}}catch(i){throw this.emit("error",i),i}}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const I4="HuobiWallet";class b4 extends Xn{constructor(e={}){super(),this.name=I4,this.url="https://www.huobiwallet.io",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjI0IiBoZWlnaHQ9IjIyNCIgdmlld0JveD0iMCAwIDIyNCAyMjQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNMCAwTDIyNCAwVjIyNEgwTDAgMFoiIGZpbGw9IiMyMTU3RTIiLz4KPHBhdGggZD0iTTEzMS4wNTkgODEuMTc3MUMxMzEuMDU5IDU3Ljc1MzEgMTE5LjQ1OCAzNy42MzE1IDExMC42MjUgMzEuMDcyOEMxMTAuNjI1IDMxLjA3MjggMTA5Ljk1MyAzMC43MDQyIDExMCAzMS42MjU4VjMxLjYyNThDMTA5LjI2NSA3Ni44MzAzIDg1Ljc2NzIgODkuMDg3NSA3Mi44MzggMTA1LjU4NEM0My4wMjQxIDE0My42NzcgNzAuNzU4NyAxODUuNDU2IDk4Ljk5MzUgMTkzLjEzNkMxMTQuNzk5IDE5Ny40NTIgOTUuMzUwOCAxODUuNDU2IDkyLjg0OTQgMTYwLjIzNUM4OS44MDA3IDEyOS43NDUgMTMxLjA1OSAxMDYuNDQ0IDEzMS4wNTkgODEuMTc3MVoiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl8xMTAxXzEyNSkiLz4KPHBhdGggZD0iTTE0My41OTcgOTYuMzE3NEMxNDMuNDA5IDk2LjE5NDMgMTQzLjE1OCA5Ni4xMDIgMTQyLjk4NiA5Ni4zOTQzQzE0Mi40ODQgMTAyLjEwMiAxMzYuNTYgMTE0LjI4NiAxMjkuMDM3IDEyNS40ODZDMTAzLjU1MiAxNjMuNDU1IDExOC4wNjUgMTgxLjc2MiAxMjYuMjQ3IDE5MS42MzlDMTMwLjk0OSAxOTcuMzQ3IDEyNi4yNDcgMTkxLjYzOSAxMzguMDk2IDE4NS44MDhDMTUyLjczNSAxNzcuMDkyIDE2Mi4yMzQgMTYyLjAyIDE2My42NDMgMTQ1LjI3QzE2NS4yMzMgMTI2Ljc1OCAxNTcuNzk4IDEwOC42IDE0My41OTcgOTYuMzE3NFoiIGZpbGw9InVybCgjcGFpbnQxX2xpbmVhcl8xMTAxXzEyNSkiLz4KPGRlZnM+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQwX2xpbmVhcl8xMTAxXzEyNSIgeDE9IjEyMi40MDEiIHkxPSIyMDkuMjk1IiB4Mj0iMTc4LjY2MiIgeTI9IjExMC40NDciIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0Y3RjZGRiIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IndoaXRlIi8+CjwvbGluZWFyR3JhZGllbnQ+CjxsaW5lYXJHcmFkaWVudCBpZD0icGFpbnQxX2xpbmVhcl8xMTAxXzEyNSIgeDE9IjE1Ny44NjEiIHkxPSIyMDMuMTc3IiB4Mj0iMTg5LjAxNCIgeTI9IjE0MC4wMjIiIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agc3RvcC1jb2xvcj0iI0Y3RjZGRiIvPgo8c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IndoaXRlIi8+CjwvbGluZWFyR3JhZGllbnQ+CjwvZGVmcz4KPC9zdmc+Cg==",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n;return(n=window.huobiWallet)!=null&&n.isHuobiWallet?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isConnected)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.huobiWallet;try{await e.connect()}catch(r){throw new lr(r==null?void 0:r.message,r)}if(!e.publicKey)throw new qt;let n;try{n=new X(e.publicKey.toBytes())}catch(r){throw new Sn(r==null?void 0:r.message,r)}e.on("disconnect",this._disconnected),this._wallet=e,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;e&&(e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("disconnect"))}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const k4="MathWallet";class E4 extends IM{constructor(e={}){super(),this.name=k4,this.url="https://mathwallet.org",this.icon="data:image/svg+xml;base64,PHN2ZyBoZWlnaHQ9IjEyOCIgdmlld0JveD0iMCAwIDEyOCAxMjgiIHdpZHRoPSIxMjgiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PGcgZmlsbD0iI2ZmZiIgZmlsbC1ydWxlPSJldmVub2RkIj48cGF0aCBkPSJtMCAwaDEyOHYxMjhoLTEyOHoiIG9wYWNpdHk9IjAiLz48cGF0aCBkPSJtOTAuODQ3MDA4NiA1Ny43NjEwMDIzYy0yLjI3NzAzNjMtMi4yNzcwMzYzLTIuMjc3MDM2My01Ljk2ODg0MTYgMC04LjI0NTg3NzggMi4yNzcwMzYyLTIuMjc3MDM2MyA1Ljk2ODg0MTUtMi4yNzcwMzYzIDguMjQ1ODc3OCAwIDIuMjc3MDM2NiAyLjI3NzAzNjIgMi4yNzcwMzY2IDUuOTY4ODQxNSAwIDguMjQ1ODc3OC0yLjI3NzAzNjMgMi4yNzcwMzYyLTUuOTY4ODQxNiAyLjI3NzAzNjItOC4yNDU4Nzc4IDB6bS0xOS41ODM5NTk4IDE5LjU4Mzk1OTdjLTEuNzA3Nzc3Mi0xLjcwNzc3NzItMS43MDc3NzcyLTQuNDc2NjMxMSAwLTYuMTg0NDA4M3M0LjQ3NjYzMTEtMS43MDc3NzcyIDYuMTg0NDA4MyAwIDEuNzA3Nzc3MiA0LjQ3NjYzMTEgMCA2LjE4NDQwODMtNC40NzY2MzExIDEuNzA3Nzc3Mi02LjE4NDQwODMgMHptMzAuOTIyMDQyMi0xMC4zMDczNDcyYy0xLjcwNzc3OC0xLjcwNzc3NzItMS43MDc3NzgtNC40NzY2MzEyIDAtNi4xODQ0MDg0IDEuNzA3Nzc3LTEuNzA3Nzc3MiA0LjQ3NjYzMS0xLjcwNzc3NzIgNi4xODQ0MDggMHMxLjcwNzc3NyA0LjQ3NjYzMTIgMCA2LjE4NDQwODQtNC40NzY2MzEgMS43MDc3NzcyLTYuMTg0NDA4IDB6bS0xMC4zMDczNDc3IDEwLjMwNzM0NzJjLTEuNzA3Nzc3Mi0xLjcwNzc3NzItMS43MDc3NzcyLTQuNDc2NjMxMSAwLTYuMTg0NDA4M3M0LjQ3NjYzMTEtMS43MDc3NzcyIDYuMTg0NDA4MyAwIDEuNzA3Nzc3MiA0LjQ3NjYzMTEgMCA2LjE4NDQwODMtNC40NzY2MzExIDEuNzA3Nzc3Mi02LjE4NDQwODMgMHptMjEuNjQ1NDI4Ny0xLjAzMDczNDdjLTEuMTM4NTE4LTEuMTM4NTE4MS0xLjEzODUxOC0yLjk4NDQyMDggMC00LjEyMjkzODkgMS4xMzg1MTktMS4xMzg1MTgxIDIuOTg0NDIxLTEuMTM4NTE4MSA0LjEyMjkzOSAwIDEuMTM4NTE5IDEuMTM4NTE4MSAxLjEzODUxOSAyLjk4NDQyMDggMCA0LjEyMjkzODktMS4xMzg1MTggMS4xMzg1MTgxLTIuOTg0NDIgMS4xMzg1MTgxLTQuMTIyOTM5IDB6bS0xMC4zMDczNDcgMTAuMzA3MzQ3MmMtMS4xMzg1MTgtMS4xMzg1MTgxLTEuMTM4NTE4LTIuOTg0NDIwNyAwLTQuMTIyOTM4OSAxLjEzODUxOC0xLjEzODUxODEgMi45ODQ0MjEtMS4xMzg1MTgxIDQuMTIyOTM5IDAgMS4xMzg1MTggMS4xMzg1MTgyIDEuMTM4NTE4IDIuOTg0NDIwOCAwIDQuMTIyOTM4OS0xLjEzODUxOCAxLjEzODUxODItMi45ODQ0MjEgMS4xMzg1MTgyLTQuMTIyOTM5IDB6bS0yMi42NzYxNjM3LTE4LjU1MzIyNWMtMi4yNzcwMzYzLTIuMjc3MDM2My0yLjI3NzAzNjMtNS45Njg4NDE1IDAtOC4yNDU4Nzc4czUuOTY4ODQxNS0yLjI3NzAzNjMgOC4yNDU4Nzc4IDAgMi4yNzcwMzYzIDUuOTY4ODQxNSAwIDguMjQ1ODc3OC01Ljk2ODg0MTUgMi4yNzcwMzYzLTguMjQ1ODc3OCAwem0wLTIwLjYxNDY5NDVjLTIuMjc3MDM2My0yLjI3NzAzNjMtMi4yNzcwMzYzLTUuOTY4ODQxNSAwLTguMjQ1ODc3OHM1Ljk2ODg0MTUtMi4yNzcwMzYzIDguMjQ1ODc3OCAwIDIuMjc3MDM2MyA1Ljk2ODg0MTUgMCA4LjI0NTg3NzgtNS45Njg4NDE1IDIuMjc3MDM2My04LjI0NTg3NzggMHptLTEwLjMwNzM0NzIgMTAuMzA3MzQ3M2MtMi4yNzcwMzYzLTIuMjc3MDM2My0yLjI3NzAzNjMtNS45Njg4NDE2IDAtOC4yNDU4Nzc4IDIuMjc3MDM2Mi0yLjI3NzAzNjMgNS45Njg4NDE1LTIuMjc3MDM2MyA4LjI0NTg3NzggMCAyLjI3NzAzNjIgMi4yNzcwMzYyIDIuMjc3MDM2MiA1Ljk2ODg0MTUgMCA4LjI0NTg3NzgtMi4yNzcwMzYzIDIuMjc3MDM2Mi01Ljk2ODg0MTYgMi4yNzcwMzYyLTguMjQ1ODc3OCAwem0tMjAuNzEwNTA2IDBjLTIuMjc3MDM2Mi0yLjI3NzAzNjMtMi4yNzcwMzYyLTUuOTY4ODQxNiAwLTguMjQ1ODc3OCAyLjI3NzAzNjMtMi4yNzcwMzYzIDUuOTY4ODQxNi0yLjI3NzAzNjMgOC4yNDU4Nzc4IDAgMi4yNzcwMzYzIDIuMjc3MDM2MiAyLjI3NzAzNjMgNS45Njg4NDE1IDAgOC4yNDU4Nzc4LTIuMjc3MDM2MiAyLjI3NzAzNjItNS45Njg4NDE1IDIuMjc3MDM2Mi04LjI0NTg3NzggMHptLTE5LjU4Mzk1OTcgMTkuNTgzOTU5N2MtMS43MDc3NzcyLTEuNzA3Nzc3Mi0xLjcwNzc3NzItNC40NzY2MzExIDAtNi4xODQ0MDgzczQuNDc2NjMxMS0xLjcwNzc3NzIgNi4xODQ0MDgzIDAgMS43MDc3NzcyIDQuNDc2NjMxMSAwIDYuMTg0NDA4My00LjQ3NjYzMTEgMS43MDc3NzcyLTYuMTg0NDA4MyAwem0zMC45MjIwNDE3LTEwLjMwNzM0NzJjLTEuNzA3Nzc3Mi0xLjcwNzc3NzItMS43MDc3NzcyLTQuNDc2NjMxMiAwLTYuMTg0NDA4NHM0LjQ3NjYzMTItMS43MDc3NzcyIDYuMTg0NDA4NCAwIDEuNzA3Nzc3MiA0LjQ3NjYzMTIgMCA2LjE4NDQwODQtNC40NzY2MzEyIDEuNzA3Nzc3Mi02LjE4NDQwODQgMHptLTEwLjMwNzM0NzIgMTAuMzA3MzQ3MmMtMS43MDc3NzcyLTEuNzA3Nzc3Mi0xLjcwNzc3NzItNC40NzY2MzExIDAtNi4xODQ0MDgzczQuNDc2NjMxMS0xLjcwNzc3NzIgNi4xODQ0MDgzIDAgMS43MDc3NzcyIDQuNDc2NjMxMSAwIDYuMTg0NDA4My00LjQ3NjYzMTEgMS43MDc3NzcyLTYuMTg0NDA4MyAwem0tNDAuMTk4NjU0My0xLjAzMDczNDdjLTEuMTM4NTE4MTMtMS4xMzg1MTgxLTEuMTM4NTE4MTMtMi45ODQ0MjA4IDAtNC4xMjI5Mzg5IDEuMTM4NTE4MS0xLjEzODUxODEgMi45ODQ0MjA4LTEuMTM4NTE4MSA0LjEyMjkzODkgMHMxLjEzODUxODEgMi45ODQ0MjA4IDAgNC4xMjI5Mzg5LTIuOTg0NDIwOCAxLjEzODUxODEtNC4xMjI5Mzg5IDB6bTEwLjMwNzM0NzMgMTAuMzA3MzQ3MmMtMS4xMzg1MTgyLTEuMTM4NTE4MS0xLjEzODUxODItMi45ODQ0MjA3IDAtNC4xMjI5Mzg5IDEuMTM4NTE4MS0xLjEzODUxODEgMi45ODQ0MjA3LTEuMTM4NTE4MSA0LjEyMjkzODggMCAxLjEzODUxODIgMS4xMzg1MTgyIDEuMTM4NTE4MiAyLjk4NDQyMDggMCA0LjEyMjkzODktMS4xMzg1MTgxIDEuMTM4NTE4Mi0yLjk4NDQyMDcgMS4xMzg1MTgyLTQuMTIyOTM4OCAwem00MS4yMjkzODg5IDBjLTEuMTM4NTE4MS0xLjEzODUxODEtMS4xMzg1MTgxLTIuOTg0NDIwNyAwLTQuMTIyOTM4OSAxLjEzODUxODItMS4xMzg1MTgxIDIuOTg0NDIwOC0xLjEzODUxODEgNC4xMjI5Mzg5IDAgMS4xMzg1MTgyIDEuMTM4NTE4MiAxLjEzODUxODIgMi45ODQ0MjA4IDAgNC4xMjI5Mzg5LTEuMTM4NTE4MSAxLjEzODUxODItMi45ODQ0MjA3IDEuMTM4NTE4Mi00LjEyMjkzODkgMHptLTQyLjI2MDEyMzctMTkuNTgzOTU5N2MtMS43MDc3NzcyLTEuNzA3Nzc3Mi0xLjcwNzc3NzItNC40NzY2MzEyIDAtNi4xODQ0MDg0czQuNDc2NjMxMi0xLjcwNzc3NzIgNi4xODQ0MDg0IDAgMS43MDc3NzcyIDQuNDc2NjMxMiAwIDYuMTg0NDA4NC00LjQ3NjYzMTIgMS43MDc3NzcyLTYuMTg0NDA4NCAwem0xOS41ODM5NTk4IDEuMDMwNzM0N2MtMi4yNzcwMzYzLTIuMjc3MDM2My0yLjI3NzAzNjMtNS45Njg4NDE1IDAtOC4yNDU4Nzc4czUuOTY4ODQxNS0yLjI3NzAzNjMgOC4yNDU4Nzc4IDAgMi4yNzcwMzYzIDUuOTY4ODQxNSAwIDguMjQ1ODc3OC01Ljk2ODg0MTUgMi4yNzcwMzYzLTguMjQ1ODc3OCAwem0wLTIwLjYxNDY5NDVjLTIuMjc3MDM2My0yLjI3NzAzNjMtMi4yNzcwMzYzLTUuOTY4ODQxNSAwLTguMjQ1ODc3OHM1Ljk2ODg0MTUtMi4yNzcwMzYzIDguMjQ1ODc3OCAwIDIuMjc3MDM2MyA1Ljk2ODg0MTUgMCA4LjI0NTg3NzgtNS45Njg4NDE1IDIuMjc3MDM2My04LjI0NTg3NzggMHptLTEwLjMwNzM0NzMgMTAuMzA3MzQ3M2MtMi4yNzcwMzYyLTIuMjc3MDM2My0yLjI3NzAzNjItNS45Njg4NDE2IDAtOC4yNDU4Nzc4IDIuMjc3MDM2My0yLjI3NzAzNjMgNS45Njg4NDE2LTIuMjc3MDM2MyA4LjI0NTg3NzggMCAyLjI3NzAzNjMgMi4yNzcwMzYyIDIuMjc3MDM2MyA1Ljk2ODg0MTUgMCA4LjI0NTg3NzgtMi4yNzcwMzYyIDIuMjc3MDM2Mi01Ljk2ODg0MTUgMi4yNzcwMzYyLTguMjQ1ODc3OCAweiIvPjwvZz48L3N2Zz4=",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._messaged=n=>{const r=n.data;r&&r.origin==="mathwallet_internal"&&r.type==="lockStatusChanged"&&!r.payload&&this._disconnected()},this._disconnected=()=>{this._wallet&&(window.removeEventListener("message",this._messaged),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n;return(n=window.solana)!=null&&n.isMathWallet?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.solana;let n;try{n=await e.getAccount()}catch(i){throw new qt(i==null?void 0:i.message,i)}let r;try{r=new X(n)}catch(i){throw new Sn(i==null?void 0:i.message,i)}window.addEventListener("message",this._messaged),this._wallet=e,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){this._wallet&&(window.removeEventListener("message",this._messaged),this._wallet=null,this._publicKey=null),this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const x4="Neko";class T4 extends Xn{constructor(e={}){super(),this.name=x4,this.url="https://nekowallet.com",this.icon="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8+CjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+CjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iTGF5ZXJfMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiIHdpZHRoPSIyNDRweCIgaGVpZ2h0PSIyNjBweCIgdmlld0JveD0iMCAwIDI0NCAyNjAiIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDI0NCAyNjAiIHhtbDpzcGFjZT0icHJlc2VydmUiPiAgPGltYWdlIGlkPSJpbWFnZTAiIHdpZHRoPSIyNDQiIGhlaWdodD0iMjYwIiB4PSIwIiB5PSIwIgogICAgaHJlZj0iZGF0YTppbWFnZS9wbmc7YmFzZTY0LGlWQk9SdzBLR2dvQUFBQU5TVWhFVWdBQUFQUUFBQUVFQ0FNQUFBQW9GT2xoQUFBQUJHZEJUVUVBQUxHUEMveGhCUUFBQUNCalNGSk4KQUFCNkpnQUFnSVFBQVBvQUFBQ0E2QUFBZFRBQUFPcGdBQUE2bUFBQUYzQ2N1bEU4QUFBQjQxQk1WRVVBQUFEL2Z5RC9jQ0QvZ0NyLwpmeXIvZ0VEL2dBRC9iU1QvY0JEM2JCajViUnI0YlJuNGJScjViaHI0YmhuNWJCbjRiaG40YlJyNmJodjNiQmo0YlJyM2NCajRiUm41CmJoci9jUno0Ynh2NWJocjNhQmovY3huNWJocjFhaHYzYkJyL2JSdjNiUnIyYkJ2M2JSdjRiQnI0YmhydmNDRDRiUm40YlJyM2NCajQKYmhmM2JSdjRieG4zYkJyM2JCbjRiQm41YlJyNWJScjRiQm4vZGgzNGJocjZhaHY0YXhuL2RTRDNiaHIzYlJqL2JCMzNhQmowYWh2MwpiUnIvYnhINGJCbjRiUnYvYnhENGJSbjZhaFg0YlJyMWJCbjRiUnI2YmhqNGJScjRiUm40YkJuNGJCcjNiUmo0YmhuNGJCcjRiUnI0CmJodjRiUnY5MnNiN3Y1cjVkaWo2bW1INnJYNzh5S245MGJqOHY1djd0b3o1aUVYKzQ5VCs3T1ArOXZILy8vLzVrVlA1ZGluN28zRDcKdG8zNnBIRDVpRWI1ZnpiKzdlTDdyWC81ZnpmLzl2SCs3ZVA3djV2KzdlSC8vLzcrNU5UN3BIRCs0OVA4dG8zOTJzWDZtMkw1ZnpqLwo5dkQ1Z0RqN3JYNzZwSEg4eUtqKzdPSC8vdjc4djVuNGRpbi85ZkQ4djVyNmlFYjd0b3Y5NDlQOHRveis1TlA5MExmNmtWUDRkeW42CmtWVDZtbUQ0ZGlqOTBiZis3T0Q3dFl2KzlmRDdtbUQ4dnBuOHRZdjgwYmo2bzNEOTVOVDZtbUw3bzNIKzl2RDZpRVg4ckgvNm0ySDcKcllEOTI4WDdtbUg4ckg3N3JIN1dKTE5MQUFBQVQzUlNUbE1BQUFBQUFBQUFBQkJBbjkvdno1QlFiOTlmUWQ0Z3YzOEJqODRnQVlBeApnQUh1a0dIUHpoQncvaUZQWUkrZ29JK2VyNzRCenpCd0FZQmdBU0V3N3hDUWp4QytNTEJRcjErdTNyK3VYNC9Pd0xqT0dBQUFBQUZpClMwZEVYM1BSVVMwQUFBQUpjRWhaY3dBQUN4TUFBQXNUQVFDYW5CZ0FBQUFIZEVsTlJRZm1CaHdHRkNaaGFHR2lBQUFPMTBsRVFWUjQKMnUyZCsyTVVWeFhIbDFacU5vWGF0QW1VaDRhdEJiYUNiVVNMSWxTMFZTeDlPTTAweXo2U3pTNGh6UVBMMGhwVEVaWUVBelZxMGFxawppbS8rVkdkMlp2WTVNK2Q3WnM2ZG05MzAreVBNenIyZm5Edm5mdStkZSsra1Vnd05wWWVmM0dQczJUdWM1dnhLb1hhbG43SXFaT3dkCi9vcXlJcDYyN3U5cTVCbmR2RGJ5c3lQTkNvMnFxZERZUHFOZCszVWpwNTQ3MEZHaGc0Y1VNSThZblJyV3pIeDR1S3RDbytMVVE5M00KdW1QOTJGZDdLalE2SkZ6R0FhTlhPdFBaNDEvenFkQzRiQmxqUGtVWSt6UkNIeG54cVZCR050VFArMEZyRFBXWHZ1NWJJZGxRditCYgp4b2cyYU45QUc4WlJ5VEtPR2Y0NnJvazVJTkJHVnJKOXB3T2c5MGpuUzB5N1h4d0pnSmJzdFlLZ3BmTWxLSi91eW9YK2htQXBKNEtnCnRZUjY5NHRCMWNtZUVDeG1QS2dVNDZRRzZNUGZES3lPWk10N0tiQVVRNEhqSlJRY2FNTjRXYkNjZmNIRkpPOVFRZ0p0VENRRG5iaEQKMmZWc1NHVWtPK3FSa0hLU0R2V1JzTXFNQ2haa2hDblpVQWY1RWtkWnVZTEdRcUgzSmdvZEdtaEpTNVlPaFRhU25Eb0tEN1NrSlNPZwpFM1FvZ1FiVWc1YXpaQ2ZDb1JNMG80RUcxSU9XczJUakJIUmlvUTd6SmRKLy8rZVRLeXBjWWI3RWtad2wreFpWVkVKbWxBNjBvQ1hiClI1YVZ6SHd3SFdqamxGaGhJMlJaaVRnVTN4blFMc2xaTXJxc1JNem90NzlEMXlNalZkZ3h1cXdrUWszNEVrZGlsdXdWQkZwOXFJOEEKVDVtY0pVc0RoYWszbzFDZ2pheFVpNk1NbWFNUnhRNEZDclNjSlJ1SG9CVTdGTXFBZXRDbmhjb2pEWmtqcFdhVUdtazBKV1hKYUVPbQpQdFNBTDNFMElWUWdiY2pjVUtzem80QUJkU1ZseWNDR3BkS013b0VXczJSb2Vlb2NDaDVvS1VzR0dUSkhxaHpLZDlFblRNeVNRWVpNCmFhZ3hYK0pDeXlRV3pKQ3BERFhtUzF4b21iODdac2hjcVRDam5FQkxXYkp4RHJRS004b0p0SlFsQXcyWkszbUhBaHBRVHpLV0REVmsKanNUTktHeEFYVTJJbElwM0YwcENqZnNTUnpLV2pQZUhsamFqREYvaVNNYVNNUXNWTnFQY1FCdVpKd1JLWlJneVY1SU9oUjFvR1V2RwpNV1NPSkIwS3c0QjYwQktQRjhlUWlZZWE1VXRjYUluU1dZWk1PdFFzWCtKQ1MxaXljVDYwOGIwelFqckFMMXZFa3ZFTTJUYVFoQ1hqCkdiSnRvQWtCYUhiNjFDMEpTOFpQSlpvbFljbDBNN0FsWU1uNGhreTNCQ3daMzVEcGxvQWxpMkRJZEVQSHQyUVJESmx1NlBpV2JGdzMKQXg4NnZpWHJPME1tWWNuNnpwQkpXTEsrTTJTV0pkc1Zrem5kZDRiTWNpZnB4Mkl4NzljTkVFblovZC9mSFJsNXFBL2J0cU9EWjZOUwpuK3ZEcHUxcDlPeVhJekUvc3lkKzJmcjA2dkVvRDNaL1BzNHRaZmZ6cWZ1ZDJhWitic2N4V3pwNW1NVThITC9FN2FCaERuV0VtZGZ0CnFXRzhoUTlFMjNaMEVzMW1BOFJzWlRPc3YzNWFkMFZscVk4anc0LytteDhpcU5PMEl4M3JZKy9wcjh4WmFrNTRhT0NZZ2RPckJxYXoKYXRkd2VESWJyQ1RtS1hzODdMRWU2K3VCVmJBeVowT2dCL0NCZG5RdzJLTU1raXZwMG5oUUF4K0xmMjlWZXJkZGs1T1Q3QnNFdnVBaQo5bSthb041ci9XUXFkeWxmc1A0cFh5emxwcm4xdEg4OFU1NnRkR3UyYkJaSzFjdE04SDMrR1p4NmExVUJOZWRWK29yWldkbkMvQlJjCngycHhoaWhtcHZnK2h6dDczTStpa0xZRWhWNXdrV2Q5L2krL0FNWFk5N2U5V3B5L2pGTm5maEFsaTRITVp1UGlwYUJxMDlqTGVReTUKZ1gxbEdhWWU3dzAxbmNYQWV0aXRlOG9NL3YrclMrRlJMc0xFYnJUUlJ1NXp3T1pMNUkvQVdsaVJYUDU1NkJVZmhEemFTM2lVUFYxRApnMzF5Tnp2UUlMUkpNbHM1S0lqNnNnbVYwYVhhRWwxNVd6M2RGaDFvRUhxT1pnNmtmcC8rcGI4K3dKcjQrU2U0Z1FhaEY0enJ3RlY1CnZ3SSs1RGR0VHg5QmFid3JnZjlRQ3JwZy9BSzZ6cWRGWWo4TUVQWmdkeVp3WktRQkZUNVh4U3A1dGFmbmlzVU14anJ6STRZWnc2R24KME1mU2xHV3VWRllBaEk0MU9OQjdhS1RrQWw3M2FzZk5meG1YMmNwbUFNTnJqek9IVjBqQkpieU9IYUZlalo3RG1rSjZydXpyVFdocwoyUlJRN3RVOG81SnR3NjdKcUgxVmh6NEdqUDA0SzQxQjBOVElxRU9sMXExalA5Q09nTWM2NDAzOWc5UDdNaFZyYWJGNTUxOEozUkZvCjRNMkZvK0NpUUdub1p2dVdhZHkyUHFZSDdPZGQ2QmZJSzlWQTMzQnYvR3U1VzVaSWl0SGRyS2t4Y2VpYnJFRFhrSXZvVUx1akRuUngKc3pqMExVNmdiODFEbDVHaGR2MEp1dVJWSExyZUNNc2tOcHk4dlFaZHRrNWkvTGdCamI3VmtJZHU5S3RZNnE3bHNLZWdWcVV3TXZaRApEVy9TRUlldTVlemIzc0d1clU0V29BdnpGRWJqb2Y2SlB1aDVBMDVqOWFsSnpPMlI3YnV4MndGZXVpOFBiZmRadjhHdXJSc0c1dXZyCnBCYzlqNDZ3bEVCWE5xeTdMbUdYV3BuK2hoRDBhNHc4aGtNWDBlazlDeHA4VWl0M0RRUHJzOGptYldjeWZJY2RERDEvandIOUNYYnAKQ2pyay9pM0pZV1V5ZkRFUkRyMkpRLzhPdk5TQy9qMXlYZTBQTlBUcmpNMW1NSFQxVXh3YXpHT1YreUQwSDJrT0szMlBLNEEyd0dIVApCa2hTYWZoMHhNWFFhY3l3SnhLQVdYNCtORGlCc29HUHNERG8rcDhRa0FuR3Zpc0dOSlpvYldpd3g4S2dNV2JqZ2dyb0JXTVpoa1puCkVoRm9rTms0eWxoUXhJQTJzTWxOV2VqUC9neUNqQ3FDeHV5SlpQT3Uvd1ZlMnpIS09QSUFocmF1eGV3Skk1RVZER00xK0g5cm4vMFYKV3RmaEtLc0lHck1uRzR3M0d5Vmo3VUhBUXpPYnorRXJlQlJDWS9hRVlVNHNlMkxGY25xdWFKYmIvN0g4b0xqRlhxdWxDaHF6Snd3YgphdW1xTi8rMU1MM1owSUovazZibkJoVkFOeWJ4SVh1eXdaenpYbHdpbjl5RlMrWXRiZENRUGJHaE9XKy9MSm56d2R6VFczbTc3ZC9YCkJnM1pFOFlrUXB0bThwZXFuZVJUMC9hS1NqZk4xVzVRSUNxZ1AyOWNqZGdUR3hyUFpKMHFtNlpaeU9kTmM2YmMrUjgxTXJHcGdIWmUKUENQMnhJYVdlNUhsaW55a0ZVSWo5bVFEdlpDam14cWhFWHZTZ0VaSDFLRG8xcTBFdXRDNEdyRW5EV2p3dFE0cXVuVXJnWGJmTVFEUAphZ1BhK0pza2MyMk9CbEVJRFhUQURyUm9LZ01DclFUNmpuTTVZRThjYU9QdmNzeElvSlZBdXhZWnNDY3V0T0JUalFSYUpUUmdUMXhvCnVRUU9wRzdGMEhUOFBHandkUzJ0MnhDSUNtalArOUt1b3dtOXhscUFGcWhiMkZ5Q0N1aDU5M3JhbmpTaFJaWkpWaDZDVTBZcW9XbDcKMG9LVzZLeHJINElnS3FCejNnL0kvcmNOV3NDQ2I2QWdLcUNiUzExSWU5SlJ6YmpVTUxOYWFITHBRR2M5NDFIanpHcWgvOEdzNkQragpJOVBUSllxaFd3YUJTc25kMFltOFJlbmhKb05aQ1hTcjQ2RHNTVStUWEgwUWlYbUY4WHBET1RSbHRIeWV3emwrc0djNVRWczk5TC80CjBNWXljMDY0Y3BQMVNrY1ZkT3NYbEQzeHo3Z3M3QUw3cFk1cWFNcWVCSFV6eTNtc2tjL2VZMGM1QVdnaVppRjk2MmFlR29PVWk2eVUKblJ3MFlVL0NEY1Z5cnZUQUxQdjhyRHlUTC9KZXprYUhIaGg5QWIxVDlBWDBUaEVIdXN5Ui95Mm10MHI1d2t6WlRzbmw4b3haS0FWYgppNm5wcldMZTlMbXo5YlBpcFdxTTVLMW16VW1sZDB1NEJWRXRtajJqcnFDNStlb1ZreHFoelJUSmZUbEpRM2VOQWFhMi9DRjhOeFJOClhTbGpoU3plNUkydVZFTjNOTnRxTVNoczlkNVdXbVVOT0ZhaWhGc1I5R0xiejZvaG8rcTczV1h3QjlUTXNiUkM2TmFPc09WUWlxNkYKUU9qcFZKMWlOM0pGME0zOFJCeEYxR20rbzg0V1hadkhJUlJDdTMvN1pXSytxSlpydi8rL295SGJvcmROcTRkMkZsVVpWYXF4dHI5awp2TXlkTWVuUVI1d21yZ2JhZVMxUEw0dGJiMk8rSG9mWmF1SzZsejQ3TTkvQWlSYXQweXBXWXpLenFOVkFnOHl0MThtWEJaYWQ0TlJLCm9HMFBpaXo1Ykw2V21Md2VuNWxCclFUYVlwbEdydk5NNkNUeldNRWdJVWMyS1lPZVJnNmZxN1JNYUl5K3FsUHZZU0NLbGo1ank0WGMKcFVBaXF4QWFvZzlFVUFhZFJ6ZmdPYzFSY3UwY3R1aEVCZlFjMXJnOUV5cld1RzFCRFZ6SnV5elFXemttZEZWMHZUZlV3QlZBZnc1dQp0SFJNS0hjUEJ5WG8wRDE1NkRzb1J0MitLWG9xMXl6WUlKQlFLNENHYy9GZFRxRHo2UDVFSU5TcXBvc1EyVE1JYU9xdTVkQW1VYWNUCnVFYm9oZ2xGNDFlYmZoZHRRZlF5STUzUVZjYWk1enJlbmE5dloyaTdIY0k3TFcvQnA4QUFxVXdqdEIwUmVDUHhDcU52STl1M1J1Z1YKVGllOWdoOGtRT2R2amRDMzhUTjhHanZNWUdneWYrdUR0bDlqNFp1bmJ6TE9uQ1QzTkdpRXJuTDJiakJPVDNET2R0dWUwTFlKeFk5Ngo1a0NUT3puMFFkc21GRDhqbW5IS0ViM0ZWQiswYlVMeFRUb3NhQ3A5NjRObUhRMWdQNlk0OUYwQ1JCOTBUaDAwdFExUEUvVHN6SU9GCkhRTnRMM0RjeWkyNDdtSEFvV2ZOZk1tQzdicWhLdWh0a3NnS3ZqZGtRTi9vUTJqN0tUYUxwYTNxZEljdlZ0UlBVNmU3SkovSUxQcTgKVFcvZkVUZFpuUE9zdHE4ajQ1d0RYR0Y2YjJvamkxNUhwbWlVUlUyZDZJTmVOeml2c1FabFBGM2xwTy83REdqS2hlcWNPV0VkVWNXWgpJeVBQOGRFN1I3Ynpaa1B0UncrZTkxN25YTHFOb1J0dmF0SDJYVitBMzNEb09hVUtsZTBoMWtDVVdnNTlFb0RYbGpxaDdjRVFuSjVLCnFDSFRja3JWOWYrZzBJMnp1RkZIdlhnZHUwN1BLVlVsZENHQ1l4ZUZUeVBUZEVwVkNWeFBWWEdIZ0ZJZkNIUC9rSHBPcVNxQjM4dW8KZUoyTDFMbEZEWkZuaHFxQy9oVHRYSnhFdXlhNHZBZzZzbDhKdElGNkovZWxxdURKaXRoaEowcWcwYzl3ZVBNNllnMGNYQkdyQkJvOAp2TDQ1Q0p5VU9aZ0xYdnVzQmhvOWtNZDd2eWl6YWhBOW1Vc1JOTnkrUFo4c1FWMkRqMGhRQXcxMzFldmV2ZU5UdzZlUktZTkd1K3BXCkZ4T1grdUYvY1JCRjBPZ1hoZG9tTHVOUlgrT2M4WklWL3c2SHN4a09iZDl0bmN4YWpQWEFuN0MyVzJiRW9aMk5hR2dxVzIrZnVmeGYKMUgwTjJNbVpUUjJGUCtXSlFqc2JhbEVyMmpua1g0VzlYRWVZdVNmYm5NSS9kc2lDaGwxV1Y1RDRKM094RCtZeWpKZkZ2NHptUXFQdAp1MmVTbW9jZDVjaW03RS94RDVqeW9OR1BvL204anBpRGQ4dWJqNkljZ21GL1YxNzRFNDhlTkdoRmZWZTZMYytSaDE5WXhQZWlIUU5oCkplOFUvajA0SGpUYVZRZk4yRzQrS3BvQnAyQ1VaL0tQTnFNZmRETEIrUHkwSGkzMEtNNnhMcmFzUnpxVk9nYTM3OEZRcHZIOWFielQKR2doTk5LRHhiNWdPZ3R4dnlqTStlRGdBdXVBdzc2aFFlNEZPcFM3b3JrcHltdkNZVTJNN0pvRm5tb0ZPcFU3cnJreEN5cDVPdFdtSAo1TEkzMnBsVHg1N1VYWjhrZFBGUUIzVHEzQTU0ckROZHpEdWgzOHFlUy9Yb2pPNUtxV1kra2ZKUmVxQmJlQ2FkOHRYWUFHZXppK2RTCkFSb2JXR3QyYWlnVnJOTUQyY1F6cDFPaEdvTm5qL3BIYnh4S1VYcmxUZDJWbE5XYmFSTFppZmJBTlBKWG44S1FiUTJkZVN1VHplcXUKY1R4bHM1bUp0NGRnWkVmbnpyeHo2bWNXZWovcTRzVzMzbms3c0pOSy9SOXZRRFNYcURYRjdRQUFBQ1YwUlZoMFpHRjBaVHBqY21WaApkR1VBTWpBeU1pMHdOaTB5T0ZRd05Eb3lNRG96T0Nzd01qb3dNSmVEK2JFQUFBQWxkRVZZZEdSaGRHVTZiVzlrYVdaNUFESXdNakl0Ck1EWXRNamhVTURRNk1qQTZNemdyTURJNk1ERG0za0VOQUFBQUFFbEZUa1N1UW1DQyIgLz4KPC9zdmc+Cg==",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n;return(n=window.neko)!=null&&n.isNeko?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isConnected)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.neko;if(!e.isConnected)try{await e.connect()}catch(r){throw new lr(r==null?void 0:r.message,r)}if(!e.publicKey)throw new qt;let n;try{n=new X(e.publicKey.toBytes())}catch(r){throw new Sn(r==null?void 0:r.message,r)}e.on("disconnect",this._disconnected),this._wallet=e,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const A4="Nightly";class D4 extends Xn{constructor(){super(),this.name=A4,this.url="https://nightly.app",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iOTYiIGhlaWdodD0iOTYiIHZpZXdCb3g9IjAgMCA5NiA5NiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTQ4IDk2Qzc0LjUwOTcgOTYgOTYgNzQuNTA5NyA5NiA0OEM5NiAyMS40OTAzIDc0LjUwOTcgMCA0OCAwQzIxLjQ5MDMgMCAwIDIxLjQ5MDMgMCA0OEMwIDc0LjUwOTcgMjEuNDkwMyA5NiA0OCA5NloiIGZpbGw9IiM2RDczRjgiLz4KPHBhdGggZD0iTTQ4IDg1LjYzNTZDNDggODUuNjM1NiA1Mi40NTMzIDg1LjYzNTYgNTUuNDQgODIuNTg2N0M1OC45MTU1IDc5LjI4MDEgNTcuMzUxMSA3NS40MzEyIDYyLjI3NTUgNzEuNDMxMkM2Ni45ODY2IDY3LjY0NDUgNzIuOTI0NCA3MC4zMzc5IDcyLjkyNDQgNzAuMzM3OUM3Ny4wMjIyIDYyLjEyNDUgNzQuNzkxMSA1Mi41NjkgNzQuNzkxMSA1Mi41NjlDODEuNzY4OCAzNC4yNTc5IDc1Ljk2NDQgMjEuMTU1NyA3NC40NDQ0IDE3LjM2MDFDNjkuNDQ4OCAyNC4zMzc5IDYzLjE5MTEgMjkuMTczNCA1NS43OTU1IDMyLjQwOUM1My4yMjY2IDMxLjcwNjggNTAuNTk1NSAzMS4zMzM0IDQ4IDMxLjM2MDFDNDUuNDEzMyAzMS4zMzM0IDQyLjc3MzMgMzEuNzA2OCA0MC4yMDQ0IDMyLjQwOUMzMi44MTc3IDI5LjE2NDUgMjYuNTUxMSAyNC4zMzc5IDIxLjU1NTUgMTcuMzYwMUMyMC4wMzU1IDIxLjE1NTcgMTQuMjMxMSAzNC4yNTc5IDIxLjIwODkgNTIuNTY5QzIxLjIwODkgNTIuNTY5IDE4Ljk3NzggNjIuMTI0NSAyMy4wNzU1IDcwLjMzNzlDMjMuMDc1NSA3MC4zMzc5IDI5LjAxMzMgNjcuNjQ0NSAzMy43MjQ0IDcxLjQzMTJDMzguNjU3NyA3NS40MzEyIDM3LjA4NDQgNzkuMjgwMSA0MC41NiA4Mi41ODY3QzQzLjU0NjYgODUuNjM1NiA0OCA4NS42MzU2IDQ4IDg1LjYzNTZaIiBmaWxsPSJ3aGl0ZSIvPgo8cGF0aCBkPSJNNDIuNDc5OSA2NS4yOThDNDIuMjkzMyA1OS4yMTggMzYuMzAyMSA1Ny4yNjI0IDMyLjIxMzMgNTkuODIyNEMzMi4yMTMzIDU5LjgyMjQgMzIuODUzMyA2Mi40MzU4IDM1LjgzOTkgNjMuNzUxM0MzOC4yNzU1IDY0LjgyNjkgMzkuMzI0NCA2My4zODY5IDQyLjQ3OTkgNjUuMjk4WiIgZmlsbD0iIzdCODFGOSIvPgo8cGF0aCBkPSJNMjIuNDk3NyAyMy4wOTM1QzIwLjA4ODggMzEuNTQ2OCAyMS4xMjg4IDQyLjI0MDIgMjQuOTMzMyA1MC4wMjY5QzI4LjgyNjYgNDcuMjcxMyAzMi45MTU1IDQzLjAxMzUgMzUuMDkzMyAzOC41MDY5QzI5Ljk2NDQgMzQuNzExMyAyNS42NjIyIDMxLjEwMjQgMjIuNDk3NyAyMy4wOTM1WiIgZmlsbD0iIzdCODFGOSIvPgo8cGF0aCBkPSJNNTMuNTE5OSA2NS4yOThDNTMuNzA2NiA1OS4yMTggNTkuNjk3NyA1Ny4yNjI0IDYzLjc4NjYgNTkuODIyNEM2My43ODY2IDU5LjgyMjQgNjMuMTQ2NiA2Mi40MzU4IDYwLjE1OTkgNjMuNzUxM0M1Ny43MjQzIDY0LjgyNjkgNTYuNjc1NSA2My4zODY5IDUzLjUxOTkgNjUuMjk4WiIgZmlsbD0iIzdCODFGOSIvPgo8cGF0aCBkPSJNNzMuNTAyMiAyMy4wOTM1Qzc1LjkxMTEgMzEuNTQ2OCA3NC44NzExIDQyLjI0MDIgNzEuMDY2NiA1MC4wMjY5QzY3LjE3MzMgNDcuMjcxMyA2My4wODQ0IDQzLjAxMzUgNjAuOTA2NiAzOC41MDY5QzY2LjAzNTUgMzQuNzExMyA3MC4zMzc3IDMxLjEwMjQgNzMuNTAyMiAyMy4wOTM1WiIgZmlsbD0iIzdCODFGOSIvPgo8cGF0aCBkPSJNNDcuOTk5OSA4NS4zMDY5QzUwLjE0MDQgODUuMzA2OSA1MS44NzU1IDgzLjc3ODcgNTEuODc1NSA4MS44OTM2QzUxLjg3NTUgODAuMDA4NCA1MC4xNDA0IDc4LjQ4MDIgNDcuOTk5OSA3OC40ODAyQzQ1Ljg1OTUgNzguNDgwMiA0NC4xMjQ0IDgwLjAwODQgNDQuMTI0NCA4MS44OTM2QzQ0LjEyNDQgODMuNzc4NyA0NS44NTk1IDg1LjMwNjkgNDcuOTk5OSA4NS4zMDY5WiIgZmlsbD0iIzdCODFGOSIvPgo8L3N2Zz4K",this.supportedTransactionVersions=new Set(["legacy",0]),this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._connecting=!1,this._publicKey=null,this._wallet=null,this._readyState!==$.Unsupported&&cr(()=>{var e;return(e=window==null?void 0:window.nightly)!=null&&e.solana?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get connecting(){return this._connecting}get readyState(){return this._readyState}get publicKey(){return this._publicKey}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.nightly.solana;try{await e.connect()}catch(r){throw new lr(r==null?void 0:r.message,r)}if(e.publicKey.toString()==="11111111111111111111111111111111")throw new qt;let n;try{n=new X(e.publicKey.toBytes())}catch(r){throw new Sn(r==null?void 0:r.message,r)}this._wallet=e,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch{this.emit("error",new Vr)}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{return n.signMessage(new TextDecoder().decode(e))}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const L4="Salmon";class z4 extends Xn{constructor({network:e=Vf.Mainnet}={}){super(),this.name=L4,this.url="https://salmonwallet.io",this.icon="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPHN2ZyB3aWR0aD0iODgiIGhlaWdodD0iODgiIHZpZXdCb3g9IjAgMCA4OCA4OCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHJlY3Qgd2lkdGg9Ijg4IiBoZWlnaHQ9Ijg4IiByeD0iMzAiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl84NTVfNTgwKSIvPgo8cGF0aCBkPSJNNTkuODA1NSAyNy42M0M1Ni43OTU1IDI1LjgyMzkgNTMuNjIyMiAyNC41Mzg4IDUwLjM1OTcgMjMuODE0NEw0Ni45MDQyIDE2LjEyODdDNDYuNDkzMyAxNC44NTg1IDQ1LjMwMDIgMTQuMDAwMSA0My45NTM3IDE0LjAwMDFINDMuODE1QzQyLjQ2ODUgMTQuMDAwMSA0MS4yNzU0IDE0Ljg2MzUgNDAuODY0NSAxNi4xMjg3TDM3LjQwOSAyMy44MDk1QzM0LjE0MTYgMjQuNTM4OCAzMC45NTgzIDI1LjgyODkgMjcuOTQzNCAyNy42MzQ5QzIxLjk1MzIgMzkuMjYwMyAyMC4zMjk0IDUwLjU5MjggMjEuMTQxMyA2MS43NjY2QzI0LjY1MTMgNjUuMTY1NCAzMi40MzM2IDY5LjM2OCAzNi42MDcgNzEuMDMwMkMzOS4wNTI2IDcyLjAwMjcgMzkuODAwMSA3Mi40OTM5IDQyLjI1MDYgNzIuOTAwN0M0NC40Mjg5IDczLjUxNiA0NS4wODczIDczLjI3NzggNDYuNzU1NyA3My4xMDQyQzQ5LjMyNTEgNzIuNDE5NSA1MC4zOTQ0IDcxLjcyNDggNTEuNDM0IDcxLjE2NDFDNTUuODQ5OSA2OC44NzY4IDYzLjExNzQgNjUuMTcwNCA2Ni42Mjc0IDYxLjc3MTZDNjcuNTc3OSA0OC44MTE2IDY0Ljk5ODYgMzcuNTgzMiA1OS44MDU1IDI3LjYyNVYyNy42M1pNMzcuNTI3OCA1MS4xNDg1QzM1LjY0MTYgNTEuMTQ4NSAzNC4wODIyIDQ4LjkwMDkgMzQuMDgyMiA0Ni4xMzIyQzM0LjA4MjIgNDMuMzYzNiAzNS41ODcxIDQxLjA5NjEgMzcuNTE3OSA0MS4wOTYxQzM5LjQ0ODYgNDEuMDk2MSA0MC45OTgxIDQzLjM2MzYgNDAuOTYzNSA0Ni4xMzIyQzQwLjkyODggNDguOTAwOSAzOS40NDM3IDUxLjE0ODUgMzcuNTIyOCA1MS4xNDg1SDM3LjUyNzhaTTUwLjIzMSA1MS4xNDg1QzQ4LjMzOTkgNTEuMTQ4NSA0Ni43OTAzIDQ4LjkwMDkgNDYuNzkwMyA0Ni4xMzIyQzQ2Ljc5MDMgNDMuMzYzNiA0OC4yOTUzIDQxLjA5NjEgNTAuMjMxIDQxLjA5NjFDNTIuMTY2NyA0MS4wOTYxIDUzLjcwMTQgNDMuMzYzNiA1My42NjY3IDQ2LjEzMjJDNTMuNjMyMSA0OC45MDA5IDUyLjE1MTggNTEuMTQ4NSA1MC4yMzEgNTEuMTQ4NVoiIGZpbGw9IiNGQ0ZDRkMiLz4KPHBhdGggZD0iTTc1LjQwNTEgNTYuMTIwM0w3MC45NzkzIDQyLjE3MjlDNzAuNDM0NyA0MC40NjYxIDY4Ljg1NTUgMzkuMzA1MSA2Ny4wNjMzIDM5LjMwNTFDNjYuNTI4NyAzOS4zMDUxIDY2LjAwODkgMzkuNDA5MiA2NS41Mjg3IDM5LjYwMjhDNjcuNTQ4NSA0Ni4zMjU5IDY4LjM2MDQgNTMuNTc5OSA2Ny43MjY3IDYxLjQ4NEg3MS40ODQyQzc0LjI2NjUgNjEuNDg0IDc2LjI0MTcgNTguNzc0OSA3NS40MDAxIDU2LjEyMDNINzUuNDA1MVoiIGZpbGw9IiNGQ0ZDRkMiLz4KPHBhdGggZD0iTTEyLjE5MDggNTYuMzgzNUwxNi42MTY2IDQyLjQzNjFDMTcuMTYxMiA0MC43MjkyIDE4Ljc0MDUgMzkuNTY4MiAyMC41MzI2IDM5LjU2ODJDMjEuMDY3MiAzOS41NjgyIDIxLjU4NyAzOS42NzI0IDIyLjA2NzMgMzkuODY1OUMyMC4wNDc0IDQ2LjU4OSAxOS4yMzU1IDUzLjg0MzEgMTkuODY5MiA2MS43NDcxSDE2LjExMTdDMTMuMzI5NSA2MS43NDcxIDExLjM1NDIgNTkuMDM4IDEyLjE5NTggNTYuMzgzNUgxMi4xOTA4WiIgZmlsbD0iI0ZDRkNGQyIvPgo8ZGVmcz4KPGxpbmVhckdyYWRpZW50IGlkPSJwYWludDBfbGluZWFyXzg1NV81ODAiIHgxPSI0NCIgeTE9IjAiIHgyPSI0NCIgeTI9Ijg4IiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSI+CjxzdG9wIHN0b3AtY29sb3I9IiNGRjgxNzAiLz4KPHN0b3Agb2Zmc2V0PSIxIiBzdG9wLWNvbG9yPSIjRkY1QzQ1Ii8+CjwvbGluZWFyR3JhZGllbnQ+CjwvZGVmcz4KPC9zdmc+",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.Loadable,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._network=e,this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>window.salmon?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1)}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.connected)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Loadable&&this._readyState!==$.Installed)throw new en;this._connecting=!0;let e;try{e=(await Ba(()=>import("./index-3e67d3a8.js"),[])).default}catch(i){throw new B0(i==null?void 0:i.message,i)}let n;try{n=new e({network:this._network})}catch(i){throw new Ei(i==null?void 0:i.message,i)}if(!n.connected)try{await n.connect()}catch(i){throw new lr(i==null?void 0:i.message,i)}if(!n.publicKey)throw new qt;let r;try{r=new X(n.publicKey.toBytes())}catch(i){throw new Sn(i==null?void 0:i.message,i)}n.on("disconnect",this._disconnected),this._wallet=n,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signMessage(e,"utf8")}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const j4="data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjMxIiB2aWV3Qm94PSIwIDAgMzEgMzEiIHdpZHRoPSIzMSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGxpbmVhckdyYWRpZW50IGlkPSJhIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjIwLjI1IiB4Mj0iMjYuNTcxIiB5MT0iMjcuMTczIiB5Mj0iMTkuODU4Ij48c3RvcCBvZmZzZXQ9Ii4wOCIgc3RvcC1jb2xvcj0iIzk5NDVmZiIvPjxzdG9wIG9mZnNldD0iLjMiIHN0b3AtY29sb3I9IiM4NzUyZjMiLz48c3RvcCBvZmZzZXQ9Ii41IiBzdG9wLWNvbG9yPSIjNTQ5N2Q1Ii8+PHN0b3Agb2Zmc2V0PSIuNiIgc3RvcC1jb2xvcj0iIzQzYjRjYSIvPjxzdG9wIG9mZnNldD0iLjcyIiBzdG9wLWNvbG9yPSIjMjhlMGI5Ii8+PHN0b3Agb2Zmc2V0PSIuOTciIHN0b3AtY29sb3I9IiMxOWZiOWIiLz48L2xpbmVhckdyYWRpZW50PjxnIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iLjA5NCI+PHBhdGggZD0ibTI2LjEwOSAzLjY0My05LjM2OSA2Ljk1OSAxLjczMy00LjEwNSA3LjYzNy0yLjg1M3oiIGZpbGw9IiNlMjc2MWIiIHN0cm9rZT0iI2UyNzYxYiIvPjxnIGZpbGw9IiNlNDc2MWIiIHN0cm9rZT0iI2U0NzYxYiI+PHBhdGggZD0ibTQuNDgxIDMuNjQzIDkuMjk0IDcuMDI0LTEuNjQ4LTQuMTcxem0xOC4yNTggMTYuMTMtMi40OTUgMy44MjMgNS4zMzkgMS40NjkgMS41MzUtNS4yMDctNC4zNzgtLjA4NXptLTE5LjI0Ny4wODUgMS41MjUgNS4yMDcgNS4zMzktMS40NjktMi40OTUtMy44MjN6Ii8+PHBhdGggZD0ibTEwLjA1NSAxMy4zMTMtMS40ODggMi4yNTEgNS4zMDEuMjM1LS4xODgtNS42OTd6bTEwLjQ4IDAtMy42NzItMy4yNzctLjEyMiA1Ljc2MyA1LjI5Mi0uMjM1LTEuNDk3LTIuMjUxem0tMTAuMTc4IDEwLjI4MyAzLjE4My0xLjU1NC0yLjc0OS0yLjE0Ny0uNDMzIDMuNzAxem02LjY5NS0xLjU1NCAzLjE5MiAxLjU1NC0uNDQzLTMuNzAxeiIvPjwvZz48cGF0aCBkPSJtMjAuMjQ0IDIzLjU5Ni0zLjE5Mi0xLjU1NC4yNTQgMi4wODEtLjAyOC44NzZ6bS05Ljg4NyAwIDIuOTY2IDEuNDAzLS4wMTktLjg3Ni4yMzUtMi4wODEtMy4xODMgMS41NTR6IiBmaWxsPSIjZDdjMWIzIiBzdHJva2U9IiNkN2MxYjMiLz48cGF0aCBkPSJtMTMuMzY5IDE4LjUyMS0yLjY1NS0uNzgxIDEuODc0LS44NTd6bTMuODUxIDAgLjc4MS0xLjYzOCAxLjg4My44NTctMi42NjUuNzgxeiIgZmlsbD0iIzIzMzQ0NyIgc3Ryb2tlPSIjMjMzNDQ3Ii8+PHBhdGggZD0ibTEwLjM1NyAyMy41OTYuNDUyLTMuODIzLTIuOTQ3LjA4NXptOS40MzUtMy44MjMuNDUyIDMuODIzIDIuNDk1LTMuNzM4em0yLjI0MS00LjIwOS01LjI5Mi4yMzUuNDkgMi43MjEuNzgyLTEuNjM4IDEuODgzLjg1N3ptLTExLjMxOCAyLjE3NSAxLjg4My0uODU3Ljc3MiAxLjYzOC40OTktMi43MjEtNS4zMDEtLjIzNXoiIGZpbGw9IiNjZDYxMTYiIHN0cm9rZT0iI2NkNjExNiIvPjxwYXRoIGQ9Im04LjU2NyAxNS41NjQgMi4yMjIgNC4zMzEtLjA3NS0yLjE1NnptMTEuMzI4IDIuMTc1LS4wOTQgMi4xNTYgMi4yMzItNC4zMzEtMi4xMzcgMi4xNzV6bS02LjAyNi0xLjk0LS40OTkgMi43MjEuNjIxIDMuMjExLjE0MS00LjIyOC0uMjY0LTEuNzA0em0yLjg3MiAwLS4yNTQgMS42OTUuMTEzIDQuMjM3LjYzMS0zLjIxMXoiIGZpbGw9IiNlNDc1MWYiIHN0cm9rZT0iI2U0NzUxZiIvPjxwYXRoIGQ9Im0xNy4yMyAxOC41Mi0uNjMxIDMuMjExLjQ1Mi4zMTEgMi43NS0yLjE0Ny4wOTQtMi4xNTZ6bS02LjUxNi0uNzgxLjA3NSAyLjE1NiAyLjc1IDIuMTQ3LjQ1Mi0uMzExLS42MjItMy4yMTF6IiBmaWxsPSIjZjY4NTFiIiBzdHJva2U9IiNmNjg1MWIiLz48cGF0aCBkPSJtMTcuMjc3IDI0Ljk5OS4wMjgtLjg3Ni0uMjM1LS4yMDdoLTMuNTVsLS4yMTcuMjA3LjAxOS44NzYtMi45NjYtMS40MDMgMS4wMzYuODQ4IDIuMSAxLjQ1OWgzLjYwNmwyLjEwOS0xLjQ1OSAxLjAzNi0uODQ4eiIgZmlsbD0iI2MwYWQ5ZSIgc3Ryb2tlPSIjYzBhZDllIi8+PHBhdGggZD0ibTE3LjA1MSAyMi4wNDItLjQ1Mi0uMzExaC0yLjYwOGwtLjQ1Mi4zMTEtLjIzNSAyLjA4MS4yMTctLjIwN2gzLjU1bC4yMzUuMjA3LS4yNTQtMi4wODF6IiBmaWxsPSIjMTYxNjE2IiBzdHJva2U9IiMxNjE2MTYiLz48cGF0aCBkPSJtMjYuNTA1IDExLjA1My44LTMuODQyLTEuMTk2LTMuNTY5LTkuMDU4IDYuNzIzIDMuNDg0IDIuOTQ3IDQuOTI1IDEuNDQxIDEuMDkyLTEuMjcxLS40NzEtLjMzOS43NTMtLjY4Ny0uNTg0LS40NTIuNzUzLS41NzQtLjQ5OS0uMzc3em0tMjMuMjExLTMuODQxLjggMy44NDItLjUwOC4zNzcuNzUzLjU3NC0uNTc0LjQ1Mi43NTMuNjg3LS40NzEuMzM5IDEuMDgzIDEuMjcxIDQuOTI1LTEuNDQxIDMuNDg0LTIuOTQ3LTkuMDU5LTYuNzIzeiIgZmlsbD0iIzc2M2QxNiIgc3Ryb2tlPSIjNzYzZDE2Ii8+PHBhdGggZD0ibTI1LjQ2IDE0Ljc1NC00LjkyNS0xLjQ0MSAxLjQ5NyAyLjI1MS0yLjIzMiA0LjMzMSAyLjkzOC0uMDM4aDQuMzc4bC0xLjY1Ny01LjEwNHptLTE1LjQwNS0xLjQ0MS00LjkyNSAxLjQ0MS0xLjYzOCA1LjEwNGg0LjM2OWwyLjkyOC4wMzgtMi4yMjItNC4zMzEgMS40ODgtMi4yNTF6bTYuNjg1IDIuNDg2LjMxMS01LjQzMyAxLjQzMS0zLjg3aC02LjM1NmwxLjQxMyAzLjg3LjMyOSA1LjQzMy4xMTMgMS43MTQuMDA5IDQuMjE5aDIuNjFsLjAxOS00LjIxOS4xMjItMS43MTR6IiBmaWxsPSIjZjY4NTFiIiBzdHJva2U9IiNmNjg1MWIiLz48L2c+PGNpcmNsZSBjeD0iMjMuNSIgY3k9IjIzLjUiIGZpbGw9IiMwMDAiIHI9IjYuNSIvPjxwYXRoIGQ9Im0yNy40NzMgMjUuNTQ1LTEuMzEgMS4zNjhjLS4wMjkuMDMtLjA2My4wNTMtLjEwMS4wN2EuMzEuMzEgMCAwIDEgLS4xMjEuMDI0aC02LjIwOWMtLjAzIDAtLjA1OS0uMDA4LS4wODMtLjAyNGEuMTUuMTUgMCAwIDEgLS4wNTYtLjA2NWMtLjAxMi0uMDI2LS4wMTUtLjA1Ni0uMDEtLjA4NHMuMDE4LS4wNTUuMDM5LS4wNzZsMS4zMTEtMS4zNjhjLjAyOC0uMDMuMDYzLS4wNTMuMTAxLS4wNjlhLjMxLjMxIDAgMCAxIC4xMjEtLjAyNWg2LjIwOGMuMDMgMCAuMDU5LjAwOC4wODMuMDI0YS4xNS4xNSAwIDAgMSAuMDU2LjA2NWMuMDEyLjAyNi4wMTUuMDU2LjAxLjA4NHMtLjAxOC4wNTUtLjAzOS4wNzZ6bS0xLjMxLTIuNzU2Yy0uMDI5LS4wMy0uMDYzLS4wNTMtLjEwMS0uMDdhLjMxLjMxIDAgMCAwIC0uMTIxLS4wMjRoLTYuMjA5Yy0uMDMgMC0uMDU5LjAwOC0uMDgzLjAyNHMtLjA0NC4wMzgtLjA1Ni4wNjUtLjAxNS4wNTYtLjAxLjA4NC4wMTguMDU1LjAzOS4wNzZsMS4zMTEgMS4zNjhjLjAyOC4wMy4wNjMuMDUzLjEwMS4wNjlhLjMxLjMxIDAgMCAwIC4xMjEuMDI1aDYuMjA4Yy4wMyAwIC4wNTktLjAwOC4wODMtLjAyNGEuMTUuMTUgMCAwIDAgLjA1Ni0uMDY1Yy4wMTItLjAyNi4wMTUtLjA1Ni4wMS0uMDg0cy0uMDE4LS4wNTUtLjAzOS0uMDc2em0tNi40MzEtLjk4M2g2LjIwOWEuMzEuMzEgMCAwIDAgLjEyMS0uMDI0Yy4wMzgtLjAxNi4wNzMtLjA0LjEwMS0uMDdsMS4zMS0xLjM2OGMuMDItLjAyMS4wMzQtLjA0Ny4wMzktLjA3NnMuMDAxLS4wNTgtLjAxLS4wODRhLjE1LjE1IDAgMCAwIC0uMDU2LS4wNjVjLS4wMjUtLjAxNi0uMDU0LS4wMjQtLjA4My0uMDI0aC02LjIwOGEuMzEuMzEgMCAwIDAgLS4xMjEuMDI1Yy0uMDM4LjAxNi0uMDcyLjA0LS4xMDEuMDY5bC0xLjMxIDEuMzY4Yy0uMDIuMDIxLS4wMzQuMDQ3LS4wMzkuMDc2cy0uMDAxLjA1OC4wMS4wODQuMDMxLjA0OS4wNTYuMDY1LjA1NC4wMjQuMDgzLjAyNHoiIGZpbGw9InVybCgjYSkiLz48L3N2Zz4=";var Qe=globalThis&&globalThis.__classPrivateFieldGet||function(t,e,n,r){if(n==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!r:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return n==="m"?r:n==="a"?r.call(t):r?r.value:e.get(t)},U4=globalThis&&globalThis.__classPrivateFieldSet||function(t,e,n,r,i){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?i.call(t,n):i?i.value=n:e.set(t,n),n},jl,ao,Kf,Jf,Xf,Mn,qf,zM,jM,$f,eh,th,nh,rh;class _4{constructor(){jl.add(this),ao.set(this,{}),Kf.set(this,"1.0.0"),Jf.set(this,"MetaMask"),Xf.set(this,j4),Mn.set(this,null),qf.set(this,(e,n)=>{var r;return(r=Qe(this,ao,"f")[e])!=null&&r.push(n)||(Qe(this,ao,"f")[e]=[n]),()=>Qe(this,jl,"m",jM).call(this,e,n)}),$f.set(this,async()=>{if(!Qe(this,Mn,"f")){let e;try{e=(await Ba(()=>import("./index-e2c1b9df.js"),[])).default}catch{throw new Error("Unable to load Solflare MetaMask SDK")}U4(this,Mn,new e,"f"),Qe(this,Mn,"f").on("standard_change",n=>Qe(this,jl,"m",zM).call(this,"change",n))}return this.accounts.length||await Qe(this,Mn,"f").connect(),{accounts:this.accounts}}),eh.set(this,async()=>{Qe(this,Mn,"f")&&await Qe(this,Mn,"f").disconnect()}),th.set(this,async(...e)=>{if(!Qe(this,Mn,"f"))throw new me;return await Qe(this,Mn,"f").standardSignAndSendTransaction(...e)}),nh.set(this,async(...e)=>{if(!Qe(this,Mn,"f"))throw new me;return await Qe(this,Mn,"f").standardSignTransaction(...e)}),rh.set(this,async(...e)=>{if(!Qe(this,Mn,"f"))throw new me;return await Qe(this,Mn,"f").standardSignMessage(...e)})}get version(){return Qe(this,Kf,"f")}get name(){return Qe(this,Jf,"f")}get icon(){return Qe(this,Xf,"f")}get chains(){return[Qf,DM,LM]}get features(){return{[F0]:{version:"1.0.0",connect:Qe(this,$f,"f")},[Wf]:{version:"1.0.0",disconnect:Qe(this,eh,"f")},[W0]:{version:"1.0.0",on:Qe(this,qf,"f")},[qr]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:Qe(this,th,"f")},[Kt]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:Qe(this,nh,"f")},[Uo]:{version:"1.0.0",signMessage:Qe(this,rh,"f")}}}get accounts(){return Qe(this,Mn,"f")?Qe(this,Mn,"f").standardAccounts:[]}}ao=new WeakMap,Kf=new WeakMap,Jf=new WeakMap,Xf=new WeakMap,Mn=new WeakMap,qf=new WeakMap,$f=new WeakMap,eh=new WeakMap,th=new WeakMap,nh=new WeakMap,rh=new WeakMap,jl=new WeakSet,zM=function(e,...n){var r;(r=Qe(this,ao,"f")[e])==null||r.forEach(i=>i.apply(null,n))},jM=function(e,n){var r;Qe(this,ao,"f")[e]=(r=Qe(this,ao,"f")[e])==null?void 0:r.filter(i=>n!==i)};let hy=!1;function R4(){hy||(_T(new _4),hy=!0)}async function C4(){const t="solflare-detect-metamask";function e(){window.postMessage({target:"metamask-contentscript",data:{name:"metamask-provider",data:{id:t,jsonrpc:"2.0",method:"wallet_getSnaps"}}},window.location.origin)}function n(r){var o,s;const i=r.data;(i==null?void 0:i.target)==="metamask-inpage"&&((o=i.data)==null?void 0:o.name)==="metamask-provider"&&(((s=i.data.data)==null?void 0:s.id)===t?(window.removeEventListener("message",n),i.data.data.error||R4()):e())}window.addEventListener("message",n),window.setTimeout(()=>window.removeEventListener("message",n),5e3),e()}const O4="Solflare";class B4 extends Xn{constructor(e={}){super(),this.name=O4,this.url="https://solflare.com",this.icon="data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiBoZWlnaHQ9IjUwIiB2aWV3Qm94PSIwIDAgNTAgNTAiIHdpZHRoPSI1MCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayI+PGxpbmVhckdyYWRpZW50IGlkPSJhIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiNmZmMxMGIiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNmYjNmMmUiLz48L2xpbmVhckdyYWRpZW50PjxsaW5lYXJHcmFkaWVudCBpZD0iYiIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI2LjQ3ODM1IiB4Mj0iMzQuOTEwNyIgeGxpbms6aHJlZj0iI2EiIHkxPSI3LjkyIiB5Mj0iMzMuNjU5MyIvPjxyYWRpYWxHcmFkaWVudCBpZD0iYyIgY3g9IjAiIGN5PSIwIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDQuOTkyMTg4MzIgMTIuMDYzODc5NjMgLTEyLjE4MTEzNjU1IDUuMDQwNzEwNzQgMjIuNTIwMiAyMC42MTgzKSIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHI9IjEiIHhsaW5rOmhyZWY9IiNhIi8+PHBhdGggZD0ibTI1LjE3MDggNDcuOTEwNGMuNTI1IDAgLjk1MDcuNDIxLjk1MDcuOTQwM3MtLjQyNTcuOTQwMi0uOTUwNy45NDAyLS45NTA3LS40MjA5LS45NTA3LS45NDAyLjQyNTctLjk0MDMuOTUwNy0uOTQwM3ptLTEuMDMyOC00NC45MTU2NWMuNDY0Ni4wMzgzNi44Mzk4LjM5MDQuOTAyNy44NDY4MWwxLjEzMDcgOC4yMTU3NGMuMzc5OCAyLjcxNDMgMy42NTM1IDMuODkwNCA1LjY3NDMgMi4wNDU5bDExLjMyOTEtMTAuMzExNThjLjI3MzMtLjI0ODczLjY5ODktLjIzMTQ5Ljk1MDcuMDM4NTEuMjMwOS4yNDc3Mi4yMzc5LjYyNjk3LjAxNjEuODgyNzdsLTkuODc5MSAxMS4zOTU4Yy0xLjgxODcgMi4wOTQyLS40NzY4IDUuMzY0MyAyLjI5NTYgNS41OTc4bDguNzE2OC44NDAzYy40MzQxLjA0MTguNzUxNy40MjM0LjcwOTMuODUyNC0uMDM0OS4zNTM3LS4zMDc0LjYzOTUtLjY2MjguNjk0OWwtOS4xNTk0IDEuNDMwMmMtMi42NTkzLjM2MjUtMy44NjM2IDMuNTExNy0yLjEzMzkgNS41NTc2bDMuMjIgMy43OTYxYy4yNTk0LjMwNTguMjE4OC43NjE1LS4wOTA4IDEuMDE3OC0uMjYyMi4yMTcyLS42NDE5LjIyNTYtLjkxMzguMDIwM2wtMy45Njk0LTIuOTk3OGMtMi4xNDIxLTEuNjEwOS01LjIyOTctLjI0MTctNS40NTYxIDIuNDI0M2wtLjg3NDcgMTAuMzk3NmMtLjAzNjIuNDI5NS0uNDE3OC43NDg3LS44NTI1LjcxMy0uMzY5LS4wMzAzLS42NjcxLS4zMDk3LS43MTcxLS42NzIxbC0xLjM4NzEtMTAuMDQzN2MtLjM3MTctMi43MTQ0LTMuNjQ1NC0zLjg5MDQtNS42NzQzLTIuMDQ1OWwtMTIuMDUxOTUgMTAuOTc0Yy0uMjQ5NDcuMjI3MS0uNjM4MDkuMjExNC0uODY4LS4wMzUtLjIxMDk0LS4yMjYyLS4yMTczNS0uNTcyNC0uMDE0OTMtLjgwNmwxMC41MTgxOC0xMi4xMzg1YzEuODE4Ny0yLjA5NDIuNDg0OS01LjM2NDQtMi4yODc2LTUuNTk3OGwtOC43MTg3Mi0uODQwNWMtLjQzNDEzLS4wNDE4LS43NTE3Mi0uNDIzNS0uNzA5MzYtLjg1MjQuMDM0OTMtLjM1MzcuMzA3MzktLjYzOTQuNjYyNy0uNjk1bDkuMTUzMzgtMS40Mjk5YzIuNjU5NC0uMzYyNSAzLjg3MTgtMy41MTE3IDIuMTQyMS01LjU1NzZsLTIuMTkyLTIuNTg0MWMtLjMyMTctLjM3OTItLjI3MTMtLjk0NDMuMTEyNi0xLjI2MjEuMzI1My0uMjY5NC43OTYzLS4yNzk3IDEuMTMzNC0uMDI0OWwyLjY5MTggMi4wMzQ3YzIuMTQyMSAxLjYxMDkgNS4yMjk3LjI0MTcgNS40NTYxLTIuNDI0M2wuNzI0MS04LjU1OTk4Yy4wNDU3LS41NDA4LjUyNjUtLjk0MjU3IDEuMDczOS0uODk3Mzd6bS0yMy4xODczMyAyMC40Mzk2NWMuNTI1MDQgMCAuOTUwNjcuNDIxLjk1MDY3Ljk0MDNzLS40MjU2My45NDAzLS45NTA2Ny45NDAzYy0uNTI1MDQxIDAtLjk1MDY3LS40MjEtLjk1MDY3LS45NDAzcy40MjU2MjktLjk0MDMuOTUwNjctLjk0MDN6bTQ3LjY3OTczLS45NTQ3Yy41MjUgMCAuOTUwNy40MjEuOTUwNy45NDAzcy0uNDI1Ny45NDAyLS45NTA3Ljk0MDItLjk1MDctLjQyMDktLjk1MDctLjk0MDIuNDI1Ny0uOTQwMy45NTA3LS45NDAzem0tMjQuNjI5Ni0yMi40Nzk3Yy41MjUgMCAuOTUwNi40MjA5NzMuOTUwNi45NDAyNyAwIC41MTkzLS40MjU2Ljk0MDI3LS45NTA2Ljk0MDI3LS41MjUxIDAtLjk1MDctLjQyMDk3LS45NTA3LS45NDAyNyAwLS41MTkyOTcuNDI1Ni0uOTQwMjcuOTUwNy0uOTQwMjd6IiBmaWxsPSJ1cmwoI2IpIi8+PHBhdGggZD0ibTI0LjU3MSAzMi43NzkyYzQuOTU5NiAwIDguOTgwMi0zLjk3NjUgOC45ODAyLTguODgxOSAwLTQuOTA1My00LjAyMDYtOC44ODE5LTguOTgwMi04Ljg4MTlzLTguOTgwMiAzLjk3NjYtOC45ODAyIDguODgxOWMwIDQuOTA1NCA0LjAyMDYgOC44ODE5IDguOTgwMiA4Ljg4MTl6IiBmaWxsPSJ1cmwoI2MpIi8+PC9zdmc+",this.supportedTransactionVersions=new Set(["legacy",0]),this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.Loadable,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._accountChanged=n=>{if(!n)return;const r=this._publicKey;if(r){try{n=new X(n.toBytes())}catch(i){this.emit("error",new Sn(i==null?void 0:i.message,i));return}r.equals(n)||(this._publicKey=n,this.emit("connect",n))}},this._connecting=!1,this._publicKey=null,this._wallet=null,this._config=e,this._readyState!==$.Unsupported&&(cr(()=>{var n;return(n=window.solflare)!=null&&n.isSolflare||window.SolflareApp?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1}),C4())}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.connected)}get readyState(){return this._readyState}async autoConnect(){this.readyState===$.Loadable&&$g()||await this.connect()}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Loadable&&this._readyState!==$.Installed)throw new en;if(this.readyState===$.Loadable&&$g()){const i=encodeURIComponent(window.location.href),o=encodeURIComponent(window.location.origin);window.location.href=`https://solflare.com/ul/v1/browse/${i}?ref=${o}`;return}let e;try{e=(await Ba(()=>import("./index-eb9ef66c.js"),[])).default}catch(i){throw new B0(i==null?void 0:i.message,i)}let n;try{n=new e({network:this._config.network})}catch(i){throw new Ei(i==null?void 0:i.message,i)}if(this._connecting=!0,!n.connected)try{await n.connect()}catch(i){throw new lr(i==null?void 0:i.message,i)}if(!n.publicKey)throw new lr;let r;try{r=new X(n.publicKey.toBytes())}catch(i){throw new Sn(i==null?void 0:i.message,i)}n.on("disconnect",this._disconnected),n.on("accountChanged",this._accountChanged),this._wallet=n,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}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(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async sendTransaction(e,n,r={}){try{const i=this._wallet;if(!i)throw new me;try{const{signers:o,...s}=r;return xi(e)?o!=null&&o.length&&e.sign(o):(e=await this.prepareTransaction(e,n,s),o!=null&&o.length&&e.partialSign(...o)),s.preflightCommitment=s.preflightCommitment||n.commitment,await i.signAndSendTransaction(e,s)}catch(o){throw o instanceof Qt?o:new mr(o==null?void 0:o.message,o)}}catch(i){throw this.emit("error",i),i}}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signMessage(e,"utf8")}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const F4="Torus";class W4 extends Xn{constructor({params:e={showTorusButton:!1}}={params:{showTorusButton:!1}}){super(),this.name=F4,this.url="https://tor.us",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzMiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMyAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMTYuNSIgY3k9IjE2IiByPSIxNiIgZmlsbD0iIzAzNjRGRiIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTExLjIxODYgOS40OTIxOUMxMC40NTM5IDkuNDkyMTkgOS44MzM5OCAxMC4xMTIxIDkuODMzOTggMTAuODc2OFYxMi40ODk4QzkuODMzOTggMTMuMjU0NSAxMC40NTM5IDEzLjg3NDQgMTEuMjE4NiAxMy44NzQ0SDEzLjY2ODRWMjIuODk3NkMxMy42Njg0IDIzLjY2MjMgMTQuMjg4MyAyNC4yODIyIDE1LjA1MyAyNC4yODIySDE2LjY2NkMxNy40MzA3IDI0LjI4MjIgMTguMDUwNiAyMy42NjIzIDE4LjA1MDYgMjIuODk3NlYxMi41MDE1QzE4LjA1MDYgMTIuNDk3NiAxOC4wNTA2IDEyLjQ5MzcgMTguMDUwNiAxMi40ODk4VjEwLjg3NjhDMTguMDUwNiAxMC4xMTIxIDE3LjQzMDcgOS40OTIxOSAxNi42NjYgOS40OTIxOUgxNS4wNTNIMTEuMjE4NloiIGZpbGw9IndoaXRlIi8+CjxwYXRoIGQ9Ik0yMS4zMzc2IDEzLjg3NDRDMjIuNTQ3NyAxMy44NzQ0IDIzLjUyODcgMTIuODkzNCAyMy41Mjg3IDExLjY4MzNDMjMuNTI4NyAxMC40NzMyIDIyLjU0NzcgOS40OTIxOSAyMS4zMzc2IDkuNDkyMTlDMjAuMTI3NSA5LjQ5MjE5IDE5LjE0NjUgMTAuNDczMiAxOS4xNDY1IDExLjY4MzNDMTkuMTQ2NSAxMi44OTM0IDIwLjEyNzUgMTMuODc0NCAyMS4zMzc2IDEzLjg3NDRaIiBmaWxsPSJ3aGl0ZSIvPgo8L3N2Zz4K",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.Loadable,this._connecting=!1,this._wallet=null,this._publicKey=null,this._params=e}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isLoggedIn)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Loadable)throw new en;this._connecting=!0;let e;try{e=(await Ba(()=>import("./solanaEmbed.esm-47ad5150.js"),["assets/solanaEmbed.esm-47ad5150.js","assets/punycode-06c60053.js"])).default}catch(o){throw new B0(o==null?void 0:o.message,o)}let n;try{n=window.torus||new e}catch(o){throw new Ei(o==null?void 0:o.message,o)}if(!n.isInitialized)try{await n.init(this._params)}catch(o){throw new lr(o==null?void 0:o.message,o)}let r;try{r=await n.login()}catch(o){throw new qt(o==null?void 0:o.message,o)}let i;try{i=new X(r[0])}catch(o){throw new Sn(o==null?void 0:o.message,o)}this._wallet=n,this._publicKey=i,this.emit("connect",i)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){this._wallet=null,this._publicKey=null;try{e.isLoggedIn&&await e.cleanUp()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async sendTransaction(e,n,r={}){try{const i=this._wallet;if(!i)throw new me;try{const{signers:o,...s}=r;e=await this.prepareTransaction(e,n,s),o!=null&&o.length&&e.partialSign(...o),s.preflightCommitment=s.preflightCommitment||n.commitment;const{signature:a}=await i.signAndSendTransaction(e,s);return a}catch(o){throw o instanceof Qt?o:new mr(o==null?void 0:o.message,o)}}catch(i){throw this.emit("error",i),i}}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signMessage(e)}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const V4="Trust";class P4 extends Xn{constructor(e={}){super(),this.name=V4,this.url="https://trustwallet.com",this.icon="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDAyIiBoZWlnaHQ9IjQwMiIgdmlld0JveD0iMCAwIDQwMiA0MDIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiPgo8cmVjdCB3aWR0aD0iNDAyIiBoZWlnaHQ9IjQwMiIgZmlsbD0idXJsKCNwYXR0ZXJuMCkiLz4KPGRlZnM+CjxwYXR0ZXJuIGlkPSJwYXR0ZXJuMCIgcGF0dGVybkNvbnRlbnRVbml0cz0ib2JqZWN0Qm91bmRpbmdCb3giIHdpZHRoPSIxIiBoZWlnaHQ9IjEiPgo8dXNlIHhsaW5rOmhyZWY9IiNpbWFnZTBfMTY5NF8xODk2NyIgdHJhbnNmb3JtPSJzY2FsZSgwLjAwMjQ4NzU2KSIvPgo8L3BhdHRlcm4+CjxpbWFnZSBpZD0iaW1hZ2UwXzE2OTRfMTg5NjciIHdpZHRoPSI0MDIiIGhlaWdodD0iNDAyIiB4bGluazpocmVmPSJkYXRhOmltYWdlL2pwZWc7YmFzZTY0LC85ai80QUFRU2taSlJnQUJBUUFBQVFBQkFBRC8yd0JEQUFjRkJRWUZCQWNHQmdZSUJ3Y0lDeElMQ3dvS0N4WVBFQTBTR2hZYkdoa1dHUmdjSUNnaUhCNG1IaGdaSXpBa0ppb3JMUzR0R3lJeU5URXNOU2dzTFN6LzJ3QkRBUWNJQ0FzSkN4VUxDeFVzSFJrZExDd3NMQ3dzTEN3c0xDd3NMQ3dzTEN3c0xDd3NMQ3dzTEN3c0xDd3NMQ3dzTEN3c0xDd3NMQ3dzTEN3c0xDd3NMQ3ovd2dBUkNBR1NBWklEQVNJQUFoRUJBeEVCLzhRQUd3QUJBQUlEQVFFQUFBQUFBQUFBQUFBQUFBRUdCQVVIQXdML3hBQVpBUUVBQXdFQkFBQUFBQUFBQUFBQUFBQUFBUU1FQlFMLzJnQU1Bd0VBQWhBREVBQUFBZWtBQUFFRXhJaEloSWhJaEloSWhJaEloSWhJaEloSWhJaEloSWhJaElJRWdBQUFBQVFrQUFBQUFBQUFBQUFBQUFBQUFBQWlVRWdBQUFRa0FBQUFBQUFBQUFBQUFBQUFBQUFBQWlVRWdBRUVnQUFBQUFBQUFBQUFBQUFBQUFBQUFBQWlZa0FJa0FBQUFBQUFBQUFBQUFBQUFBQUFBQUFBUk1FZ2lZa0FBQUFBQUFBQUFQT29XVjduWFZWdXg5TXllWTNYTG8zSXo2QUFBQUFBQUFBRVNENUV6RWdBQUFBQUFCR0xNWmJSNmUydTVWK3BlT25QazR4cXpCTUFicTE4NlVYOVZjNzNlVFRhV3J6NmJmVWVmUUFBQUFBQUdPSmozbUppUUFBQUFOTlVQckE2Zk95Zm53WFZ6Qk1BZ0EyOXFvdXJtNjNyRnI1cGk5U3JlbWlvc2pIMVpnbUFQdjF4MFRrN0RUUFBycUhyWGJGeStpSGoyQUFBQmppWTk1aVlrQUFBQURtMkhuWVBZNVFzTVRYbCt5cUx1YzdMb0UxV1ZiZTVpaTRLN0FBSTArNWV2TksxWFNtaWpsVHArSGJYenhlNlpkVmppMnE0V1d1V1BsZElLclFBQUFNY1RIdk1URWdBQUFBYzYxK3kxdlg1YTMxQzIxMldnY3pvQUFBQUFBQUFPYTlLNW5yeTR3MzRycFlkRHZ1VjB3cXNBQUFBeHhNZTh4TVNBQUFBQnovVmJuVGRibUxWVmJONTlXOGN2b2dBQUFBQUFBT1lkUDVac3lmSTNZNzF1OVB1T1Qwd3JzQUFBQXh4TWU4eE1TQUFBQUJSOUZZcTcxZWFzVmQzaGVSeXVrQUFBQUFBQUI4OHM2ZHpIZGpEWms2RnM4SE80L1ZEejZBQUFBeHhNZTh4TVNBQUFBQlVxdmNLZjArYzIycHo3UEhSaHlPb0FBQUFBQUFCaGMzNkJ6L29ZUTFaK201RVR4dXFFU0FBQUJqaVk5NWlZa0FBQUFEUlVmb1hQZWpnZTNpMDBkVmVYcnhlcUNRQUFBQUFBTkRTTFpVK2x6M3Y0Ykc2cm9nNC9WQUFBQUF4eE1lOHhNU0FBQUFCNDh3NnJ6TGJreHh0eDlDMmRic25KNllWMkFBQUFBQUFValE1bUgxK1czMmh0dmoxYUJ5K2tBQUFBQmppWTk1aVlrQUFBQUJSYjFYYjZhWU9uenQzZXVXZE53YmZZWk5RQUFBQUFERnlxdlpYVWgxdVk2QlErbjQ5WDBNTzBBQUFBREhFeDd6RXhJQUFBQUR3OXlPV2ZOaHIzWDVpeTFvZFZWeXg4cm9oNTlnQUFBRHhRNXZtNnZwWUEwVWIrN1lHZnl1a0ZWb0FBQUFHT0pqM21KaVFBQUFBQU1mbkhUOVhvbzU4Ky9qcFlHOTBUelBUTW5sdG13N0xZOC9UTG9CSUJyYWpkVFphZGpOK01MYWxrd2I3azFmUXdiUUFBQUFBTWNUSHZNVEVnQUFBQUFBYTZqZEs4NzZlWExQV3VoaCtSNzhlOXRwYXF6cXJudTZ4Yk4vVWRMNTZzNGFNNHpZbkNzTzgzR0xYOC9SajFnQUFBQUFBWTRtUGVZbUpBQUFBQUFBQVl1VW1LUm9lcTYzWGw1NDJXdDI1UW55UHBQemtiKzFaZEdoc01zT3NQUHNBQUFBQUFBUWZEMElpWWxJQUFBQUFBQUFBRVZ1eXZmamxuejB2QjJaYWxkczM2elhoVGNBQUFBQUFBQUFpWUpBaVlKQUFBQUFBQUFBQUFBQUFBQUFBQUFBQUFSSUFCRW9KQUFBQUFBQUFBQUFBQUFBQUFBQUFBaVlKQUFBQkVvSkFBQUFBQUFBQUFBQUFBQUFBQUFRRWdBQUFBQkNRUUpSSUFBQUFBQUFBQUFBQUFJSlFKaVFBQUFBQUFBQUErUkhpSkFBQUFBQUFBQUFBQWVub1FCSUFBQUFILzhRQUx4QUFBQVVFQWdFQ0JBVUZBQUFBQUFBQUFBRUNBd1FGRVRBeEVFQVNJRFFURkNGQklpUXpOV0FqTWxCd2dQL2FBQWdCQVFBQkJRTEhZV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVdJV0lXSVc1di9OTi81TGYrbC92L0FDVDcvd0FLazFOcGhTYTE5V0pEY2h2ckhvRjFsdUpiUk1xaW5PV1hsc09SS2kzSTY5d1d1bXBTVUprVmR0QWVrT3lGZW1OVTNXQXhPWWtkVTlsclBld1ZLWVFIS3RIU0hhdzZvT1BPUEhoWm55R1EzV2lDS2xGV0V1dHI2SjdMV09mUCtWSmN5UXMvbVh3YnpwZ3pNOEVXbHVQQitsTXVOdnhuWTZ2V1Mxa1BtSGg4eStJOVRmYVUyNGwxdkdleTFqbktOYzdDeFRYM2hHZ014dVZJU3RNaWpwTU94M1dEdzBaUm5HeG5zdFk1ZnZmU2xLbEczVHBMZ2FveEJtSXd4NnpJbEU5UzQ3Z2NvN3lRdUsrMTY2TCtqalBaYXh6ZmZjVTZFMUpiS2x4U0NZY2RBSWlJc3FtVzNBcW54VkE2VEZNU0VFMUk0bzN0OFo3TFdPZjcvaWkvcGRPWDd6aWplMHhuc3RZNmorNGNVWCszcHlQZGNVZjJXTTlsckhVLzNIaWlkUjM2dmNVbjJPTTlsckhWZmY4QUZGL1Y2YXZxcmlsL3QrTTlsckhWeS9POFVZL3pQU1VkazgwNHJVL0dleTFqckpmbWVLUWRwdlNmTzBmbUVWb09NOWxySFdpL0Z4VER0VU9sTk8wTG1PVm8yTTlsckhXaS9wY1FUOFozU3FSMnAvSkZaT005bHJIVnl2QzRhVjR2ZEtzS3RENFlUNVNNaDdMV09vcDhvSExTdk5ubzFwWDA0cDZmS2ZrUFpheHZKODJPYWN2emdkR3JyOHBuRklUZVprUFpheVNFZkRrOFVaeTdIUmxyK0pNNG9xUHdaRDJXc2xXYjhKdkZLZCtITTZFbDM0TWJtbXQvRGdaRDJXc2xZYThtT0VxTkMyWENlWnoxaC84QUR3MmczSEVwSktjaDdMV1I1c25tRkpOS3VLVEs4RlpublVzTlBPcWZlNHBEUG5KeW5zdFphdEg4SHVZRlNKd3NqcnFHVVRacXBhK1lVZjVhTmxQWmF5dnNwZlplYVV3N3pGcWJqSVprTnlFNFpWVGFZRDhoeVF2bWxSUE5lWTlsck5OaEpsTnJRcHRmS0ZxYlZHcTRRNGgxUHBrem1Zd2sxQjZSNllNRlVwYVVraE9ZOWxyUExoTnlreUl6a1pmb2FmY1lWRnF5SE9YcERjZEVtcU9PK3FIVEZPaEtTUW5PZXkxMEZvUzRpVlNESUtTYUZlaUxPZGpCK3NGNExjVTZ2MFI0ajBrNHRPYWo5STlscnBQeG1wQlNhVTYxaFpZY2ZWR3BLRUFpSWk2VnV0SmdzeVJKZ3V4dlNTVFVjV2tHWVEybHRQVCt3Ky9WTXJsTHBSS0NrcVFvUllUc280ME5xS25ybjJIb3pNZ0pwY1ZKa1JKTHJmZi9BSnd2M2I5Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN4Y3hjeGN3bkwvQVAvRUFDY1JBQUlCQWdVRkFBSURBQUFBQUFBQUFBRUNBd0FSQkJBd01USVNJQ0ZBUVJSd0lsRlMvOW9BQ0FFREFRRS9BZjBhN2hONk03VkhNRzhIMWIyb3lxS2FjbmF0ODFtWmFXZFRRWUhiMEpKQ1RWejJKQ3pVSWxBdFR3RWNhMnp2UVlpa1BVTDZyYjBxbGpZVitPMUREajdTeHF1M1lWQjNvNGRmbEhEbis2ZU1wdmxGd0dxL0kxRHowc1JzTW8rQTFYNUdvZVkwc1I4eWo0alZsNW1vK1kwc1I4eVhpTldiblNjaHBZamxrTlhFY3RPZm5TK1RyWWdiSEtNM1VhTG03RTFFTHVOYVlYWExEdDR0b08zU3Q4c09QTjlkbDZUYWxicE42Vmd3dU8rV1RxOERLSmVsZGVXUHE4akpXSzdVazRQTHNlVlZwNUMrVU1kLzVIMFpJZzlNaFhmSkpDbTFDZFNQTlBNVzJ5QXZ0U1FmVzlNaTlQQi9taUNOODBnSjNwVkM3ZXN5aHQ2T0hQeWtpQ2ZvL3dEL3hBQWtFUUFDQVFNRUFnTUJBUUFBQUFBQUFBQUJBZ01BQkJFUU1ERXlFaUVnUUVFaWNQL2FBQWdCQWdFQlB3SC9BQTFJeS9GQzNURlNRRmZZK3FBVFN3dWFTMkE3VUJqVjRGYW10M0hGRlNPZm9SUmhWckErRHpxdE5NNU9hUzRCN1VEblhBb29wNUZPdmkyTjFlQlRNRUdUUnVWbzNSL0JUU00zSitDc1Y0b1hMRG1oZEQ5RkpLSDQwbTduZFRxS242YlZyeWRKZTUzWStncWZvZHExL2RKTzUzWXVncVhvZHExL2RIN0hkZzZDbjZuYXR1dWgzYlkveHQyNC9pbU9CbmV0VHlOSlJoenN4akNnVk1jSWQ2QnNQcGNyNzh0aU5mSnNhWFRlZ043aWtieUdhZGZNWU5NaFE0UHpoaThCazZTdjV0bmZobDhEZzhhTW9iMGFlM0k2L0JJV2VraVZOSjVjZnlQb3h6RlBWSTRmalI0bGZtbXQyQndLamdDODZFZ2MxSmNmaWZUQnh4U1hQNDFBZyt4ckpjQWVscG5MYy9XVnluc1VMbGNlNmttTC93Q0gvd0QveEFBM0VBQUJBUVFHQndZR0FnTUFBQUFBQUFBQkFnQURFUklRSUNFaVFGRXhRVkpoY1hLQkV5TXdVR0toQkRJemtaS3hRb0tBa1BELzJnQUlBUUVBQmo4Qy93QkMwcVIyaXR6WG5ObTR0TTdNZkw1bHFDUXhRNXVvejFtbWQyWUZwVlhIbVdmbGtWRUFiMmc1RTV6MU5GNHFOYVZmZUkzNld1cmdySStUM255UHUxMlpmQU4zYVFqM2FMeFpWeDhLeGNSa3ExdTlkZFV0OVNYaTExYVZjRGpwVTJ2RDdORXZsOURCdnJQUHlhMTR2N3RhZkFtZTkyajNMQU8rN1VHZzhURGZxUGdXS0k2dDlWZjVOOVo1K1RYMWRvbmV3V2d4QnhMMG5haDRVU096VG1wb3dtWHRHbVZRQkJ6YUxoVXZwTFFlSUtmQ1duSldKZmN4clFTQ2VEZlRsNXJHNzE1MFMxeDJBYzY4Q0lockIyWjlMWEZKWDdOZmRLSFN1ODVzUzk1cVZLZVJzT3B2a2oxYXh5ajdOWUllTmZkcFZ4RGZSSFJ0Q2gxWjRoT2hKaFN2bXhMM2pTOTQ0Ujl6bWxmUGlYdEwzcGhIdk1hVHo0bDUwL1ZMN3BoRjh4cC9zY1NyZ0tYdkRDRTBvNjRrY3RLeDZjR1RVZGY5cnhLRDZhZUtjRzhQcE5SMXk0bHllTktOOGYxZzMzTFVkREpJeExzNzZYWE5nM25UOTFBTXNUSEpWS0ZaS0J3WUdhcVhhYzFERlBmdlVRck1Sd1RwUEUwdWh2amlscHpTUlVkN3JNRkxzcHBKMlU0dDRqSlZLMFpHT0NlcTMwdlY5TVhOdGlOTXVwWWhnVnZNaFVSNnJjV2w1c0drS0drV3NsNG5Rb1lCTGtjVFNsQTBxTUdDUm9GbUxXN1A4Z3hTZElwN0Jac1Y4dmpsNHMyQmxQRmFUU1hoMEkvZU43WWZLdlR4cUIwK01GNmpuNHBXdFVBMlRzYUJVU2orV2s0MVR0V2dzWGE5SXFCTHkrajNEVE8xUjhLVkhlTDltbWVLalU3ZFl1ajVjZms4R2dzVUxFQ0treUZGSjNNRS9FRCt3YVpDZ29icTBDWmxiSWFFWkVaQ3JFMk9ocExCS1JBRHlDMnhlcFRRZUo2MVpuYWlscFgxeFdlcW1aNHFEU3V1N1Q3MWd0OWRSbHJMQktSQUR5S1ZhUW9NVmZEMmpaTFFVQ0R2cXdqTWpaTGR5bThkclUweTFGUnEzRTJablEweHZyelBrMEhpWTcybWRkNG4zOEdWMmtxYVo4WnpscWFBRUI1VEVpQzlvTkVpS05vVllKRVMwM3hGbnBEU29TRWpkNVpBdFA4QUQzVHN0S29RSW91aUNkb3RkRVZiUjh3N3hFZDdSbEo0bG9KRUIvbkovOFFBS2hBQUFRSUVCQVlEQVFFQkFBQUFBQUFBQVFBUklURmhjUkF3UVZFZ1FJR1JvYkZRNGZEQjhkSC8yZ0FJQVFFQUFUOGh5Q1FFNTI3cGp1bUtnRlFDb0JVQXFBVkFLZ0ZRQ29CVUFxQVZBS2dGUUNvQlVBcUFWQUtnRlFDb0JVQXFBVkFLZ0ZRQ1ltcVZHNlpia0NXVVRPQ0FiNEpta24zaG11OHBib0J2aG9pb1U4cncrSmJVSUY4ancrTEkxRTBJOFJpVzcvR21CZnZ3a3NnR0h4d2hEZ203YjQ4K3NTV0NBWWZJQ0RqQXlmSW1Zd0V6ekI4WUdZSmdPcSsvbFFGV28xRitaSk9XTmhEcVZHWElQNk5pSE1ieW1kamNTczVjQUFGSjVRb0hjeVRCT0Zab2ZaUEg3Um9PbkVPRmlLQ3hUUUJFcG5sWmlrMjVBZ0RrZ0NxbDRwR1U3eE5nZVU1Z2Z1WWs4UjFaVE9Eam9FWkFncVA0SzBtV3drTHduQjVHYmRTYlpnQkRBcnhrRzY4UFFlRi9wRk5GYzBSY2h2a05EMngrR1FnV0xBemU2Y2MyQjREa2VGNUFHUStwZjZSQVFKcWlNOUNtbmpjWmsyNmsyek5FUXV5R1RNcHY3a095WmcvWmh0aVp6YkFFOHZuUjdxOFdhSHJsRkJLRjFHWk51cE5zeUg4VWVKMUYyQjFxME4wQk1YNkg5SzZqQkU5K001Q0pNRUozSnV5N0o2SW51VW9MZUlkK01JOUhyTW0zVW0yWURYV01ieTJITXAwZDVyMzJkN1RLRUd3R2Q0b2txYkJ1STlLUVdpdTFQUWZIOTlNeWJkU2JaZ05peWhVK3VVSi8weHhDSlY2R1pOdXBOc3dHdUQwTVRoMS9ybERjbS91eEJxcGVobVRicVRiTUJxdjhNU2lQN1BsRGQ3K3pFV0d1WVRicVRiTUZxM294S0J1SEtGVkRpTFZEN1prMjZrMnpHaWJpZkp4dlova2NuUVFQd05LaFBsbVRicVRiTXZKdms0d0hjSHJrNkhFOGNEUm9PWk51cE5zeThRSHJHMHdlWEp1YXNjRkRWNHpKdDFKdG1PN2N4NCtzWFRRTzhPVHZ4bmhpQTVZS2xCc3liZFNiWmpmc2o3R1A2NkR5ZEJNZURqUWdlYzJiZFNiWmpHMkE3RHdVWi9Ea3V2eWVNYUVlQVBtemJxVGJNL053T0J5Nmg0bHVTYWRnUDdqWDBQOEFNMmJkU2Jac0FHZUFzK01ZNCtkL25KYThnbUJZUXhZM0pBL3V1Yk51cE5zMXgwQi9qK1l0SkdLNjVqa2Q3b1Y5T0NNSnVQcjlObXpicVRiTmFlYkJzY1Rqc2NBYXJWMEZ1UWFMeFAxNHlDUUNsT0lETm0zVW0yYkxRWXNnSXNSaU1RbGFFY2pvZHM5bVFQdlJUd0Y3WXN5Z3d1L0hPbTNVbTJjY1lmU3hTSzBNUVdYM3pRRWg2bFFDL3dEdHppQVNXRVNuRW03dWROdXBOczZRaXoyTzZEWXhlOWVBYTZHaHFzZFJxTGpLY0dOZ0dDNVZqQU5CYmdza1IxTytmTnVwTnM5NUJoZnFLT2hoaUR3QW9CMUprVVJFZnR3aGtvNmx4T25kcjEyVHZHUDJUcndnSXlSY29FT2dFd0EwejV0MUp0eUdnOUkwVUdRYUJJOEwxWlNSVEdJZDUvNGdRUTRMZzROUmpvTlRaUDdubGY4QUZNOEo0TXpoK2pJZEFaZ0JweUUyNmsyNUUrTU13VTRyVWVqMEtMQlhNQXg0UzREOFNHeVp3ZGlKL0RvME9PcDRlcXJDQk05bklDdzVLYmZsQm5zdEpDT3FlYkNKZW1xSUlMR0J5SE96WFlKbm92Si8xQVFBSkFjbkhIZENaNVVTZTZqN1J1aXBIMXdpNWhwQUJ5VXdtWjF1cFF1QWRBNVF6S1FYdHl3Q0FCQjBLZjJOWFNiYkk3TG5nY0pCT2NqN1U0Uk9ZZVdPZ3drNWdaQ01Ta0k2cDBxV0NoOFFVZ0F3SExpSkhFUWg4ZVN3UURERTc3Zkh6TnVHUnA4YWRoTlNIRE5EWS9Ga3NnTy9HUTZCME0vaVNXUUdwbmtrT25hZmY0ZDlCTkFkOHhtbDJUN3crRGRsRTBVczl0aW5PbzdKbS9PczNUN0JNVE05a0EzS0FBSktvVlVLcUZWQ3FoVlFxb1ZVS3FGVkNxaFZRcW9WVUtxRlZDcWhWUXFvVlVLcUZWQ3FoVlFxb1ZVS2luSE4vOW9BREFNQkFBSUFBd0FBQUJEenp6UlR6enp6enp6enp6enp6enp6VHp6enp6eVJ6enp6enp6enp6enp6enp6enp3elR6enlUenp6enp6enp6enp6enp6enp6enp5anp5aHp6enp6enp6enp6enp6enp6enp6enp4end6enp6enp6enp6enp6enp6enp6enp6enl6enp6enp6enp6enp6OVBmenp6enp6enp6enpEenp6enp6enp6UW9NTU9EN0h6enp6enp6ekx6enp6enl1QUFNTTkrNHNNUE9MM3p6enp3THp6enp6eUVJV1kzenp3MjAwd1A4QTg4ODg4Qzg4ODg4OEtRODg4ODg4ODg4NkQwODg4ODhDODg4ODg4cUU4ODg4ODg4ODhyRGQ4ODg4OEM4ODg4ODhxRzg4ODg4ODg4OGdEVzg4ODg4Qzg4ODg4OGpTODg4ODg4ODg4SkdWODg4ODhDODg4ODg4cEEvODg4ODg4ODhDSDg4ODg4OEM4ODg4ODhNRDE4ODg4ODg4OEpIODg4ODg4Qzg4ODg4OG9EYjg4ODg4ODg1REQ4ODg4ODhDODg4ODg4L0NDLzhBUFBQUFB3UjkvUFBQUFBBdlBQUFBQUE9DQWZ0L1BPOEF5dlBQUFBQUEF2UFBQUFBQUERqUTQwcUF4VDNQUFBQUFBQQXZQUFBQUFBQUExmUUF3RGovQUR6enp6enp6elB6enp6enp6enp6eTJLL3dBODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODg4ODhFODhVODg4ODg4ODg4ODg4ODg4ODg4ODg4MGM4OHN3ODg4ODg4ODg4ODg4ODg4ODg4OHM4ODg4ODhjODg4ODg4ODg4ODg4ODg4ODhFODg4ODg4ODg4akJCQkJCQkJCQkJCQkIvOEFQUFBQUFAvRUFDWVJBUUFDQVFNRUFnSURBUUFBQUFBQUFBRUFFU0VRTURGQVFXRnhJS0ZSY0lHUnNmRC8yZ0FJQVFNQkFUOFEvUm8xd2xzYW5ZQjZWSEpuZjc5VEdHb3FyZGNRNUp5V0p5UytnYmw0SjV2aGtPQ1k0dVpUSWlLcDFFY01Xc1pTL251OHZ2U1FkeElMbE9BZkF1aGNaeXFkbkExNzZmWVp4ZFRKajdtZjhQVzF4L2xwOUxkRlFkYlE4ajNvYUR3YnBwUlVuazJuZ2VOQlFHNktMNGcwM0JzdlpWcnhCU2VlZ2l4YlB1amZoZjhBak9saS9IWXVORjYzcUNVeGxVY3g4OUNnV3k3MkRTbUhuZnI5d2lWaGlGcVlUQitvSTVOY0x5emx1UHhvNjdIUTVRd3h1aG9sbGlYREJtT3dORVZDVmY0empvZ0ZNRnovQUVqdEN0Y2ppZmNIbzdWYmg5Q1djc1ROY3Y2UC84UUFKaEVCQUFJQUJRUURBQU1CQUFBQUFBQUFBUUFSRUNFd01WRkJZWEdoSUVDeFlIQ0I4UC9hQUFnQkFnRUJQeEQralg2MmN3bEV1ZFpUNnV3RnpvdGVabVN1QUtESE16Sm5LcHM1UG9ER3JXZHI0WkdOc3BScVpabGZVQVdPS201Q2FoZGNkWDFpZE1VSHNNYjB2aTR0YnFiVUdkU1I5TmZ2V0p2L0FPZnVsNldIdmFydndrRi85ZGRJNXJ4Zzc4anF1L0ZEZmkwaGt2R0N0TzdxdS84QWI5aHN1enBITTk4RmF1cmNqaGlXVkVwclJvTHpMbmdmUUNtZDlIdzVyeXF1K1dGWUhYUXI4RkhKMWhWWkJNOVlLeXFEOGdWb25NRGhjamJwcjh3SU41a0hwdVovbVBjUkduSFBOam1iVHZ6Z1o2N3Y5SFAyWkJyZUJPVFBtYmtEbVp2bmNBYlZFdjhBMG0vMGtWcW1NZnJEYkxNZXJqNmpkdTlLOVJxMk95RzVrZXh4L09qV2ZuLy94QUFxRUFFQUFRSUNDUVVCQVFFQUFBQUFBQUFCRVFBaE1hRVFNRUZSWVhHQmtmRWdRTEhCOEZEUjRmL2FBQWdCQVFBQlB4RFVXUmI3akdwY0ljMVNZdm9SVzhsNXJYaXE4VlhpcThWWGlxOFZYaXE4VlhpcThWWGlxOFZYaXE4VlhpcThWWGlxOFZYaXE4VlhpcThWWGlxOFZYaXE4Vlc0STVNVk13NjE2azRoeVdva2hsYm4yQXFNWGNWR0lodVA5b0JZaitDZ2tKSlU4V09EY292Z1N5ZGJMZGZpMUJnUDRxQ1FralVZTTdqYVVJSkdUVXFCS3dGUTNOdHpmei9rcUhBZHB2b0JicWJ0UVhTNE1PUEgrV2srUlNCSjZ1U0g0ZnpjRndmeDlNUzJMWXF3ZnpyeTlsemw2QzVzV0gzL0FEemFURzRvUkJMam9tVXgyYzZnRGQvUXZibTV5MFhCdXY4QTBiRzMyZEZ6OVAzZjNDUERpWWU1dXZ5R2tTUU51ekE1SmZ1VUV2MkVJWGNObnQ4UjJsKzJqYTcxYy9iWTJvM2c1Y1hoUXEzWE5nNGJtZkxEU2tXeWRvTnliU2pIcXRKZTR2cHZ6OXVSTGNJcktudE1KS2lCMWFMZkd3YUw4NU9kVHFSd2VXTEhxa2dDeFlQNHN6MG9NQlByelk5RjlyTEQydFpWN0JxTllxZ281a1RFRHNGNkhFWmg4aEJ5bzVXNFd2dkJrMWNsTWtxSEl3T21xSi94d2k5em9sRkN2YkRaSHpRUkRPNXZXSXpvc3VtSDBqN0hPcXlyV1JXNkRxVGZ3T0hkS1V1eFE2UUsvYi9kRHdMeFgzVW9EdlUrc0ZZTHRQRmJjUkJjQndjWHRRVVlReU9YdDU0MHpPTEY5eFBveDFHelgzeDhWa3JIOTErMys2ZHgwblFtL0VubkpWMll6OVBFYmF6T3F5cldNVEtUd0xHUnFRUUFWYkFWZkNkZ2lPR042d2NhTWhyWVNqd1lmTGpwTGUwU2cxdkhHUlh5eEhXZVpVMkU0SW5rQ3ozMVN0ek80UUpPNVBYV1oxV1Zhd29IZjV2VURXOXBYWXBzUlBhRU9qZktuRmQrRWZqaFJBbE5sUDFYN2VzSW13TWljUnBGZWJWaTVyZG9wM1laRmw2TnM2ZVlWak4yRW5yNWtEV002ckt0WVFUZjU2UmZaQ2hSQTdxL08zNEpTUXlEQk5uV1ZGaVhBUVphNmF1TzFqTXFSbUg4S0tZZXJuM05PUXBKU3dPM1NTZmF3eTZ6T3F5cldRQ0l2ZTRhWnQwWDg2ZTBCWnVzK21MZkEvZlBXWjFXVmF5RzhidTJtYmQzN24rUGFZM1hkK2ZUTU41eWZyV1oxV1ZheTJON3B1YlJlMDdkWkdNN1dtVWJ4OEgxck02ckt0WktONitIMXBqM3Q5bC8zMmwwcGxjOU1vakhaejYxbWRWbFdzL1djSDFwZzN4N1A5dlo3S3ArdzlIR0R1ays5Wm5WWlZySWZISCsybWQ4bVgxN1B4ano5SEZydkwvZXN6cXNxMWtjVDZaWDNwanV4RHVmWHM3cVJQZEVmZm90NUdUSFdaMVdWYXkwKzJlY3RLNjhUK0p6OW54M0Y2L1JPbERDVllDakp3QWREV1oxV1ZhenlnNTltbTlrWERrSDJkeTd3WEFUNk5OaUp0dk1HdHpxc3Exa0tsek9nL0I2TGd6ZnQ4aCsvWlFCY1F1VUQ1ZE5ucGw3ajZhM09xeXJXUitTa2RVZWlWMlVyaElNZzlsRVRaZzRxL0JOTStscGJpcDhGMXVkVmxXdGUzQVRtUmxHa0c3RVRnSStWMzlrWmpJamZZWkJwbkV4NXlGZmhyYzZyS3RiQVJFejJTWGZCNjZUaHJnQ0grQ2RmWWhKUW5yMnpKU3F5M2RMUVVkOUxaTmF6cXNxMXJuWit6dmNPK25oWXJJTWxZSlFKdmJUb3lkUFlIYzFpTmdXSGVYb2FjMVlCWW9HNENOd0VHdHpxc3ExcmhRc3U5c2VqRDBwTGJ6c1JHRTAzOENCYmE5V3pqejE5eTFFYlZzSEZwRDlqVFlZQWNBZzAzVU1lMnlCMkpkdGRuVlpWcnRpMW9iRSt3bm1Pa1VFVVM0bEFaSFlYQVhaOHVldHhlejRpN2cydkNqb0VMbUw5bnhtNkFRS01BWFZvekppNXY0blFnNmE3T3F5clhCMWdBRjlrT0kxWkVwT3diQndmUWFka0ZiWEJjVGc5eW9LTkd3ZmRpR3FscU8yS2Z4WXlwUzVtSFk5dzJmUG9jcnZzTVA0SHp5MStkVmxXdkpZb0hCUGkrTzhwWU9HdWZ0L293UWdzUjJwelloQmM0N1RtZHF3c3VURGs3bmg2aDRaTFhPcGgxWDRVWTJCVFluYytIRDA3cUZybVptOTJVR2RRMEFOZm5WWlY3QzBrV0RTOENiVGgycVRSSGJ1Vy9XUHBCYlNSZEJNSHJTRFJzSE1tL1ZialFNQUpFWkUwVFlEaXZ1R0xVZmxrS052aS9BNzBxaXFyZFgwOEZCUVAweithZ3ppZUFld3pxc3E5amdxamNsU1EzbFlPRzA1TitMVFRsaFFPWStsMnhOMnNjMjFsd3JFZXdWbnVBeFpjNnhwaHZMeTRIRDB4RjRNWm9iWGdTMDRBSzVlT1J6dSt5MzNhcXdHNjNzNENjUUhaaS9UQ3BTSlhnc2NmbzdVaUJCaEVoSFVRd25FRWN4YkZObURmQWJqdHlIQ2piREFZQTRIc3drNTFXanVaOXJaUjFyZlZzSFB1VS9GTkYzMUdLNTkzMHNkdUZrY0FvcGw3aVhmQnlMOFNzRE9FUS82OGZhT0VNWXRRUUJnV3BzWGNqOW43WU1MUWhJbERHdVZHT2UydUdIS2xHWkE0UjBTT1pRYXpnYjNBNnhVTWpVRW5oRzQ0R2Z0cjNlTTl2eG9HSXhMME1rbUQ3Y1dERUJQSkMvU2pjSFpGUFlSUFdqTzNBd09BZTM0QUxIMys0YWJ6dTRjdjU5NEx1QnpxQU5KYkRITVVJZ2x4L25HUHNzT2ZwTUxhdzRPNythM0V1eU45QUFHQjZVQkRoU1IybXgzL3dBdUJoSzRHK29MdDFpK3NCR0c1M1VrNEh5L2toeExnYjZTY1JaYWtCRFV0K2ZsL3dDTzN3VGtLZ3VzcmJySjduaXcvd0NVR1lFdHp0L2hvc2NkMjJveGJOeGpRQWdJTmNna0pKVXpFT0RjcURhOFZXOWh6dDcxRmhFN3FtNHJ6dFc0QnUvMVFZQ1BhS1VBN3dwdmZOWG1xODFYbXE4MVhtcTgxWG1xODFYbXE4MVhtcTgxWG1xODFYbXE4MVhtcTgxWG1xODFYbXE4MVhtcTgxVjQrYWdHUjFYb0FJQURXZi9aIi8+CjwvZGVmcz4KPC9zdmc+Cg==",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._disconnected=()=>{const n=this._wallet;n&&(n.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null,this.emit("error",new Vr),this.emit("disconnect"))},this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n,r;return(r=(n=window.trustwallet)==null?void 0:n.solana)!=null&&r.isTrust?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isConnected)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.trustwallet.solana;if(!e.isConnected)try{await e.connect()}catch(r){throw new lr(r==null?void 0:r.message,r)}if(!e.publicKey)throw new qt;let n;try{n=new X(e.publicKey.toBytes())}catch(r){throw new Sn(r==null?void 0:r.message,r)}e.on("disconnect",this._disconnected),this._wallet=e,this._publicKey=n,this.emit("connect",n)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){e.off("disconnect",this._disconnected),this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async sendTransaction(e,n,r={}){try{const i=this._wallet;if(!i)throw new me;try{const{signers:o,...s}=r;e=await this.prepareTransaction(e,n,s),o!=null&&o.length&&e.partialSign(...o),s.preflightCommitment=s.preflightCommitment||n.commitment;const{signature:a}=await i.signAndSendTransaction(e,s);return a}catch(o){throw o instanceof Qt?o:new mr(o==null?void 0:o.message,o)}}catch(i){throw this.emit("error",i),i}}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Qr(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const Q4="FoxWallet";class Z4 extends Xn{constructor(e={}){super(),this.name=Q4,this.url="https://foxwallet.com",this.icon="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4KPCEtLSBHZW5lcmF0b3I6IEFkb2JlIElsbHVzdHJhdG9yIDI1LjIuMSwgU1ZHIEV4cG9ydCBQbHVnLUluIC4gU1ZHIFZlcnNpb246IDYuMDAgQnVpbGQgMCkgIC0tPgo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9ImZveHdhbGxldCIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiCgkgdmlld0JveD0iMCAwIDEyMDAgMTIwMCIgc3R5bGU9ImVuYWJsZS1iYWNrZ3JvdW5kOm5ldyAwIDAgMTIwMCAxMjAwOyIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+CjxzdHlsZSB0eXBlPSJ0ZXh0L2NzcyI+Cgkuc3Qwe2ZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO2ZpbGw6I0ZGRkZGRjt9Cgkuc3Qxe2ZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO2ZpbGw6dXJsKCNTVkdJRF8xXyk7fQoJLnN0MntmaWxsLXJ1bGU6ZXZlbm9kZDtjbGlwLXJ1bGU6ZXZlbm9kZDtmaWxsOnVybCgjU1ZHSURfMl8pO30KCS5zdDN7ZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7ZmlsbDp1cmwoI1NWR0lEXzNfKTt9Cgkuc3Q0e2ZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO2ZpbGw6dXJsKCNTVkdJRF80Xyk7fQoJLnN0NXtmaWxsLXJ1bGU6ZXZlbm9kZDtjbGlwLXJ1bGU6ZXZlbm9kZDtmaWxsOnVybCgjU1ZHSURfNV8pO30KCS5zdDZ7ZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7ZmlsbDojNzIyQjAwO30KCS5zdDd7ZmlsbC1ydWxlOmV2ZW5vZGQ7Y2xpcC1ydWxlOmV2ZW5vZGQ7ZmlsbDp1cmwoI1NWR0lEXzZfKTt9Cjwvc3R5bGU+CjxnPgoJPHBhdGggY2xhc3M9InN0MCIgZD0iTTQ4NS43LDY3Ny40YzIuNSwwLjgsNS4xLDEuNCw3LjcsMS43YzAsMC0xMC45LDQuMS0zMy40LTMuNmMwLDAtMTYuOS02LjktMjkuNS01LjcKCQljLTE0LjcsMS4zLTI0LjgsMjAuNC0yNC44LDIwLjRjMi45LTEuNiw2LTIuOCw5LjItMy42YzEwLTIsNi42LTAuMyw2LjYtMC4zcy0xOS4yLDguMS0yMC41LDE1LjJjLTAuMywxLjgsNS4xLTMuMywxOS4zLTIuOAoJCWMxNy41LDAuNSwzMi43LDEwLjcsMzguOSwxMi40YzEyLjgsMy40LDMxLjEsNC4yLDQ4LTljMCwwLDE1LjUtOS43LDIwLjMtMjcuN2MxLjItNSwyLTEwLjEsMi4yLTE1LjJjMC4xLTQuNS0wLjQtOS0xLjQtMTMuNQoJCUM1MjguMiw2NDUuNiw1MTkuMSw2NjYuNyw0ODUuNyw2NzcuNHoiLz4KCgkJPGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8xXyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI2MTYuMjE1MSIgeTE9Ijc0Ni4yNjQzIiB4Mj0iNjMzLjU3ODciIHkyPSIzMTUuMzk3OSIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDEyMDIpIj4KCQk8c3RvcCAgb2Zmc2V0PSIwIiBzdHlsZT0ic3RvcC1jb2xvcjojREFEQjQ4Ii8+CgkJPHN0b3AgIG9mZnNldD0iMC42NTYyIiBzdHlsZT0ic3RvcC1jb2xvcjojNjM3NjIxIi8+Cgk8L2xpbmVhckdyYWRpZW50PgoJPHBhdGggY2xhc3M9InN0MSIgZD0iTTgxNi4xLDg3NC45YzMzLjktNDIuNSw1Mi4zLTk1LjIsNTIuMy0xNDkuNmMwLTU0LjMtMTguNS0xMDcuMS01Mi4zLTE0OS42bDIxNy4xLTIzLjljMCwwLDIyLjYsNjEuOSwyOC41LDk1CgkJYzAuOCw0LjIsMi4xLDEyLjgsMi4xLDEyLjhzLTMzLjcsODEuOC04NS40LDEyNi43QzkwOSw4NDYuNyw4MTYuMSw4NzQuOSw4MTYuMSw4NzQuOXogTTMwMiw4NzEuOWwtODMuMiwxNS40CgkJYy0yNi40LTY2LjktMzYuMS0xMzkuMi0yOC4xLTIxMC42YzcuOS03MS41LDMzLjMtMTM5LjksNzMuNy0xOTkuM2MxLjgtMi42LDUuNC03LjcsNS40LTcuN2w5MS45LDI1OC45TDMwMiw4NzEuOXoiLz4KCgkJPGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8yXyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI2MjYuMjQ4IiB5MT0iOTcwLjIzNzEiIHgyPSI0MTUuMTU0MyIgeTI9Ijk3MC4yMzcxIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIC0xIDAgMTIwMikiPgoJCTxzdG9wICBvZmZzZXQ9IjAiIHN0eWxlPSJzdG9wLWNvbG9yOiNFQzZGMDEiLz4KCQk8c3RvcCAgb2Zmc2V0PSIxIiBzdHlsZT0ic3RvcC1jb2xvcjojRjRCMjNEIi8+Cgk8L2xpbmVhckdyYWRpZW50PgoJPHBhdGggY2xhc3M9InN0MiIgZD0iTTYwMy4xLDM0MC45YzAuMy0wLjQsMC41LTAuNSwwLjgtMC45YzIuMi0yLjQsNTMuOS01Ny45LTcuNy0xNTJjLTQ1LjUtNjkuMy0xNjEuMi02Ny40LTIwOC41LTEwMy41CgkJYzMuNSwyNy44LDMwLjcsNTIuOSwyNy44LDkwLjljLTEuMiwxMi42LTMuNSwyNS03LDM3LjFjLTUuNiwyMS43LTEwLjgsNDIuNC0zLDgyLjljNi4xLDMxLjYsMjAuNSw1NC42LDQyLjgsNjguNQoJCWMyNS42LDE1LjgsNjEsMTkuMyw5Ny4zLDkuNUM1NjkuOCwzNjYuOCw1OTEuNCwzNTQuNiw2MDMuMSwzNDAuOUw2MDMuMSwzNDAuOXoiLz4KCgkJPGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8zXyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI2MDkuMTIyMSIgeTE9IjkzNC43NDkiIHgyPSI1OTYuNjQ0MSIgeTI9IjExMzguNTYzNSIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDEyMDIpIj4KCQk8c3RvcCAgb2Zmc2V0PSIwIiBzdHlsZT0ic3RvcC1jb2xvcjojRjRCMzNFIi8+CgkJPHN0b3AgIG9mZnNldD0iMSIgc3R5bGU9InN0b3AtY29sb3I6I0ZCNkYxQiIvPgoJPC9saW5lYXJHcmFkaWVudD4KCTxwYXRoIGNsYXNzPSJzdDMiIGQ9Ik02ODAuMiwzMDAuM2MxMy4zLTIyLjksMTUuOC00OS42LDcuNi03OS4yYy0xMS40LTQxLjQtMzMtNjguNi01MC41LTkwLjRjLTUuNS02LjktMTAuNi0xMy4zLTE0LjgtMTkuNAoJCWMtMTYuNi0yNC40LTIzLjgtNTQtMjAuMi04My4yYy0yMS4xLDE1LjItNjEuNyw0My44LTg3LjYsNzQuM2MzNy41LDE4LDY2LjgsMzcuNiw4OS45LDcyLjljMzkuNSw2MC4yLDM4LjgsMTA4LjgsMzEuMywxMzkKCQljLTIuMSw4LjMsMTMuOCwxNS43LDEwLjksMjIuMUM2NjAuMywzMjYuOCw2NzEuNiwzMTQuNSw2ODAuMiwzMDAuM3oiLz4KCgkJPGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF80XyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSIyMzEuMDYzMyIgeTE9Ijc0My41NDg2IiB4Mj0iOTczLjUyOTIiIHkyPSI0NTAuMzA1MyIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDEyMDIpIj4KCQk8c3RvcCAgb2Zmc2V0PSIwIiBzdHlsZT0ic3RvcC1jb2xvcjojRkI2RDFBIi8+CgkJPHN0b3AgIG9mZnNldD0iMSIgc3R5bGU9InN0b3AtY29sb3I6I0YzQjIzRSIvPgoJPC9saW5lYXJHcmFkaWVudD4KCTxwYXRoIGNsYXNzPSJzdDQiIGQ9Ik05NjcuNyw1NTAuM2MtNDQuMS00LjItMTMzLjQtMTUuMS0xMzMuNC0xNS4xYy0yMDAuOS0xMS4yLTMxNC45LDQ5LjEtNDAwLjksMTI4Yy02Ni40LDY2LTEyNS42LDIzNy0xMjUuNiwyMzcKCQlsLTcxLjktMy45YzAsMCwyMi45LTY4LjIsNDkuNC0xMTcuOWMzMC40LTU2LjksMzcuMi01Mi4zLDMwLjMtNjEuN2MtMzIuMS00NC4xLTQ3LjItNzguOC02MC4xLTE1M2MwLDAsMTUuMSwxMS45LDI2LjUsNC42CgkJYzAsMC0yNS45LTQ1LTI5LjktOTMuNmMtNy4xLTg2LjEsMzMuMi0yMDMuNywzNC4yLTIwNi40Yy0wLjQsMS4yLTIuNSwxMS4zLDIxLjEsMjYuNGMxLjctNy4xLDMuNS0xNC4xLDUuNC0yMC45CgkJYzguMy00MC42LDMwLjYtMTI5LjMsNzUuMS0xODkuNGMwLDAsMjQuOSw4Ni45LDg3LjQsMTI2LjNjMTIxLjcsNzYuOCwxOTcuOSw3Ny4yLDE5Ny45LDc3LjJjMTcxLjksMTkuMiwyNDUuMywxMDMuNiwyNDUuMywxMDMuNgoJCUMxMDQxLjksNTI0LjYsMTE1NCw1MjMuNCwxMTU0LDUyMy40QzExMTMuNyw1NjEuOSw5NjcuNyw1NTAuMyw5NjcuNyw1NTAuM3ogTTI4Ni4yLDI2OC4zYzAsMCwwLTAuMSwwLTAuMUwyODYuMiwyNjguM3oiLz4KCgkJPGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF81XyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSIzOTcuNDM0OCIgeTE9IjMxNC44MjYxIiB4Mj0iMTEwMi40NjUyIiB5Mj0iNjI0LjcwNjYiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMCAxMjAyKSI+CgkJPHN0b3AgIG9mZnNldD0iMCIgc3R5bGU9InN0b3AtY29sb3I6I0YzQjYzRiIvPgoJCTxzdG9wICBvZmZzZXQ9IjEiIHN0eWxlPSJzdG9wLWNvbG9yOiNGQjcwMUMiLz4KCTwvbGluZWFyR3JhZGllbnQ+Cgk8cGF0aCBjbGFzcz0ic3Q1IiBkPSJNMTE1Ni4xLDUyMy40YzAsMC0xNy41LDk2LjgtMTA5LjIsMTA4LjFjMCwwLTMzMi42LTIuMS0zNTYuOSwzMDBsLTUuNiw4NC45bC0zOTktMTE2LjMKCQljMCwwLDM3LjYtMTI4LjMsMTE5LjktMjMxLjNjMCwwLDEzOS43LTE5Ny4zLDUzNy43LTE0NS4zYzAsMCw0Ni41LDkuNCwxMTEuNywxNS41QzExMDkuNyw1NDQuMSwxMTU2LjEsNTIzLjQsMTE1Ni4xLDUyMy40eiIvPgoJPHBhdGggY2xhc3M9InN0NiIgZD0iTTkyOS44LDQ3Ny4zYzAsMC04Ni40LTQ0LjktMTkzLjktNDAuN2MwLDAsNTguNS00NS43LDEzNy41LTM0LjVMOTI5LjgsNDc3LjN6Ii8+CgoJCTxsaW5lYXJHcmFkaWVudCBpZD0iU1ZHSURfNl8iIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iMzI0Ljc0IiB5MT0iODYuNzMzMyIgeDI9IjkzNS4xNDM4IiB5Mj0iNDY3LjMyNjYiIGdyYWRpZW50VHJhbnNmb3JtPSJtYXRyaXgoMSAwIDAgLTEgMCAxMjAyKSI+CgkJPHN0b3AgIG9mZnNldD0iMCIgc3R5bGU9InN0b3AtY29sb3I6I0VDNkYwMCIvPgoJCTxzdG9wICBvZmZzZXQ9IjEiIHN0eWxlPSJzdG9wLWNvbG9yOiNGNEIzM0UiLz4KCTwvbGluZWFyR3JhZGllbnQ+Cgk8cGF0aCBjbGFzcz0ic3Q3IiBkPSJNNzExLjMsODkwLjFjMCwwLDI4LjEsMTkuNCw3Mi43LDkuMWMwLDAtNzIuMSw0MS44LTIyNC4xLTE1LjVjMCwwLTE1Ni43LTcwLjEtMjY3LTU0LjEKCQljLTcwLjksMTAuMy0xMzMuNSw2Ni42LTE3MS41LDEwOS40Yy00NS44LDUxLjgtNDAuMSwyNy42LDc1LDEzLjNjMjcuNy0zLjQsMTEuNyw0LjQsMTEuNyw0LjRTNTQuNCwxMDIxLjIsNDQsMTA3OC41CgkJYy0yLjYsMTQuMyw0MC41LTI2LjEsMTU0LjItMjIuNWMxMzkuNiw0LjQsMjYxLDg1LjQsMzEwLjksOTguOGMxMDIuMiwyNy4zLDI0OC44LDMzLjYsMzgzLjMtNzEuOWMwLDAsMTI0LjEtNzcuOSwxNjIuNS0yMjEuOAoJCWMxMC0zOS45LDE1LjktODAuOCwxNy42LTEyMS45YzItNTMuNi0xNC4zLTExMC0xNC4zLTExMFM5NjcuNiw4MzAuMyw3MTEuMyw4OTAuMXoiLz4KPC9nPgo8L3N2Zz4K",this.supportedTransactionVersions=null,this._readyState=typeof window>"u"||typeof document>"u"?$.Unsupported:$.NotDetected,this._connecting=!1,this._wallet=null,this._publicKey=null,this._readyState!==$.Unsupported&&cr(()=>{var n,r;return(r=(n=window.foxwallet)==null?void 0:n.solana)!=null&&r.isFoxWallet?(this._readyState=$.Installed,this.emit("readyStateChange",this._readyState),!0):!1})}get publicKey(){return this._publicKey}get connecting(){return this._connecting}get connected(){var e;return!!((e=this._wallet)!=null&&e.isConnected)}get readyState(){return this._readyState}async connect(){try{if(this.connected||this.connecting)return;if(this._readyState!==$.Installed)throw new en;this._connecting=!0;const e=window.foxwallet.solana;let n;try{n=await e.getAccount()}catch(i){throw new qt(i==null?void 0:i.message,i)}let r;try{r=new X(n)}catch(i){throw new Sn(i==null?void 0:i.message,i)}this._wallet=e,this._publicKey=r,this.emit("connect",r)}catch(e){throw this.emit("error",e),e}finally{this._connecting=!1}}async disconnect(){const e=this._wallet;if(e){this._wallet=null,this._publicKey=null;try{await e.disconnect()}catch(n){this.emit("error",new Pr(n==null?void 0:n.message,n))}}this.emit("disconnect")}async signTransaction(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signTransaction(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signAllTransactions(e){try{const n=this._wallet;if(!n)throw new me;try{return await n.signAllTransactions(e)||e}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}async signMessage(e){try{const n=this._wallet;if(!n)throw new me;try{const{signature:r}=await n.signMessage(e);return r}catch(r){throw new Le(r==null?void 0:r.message,r)}}catch(n){throw this.emit("error",n),n}}}const UM={setVisible(t){console.error(_M("call","setVisible"))},visible:!1};Object.defineProperty(UM,"visible",{get(){return console.error(_M("read","visible")),!1}});function _M(t,e){return`You have tried to ${t} "${e}" on a WalletModalContext without providing one. Make sure to render a WalletModalProvider as an ancestor of the component that uses WalletModalContext`}const RM=oe.createContext(UM);function CM(){return oe.useContext(RM)}const Y4=t=>te.createElement("button",{className:`wallet-adapter-button ${t.className||""}`,disabled:t.disabled,style:t.style,onClick:t.onClick,tabIndex:t.tabIndex||0,type:"button"},t.startIcon&&te.createElement("i",{className:"wallet-adapter-button-start-icon"},t.startIcon),t.children,t.endIcon&&te.createElement("i",{className:"wallet-adapter-button-end-icon"},t.endIcon)),G4=({wallet:t,...e})=>t&&te.createElement("img",{src:t.adapter.icon,alt:`${t.adapter.name} icon`,...e}),py=({id:t,children:e,expanded:n=!1})=>{const r=oe.useRef(null),i=oe.useRef(!0),o="height 250ms ease-out",s=()=>{const l=r.current;l&&requestAnimationFrame(()=>{l.style.height=l.scrollHeight+"px"})},a=()=>{const l=r.current;l&&requestAnimationFrame(()=>{l.style.height=l.offsetHeight+"px",l.style.overflow="hidden",requestAnimationFrame(()=>{l.style.height="0"})})};return oe.useLayoutEffect(()=>{n?s():a()},[n]),oe.useLayoutEffect(()=>{const l=r.current;if(!l)return;function d(){l&&(l.style.overflow=n?"initial":"hidden",n&&(l.style.height="auto"))}function g(y){l&&y.target===l&&y.propertyName==="height"&&d()}return i.current&&(d(),i.current=!1),l.addEventListener("transitionend",g),()=>l.removeEventListener("transitionend",g)},[n]),te.createElement("div",{className:"wallet-adapter-collapse",id:t,ref:r,role:"region",style:{height:0,transition:i.current?void 0:o}},e)},Td=({handleClick:t,tabIndex:e,wallet:n})=>te.createElement("li",null,te.createElement(Y4,{onClick:t,startIcon:te.createElement(G4,{wallet:n}),tabIndex:e},n.adapter.name,n.readyState===$.Installed&&te.createElement("span",null,"Detected"))),H4=()=>te.createElement("svg",{width:"97",height:"96",viewBox:"0 0 97 96",fill:"none",xmlns:"http://www.w3.org/2000/svg"},te.createElement("circle",{cx:"48.5",cy:"48",r:"48",fill:"url(#paint0_linear_880_5115)",fillOpacity:"0.1"}),te.createElement("circle",{cx:"48.5",cy:"48",r:"47",stroke:"url(#paint1_linear_880_5115)",strokeOpacity:"0.4",strokeWidth:"2"}),te.createElement("g",{clipPath:"url(#clip0_880_5115)"},te.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)"}),te.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)"})),te.createElement("defs",null,te.createElement("linearGradient",{id:"paint0_linear_880_5115",x1:"3.41664",y1:"98.0933",x2:"103.05",y2:"8.42498",gradientUnits:"userSpaceOnUse"},te.createElement("stop",{stopColor:"#9945FF"}),te.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),te.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),te.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),te.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),te.createElement("stop",{offset:"1",stopColor:"#00D18C"})),te.createElement("linearGradient",{id:"paint1_linear_880_5115",x1:"3.41664",y1:"98.0933",x2:"103.05",y2:"8.42498",gradientUnits:"userSpaceOnUse"},te.createElement("stop",{stopColor:"#9945FF"}),te.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),te.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),te.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),te.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),te.createElement("stop",{offset:"1",stopColor:"#00D18C"})),te.createElement("linearGradient",{id:"paint2_linear_880_5115",x1:"25.9583",y1:"68.7101",x2:"67.2337",y2:"23.7879",gradientUnits:"userSpaceOnUse"},te.createElement("stop",{stopColor:"#9945FF"}),te.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),te.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),te.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),te.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),te.createElement("stop",{offset:"1",stopColor:"#00D18C"})),te.createElement("linearGradient",{id:"paint3_linear_880_5115",x1:"58.3326",y1:"49.4467",x2:"61.0002",y2:"45.4453",gradientUnits:"userSpaceOnUse"},te.createElement("stop",{stopColor:"#9945FF"}),te.createElement("stop",{offset:"0.14",stopColor:"#8A53F4"}),te.createElement("stop",{offset:"0.42",stopColor:"#6377D6"}),te.createElement("stop",{offset:"0.79",stopColor:"#24B0A7"}),te.createElement("stop",{offset:"0.99",stopColor:"#00D18C"}),te.createElement("stop",{offset:"1",stopColor:"#00D18C"})),te.createElement("clipPath",{id:"clip0_880_5115"},te.createElement("rect",{width:"48",height:"48",fill:"white",transform:"translate(24.5 24)"})))),K4=({className:t="",container:e="body"})=>{const n=oe.useRef(null),{wallets:r,select:i}=kM(),{setVisible:o}=CM(),[s,a]=oe.useState(!1),[l,d]=oe.useState(!1),[g,y]=oe.useState(null),[x,v]=oe.useMemo(()=>{const w=[],j=[],C=[];for(const B of r)B.readyState===$.NotDetected?C.push(B):B.readyState===$.Loadable?j.push(B):B.readyState===$.Installed&&w.push(B);let U=[],O=[];return w.length?(U=w,O=[...j,...C]):(j.length&&(U=j),O=C),[U,O]},[r]),A=oe.useCallback(()=>{d(!1),setTimeout(()=>o(!1),150)},[o]),k=oe.useCallback(w=>{w.preventDefault(),A()},[A]),D=oe.useCallback((w,j)=>{i(j),k(w)},[i,k]),I=oe.useCallback(()=>a(!s),[s]),M=oe.useCallback(w=>{const j=n.current;if(!j)return;const C=j.querySelectorAll("button"),U=C[0],O=C[C.length-1];w.shiftKey?document.activeElement===U&&(O.focus(),w.preventDefault()):document.activeElement===O&&(U.focus(),w.preventDefault())},[n]);return oe.useLayoutEffect(()=>{const w=C=>{C.key==="Escape"?A():C.key==="Tab"&&M(C)},{overflow:j}=window.getComputedStyle(document.body);return setTimeout(()=>d(!0),0),document.body.style.overflow="hidden",window.addEventListener("keydown",w,!1),()=>{document.body.style.overflow=j,window.removeEventListener("keydown",w,!1)}},[A,M]),oe.useLayoutEffect(()=>y(document.querySelector(e)),[e]),g&&Lw.createPortal(te.createElement("div",{"aria-labelledby":"wallet-adapter-modal-title","aria-modal":"true",className:`wallet-adapter-modal ${l&&"wallet-adapter-modal-fade-in"} ${t}`,ref:n,role:"dialog"},te.createElement("div",{className:"wallet-adapter-modal-container"},te.createElement("div",{className:"wallet-adapter-modal-wrapper"},te.createElement("button",{onClick:k,className:"wallet-adapter-modal-button-close"},te.createElement("svg",{width:"14",height:"14"},te.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"}))),x.length?te.createElement(te.Fragment,null,te.createElement("h1",{className:"wallet-adapter-modal-title"},"Connect a wallet on Solana to continue"),te.createElement("ul",{className:"wallet-adapter-modal-list"},x.map(w=>te.createElement(Td,{key:w.adapter.name,handleClick:j=>D(j,w.adapter.name),wallet:w})),v.length?te.createElement(py,{expanded:s,id:"wallet-adapter-modal-collapse"},v.map(w=>te.createElement(Td,{key:w.adapter.name,handleClick:j=>D(j,w.adapter.name),tabIndex:s?0:-1,wallet:w}))):null),v.length?te.createElement("button",{className:"wallet-adapter-modal-list-more",onClick:I,tabIndex:0},te.createElement("span",null,s?"Less ":"More ","options"),te.createElement("svg",{width:"13",height:"7",viewBox:"0 0 13 7",xmlns:"http://www.w3.org/2000/svg",className:`${s?"wallet-adapter-modal-list-more-icon-rotate":""}`},te.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):te.createElement(te.Fragment,null,te.createElement("h1",{className:"wallet-adapter-modal-title"},"You'll need a wallet on Solana to continue"),te.createElement("div",{className:"wallet-adapter-modal-middle"},te.createElement(H4,null)),v.length?te.createElement(te.Fragment,null,te.createElement("button",{className:"wallet-adapter-modal-list-more",onClick:I,tabIndex:0},te.createElement("span",null,s?"Hide ":"Already have a wallet? View ","options"),te.createElement("svg",{width:"13",height:"7",viewBox:"0 0 13 7",xmlns:"http://www.w3.org/2000/svg",className:`${s?"wallet-adapter-modal-list-more-icon-rotate":""}`},te.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"}))),te.createElement(py,{expanded:s,id:"wallet-adapter-modal-collapse"},te.createElement("ul",{className:"wallet-adapter-modal-list"},v.map(w=>te.createElement(Td,{key:w.adapter.name,handleClick:j=>D(j,w.adapter.name),tabIndex:s?0:-1,wallet:w}))))):null))),te.createElement("div",{className:"wallet-adapter-modal-overlay",onMouseDown:k})),g)},J4=({children:t,...e})=>{const[n,r]=oe.useState(!1);return te.createElement(RM.Provider,{value:{visible:n,setVisible:r}},t,n&&te.createElement(K4,{...e}))};const V0="-";function X4(t){const e=$4(t),{conflictingClassGroups:n,conflictingClassGroupModifiers:r}=t;function i(s){const a=s.split(V0);return a[0]===""&&a.length!==1&&a.shift(),OM(a,e)||q4(s)}function o(s,a){const l=n[s]||[];return a&&r[s]?[...l,...r[s]]:l}return{getClassGroupId:i,getConflictingClassGroupIds:o}}function OM(t,e){var s;if(t.length===0)return e.classGroupId;const n=t[0],r=e.nextPart.get(n),i=r?OM(t.slice(1),r):void 0;if(i)return i;if(e.validators.length===0)return;const o=t.join(V0);return(s=e.validators.find(({validator:a})=>a(o)))==null?void 0:s.classGroupId}const gy=/^\[(.+)\]$/;function q4(t){if(gy.test(t)){const e=gy.exec(t)[1],n=e==null?void 0:e.substring(0,e.indexOf(":"));if(n)return"arbitrary.."+n}}function $4(t){const{theme:e,prefix:n}=t,r={nextPart:new Map,validators:[]};return t2(Object.entries(t.classGroups),n).forEach(([o,s])=>{ih(s,r,o,e)}),r}function ih(t,e,n,r){t.forEach(i=>{if(typeof i=="string"){const o=i===""?e:yy(e,i);o.classGroupId=n;return}if(typeof i=="function"){if(e2(i)){ih(i(r),e,n,r);return}e.validators.push({validator:i,classGroupId:n});return}Object.entries(i).forEach(([o,s])=>{ih(s,yy(e,o),n,r)})})}function yy(t,e){let n=t;return e.split(V0).forEach(r=>{n.nextPart.has(r)||n.nextPart.set(r,{nextPart:new Map,validators:[]}),n=n.nextPart.get(r)}),n}function e2(t){return t.isThemeGetter}function t2(t,e){return e?t.map(([n,r])=>{const i=r.map(o=>typeof o=="string"?e+o:typeof o=="object"?Object.fromEntries(Object.entries(o).map(([s,a])=>[e+s,a])):o);return[n,i]}):t}function n2(t){if(t<1)return{get:()=>{},set:()=>{}};let e=0,n=new Map,r=new Map;function i(o,s){n.set(o,s),e++,e>t&&(e=0,r=n,n=new Map)}return{get(o){let s=n.get(o);if(s!==void 0)return s;if((s=r.get(o))!==void 0)return i(o,s),s},set(o,s){n.has(o)?n.set(o,s):i(o,s)}}}const BM="!";function r2(t){const e=t.separator,n=e.length===1,r=e[0],i=e.length;return function(s){const a=[];let l=0,d=0,g;for(let k=0;kd?g-d:void 0;return{modifiers:a,hasImportantModifier:x,baseClassName:v,maybePostfixModifierPosition:A}}}function i2(t){if(t.length<=1)return t;const e=[];let n=[];return t.forEach(r=>{r[0]==="["?(e.push(...n.sort(),r),n=[]):n.push(r)}),e.push(...n.sort()),e}function o2(t){return{cache:n2(t.cacheSize),splitModifiers:r2(t),...X4(t)}}const s2=/\s+/;function a2(t,e){const{splitModifiers:n,getClassGroupId:r,getConflictingClassGroupIds:i}=e,o=new Set;return t.trim().split(s2).map(s=>{const{modifiers:a,hasImportantModifier:l,baseClassName:d,maybePostfixModifierPosition:g}=n(s);let y=r(g?d.substring(0,g):d),x=!!g;if(!y){if(!g)return{isTailwindClass:!1,originalClassName:s};if(y=r(d),!y)return{isTailwindClass:!1,originalClassName:s};x=!1}const v=i2(a).join(":");return{isTailwindClass:!0,modifierId:l?v+BM:v,classGroupId:y,originalClassName:s,hasPostfixModifier:x}}).reverse().filter(s=>{if(!s.isTailwindClass)return!0;const{modifierId:a,classGroupId:l,hasPostfixModifier:d}=s,g=a+l;return o.has(g)?!1:(o.add(g),i(l,d).forEach(y=>o.add(a+y)),!0)}).reverse().map(s=>s.originalClassName).join(" ")}function l2(){let t=0,e,n,r="";for(;ty(g),t());return n=o2(d),r=n.cache.get,i=n.cache.set,o=a,a(l)}function a(l){const d=r(l);if(d)return d;const g=a2(l,n);return i(l,g),g}return function(){return o(l2.apply(null,arguments))}}function it(t){const e=n=>n[t]||[];return e.isThemeGetter=!0,e}const WM=/^\[(?:([a-z-]+):)?(.+)\]$/i,u2=/^\d+\/\d+$/,d2=new Set(["px","full","screen"]),f2=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,h2=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,p2=/^-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,g2=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;function fr(t){return lo(t)||d2.has(t)||u2.test(t)}function gi(t){return Ds(t,"length",I2)}function lo(t){return!!t&&!Number.isNaN(Number(t))}function hl(t){return Ds(t,"number",lo)}function Vs(t){return!!t&&Number.isInteger(Number(t))}function y2(t){return t.endsWith("%")&&lo(t.slice(0,-1))}function be(t){return WM.test(t)}function yi(t){return f2.test(t)}const m2=new Set(["length","size","percentage"]);function w2(t){return Ds(t,m2,VM)}function M2(t){return Ds(t,"position",VM)}const N2=new Set(["image","url"]);function v2(t){return Ds(t,N2,k2)}function S2(t){return Ds(t,"",b2)}function Ps(){return!0}function Ds(t,e,n){const r=WM.exec(t);return r?r[1]?typeof e=="string"?r[1]===e:e.has(r[1]):n(r[2]):!1}function I2(t){return h2.test(t)}function VM(){return!1}function b2(t){return p2.test(t)}function k2(t){return g2.test(t)}function E2(){const t=it("colors"),e=it("spacing"),n=it("blur"),r=it("brightness"),i=it("borderColor"),o=it("borderRadius"),s=it("borderSpacing"),a=it("borderWidth"),l=it("contrast"),d=it("grayscale"),g=it("hueRotate"),y=it("invert"),x=it("gap"),v=it("gradientColorStops"),A=it("gradientColorStopPositions"),k=it("inset"),D=it("margin"),I=it("opacity"),M=it("padding"),w=it("saturate"),j=it("scale"),C=it("sepia"),U=it("skew"),O=it("space"),B=it("translate"),Y=()=>["auto","contain","none"],G=()=>["auto","hidden","clip","visible","scroll"],q=()=>["auto",be,e],ie=()=>[be,e],R=()=>["",fr,gi],c=()=>["auto",lo,be],p=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],S=()=>["solid","dashed","dotted","double","none"],z=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity","plus-lighter"],b=()=>["start","end","center","between","around","evenly","stretch"],N=()=>["","0",be],T=()=>["auto","avoid","all","avoid-page","page","left","right","column"],m=()=>[lo,hl],u=()=>[lo,be];return{cacheSize:500,separator:":",theme:{colors:[Ps],spacing:[fr,gi],blur:["none","",yi,be],brightness:m(),borderColor:[t],borderRadius:["none","","full",yi,be],borderSpacing:ie(),borderWidth:R(),contrast:m(),grayscale:N(),hueRotate:u(),invert:N(),gap:ie(),gradientColorStops:[t],gradientColorStopPositions:[y2,gi],inset:q(),margin:q(),opacity:m(),padding:ie(),saturate:m(),scale:m(),sepia:N(),skew:u(),space:ie(),translate:ie()},classGroups:{aspect:[{aspect:["auto","square","video",be]}],container:["container"],columns:[{columns:[yi]}],"break-after":[{"break-after":T()}],"break-before":[{"break-before":T()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none"]}],clear:[{clear:["left","right","both","none"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...p(),be]}],overflow:[{overflow:G()}],"overflow-x":[{"overflow-x":G()}],"overflow-y":[{"overflow-y":G()}],overscroll:[{overscroll:Y()}],"overscroll-x":[{"overscroll-x":Y()}],"overscroll-y":[{"overscroll-y":Y()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[k]}],"inset-x":[{"inset-x":[k]}],"inset-y":[{"inset-y":[k]}],start:[{start:[k]}],end:[{end:[k]}],top:[{top:[k]}],right:[{right:[k]}],bottom:[{bottom:[k]}],left:[{left:[k]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",Vs,be]}],basis:[{basis:q()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",be]}],grow:[{grow:N()}],shrink:[{shrink:N()}],order:[{order:["first","last","none",Vs,be]}],"grid-cols":[{"grid-cols":[Ps]}],"col-start-end":[{col:["auto",{span:["full",Vs,be]},be]}],"col-start":[{"col-start":c()}],"col-end":[{"col-end":c()}],"grid-rows":[{"grid-rows":[Ps]}],"row-start-end":[{row:["auto",{span:[Vs,be]},be]}],"row-start":[{"row-start":c()}],"row-end":[{"row-end":c()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",be]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",be]}],gap:[{gap:[x]}],"gap-x":[{"gap-x":[x]}],"gap-y":[{"gap-y":[x]}],"justify-content":[{justify:["normal",...b()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...b(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...b(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[M]}],px:[{px:[M]}],py:[{py:[M]}],ps:[{ps:[M]}],pe:[{pe:[M]}],pt:[{pt:[M]}],pr:[{pr:[M]}],pb:[{pb:[M]}],pl:[{pl:[M]}],m:[{m:[D]}],mx:[{mx:[D]}],my:[{my:[D]}],ms:[{ms:[D]}],me:[{me:[D]}],mt:[{mt:[D]}],mr:[{mr:[D]}],mb:[{mb:[D]}],ml:[{ml:[D]}],"space-x":[{"space-x":[O]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[O]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit",be,e]}],"min-w":[{"min-w":["min","max","fit",be,fr]}],"max-w":[{"max-w":["0","none","full","min","max","fit","prose",{screen:[yi]},yi,be]}],h:[{h:[be,e,"auto","min","max","fit"]}],"min-h":[{"min-h":["min","max","fit",fr,be]}],"max-h":[{"max-h":[be,e,"min","max","fit"]}],"font-size":[{text:["base",yi,gi]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",hl]}],"font-family":[{font:[Ps]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractons"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",be]}],"line-clamp":[{"line-clamp":["none",lo,hl]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",fr,be]}],"list-image":[{"list-image":["none",be]}],"list-style-type":[{list:["none","disc","decimal",be]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[t]}],"placeholder-opacity":[{"placeholder-opacity":[I]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[t]}],"text-opacity":[{"text-opacity":[I]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...S(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",fr,gi]}],"underline-offset":[{"underline-offset":["auto",fr,be]}],"text-decoration-color":[{decoration:[t]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],indent:[{indent:ie()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",be]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",be]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[I]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...p(),M2]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",w2]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},v2]}],"bg-color":[{bg:[t]}],"gradient-from-pos":[{from:[A]}],"gradient-via-pos":[{via:[A]}],"gradient-to-pos":[{to:[A]}],"gradient-from":[{from:[v]}],"gradient-via":[{via:[v]}],"gradient-to":[{to:[v]}],rounded:[{rounded:[o]}],"rounded-s":[{"rounded-s":[o]}],"rounded-e":[{"rounded-e":[o]}],"rounded-t":[{"rounded-t":[o]}],"rounded-r":[{"rounded-r":[o]}],"rounded-b":[{"rounded-b":[o]}],"rounded-l":[{"rounded-l":[o]}],"rounded-ss":[{"rounded-ss":[o]}],"rounded-se":[{"rounded-se":[o]}],"rounded-ee":[{"rounded-ee":[o]}],"rounded-es":[{"rounded-es":[o]}],"rounded-tl":[{"rounded-tl":[o]}],"rounded-tr":[{"rounded-tr":[o]}],"rounded-br":[{"rounded-br":[o]}],"rounded-bl":[{"rounded-bl":[o]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[I]}],"border-style":[{border:[...S(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[I]}],"divide-style":[{divide:S()}],"border-color":[{border:[i]}],"border-color-x":[{"border-x":[i]}],"border-color-y":[{"border-y":[i]}],"border-color-t":[{"border-t":[i]}],"border-color-r":[{"border-r":[i]}],"border-color-b":[{"border-b":[i]}],"border-color-l":[{"border-l":[i]}],"divide-color":[{divide:[i]}],"outline-style":[{outline:["",...S()]}],"outline-offset":[{"outline-offset":[fr,be]}],"outline-w":[{outline:[fr,gi]}],"outline-color":[{outline:[t]}],"ring-w":[{ring:R()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[t]}],"ring-opacity":[{"ring-opacity":[I]}],"ring-offset-w":[{"ring-offset":[fr,gi]}],"ring-offset-color":[{"ring-offset":[t]}],shadow:[{shadow:["","inner","none",yi,S2]}],"shadow-color":[{shadow:[Ps]}],opacity:[{opacity:[I]}],"mix-blend":[{"mix-blend":z()}],"bg-blend":[{"bg-blend":z()}],filter:[{filter:["","none"]}],blur:[{blur:[n]}],brightness:[{brightness:[r]}],contrast:[{contrast:[l]}],"drop-shadow":[{"drop-shadow":["","none",yi,be]}],grayscale:[{grayscale:[d]}],"hue-rotate":[{"hue-rotate":[g]}],invert:[{invert:[y]}],saturate:[{saturate:[w]}],sepia:[{sepia:[C]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[n]}],"backdrop-brightness":[{"backdrop-brightness":[r]}],"backdrop-contrast":[{"backdrop-contrast":[l]}],"backdrop-grayscale":[{"backdrop-grayscale":[d]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[g]}],"backdrop-invert":[{"backdrop-invert":[y]}],"backdrop-opacity":[{"backdrop-opacity":[I]}],"backdrop-saturate":[{"backdrop-saturate":[w]}],"backdrop-sepia":[{"backdrop-sepia":[C]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[s]}],"border-spacing-x":[{"border-spacing-x":[s]}],"border-spacing-y":[{"border-spacing-y":[s]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",be]}],duration:[{duration:u()}],ease:[{ease:["linear","in","out","in-out",be]}],delay:[{delay:u()}],animate:[{animate:["none","spin","ping","pulse","bounce",be]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[j]}],"scale-x":[{"scale-x":[j]}],"scale-y":[{"scale-y":[j]}],rotate:[{rotate:[Vs,be]}],"translate-x":[{"translate-x":[B]}],"translate-y":[{"translate-y":[B]}],"skew-x":[{"skew-x":[U]}],"skew-y":[{"skew-y":[U]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",be]}],accent:[{accent:["auto",t]}],appearance:["appearance-none"],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",be]}],"caret-color":[{caret:[t]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":ie()}],"scroll-mx":[{"scroll-mx":ie()}],"scroll-my":[{"scroll-my":ie()}],"scroll-ms":[{"scroll-ms":ie()}],"scroll-me":[{"scroll-me":ie()}],"scroll-mt":[{"scroll-mt":ie()}],"scroll-mr":[{"scroll-mr":ie()}],"scroll-mb":[{"scroll-mb":ie()}],"scroll-ml":[{"scroll-ml":ie()}],"scroll-p":[{"scroll-p":ie()}],"scroll-px":[{"scroll-px":ie()}],"scroll-py":[{"scroll-py":ie()}],"scroll-ps":[{"scroll-ps":ie()}],"scroll-pe":[{"scroll-pe":ie()}],"scroll-pt":[{"scroll-pt":ie()}],"scroll-pr":[{"scroll-pr":ie()}],"scroll-pb":[{"scroll-pb":ie()}],"scroll-pl":[{"scroll-pl":ie()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",be]}],fill:[{fill:[t,"none"]}],"stroke-w":[{stroke:[fr,gi,hl]}],stroke:[{stroke:[t,"none"]}],sr:["sr-only","not-sr-only"]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}}const x2=c2(E2),T2=t=>at.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 56 64",...t,children:[at.jsx("path",{stroke:"currentColor",strokeLinejoin:"round",d:"m28 4 .015 13.1M52.46 46.01l-11.137-6.555M4.099 46.01l11.137-6.555"}),at.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",d:"M28.009 32.01 15 24.49l13.009-7.518L41 24.52l-12.991 7.49Z"}),at.jsx("path",{stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"2",d:"m28.02 46.969-13.003-7.463L15 24.49l13.02 7.52V46.97Z"}),at.jsx("path",{stroke:"currentColor",strokeLinejoin:"round",strokeWidth:"2",d:"m28 46.969 13.003-7.43V24.521L28 32.01v14.958Z"}),at.jsx("path",{stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"3",d:"M52 46.01V18.032L28 4.042 4 18.032V46.01L28 60l24-13.99Z"}),at.jsx("path",{stroke:"currentColor",strokeMiterlimit:"10",strokeWidth:"3",d:"M4.04 18.056 28 32.047l24.04-13.99"}),at.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeMiterlimit:"10",strokeWidth:"3",d:"M28 32.046V60"})]}),A2=oe.lazy(()=>Ba(()=>import("./widget-e5024a77.js"),["assets/widget-e5024a77.js","assets/punycode-06c60053.js"])),D2=({rootWrapperClassNames:t,rootWrapperStyles:e,isDark:n,...r})=>{const[i,o]=oe.useState(!1);return at.jsxs("div",{className:x2("bonfida-widget-root sns-bw",t,n&&"dark"),style:e,children:[at.jsx("button",{onClick:()=>o(!i),className:"w-[50px] h-[50px] rounded-full bg-background-primary overflow-hidden text-text-primary p-2 flex items-center justify-center shadow-xl dark:border dark:border-interactive-border",type:"button","aria-label":i?"Close SNS widget":"Open SNS widget","aria-haspopup":"true",tabIndex:0,children:at.jsx(T2,{className:"w-full h-full"})}),i&&at.jsx(oe.Suspense,{children:at.jsx(A2,{...r})})]})};const L2="https://helius-proxy.bonfida.com",z2=({children:t})=>at.jsx(a4,{autoConnect:!0,wallets:[new B4,new W4,new E4,new N4,new h4,new b4,new S4,new c4,new T4,new P4,new D4,new z4,new Z4],children:at.jsx(J4,{children:t})}),j2=()=>{const t=kM(),{visible:e,setVisible:n}=CM(),[r,i]=oe.useState(!1);return at.jsxs("div",{className:"p-10",children:[at.jsx("h1",{className:"text-[40px] text-center text-white font-medium",children:"SNS Widget Demo"}),at.jsx("div",{className:"mt-10",children:at.jsx("button",{className:"p-3 bg-white rounded-[24px] font-medium",onClick:()=>i(!r),children:"Toggle dark"})}),at.jsx(D2,{endpoint:L2,passthroughWallet:{...t,visible:e,setVisible:n},isDark:r})]})};function U2(){return at.jsx(z2,{children:at.jsx(j2,{})})}const _2="/sns-widget/assets/preview-bg-7f26f3aa.png";Ad.createRoot(document.getElementById("root")).render(at.jsx(te.StrictMode,{children:at.jsx("div",{style:{backgroundImage:`url(${_2})`,backgroundSize:"cover",height:"100vh",width:"100vw"},children:at.jsx(U2,{})})}));export{Tf as A,C2 as B,Mx as C,R2 as D,Fx as E,Ue as F,mT as G,x2 as H,Le as I,wT as J,_I as K,Rx as L,qr as M,_f as N,Kt as O,X as P,Uo as Q,te as R,B4 as S,Xe as T,ws as V,a4 as W,Cx as a,ye as b,vr as c,Wt as d,t1 as e,Or as f,my as g,kM as h,V2 as i,at as j,CM as k,J4 as l,st as m,L1 as n,_e as o,de as p,ue as q,oe as r,_c as s,sb as t,Ox as u,cn as v,fg as w,Ms as x,Lr as y,Rf as z}; diff --git a/preview-build/assets/punycode-e9579d2a.js b/preview-build/assets/punycode-06c60053.js similarity index 99% rename from preview-build/assets/punycode-e9579d2a.js rename to preview-build/assets/punycode-06c60053.js index e1cb2d2..ba1790b 100644 --- a/preview-build/assets/punycode-e9579d2a.js +++ b/preview-build/assets/punycode-06c60053.js @@ -1,4 +1,4 @@ -import{c as ie,d as W,b as At,s as pr,f as yr}from"./index-e25ecac5.js";var Rt={exports:{}},_e=typeof Reflect=="object"?Reflect:null,xt=_e&&typeof _e.apply=="function"?_e.apply:function(t,r,o){return Function.prototype.apply.call(t,r,o)},Me;_e&&typeof _e.ownKeys=="function"?Me=_e.ownKeys:Object.getOwnPropertySymbols?Me=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:Me=function(t){return Object.getOwnPropertyNames(t)};function Kr(e){console&&console.warn&&console.warn(e)}var hr=Number.isNaN||function(t){return t!==t};function z(){z.init.call(this)}Rt.exports=z;Rt.exports.once=Zr;z.EventEmitter=z;z.prototype._events=void 0;z.prototype._eventsCount=0;z.prototype._maxListeners=void 0;var $t=10;function We(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(z,"defaultMaxListeners",{enumerable:!0,get:function(){return $t},set:function(e){if(typeof e!="number"||e<0||hr(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");$t=e}});z.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};z.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||hr(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function gr(e){return e._maxListeners===void 0?z.defaultMaxListeners:e._maxListeners}z.prototype.getMaxListeners=function(){return gr(this)};z.prototype.emit=function(t){for(var r=[],o=1;o0&&(y=r[0]),y instanceof Error)throw y;var _=new Error("Unhandled error."+(y?" ("+y.message+")":""));throw _.context=y,_}var h=d[t];if(h===void 0)return!1;if(typeof h=="function")xt(h,this,r);else for(var P=h.length,I=_r(h,P),o=0;o0&&y.length>a&&!y.warned){y.warned=!0;var _=new Error("Possible EventEmitter memory leak detected. "+y.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");_.name="MaxListenersExceededWarning",_.emitter=e,_.type=t,_.count=y.length,Kr(_)}return e}z.prototype.addListener=function(t,r){return vr(this,t,r,!1)};z.prototype.on=z.prototype.addListener;z.prototype.prependListener=function(t,r){return vr(this,t,r,!0)};function Yr(){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 br(e,t,r){var o={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},a=Yr.bind(o);return a.listener=r,o.wrapFn=a,a}z.prototype.once=function(t,r){return We(r),this.on(t,br(this,t,r)),this};z.prototype.prependOnceListener=function(t,r){return We(r),this.prependListener(t,br(this,t,r)),this};z.prototype.removeListener=function(t,r){var o,a,d,y,_;if(We(r),a=this._events,a===void 0)return this;if(o=a[t],o===void 0)return this;if(o===r||o.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete a[t],a.removeListener&&this.emit("removeListener",t,o.listener||r));else if(typeof o!="function"){for(d=-1,y=o.length-1;y>=0;y--)if(o[y]===r||o[y].listener===r){_=o[y].listener,d=y;break}if(d<0)return this;d===0?o.shift():Jr(o,d),o.length===1&&(a[t]=o[0]),a.removeListener!==void 0&&this.emit("removeListener",t,_||r)}return this};z.prototype.off=z.prototype.removeListener;z.prototype.removeAllListeners=function(t){var r,o,a;if(o=this._events,o===void 0)return this;if(o.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):o[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete o[t]),this;if(arguments.length===0){var d=Object.keys(o),y;for(a=0;a=0;a--)this.removeListener(t,r[a]);return this};function wr(e,t,r){var o=e._events;if(o===void 0)return[];var a=o[t];return a===void 0?[]:typeof a=="function"?r?[a.listener||a]:[a]:r?Xr(a):_r(a,a.length)}z.prototype.listeners=function(t){return wr(this,t,!0)};z.prototype.rawListeners=function(t){return wr(this,t,!1)};z.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):mr.call(e,t)};z.prototype.listenerCount=mr;function mr(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}z.prototype.eventNames=function(){return this._eventsCount>0?Me(this._events):[]};function _r(e,t){for(var r=new Array(t),o=0;o"u"||!J?$:J(Uint8Array),ce={"%AggregateError%":typeof AggregateError>"u"?$:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?$:ArrayBuffer,"%ArrayIteratorPrototype%":ve&&J?J([][Symbol.iterator]()):$,"%AsyncFromSyncIteratorPrototype%":$,"%AsyncFunction%":we,"%AsyncGenerator%":we,"%AsyncGeneratorFunction%":we,"%AsyncIteratorPrototype%":we,"%Atomics%":typeof Atomics>"u"?$:Atomics,"%BigInt%":typeof BigInt>"u"?$:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?$:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?$:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?$:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?$:Float32Array,"%Float64Array%":typeof Float64Array>"u"?$:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?$:FinalizationRegistry,"%Function%":Or,"%GeneratorFunction%":we,"%Int8Array%":typeof Int8Array>"u"?$:Int8Array,"%Int16Array%":typeof Int16Array>"u"?$:Int16Array,"%Int32Array%":typeof Int32Array>"u"?$:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ve&&J?J(J([][Symbol.iterator]())):$,"%JSON%":typeof JSON=="object"?JSON:$,"%Map%":typeof Map>"u"?$:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ve||!J?$:J(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?$:Promise,"%Proxy%":typeof Proxy>"u"?$:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?$:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?$:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ve||!J?$:J(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?$:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ve&&J?J(""[Symbol.iterator]()):$,"%Symbol%":ve?Symbol:$,"%SyntaxError%":Ee,"%ThrowTypeError%":bn,"%TypedArray%":mn,"%TypeError%":Se,"%Uint8Array%":typeof Uint8Array>"u"?$:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?$:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?$:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?$:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?$:WeakMap,"%WeakRef%":typeof WeakRef>"u"?$:WeakRef,"%WeakSet%":typeof WeakSet>"u"?$:WeakSet};if(J)try{null.error}catch(e){var _n=J(J(e));ce["%Error.prototype%"]=_n}var Sn=function e(t){var r;if(t==="%AsyncFunction%")r=Je("async function () {}");else if(t==="%GeneratorFunction%")r=Je("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=Je("async function* () {}");else if(t==="%AsyncGenerator%"){var o=e("%AsyncGeneratorFunction%");o&&(r=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=e("%AsyncGenerator%");a&&J&&(r=J(a.prototype))}return ce[t]=r,r},Ht={"%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"]},Pe=jt,Fe=vn,En=Pe.call(Function.call,Array.prototype.concat),An=Pe.call(Function.apply,Array.prototype.splice),Vt=Pe.call(Function.call,String.prototype.replace),Be=Pe.call(Function.call,String.prototype.slice),Rn=Pe.call(Function.call,RegExp.prototype.exec),On=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Tn=/\\(\\)?/g,Pn=function(t){var r=Be(t,0,1),o=Be(t,-1);if(r==="%"&&o!=="%")throw new Ee("invalid intrinsic syntax, expected closing `%`");if(o==="%"&&r!=="%")throw new Ee("invalid intrinsic syntax, expected opening `%`");var a=[];return Vt(t,On,function(d,y,_,h){a[a.length]=_?Vt(h,Tn,"$1"):y||d}),a},jn=function(t,r){var o=t,a;if(Fe(Ht,o)&&(a=Ht[o],o="%"+a[0]+"%"),Fe(ce,o)){var d=ce[o];if(d===we&&(d=Sn(o)),typeof d>"u"&&!r)throw new Se("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:d}}throw new Ee("intrinsic "+t+" does not exist!")},Ae=function(t,r){if(typeof t!="string"||t.length===0)throw new Se("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Se('"allowMissing" argument must be a boolean');if(Rn(/^%?[^%]*%?$/,t)===null)throw new Ee("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var o=Pn(t),a=o.length>0?o[0]:"",d=jn("%"+a+"%",r),y=d.name,_=d.value,h=!1,P=d.alias;P&&(a=P[0],An(o,En([0,1],P)));for(var I=1,k=!0;I=o.length){var L=le(_,x);k=!!L,k&&"get"in L&&!("originalValue"in L.get)?_=L.get:_=_[x]}else k=Fe(_,x),_=_[x];k&&!h&&(ce[y]=_)}}return _},Tr={exports:{}},Mn=Ae,ht=Mn("%Object.defineProperty%",!0),gt=function(){if(ht)try{return ht({},"a",{value:1}),!0}catch{return!1}return!1};gt.hasArrayLengthDefineBug=function(){if(!gt())return null;try{return ht([],"length",{value:1}).length!==1}catch{return!0}};var Pr=gt,Ln=Ae,Le=Ln("%Object.getOwnPropertyDescriptor%",!0);if(Le)try{Le([],"length")}catch{Le=null}var Mt=Le,Cn=Pr(),Lt=Ae,Oe=Cn&&Lt("%Object.defineProperty%",!0);if(Oe)try{Oe({},"a",{value:1})}catch{Oe=!1}var In=Lt("%SyntaxError%"),be=Lt("%TypeError%"),zt=Mt,Nn=function(t,r,o){if(!t||typeof t!="object"&&typeof t!="function")throw new be("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new be("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new be("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new be("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new be("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new be("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,d=arguments.length>4?arguments[4]:null,y=arguments.length>5?arguments[5]:null,_=arguments.length>6?arguments[6]:!1,h=!!zt&&zt(t,r);if(Oe)Oe(t,r,{configurable:y===null&&h?h.configurable:!y,enumerable:a===null&&h?h.enumerable:!a,value:o,writable:d===null&&h?h.writable:!d});else if(_||!a&&!d&&!y)t[r]=o;else throw new In("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},jr=Ae,Kt=Nn,Dn=Pr(),Yt=Mt,Jt=jr("%TypeError%"),Fn=jr("%Math.floor%"),Bn=function(t,r){if(typeof t!="function")throw new Jt("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||Fn(r)!==r)throw new Jt("`length` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,d=!0;if("length"in t&&Yt){var y=Yt(t,"length");y&&!y.configurable&&(a=!1),y&&!y.writable&&(d=!1)}return(a||d||!o)&&(Dn?Kt(t,"length",r,!0,!0):Kt(t,"length",r)),t};(function(e){var t=jt,r=Ae,o=Bn,a=r("%TypeError%"),d=r("%Function.prototype.apply%"),y=r("%Function.prototype.call%"),_=r("%Reflect.apply%",!0)||t.call(y,d),h=r("%Object.defineProperty%",!0),P=r("%Math.max%");if(h)try{h({},"a",{value:1})}catch{h=null}e.exports=function(x){if(typeof x!="function")throw new a("a function is required");var H=_(t,y,arguments);return o(H,1+P(0,x.length-(arguments.length-1)),!0)};var I=function(){return _(t,d,arguments)};h?h(e.exports,"apply",{value:I}):e.exports.apply=I})(Tr);var Mr=Tr.exports,Lr=Ae,Cr=Mr,kn=Cr(Lr("String.prototype.indexOf")),Ir=function(t,r){var o=Lr(t,!!r);return typeof o=="function"&&kn(t,".prototype.")>-1?Cr(o):o},Un=Pt(),xn=Ir,vt=xn("Object.prototype.toString"),qe=function(t){return Un&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:vt(t)==="[object Arguments]"},Nr=function(t){return qe(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&vt(t)!=="[object Array]"&&vt(t.callee)==="[object Function]"},$n=function(){return qe(arguments)}();qe.isLegacyArguments=Nr;var Wn=$n?qe:Nr,qn=Object.prototype.toString,Gn=Function.prototype.toString,Hn=/^\s*(?:function)?\*/,Dr=Pt(),Ze=Object.getPrototypeOf,Vn=function(){if(!Dr)return!1;try{return Function("return function*() {}")()}catch{}},Qe,zn=function(t){if(typeof t!="function")return!1;if(Hn.test(Gn.call(t)))return!0;if(!Dr){var r=qn.call(t);return r==="[object GeneratorFunction]"}if(!Ze)return!1;if(typeof Qe>"u"){var o=Vn();Qe=o?Ze(o):!1}return Ze(t)===Qe},Fr=Function.prototype.toString,me=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,bt,Ce;if(typeof me=="function"&&typeof Object.defineProperty=="function")try{bt=Object.defineProperty({},"length",{get:function(){throw Ce}}),Ce={},me(function(){throw 42},null,bt)}catch(e){e!==Ce&&(me=null)}else me=null;var Kn=/^\s*class\b/,wt=function(t){try{var r=Fr.call(t);return Kn.test(r)}catch{return!1}},et=function(t){try{return wt(t)?!1:(Fr.call(t),!0)}catch{return!1}},Ie=Object.prototype.toString,Yn="[object Object]",Jn="[object Function]",Xn="[object GeneratorFunction]",Zn="[object HTMLAllCollection]",Qn="[object HTML document.all class]",ei="[object HTMLCollection]",ti=typeof Symbol=="function"&&!!Symbol.toStringTag,ri=!(0 in[,]),mt=function(){return!1};if(typeof document=="object"){var ni=document.all;Ie.call(ni)===Ie.call(document.all)&&(mt=function(t){if((ri||!t)&&(typeof t>"u"||typeof t=="object"))try{var r=Ie.call(t);return(r===Zn||r===Qn||r===ei||r===Yn)&&t("")==null}catch{}return!1})}var ii=me?function(t){if(mt(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{me(t,null,bt)}catch(r){if(r!==Ce)return!1}return!wt(t)&&et(t)}:function(t){if(mt(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(ti)return et(t);if(wt(t))return!1;var r=Ie.call(t);return r!==Jn&&r!==Xn&&!/^\[object HTML/.test(r)?!1:et(t)},oi=ii,ai=Object.prototype.toString,Br=Object.prototype.hasOwnProperty,fi=function(t,r,o){for(var a=0,d=t.length;a=3&&(a=o),ai.call(t)==="[object Array]"?fi(t,r,a):typeof t=="string"?ui(t,r,a):si(t,r,a)},ci=li,tt=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],di=typeof globalThis>"u"?ie:globalThis,pi=function(){for(var t=[],r=0;r"u"?ie:globalThis,_t=yi(),It=Ct("String.prototype.slice"),rt=Object.getPrototypeOf,gi=Ct("Array.prototype.indexOf",!0)||function(t,r){for(var o=0;o-1?r:r!=="Object"?!1:bi(t)}return Ne?vi(t):null},wi=Ur,mi=function(t){return!!wi(t)};(function(e){var t=Wn,r=zn,o=Ur,a=mi;function d(b){return b.call.bind(b)}var y=typeof BigInt<"u",_=typeof Symbol<"u",h=d(Object.prototype.toString),P=d(Number.prototype.valueOf),I=d(String.prototype.valueOf),k=d(Boolean.prototype.valueOf);if(y)var x=d(BigInt.prototype.valueOf);if(_)var H=d(Symbol.prototype.valueOf);function j(b,je){if(typeof b!="object")return!1;try{return je(b),!0}catch{return!1}}e.isArgumentsObject=t,e.isGeneratorFunction=r,e.isTypedArray=a;function L(b){return typeof Promise<"u"&&b instanceof Promise||b!==null&&typeof b=="object"&&typeof b.then=="function"&&typeof b.catch=="function"}e.isPromise=L;function T(b){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(b):a(b)||c(b)}e.isArrayBufferView=T;function l(b){return o(b)==="Uint8Array"}e.isUint8Array=l;function w(b){return o(b)==="Uint8ClampedArray"}e.isUint8ClampedArray=w;function S(b){return o(b)==="Uint16Array"}e.isUint16Array=S;function R(b){return o(b)==="Uint32Array"}e.isUint32Array=R;function E(b){return o(b)==="Int8Array"}e.isInt8Array=E;function D(b){return o(b)==="Int16Array"}e.isInt16Array=D;function q(b){return o(b)==="Int32Array"}e.isInt32Array=q;function F(b){return o(b)==="Float32Array"}e.isFloat32Array=F;function N(b){return o(b)==="Float64Array"}e.isFloat64Array=N;function K(b){return o(b)==="BigInt64Array"}e.isBigInt64Array=K;function X(b){return o(b)==="BigUint64Array"}e.isBigUint64Array=X;function Z(b){return h(b)==="[object Map]"}Z.working=typeof Map<"u"&&Z(new Map);function oe(b){return typeof Map>"u"?!1:Z.working?Z(b):b instanceof Map}e.isMap=oe;function Q(b){return h(b)==="[object Set]"}Q.working=typeof Set<"u"&&Q(new Set);function te(b){return typeof Set>"u"?!1:Q.working?Q(b):b instanceof Set}e.isSet=te;function re(b){return h(b)==="[object WeakMap]"}re.working=typeof WeakMap<"u"&&re(new WeakMap);function ee(b){return typeof WeakMap>"u"?!1:re.working?re(b):b instanceof WeakMap}e.isWeakMap=ee;function ne(b){return h(b)==="[object WeakSet]"}ne.working=typeof WeakSet<"u"&&ne(new WeakSet);function Y(b){return ne(b)}e.isWeakSet=Y;function M(b){return h(b)==="[object ArrayBuffer]"}M.working=typeof ArrayBuffer<"u"&&M(new ArrayBuffer);function B(b){return typeof ArrayBuffer>"u"?!1:M.working?M(b):b instanceof ArrayBuffer}e.isArrayBuffer=B;function s(b){return h(b)==="[object DataView]"}s.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&s(new DataView(new ArrayBuffer(1),0,1));function c(b){return typeof DataView>"u"?!1:s.working?s(b):b instanceof DataView}e.isDataView=c;var g=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function C(b){return h(b)==="[object SharedArrayBuffer]"}function f(b){return typeof g>"u"?!1:(typeof C.working>"u"&&(C.working=C(new g)),C.working?C(b):b instanceof g)}e.isSharedArrayBuffer=f;function u(b){return h(b)==="[object AsyncFunction]"}e.isAsyncFunction=u;function p(b){return h(b)==="[object Map Iterator]"}e.isMapIterator=p;function m(b){return h(b)==="[object Set Iterator]"}e.isSetIterator=m;function O(b){return h(b)==="[object Generator]"}e.isGeneratorObject=O;function n(b){return h(b)==="[object WebAssembly.Module]"}e.isWebAssemblyCompiledModule=n;function i(b){return j(b,P)}e.isNumberObject=i;function v(b){return j(b,I)}e.isStringObject=v;function A(b){return j(b,k)}e.isBooleanObject=A;function G(b){return y&&j(b,x)}e.isBigIntObject=G;function U(b){return _&&j(b,H)}e.isSymbolObject=U;function V(b){return i(b)||v(b)||A(b)||G(b)||U(b)}e.isBoxedPrimitive=V;function se(b){return typeof Uint8Array<"u"&&(B(b)||f(b))}e.isAnyArrayBuffer=se,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(b){Object.defineProperty(e,b,{enumerable:!1,value:function(){throw new Error(b+" is not supported in userland")}})})})(Ar);var _i=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"};(function(e){var t=Object.getOwnPropertyDescriptors||function(c){for(var g=Object.keys(c),C={},f=0;f=f)return m;switch(m){case"%s":return String(C[g++]);case"%d":return Number(C[g++]);case"%j":try{return JSON.stringify(C[g++])}catch{return"[Circular]"}default:return m}}),p=C[g];g"u")return function(){return e.deprecate(s,c).apply(this,arguments)};var g=!1;function C(){if(!g){if(W.process.throwDeprecation)throw new Error(c);W.process.traceDeprecation?console.trace(c):console.error(c),g=!0}return s.apply(this,arguments)}return C};var o={},a=/^$/;if({}.NODE_DEBUG){var d={}.NODE_DEBUG;d=d.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),a=new RegExp("^"+d+"$","i")}e.debuglog=function(s){if(s=s.toUpperCase(),!o[s])if(a.test(s)){var c=W.process.pid;o[s]=function(){var g=e.format.apply(e,arguments);console.error("%s %d: %s",s,c,g)}}else o[s]=function(){};return o[s]};function y(s,c){var g={seen:[],stylize:h};return arguments.length>=3&&(g.depth=arguments[2]),arguments.length>=4&&(g.colors=arguments[3]),l(c)?g.showHidden=c:c&&e._extend(g,c),q(g.showHidden)&&(g.showHidden=!1),q(g.depth)&&(g.depth=2),q(g.colors)&&(g.colors=!1),q(g.customInspect)&&(g.customInspect=!0),g.colors&&(g.stylize=_),I(g,s,g.depth)}e.inspect=y,y.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]},y.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function _(s,c){var g=y.styles[c];return g?"\x1B["+y.colors[g][0]+"m"+s+"\x1B["+y.colors[g][1]+"m":s}function h(s,c){return s}function P(s){var c={};return s.forEach(function(g,C){c[g]=!0}),c}function I(s,c,g){if(s.customInspect&&c&&Z(c.inspect)&&c.inspect!==e.inspect&&!(c.constructor&&c.constructor.prototype===c)){var C=c.inspect(g,s);return E(C)||(C=I(s,C,g)),C}var f=k(s,c);if(f)return f;var u=Object.keys(c),p=P(u);if(s.showHidden&&(u=Object.getOwnPropertyNames(c)),X(c)&&(u.indexOf("message")>=0||u.indexOf("description")>=0))return x(c);if(u.length===0){if(Z(c)){var m=c.name?": "+c.name:"";return s.stylize("[Function"+m+"]","special")}if(F(c))return s.stylize(RegExp.prototype.toString.call(c),"regexp");if(K(c))return s.stylize(Date.prototype.toString.call(c),"date");if(X(c))return x(c)}var O="",n=!1,i=["{","}"];if(T(c)&&(n=!0,i=["[","]"]),Z(c)){var v=c.name?": "+c.name:"";O=" [Function"+v+"]"}if(F(c)&&(O=" "+RegExp.prototype.toString.call(c)),K(c)&&(O=" "+Date.prototype.toUTCString.call(c)),X(c)&&(O=" "+x(c)),u.length===0&&(!n||c.length==0))return i[0]+O+i[1];if(g<0)return F(c)?s.stylize(RegExp.prototype.toString.call(c),"regexp"):s.stylize("[Object]","special");s.seen.push(c);var A;return n?A=H(s,c,g,p,u):A=u.map(function(G){return j(s,c,g,p,G,n)}),s.seen.pop(),L(A,O,i)}function k(s,c){if(q(c))return s.stylize("undefined","undefined");if(E(c)){var g="'"+JSON.stringify(c).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return s.stylize(g,"string")}if(R(c))return s.stylize(""+c,"number");if(l(c))return s.stylize(""+c,"boolean");if(w(c))return s.stylize("null","null")}function x(s){return"["+Error.prototype.toString.call(s)+"]"}function H(s,c,g,C,f){for(var u=[],p=0,m=c.length;p0&&(y=r[0]),y instanceof Error)throw y;var _=new Error("Unhandled error."+(y?" ("+y.message+")":""));throw _.context=y,_}var h=d[t];if(h===void 0)return!1;if(typeof h=="function")xt(h,this,r);else for(var P=h.length,I=_r(h,P),o=0;o0&&y.length>a&&!y.warned){y.warned=!0;var _=new Error("Possible EventEmitter memory leak detected. "+y.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");_.name="MaxListenersExceededWarning",_.emitter=e,_.type=t,_.count=y.length,Kr(_)}return e}z.prototype.addListener=function(t,r){return vr(this,t,r,!1)};z.prototype.on=z.prototype.addListener;z.prototype.prependListener=function(t,r){return vr(this,t,r,!0)};function Yr(){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 br(e,t,r){var o={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},a=Yr.bind(o);return a.listener=r,o.wrapFn=a,a}z.prototype.once=function(t,r){return We(r),this.on(t,br(this,t,r)),this};z.prototype.prependOnceListener=function(t,r){return We(r),this.prependListener(t,br(this,t,r)),this};z.prototype.removeListener=function(t,r){var o,a,d,y,_;if(We(r),a=this._events,a===void 0)return this;if(o=a[t],o===void 0)return this;if(o===r||o.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete a[t],a.removeListener&&this.emit("removeListener",t,o.listener||r));else if(typeof o!="function"){for(d=-1,y=o.length-1;y>=0;y--)if(o[y]===r||o[y].listener===r){_=o[y].listener,d=y;break}if(d<0)return this;d===0?o.shift():Jr(o,d),o.length===1&&(a[t]=o[0]),a.removeListener!==void 0&&this.emit("removeListener",t,_||r)}return this};z.prototype.off=z.prototype.removeListener;z.prototype.removeAllListeners=function(t){var r,o,a;if(o=this._events,o===void 0)return this;if(o.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):o[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete o[t]),this;if(arguments.length===0){var d=Object.keys(o),y;for(a=0;a=0;a--)this.removeListener(t,r[a]);return this};function wr(e,t,r){var o=e._events;if(o===void 0)return[];var a=o[t];return a===void 0?[]:typeof a=="function"?r?[a.listener||a]:[a]:r?Xr(a):_r(a,a.length)}z.prototype.listeners=function(t){return wr(this,t,!0)};z.prototype.rawListeners=function(t){return wr(this,t,!1)};z.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):mr.call(e,t)};z.prototype.listenerCount=mr;function mr(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}z.prototype.eventNames=function(){return this._eventsCount>0?Me(this._events):[]};function _r(e,t){for(var r=new Array(t),o=0;o"u"||!J?$:J(Uint8Array),ce={"%AggregateError%":typeof AggregateError>"u"?$:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?$:ArrayBuffer,"%ArrayIteratorPrototype%":ve&&J?J([][Symbol.iterator]()):$,"%AsyncFromSyncIteratorPrototype%":$,"%AsyncFunction%":we,"%AsyncGenerator%":we,"%AsyncGeneratorFunction%":we,"%AsyncIteratorPrototype%":we,"%Atomics%":typeof Atomics>"u"?$:Atomics,"%BigInt%":typeof BigInt>"u"?$:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?$:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?$:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?$:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":Error,"%eval%":eval,"%EvalError%":EvalError,"%Float32Array%":typeof Float32Array>"u"?$:Float32Array,"%Float64Array%":typeof Float64Array>"u"?$:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?$:FinalizationRegistry,"%Function%":Or,"%GeneratorFunction%":we,"%Int8Array%":typeof Int8Array>"u"?$:Int8Array,"%Int16Array%":typeof Int16Array>"u"?$:Int16Array,"%Int32Array%":typeof Int32Array>"u"?$:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ve&&J?J(J([][Symbol.iterator]())):$,"%JSON%":typeof JSON=="object"?JSON:$,"%Map%":typeof Map>"u"?$:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ve||!J?$:J(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?$:Promise,"%Proxy%":typeof Proxy>"u"?$:Proxy,"%RangeError%":RangeError,"%ReferenceError%":ReferenceError,"%Reflect%":typeof Reflect>"u"?$:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?$:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ve||!J?$:J(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?$:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ve&&J?J(""[Symbol.iterator]()):$,"%Symbol%":ve?Symbol:$,"%SyntaxError%":Ee,"%ThrowTypeError%":bn,"%TypedArray%":mn,"%TypeError%":Se,"%Uint8Array%":typeof Uint8Array>"u"?$:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?$:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?$:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?$:Uint32Array,"%URIError%":URIError,"%WeakMap%":typeof WeakMap>"u"?$:WeakMap,"%WeakRef%":typeof WeakRef>"u"?$:WeakRef,"%WeakSet%":typeof WeakSet>"u"?$:WeakSet};if(J)try{null.error}catch(e){var _n=J(J(e));ce["%Error.prototype%"]=_n}var Sn=function e(t){var r;if(t==="%AsyncFunction%")r=Je("async function () {}");else if(t==="%GeneratorFunction%")r=Je("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=Je("async function* () {}");else if(t==="%AsyncGenerator%"){var o=e("%AsyncGeneratorFunction%");o&&(r=o.prototype)}else if(t==="%AsyncIteratorPrototype%"){var a=e("%AsyncGenerator%");a&&J&&(r=J(a.prototype))}return ce[t]=r,r},Ht={"%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"]},Pe=jt,Fe=vn,En=Pe.call(Function.call,Array.prototype.concat),An=Pe.call(Function.apply,Array.prototype.splice),Vt=Pe.call(Function.call,String.prototype.replace),Be=Pe.call(Function.call,String.prototype.slice),Rn=Pe.call(Function.call,RegExp.prototype.exec),On=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Tn=/\\(\\)?/g,Pn=function(t){var r=Be(t,0,1),o=Be(t,-1);if(r==="%"&&o!=="%")throw new Ee("invalid intrinsic syntax, expected closing `%`");if(o==="%"&&r!=="%")throw new Ee("invalid intrinsic syntax, expected opening `%`");var a=[];return Vt(t,On,function(d,y,_,h){a[a.length]=_?Vt(h,Tn,"$1"):y||d}),a},jn=function(t,r){var o=t,a;if(Fe(Ht,o)&&(a=Ht[o],o="%"+a[0]+"%"),Fe(ce,o)){var d=ce[o];if(d===we&&(d=Sn(o)),typeof d>"u"&&!r)throw new Se("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:a,name:o,value:d}}throw new Ee("intrinsic "+t+" does not exist!")},Ae=function(t,r){if(typeof t!="string"||t.length===0)throw new Se("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Se('"allowMissing" argument must be a boolean');if(Rn(/^%?[^%]*%?$/,t)===null)throw new Ee("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var o=Pn(t),a=o.length>0?o[0]:"",d=jn("%"+a+"%",r),y=d.name,_=d.value,h=!1,P=d.alias;P&&(a=P[0],An(o,En([0,1],P)));for(var I=1,k=!0;I=o.length){var L=le(_,x);k=!!L,k&&"get"in L&&!("originalValue"in L.get)?_=L.get:_=_[x]}else k=Fe(_,x),_=_[x];k&&!h&&(ce[y]=_)}}return _},Tr={exports:{}},Mn=Ae,ht=Mn("%Object.defineProperty%",!0),gt=function(){if(ht)try{return ht({},"a",{value:1}),!0}catch{return!1}return!1};gt.hasArrayLengthDefineBug=function(){if(!gt())return null;try{return ht([],"length",{value:1}).length!==1}catch{return!0}};var Pr=gt,Ln=Ae,Le=Ln("%Object.getOwnPropertyDescriptor%",!0);if(Le)try{Le([],"length")}catch{Le=null}var Mt=Le,Cn=Pr(),Lt=Ae,Oe=Cn&&Lt("%Object.defineProperty%",!0);if(Oe)try{Oe({},"a",{value:1})}catch{Oe=!1}var In=Lt("%SyntaxError%"),be=Lt("%TypeError%"),zt=Mt,Nn=function(t,r,o){if(!t||typeof t!="object"&&typeof t!="function")throw new be("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new be("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new be("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new be("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new be("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new be("`loose`, if provided, must be a boolean");var a=arguments.length>3?arguments[3]:null,d=arguments.length>4?arguments[4]:null,y=arguments.length>5?arguments[5]:null,_=arguments.length>6?arguments[6]:!1,h=!!zt&&zt(t,r);if(Oe)Oe(t,r,{configurable:y===null&&h?h.configurable:!y,enumerable:a===null&&h?h.enumerable:!a,value:o,writable:d===null&&h?h.writable:!d});else if(_||!a&&!d&&!y)t[r]=o;else throw new In("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},jr=Ae,Kt=Nn,Dn=Pr(),Yt=Mt,Jt=jr("%TypeError%"),Fn=jr("%Math.floor%"),Bn=function(t,r){if(typeof t!="function")throw new Jt("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||Fn(r)!==r)throw new Jt("`length` must be a positive 32-bit integer");var o=arguments.length>2&&!!arguments[2],a=!0,d=!0;if("length"in t&&Yt){var y=Yt(t,"length");y&&!y.configurable&&(a=!1),y&&!y.writable&&(d=!1)}return(a||d||!o)&&(Dn?Kt(t,"length",r,!0,!0):Kt(t,"length",r)),t};(function(e){var t=jt,r=Ae,o=Bn,a=r("%TypeError%"),d=r("%Function.prototype.apply%"),y=r("%Function.prototype.call%"),_=r("%Reflect.apply%",!0)||t.call(y,d),h=r("%Object.defineProperty%",!0),P=r("%Math.max%");if(h)try{h({},"a",{value:1})}catch{h=null}e.exports=function(x){if(typeof x!="function")throw new a("a function is required");var H=_(t,y,arguments);return o(H,1+P(0,x.length-(arguments.length-1)),!0)};var I=function(){return _(t,d,arguments)};h?h(e.exports,"apply",{value:I}):e.exports.apply=I})(Tr);var Mr=Tr.exports,Lr=Ae,Cr=Mr,kn=Cr(Lr("String.prototype.indexOf")),Ir=function(t,r){var o=Lr(t,!!r);return typeof o=="function"&&kn(t,".prototype.")>-1?Cr(o):o},Un=Pt(),xn=Ir,vt=xn("Object.prototype.toString"),qe=function(t){return Un&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:vt(t)==="[object Arguments]"},Nr=function(t){return qe(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&vt(t)!=="[object Array]"&&vt(t.callee)==="[object Function]"},$n=function(){return qe(arguments)}();qe.isLegacyArguments=Nr;var Wn=$n?qe:Nr,qn=Object.prototype.toString,Gn=Function.prototype.toString,Hn=/^\s*(?:function)?\*/,Dr=Pt(),Ze=Object.getPrototypeOf,Vn=function(){if(!Dr)return!1;try{return Function("return function*() {}")()}catch{}},Qe,zn=function(t){if(typeof t!="function")return!1;if(Hn.test(Gn.call(t)))return!0;if(!Dr){var r=qn.call(t);return r==="[object GeneratorFunction]"}if(!Ze)return!1;if(typeof Qe>"u"){var o=Vn();Qe=o?Ze(o):!1}return Ze(t)===Qe},Fr=Function.prototype.toString,me=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,bt,Ce;if(typeof me=="function"&&typeof Object.defineProperty=="function")try{bt=Object.defineProperty({},"length",{get:function(){throw Ce}}),Ce={},me(function(){throw 42},null,bt)}catch(e){e!==Ce&&(me=null)}else me=null;var Kn=/^\s*class\b/,wt=function(t){try{var r=Fr.call(t);return Kn.test(r)}catch{return!1}},et=function(t){try{return wt(t)?!1:(Fr.call(t),!0)}catch{return!1}},Ie=Object.prototype.toString,Yn="[object Object]",Jn="[object Function]",Xn="[object GeneratorFunction]",Zn="[object HTMLAllCollection]",Qn="[object HTML document.all class]",ei="[object HTMLCollection]",ti=typeof Symbol=="function"&&!!Symbol.toStringTag,ri=!(0 in[,]),mt=function(){return!1};if(typeof document=="object"){var ni=document.all;Ie.call(ni)===Ie.call(document.all)&&(mt=function(t){if((ri||!t)&&(typeof t>"u"||typeof t=="object"))try{var r=Ie.call(t);return(r===Zn||r===Qn||r===ei||r===Yn)&&t("")==null}catch{}return!1})}var ii=me?function(t){if(mt(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{me(t,null,bt)}catch(r){if(r!==Ce)return!1}return!wt(t)&&et(t)}:function(t){if(mt(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(ti)return et(t);if(wt(t))return!1;var r=Ie.call(t);return r!==Jn&&r!==Xn&&!/^\[object HTML/.test(r)?!1:et(t)},oi=ii,ai=Object.prototype.toString,Br=Object.prototype.hasOwnProperty,fi=function(t,r,o){for(var a=0,d=t.length;a=3&&(a=o),ai.call(t)==="[object Array]"?fi(t,r,a):typeof t=="string"?ui(t,r,a):si(t,r,a)},ci=li,tt=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],di=typeof globalThis>"u"?ie:globalThis,pi=function(){for(var t=[],r=0;r"u"?ie:globalThis,_t=yi(),It=Ct("String.prototype.slice"),rt=Object.getPrototypeOf,gi=Ct("Array.prototype.indexOf",!0)||function(t,r){for(var o=0;o-1?r:r!=="Object"?!1:bi(t)}return Ne?vi(t):null},wi=Ur,mi=function(t){return!!wi(t)};(function(e){var t=Wn,r=zn,o=Ur,a=mi;function d(b){return b.call.bind(b)}var y=typeof BigInt<"u",_=typeof Symbol<"u",h=d(Object.prototype.toString),P=d(Number.prototype.valueOf),I=d(String.prototype.valueOf),k=d(Boolean.prototype.valueOf);if(y)var x=d(BigInt.prototype.valueOf);if(_)var H=d(Symbol.prototype.valueOf);function j(b,je){if(typeof b!="object")return!1;try{return je(b),!0}catch{return!1}}e.isArgumentsObject=t,e.isGeneratorFunction=r,e.isTypedArray=a;function L(b){return typeof Promise<"u"&&b instanceof Promise||b!==null&&typeof b=="object"&&typeof b.then=="function"&&typeof b.catch=="function"}e.isPromise=L;function T(b){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(b):a(b)||c(b)}e.isArrayBufferView=T;function l(b){return o(b)==="Uint8Array"}e.isUint8Array=l;function w(b){return o(b)==="Uint8ClampedArray"}e.isUint8ClampedArray=w;function S(b){return o(b)==="Uint16Array"}e.isUint16Array=S;function R(b){return o(b)==="Uint32Array"}e.isUint32Array=R;function E(b){return o(b)==="Int8Array"}e.isInt8Array=E;function D(b){return o(b)==="Int16Array"}e.isInt16Array=D;function q(b){return o(b)==="Int32Array"}e.isInt32Array=q;function F(b){return o(b)==="Float32Array"}e.isFloat32Array=F;function N(b){return o(b)==="Float64Array"}e.isFloat64Array=N;function K(b){return o(b)==="BigInt64Array"}e.isBigInt64Array=K;function X(b){return o(b)==="BigUint64Array"}e.isBigUint64Array=X;function Z(b){return h(b)==="[object Map]"}Z.working=typeof Map<"u"&&Z(new Map);function oe(b){return typeof Map>"u"?!1:Z.working?Z(b):b instanceof Map}e.isMap=oe;function Q(b){return h(b)==="[object Set]"}Q.working=typeof Set<"u"&&Q(new Set);function te(b){return typeof Set>"u"?!1:Q.working?Q(b):b instanceof Set}e.isSet=te;function re(b){return h(b)==="[object WeakMap]"}re.working=typeof WeakMap<"u"&&re(new WeakMap);function ee(b){return typeof WeakMap>"u"?!1:re.working?re(b):b instanceof WeakMap}e.isWeakMap=ee;function ne(b){return h(b)==="[object WeakSet]"}ne.working=typeof WeakSet<"u"&&ne(new WeakSet);function Y(b){return ne(b)}e.isWeakSet=Y;function M(b){return h(b)==="[object ArrayBuffer]"}M.working=typeof ArrayBuffer<"u"&&M(new ArrayBuffer);function B(b){return typeof ArrayBuffer>"u"?!1:M.working?M(b):b instanceof ArrayBuffer}e.isArrayBuffer=B;function s(b){return h(b)==="[object DataView]"}s.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&s(new DataView(new ArrayBuffer(1),0,1));function c(b){return typeof DataView>"u"?!1:s.working?s(b):b instanceof DataView}e.isDataView=c;var g=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function C(b){return h(b)==="[object SharedArrayBuffer]"}function f(b){return typeof g>"u"?!1:(typeof C.working>"u"&&(C.working=C(new g)),C.working?C(b):b instanceof g)}e.isSharedArrayBuffer=f;function u(b){return h(b)==="[object AsyncFunction]"}e.isAsyncFunction=u;function p(b){return h(b)==="[object Map Iterator]"}e.isMapIterator=p;function m(b){return h(b)==="[object Set Iterator]"}e.isSetIterator=m;function O(b){return h(b)==="[object Generator]"}e.isGeneratorObject=O;function n(b){return h(b)==="[object WebAssembly.Module]"}e.isWebAssemblyCompiledModule=n;function i(b){return j(b,P)}e.isNumberObject=i;function v(b){return j(b,I)}e.isStringObject=v;function A(b){return j(b,k)}e.isBooleanObject=A;function G(b){return y&&j(b,x)}e.isBigIntObject=G;function U(b){return _&&j(b,H)}e.isSymbolObject=U;function V(b){return i(b)||v(b)||A(b)||G(b)||U(b)}e.isBoxedPrimitive=V;function se(b){return typeof Uint8Array<"u"&&(B(b)||f(b))}e.isAnyArrayBuffer=se,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(b){Object.defineProperty(e,b,{enumerable:!1,value:function(){throw new Error(b+" is not supported in userland")}})})})(Ar);var _i=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"};(function(e){var t=Object.getOwnPropertyDescriptors||function(c){for(var g=Object.keys(c),C={},f=0;f=f)return m;switch(m){case"%s":return String(C[g++]);case"%d":return Number(C[g++]);case"%j":try{return JSON.stringify(C[g++])}catch{return"[Circular]"}default:return m}}),p=C[g];g"u")return function(){return e.deprecate(s,c).apply(this,arguments)};var g=!1;function C(){if(!g){if(W.process.throwDeprecation)throw new Error(c);W.process.traceDeprecation?console.trace(c):console.error(c),g=!0}return s.apply(this,arguments)}return C};var o={},a=/^$/;if({}.NODE_DEBUG){var d={}.NODE_DEBUG;d=d.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),a=new RegExp("^"+d+"$","i")}e.debuglog=function(s){if(s=s.toUpperCase(),!o[s])if(a.test(s)){var c=W.process.pid;o[s]=function(){var g=e.format.apply(e,arguments);console.error("%s %d: %s",s,c,g)}}else o[s]=function(){};return o[s]};function y(s,c){var g={seen:[],stylize:h};return arguments.length>=3&&(g.depth=arguments[2]),arguments.length>=4&&(g.colors=arguments[3]),l(c)?g.showHidden=c:c&&e._extend(g,c),q(g.showHidden)&&(g.showHidden=!1),q(g.depth)&&(g.depth=2),q(g.colors)&&(g.colors=!1),q(g.customInspect)&&(g.customInspect=!0),g.colors&&(g.stylize=_),I(g,s,g.depth)}e.inspect=y,y.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]},y.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function _(s,c){var g=y.styles[c];return g?"\x1B["+y.colors[g][0]+"m"+s+"\x1B["+y.colors[g][1]+"m":s}function h(s,c){return s}function P(s){var c={};return s.forEach(function(g,C){c[g]=!0}),c}function I(s,c,g){if(s.customInspect&&c&&Z(c.inspect)&&c.inspect!==e.inspect&&!(c.constructor&&c.constructor.prototype===c)){var C=c.inspect(g,s);return E(C)||(C=I(s,C,g)),C}var f=k(s,c);if(f)return f;var u=Object.keys(c),p=P(u);if(s.showHidden&&(u=Object.getOwnPropertyNames(c)),X(c)&&(u.indexOf("message")>=0||u.indexOf("description")>=0))return x(c);if(u.length===0){if(Z(c)){var m=c.name?": "+c.name:"";return s.stylize("[Function"+m+"]","special")}if(F(c))return s.stylize(RegExp.prototype.toString.call(c),"regexp");if(K(c))return s.stylize(Date.prototype.toString.call(c),"date");if(X(c))return x(c)}var O="",n=!1,i=["{","}"];if(T(c)&&(n=!0,i=["[","]"]),Z(c)){var v=c.name?": "+c.name:"";O=" [Function"+v+"]"}if(F(c)&&(O=" "+RegExp.prototype.toString.call(c)),K(c)&&(O=" "+Date.prototype.toUTCString.call(c)),X(c)&&(O=" "+x(c)),u.length===0&&(!n||c.length==0))return i[0]+O+i[1];if(g<0)return F(c)?s.stylize(RegExp.prototype.toString.call(c),"regexp"):s.stylize("[Object]","special");s.seen.push(c);var A;return n?A=H(s,c,g,p,u):A=u.map(function(G){return j(s,c,g,p,G,n)}),s.seen.pop(),L(A,O,i)}function k(s,c){if(q(c))return s.stylize("undefined","undefined");if(E(c)){var g="'"+JSON.stringify(c).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return s.stylize(g,"string")}if(R(c))return s.stylize(""+c,"number");if(l(c))return s.stylize(""+c,"boolean");if(w(c))return s.stylize("null","null")}function x(s){return"["+Error.prototype.toString.call(s)+"]"}function H(s,c,g,C,f){for(var u=[],p=0,m=c.length;p-1&&(u?m=m.split(` `).map(function(n){return" "+n}).join(` `).slice(2):m=` diff --git a/preview-build/assets/solanaEmbed.esm-aaf40c80.js b/preview-build/assets/solanaEmbed.esm-47ad5150.js similarity index 99% rename from preview-build/assets/solanaEmbed.esm-aaf40c80.js rename to preview-build/assets/solanaEmbed.esm-47ad5150.js index d3d6300..b9b5573 100644 --- a/preview-build/assets/solanaEmbed.esm-aaf40c80.js +++ b/preview-build/assets/solanaEmbed.esm-47ad5150.js @@ -1,4 +1,4 @@ -import{d as Fe,b as qn,K as go,f as po,g as Fd,c as ft,P as H0}from"./index-e25ecac5.js";import{u as ao,d as uI,e as Sb,h as fI,f as cI,g as Rb,j as aa,a as lI,c as z0,i as Ab,r as ss,k as dI,s as hI,l as gI}from"./punycode-e9579d2a.js";var Yc={exports:{}},Qc={},W0;function Ib(){if(W0)return Qc;W0=1;function e(W){"@babel/helpers - typeof";return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(F){return typeof F}:function(F){return F&&typeof Symbol=="function"&&F.constructor===Symbol&&F!==Symbol.prototype?"symbol":typeof F},e(W)}function t(W,F){for(var G=0;G"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 A(W){return A=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(G){return G.__proto__||Object.getPrototypeOf(G)},A(W)}var R={},D,ie;function Z(W,F,G){G||(G=Error);function m(w,k,_){return typeof F=="string"?F:F(w,k,_)}var S=function(w){f(_,w);var k=d(_);function _(b,v,T){var B;return a(this,_),B=k.call(this,m(b,v,T)),B.code=W,B}return r(_)}(G);R[W]=S}function J(W,F){if(Array.isArray(W)){var G=W.length;return W=W.map(function(m){return String(m)}),G>2?"one of ".concat(F," ").concat(W.slice(0,G-1).join(", "),", or ")+W[G-1]:G===2?"one of ".concat(F," ").concat(W[0]," or ").concat(W[1]):"of ".concat(F," ").concat(W[0])}else return"of ".concat(F," ").concat(String(W))}function E(W,F,G){return W.substr(!G||G<0?0:+G,F.length)===F}function te(W,F,G){return(G===void 0||G>W.length)&&(G=W.length),W.substring(G-F.length,G)===F}function q(W,F,G){return typeof G!="number"&&(G=0),G+F.length>W.length?!1:W.indexOf(F,G)!==-1}return Z("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),Z("ERR_INVALID_ARG_TYPE",function(W,F,G){D===void 0&&(D=Uu()),D(typeof W=="string","'name' must be a string");var m;typeof F=="string"&&E(F,"not ")?(m="must not be",F=F.replace(/^not /,"")):m="must be";var S;if(te(W," argument"))S="The ".concat(W," ").concat(m," ").concat(J(F,"type"));else{var w=q(W,".")?"property":"argument";S='The "'.concat(W,'" ').concat(w," ").concat(m," ").concat(J(F,"type"))}return S+=". Received type ".concat(e(G)),S},TypeError),Z("ERR_INVALID_ARG_VALUE",function(W,F){var G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";ie===void 0&&(ie=ao);var m=ie.inspect(F);return m.length>128&&(m="".concat(m.slice(0,128),"...")),"The argument '".concat(W,"' ").concat(G,". Received ").concat(m)},TypeError),Z("ERR_INVALID_RETURN_VALUE",function(W,F,G){var m;return G&&G.constructor&&G.constructor.name?m="instance of ".concat(G.constructor.name):m="type ".concat(e(G)),"Expected ".concat(W,' to be returned from the "').concat(F,'"')+" function but got ".concat(m,".")},TypeError),Z("ERR_MISSING_ARGS",function(){for(var W=arguments.length,F=new Array(W),G=0;G0,"At least one arg needs to be specified");var m="The ",S=F.length;switch(F=F.map(function(w){return'"'.concat(w,'"')}),S){case 1:m+="".concat(F[0]," argument");break;case 2:m+="".concat(F[0]," and ").concat(F[1]," arguments");break;default:m+=F.slice(0,S-1).join(", "),m+=", and ".concat(F[S-1]," arguments");break}return"".concat(m," must be specified")},TypeError),Qc.codes=R,Qc}var el,G0;function pI(){if(G0)return el;G0=1;function e(O,L){var X=Object.keys(O);if(Object.getOwnPropertySymbols){var re=Object.getOwnPropertySymbols(O);L&&(re=re.filter(function(fe){return Object.getOwnPropertyDescriptor(O,fe).enumerable})),X.push.apply(X,re)}return X}function t(O){for(var L=1;L"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 ie(O){return Function.toString.call(O).indexOf("[native code]")!==-1}function Z(O,L){return Z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(re,fe){return re.__proto__=fe,re},Z(O,L)}function J(O){return J=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(X){return X.__proto__||Object.getPrototypeOf(X)},J(O)}function E(O){"@babel/helpers - typeof";return E=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(L){return typeof L}:function(L){return L&&typeof Symbol=="function"&&L.constructor===Symbol&&L!==Symbol.prototype?"symbol":typeof L},E(O)}var te=ao,q=te.inspect,W=Ib(),F=W.codes.ERR_INVALID_ARG_TYPE;function G(O,L,X){return(X===void 0||X>O.length)&&(X=O.length),O.substring(X-L.length,X)===L}function m(O,L){if(L=Math.floor(L),O.length==0||L==0)return"";var X=O.length*L;for(L=Math.floor(Math.log(L)/Math.log(2));L;)O+=O,L--;return O+=O.substring(0,X-O.length),O}var S="",w="",k="",_="",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:"},v=10;function T(O){var L=Object.keys(O),X=Object.create(Object.getPrototypeOf(O));return L.forEach(function(re){X[re]=O[re]}),Object.defineProperty(X,"message",{value:O.message}),X}function B(O){return q(O,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function C(O,L,X){var re="",fe="",_e=0,be="",ye=!1,oe=B(O),K=oe.split(` +import{d as Fe,b as qn,K as go,f as po,g as Fd,c as ft,P as H0}from"./index-f54a1fc2.js";import{u as ao,d as uI,e as Sb,h as fI,f as cI,g as Rb,j as aa,a as lI,c as z0,i as Ab,r as ss,k as dI,s as hI,l as gI}from"./punycode-06c60053.js";var Yc={exports:{}},Qc={},W0;function Ib(){if(W0)return Qc;W0=1;function e(W){"@babel/helpers - typeof";return e=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(F){return typeof F}:function(F){return F&&typeof Symbol=="function"&&F.constructor===Symbol&&F!==Symbol.prototype?"symbol":typeof F},e(W)}function t(W,F){for(var G=0;G"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 A(W){return A=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(G){return G.__proto__||Object.getPrototypeOf(G)},A(W)}var R={},D,ie;function Z(W,F,G){G||(G=Error);function m(w,k,_){return typeof F=="string"?F:F(w,k,_)}var S=function(w){f(_,w);var k=d(_);function _(b,v,T){var B;return a(this,_),B=k.call(this,m(b,v,T)),B.code=W,B}return r(_)}(G);R[W]=S}function J(W,F){if(Array.isArray(W)){var G=W.length;return W=W.map(function(m){return String(m)}),G>2?"one of ".concat(F," ").concat(W.slice(0,G-1).join(", "),", or ")+W[G-1]:G===2?"one of ".concat(F," ").concat(W[0]," or ").concat(W[1]):"of ".concat(F," ").concat(W[0])}else return"of ".concat(F," ").concat(String(W))}function E(W,F,G){return W.substr(!G||G<0?0:+G,F.length)===F}function te(W,F,G){return(G===void 0||G>W.length)&&(G=W.length),W.substring(G-F.length,G)===F}function q(W,F,G){return typeof G!="number"&&(G=0),G+F.length>W.length?!1:W.indexOf(F,G)!==-1}return Z("ERR_AMBIGUOUS_ARGUMENT",'The "%s" argument is ambiguous. %s',TypeError),Z("ERR_INVALID_ARG_TYPE",function(W,F,G){D===void 0&&(D=Uu()),D(typeof W=="string","'name' must be a string");var m;typeof F=="string"&&E(F,"not ")?(m="must not be",F=F.replace(/^not /,"")):m="must be";var S;if(te(W," argument"))S="The ".concat(W," ").concat(m," ").concat(J(F,"type"));else{var w=q(W,".")?"property":"argument";S='The "'.concat(W,'" ').concat(w," ").concat(m," ").concat(J(F,"type"))}return S+=". Received type ".concat(e(G)),S},TypeError),Z("ERR_INVALID_ARG_VALUE",function(W,F){var G=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"is invalid";ie===void 0&&(ie=ao);var m=ie.inspect(F);return m.length>128&&(m="".concat(m.slice(0,128),"...")),"The argument '".concat(W,"' ").concat(G,". Received ").concat(m)},TypeError),Z("ERR_INVALID_RETURN_VALUE",function(W,F,G){var m;return G&&G.constructor&&G.constructor.name?m="instance of ".concat(G.constructor.name):m="type ".concat(e(G)),"Expected ".concat(W,' to be returned from the "').concat(F,'"')+" function but got ".concat(m,".")},TypeError),Z("ERR_MISSING_ARGS",function(){for(var W=arguments.length,F=new Array(W),G=0;G0,"At least one arg needs to be specified");var m="The ",S=F.length;switch(F=F.map(function(w){return'"'.concat(w,'"')}),S){case 1:m+="".concat(F[0]," argument");break;case 2:m+="".concat(F[0]," and ").concat(F[1]," arguments");break;default:m+=F.slice(0,S-1).join(", "),m+=", and ".concat(F[S-1]," arguments");break}return"".concat(m," must be specified")},TypeError),Qc.codes=R,Qc}var el,G0;function pI(){if(G0)return el;G0=1;function e(O,L){var X=Object.keys(O);if(Object.getOwnPropertySymbols){var re=Object.getOwnPropertySymbols(O);L&&(re=re.filter(function(fe){return Object.getOwnPropertyDescriptor(O,fe).enumerable})),X.push.apply(X,re)}return X}function t(O){for(var L=1;L"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 ie(O){return Function.toString.call(O).indexOf("[native code]")!==-1}function Z(O,L){return Z=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(re,fe){return re.__proto__=fe,re},Z(O,L)}function J(O){return J=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(X){return X.__proto__||Object.getPrototypeOf(X)},J(O)}function E(O){"@babel/helpers - typeof";return E=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(L){return typeof L}:function(L){return L&&typeof Symbol=="function"&&L.constructor===Symbol&&L!==Symbol.prototype?"symbol":typeof L},E(O)}var te=ao,q=te.inspect,W=Ib(),F=W.codes.ERR_INVALID_ARG_TYPE;function G(O,L,X){return(X===void 0||X>O.length)&&(X=O.length),O.substring(X-L.length,X)===L}function m(O,L){if(L=Math.floor(L),O.length==0||L==0)return"";var X=O.length*L;for(L=Math.floor(Math.log(L)/Math.log(2));L;)O+=O,L--;return O+=O.substring(0,X-O.length),O}var S="",w="",k="",_="",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:"},v=10;function T(O){var L=Object.keys(O),X=Object.create(Object.getPrototypeOf(O));return L.forEach(function(re){X[re]=O[re]}),Object.defineProperty(X,"message",{value:O.message}),X}function B(O){return q(O,{compact:!1,customInspect:!1,depth:1e3,maxArrayLength:1/0,showHidden:!1,breakLength:1/0,showProxy:!1,sorted:!0,getters:!0})}function C(O,L,X){var re="",fe="",_e=0,be="",ye=!1,oe=B(O),K=oe.split(` `),Q=B(L).split(` `),pe=0,Oe="";if(X==="strictEqual"&&E(O)==="object"&&E(L)==="object"&&O!==null&&L!==null&&(X="strictEqualObject"),K.length===1&&Q.length===1&&K[0]!==Q[0]){var Le=K[0].length+Q[0].length;if(Le<=v){if((E(O)!=="object"||O===null)&&(E(L)!=="object"||L===null)&&(O!==0||L!==0))return"".concat(b[X],` diff --git a/preview-build/assets/widget-7424685c.js b/preview-build/assets/widget-7424685c.js deleted file mode 100644 index fed9248..0000000 --- a/preview-build/assets/widget-7424685c.js +++ /dev/null @@ -1,12 +0,0 @@ -import{r as xe,C as Dk,R as zk,a as qk,s as sr,b as yr,g as W7,i as G7,c as Re,d as Gt,e as rd,f as lg,j as St,u as Fk,h as jk,k as $k,W as Kk,S as Hk,l as Vk,P as Ne,m as Y7,t as Zk,n as Wk,o as nd,p as dg,T as kh,q as Tb,v as id,w as pg,x as Gk,y as Yk,z as Ev,A as od,B as Av,D as X7,E as Xk,N as Lb,F as sd,G as Jk,H as sn,L as Qk,I as tI}from"./index-e25ecac5.js";import{r as J7,i as br,s as eI,a as rI,b as Bf,c as nI}from"./punycode-e9579d2a.js";const iI=({children:r,endpoint:t,config:e={commitment:"confirmed"}})=>{const n=xe.useMemo(()=>new Dk(t,e),[t,e]);return zk.createElement(qk.Provider,{value:{connection:n}},r)};function oI(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,i=[],c;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(l){c={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(c)throw c.error}}return i}var yl=sr.Buffer,Q7=J7.Transform,sI=br;function aI(r,t){if(!yl.isBuffer(r)&&typeof r!="string")throw new TypeError(t+" must be a string or a buffer")}function ha(r){Q7.call(this),this._block=yl.allocUnsafe(r),this._blockSize=r,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}sI(ha,Q7);ha.prototype._transform=function(r,t,e){var n=null;try{this.update(r,t)}catch(s){n=s}e(n)};ha.prototype._flush=function(r){var t=null;try{this.push(this.digest())}catch(e){t=e}r(t)};ha.prototype.update=function(r,t){if(aI(r,"Data"),this._finalized)throw new Error("Digest already called");yl.isBuffer(r)||(r=yl.from(r,t));for(var e=this._block,n=0;this._blockOffset+r.length-n>=this._blockSize;){for(var s=this._blockOffset;s0;++i)this._length[i]+=c,c=this._length[i]/4294967296|0,c>0&&(this._length[i]-=4294967296*c);return this};ha.prototype._update=function(){throw new Error("_update is not implemented")};ha.prototype.digest=function(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();r!==void 0&&(t=t.toString(r)),this._block.fill(0),this._blockOffset=0;for(var e=0;e<4;++e)this._length[e]=0;return t};ha.prototype._digest=function(){throw new Error("_digest is not implemented")};var t_=ha,uI=br,e_=t_,fI=sr.Buffer,cI=new Array(16);function ad(){e_.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}uI(ad,e_);ad.prototype._update=function(){for(var r=cI,t=0;t<16;++t)r[t]=this._block.readInt32LE(t*4);var e=this._a,n=this._b,s=this._c,i=this._d;e=jn(e,n,s,i,r[0],3614090360,7),i=jn(i,e,n,s,r[1],3905402710,12),s=jn(s,i,e,n,r[2],606105819,17),n=jn(n,s,i,e,r[3],3250441966,22),e=jn(e,n,s,i,r[4],4118548399,7),i=jn(i,e,n,s,r[5],1200080426,12),s=jn(s,i,e,n,r[6],2821735955,17),n=jn(n,s,i,e,r[7],4249261313,22),e=jn(e,n,s,i,r[8],1770035416,7),i=jn(i,e,n,s,r[9],2336552879,12),s=jn(s,i,e,n,r[10],4294925233,17),n=jn(n,s,i,e,r[11],2304563134,22),e=jn(e,n,s,i,r[12],1804603682,7),i=jn(i,e,n,s,r[13],4254626195,12),s=jn(s,i,e,n,r[14],2792965006,17),n=jn(n,s,i,e,r[15],1236535329,22),e=$n(e,n,s,i,r[1],4129170786,5),i=$n(i,e,n,s,r[6],3225465664,9),s=$n(s,i,e,n,r[11],643717713,14),n=$n(n,s,i,e,r[0],3921069994,20),e=$n(e,n,s,i,r[5],3593408605,5),i=$n(i,e,n,s,r[10],38016083,9),s=$n(s,i,e,n,r[15],3634488961,14),n=$n(n,s,i,e,r[4],3889429448,20),e=$n(e,n,s,i,r[9],568446438,5),i=$n(i,e,n,s,r[14],3275163606,9),s=$n(s,i,e,n,r[3],4107603335,14),n=$n(n,s,i,e,r[8],1163531501,20),e=$n(e,n,s,i,r[13],2850285829,5),i=$n(i,e,n,s,r[2],4243563512,9),s=$n(s,i,e,n,r[7],1735328473,14),n=$n(n,s,i,e,r[12],2368359562,20),e=Kn(e,n,s,i,r[5],4294588738,4),i=Kn(i,e,n,s,r[8],2272392833,11),s=Kn(s,i,e,n,r[11],1839030562,16),n=Kn(n,s,i,e,r[14],4259657740,23),e=Kn(e,n,s,i,r[1],2763975236,4),i=Kn(i,e,n,s,r[4],1272893353,11),s=Kn(s,i,e,n,r[7],4139469664,16),n=Kn(n,s,i,e,r[10],3200236656,23),e=Kn(e,n,s,i,r[13],681279174,4),i=Kn(i,e,n,s,r[0],3936430074,11),s=Kn(s,i,e,n,r[3],3572445317,16),n=Kn(n,s,i,e,r[6],76029189,23),e=Kn(e,n,s,i,r[9],3654602809,4),i=Kn(i,e,n,s,r[12],3873151461,11),s=Kn(s,i,e,n,r[15],530742520,16),n=Kn(n,s,i,e,r[2],3299628645,23),e=Hn(e,n,s,i,r[0],4096336452,6),i=Hn(i,e,n,s,r[7],1126891415,10),s=Hn(s,i,e,n,r[14],2878612391,15),n=Hn(n,s,i,e,r[5],4237533241,21),e=Hn(e,n,s,i,r[12],1700485571,6),i=Hn(i,e,n,s,r[3],2399980690,10),s=Hn(s,i,e,n,r[10],4293915773,15),n=Hn(n,s,i,e,r[1],2240044497,21),e=Hn(e,n,s,i,r[8],1873313359,6),i=Hn(i,e,n,s,r[15],4264355552,10),s=Hn(s,i,e,n,r[6],2734768916,15),n=Hn(n,s,i,e,r[13],1309151649,21),e=Hn(e,n,s,i,r[4],4149444226,6),i=Hn(i,e,n,s,r[11],3174756917,10),s=Hn(s,i,e,n,r[2],718787259,15),n=Hn(n,s,i,e,r[9],3951481745,21),this._a=this._a+e|0,this._b=this._b+n|0,this._c=this._c+s|0,this._d=this._d+i|0};ad.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 r=fI.allocUnsafe(16);return r.writeInt32LE(this._a,0),r.writeInt32LE(this._b,4),r.writeInt32LE(this._c,8),r.writeInt32LE(this._d,12),r};function ud(r,t){return r<>>32-t}function jn(r,t,e,n,s,i,c){return ud(r+(t&e|~t&n)+s+i|0,c)+t|0}function $n(r,t,e,n,s,i,c){return ud(r+(t&n|e&~n)+s+i|0,c)+t|0}function Kn(r,t,e,n,s,i,c){return ud(r+(t^e^n)+s+i|0,c)+t|0}function Hn(r,t,e,n,s,i,c){return ud(r+(e^(t|~n))+s+i|0,c)+t|0}var mg=ad,y1=yr.Buffer,hI=br,r_=t_,lI=new Array(16),Yf=[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],Xf=[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],Jf=[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],Qf=[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],tc=[0,1518500249,1859775393,2400959708,2840853838],ec=[1352829926,1548603684,1836072691,2053994217,0];function fd(){r_.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}hI(fd,r_);fd.prototype._update=function(){for(var r=lI,t=0;t<16;++t)r[t]=this._block.readInt32LE(t*4);for(var e=this._a|0,n=this._b|0,s=this._c|0,i=this._d|0,c=this._e|0,l=this._a|0,p=this._b|0,v=this._c|0,y=this._d|0,E=this._e|0,M=0;M<80;M+=1){var w,_;M<16?(w=Ob(e,n,s,i,c,r[Yf[M]],tc[0],Jf[M]),_=zb(l,p,v,y,E,r[Xf[M]],ec[0],Qf[M])):M<32?(w=Ub(e,n,s,i,c,r[Yf[M]],tc[1],Jf[M]),_=Db(l,p,v,y,E,r[Xf[M]],ec[1],Qf[M])):M<48?(w=Nb(e,n,s,i,c,r[Yf[M]],tc[2],Jf[M]),_=Nb(l,p,v,y,E,r[Xf[M]],ec[2],Qf[M])):M<64?(w=Db(e,n,s,i,c,r[Yf[M]],tc[3],Jf[M]),_=Ub(l,p,v,y,E,r[Xf[M]],ec[3],Qf[M])):(w=zb(e,n,s,i,c,r[Yf[M]],tc[4],Jf[M]),_=Ob(l,p,v,y,E,r[Xf[M]],ec[4],Qf[M])),e=c,c=i,i=ru(s,10),s=n,n=w,l=E,E=y,y=ru(v,10),v=p,p=_}var k=this._b+s+y|0;this._b=this._c+i+E|0,this._c=this._d+c+l|0,this._d=this._e+e+p|0,this._e=this._a+n+v|0,this._a=k};fd.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 r=y1.alloc?y1.alloc(20):new y1(20);return r.writeInt32LE(this._a,0),r.writeInt32LE(this._b,4),r.writeInt32LE(this._c,8),r.writeInt32LE(this._d,12),r.writeInt32LE(this._e,16),r};function ru(r,t){return r<>>32-t}function Ob(r,t,e,n,s,i,c,l){return ru(r+(t^e^n)+i+c|0,l)+s|0}function Ub(r,t,e,n,s,i,c,l){return ru(r+(t&e|~t&n)+i+c|0,l)+s|0}function Nb(r,t,e,n,s,i,c,l){return ru(r+((t|~e)^n)+i+c|0,l)+s|0}function Db(r,t,e,n,s,i,c,l){return ru(r+(t&n|e&~n)+i+c|0,l)+s|0}function zb(r,t,e,n,s,i,c,l){return ru(r+(t^(e|~n))+i+c|0,l)+s|0}var vg=fd,n_={exports:{}},i_=sr.Buffer;function cd(r,t){this._block=i_.alloc(r),this._finalSize=t,this._blockSize=r,this._len=0}cd.prototype.update=function(r,t){typeof r=="string"&&(t=t||"utf8",r=i_.from(r,t));for(var e=this._block,n=this._blockSize,s=r.length,i=this._len,c=0;c=this._finalSize&&(this._update(this._block),this._block.fill(0));var e=this._len*8;if(e<=4294967295)this._block.writeUInt32BE(e,this._blockSize-4);else{var n=(e&4294967295)>>>0,s=(e-n)/4294967296;this._block.writeUInt32BE(s,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var i=this._hash();return r?i.toString(r):i};cd.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Pf=cd,dI=br,o_=Pf,pI=sr.Buffer,mI=[1518500249,1859775393,-1894007588,-899497514],vI=new Array(80);function Ih(){this.init(),this._w=vI,o_.call(this,64,56)}dI(Ih,o_);Ih.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function gI(r){return r<<5|r>>>27}function yI(r){return r<<30|r>>>2}function bI(r,t,e,n){return r===0?t&e|~t&n:r===2?t&e|t&n|e&n:t^e^n}Ih.prototype._update=function(r){for(var t=this._w,e=this._a|0,n=this._b|0,s=this._c|0,i=this._d|0,c=this._e|0,l=0;l<16;++l)t[l]=r.readInt32BE(l*4);for(;l<80;++l)t[l]=t[l-3]^t[l-8]^t[l-14]^t[l-16];for(var p=0;p<80;++p){var v=~~(p/20),y=gI(e)+bI(v,n,s,i)+c+t[p]+mI[v]|0;c=i,i=s,s=yI(n),n=e,e=y}this._a=e+this._a|0,this._b=n+this._b|0,this._c=s+this._c|0,this._d=i+this._d|0,this._e=c+this._e|0};Ih.prototype._hash=function(){var r=pI.allocUnsafe(20);return r.writeInt32BE(this._a|0,0),r.writeInt32BE(this._b|0,4),r.writeInt32BE(this._c|0,8),r.writeInt32BE(this._d|0,12),r.writeInt32BE(this._e|0,16),r};var wI=Ih,xI=br,s_=Pf,_I=sr.Buffer,MI=[1518500249,1859775393,-1894007588,-899497514],EI=new Array(80);function Bh(){this.init(),this._w=EI,s_.call(this,64,56)}xI(Bh,s_);Bh.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function AI(r){return r<<1|r>>>31}function SI(r){return r<<5|r>>>27}function kI(r){return r<<30|r>>>2}function II(r,t,e,n){return r===0?t&e|~t&n:r===2?t&e|t&n|e&n:t^e^n}Bh.prototype._update=function(r){for(var t=this._w,e=this._a|0,n=this._b|0,s=this._c|0,i=this._d|0,c=this._e|0,l=0;l<16;++l)t[l]=r.readInt32BE(l*4);for(;l<80;++l)t[l]=AI(t[l-3]^t[l-8]^t[l-14]^t[l-16]);for(var p=0;p<80;++p){var v=~~(p/20),y=SI(e)+II(v,n,s,i)+c+t[p]+MI[v]|0;c=i,i=s,s=kI(n),n=e,e=y}this._a=e+this._a|0,this._b=n+this._b|0,this._c=s+this._c|0,this._d=i+this._d|0,this._e=c+this._e|0};Bh.prototype._hash=function(){var r=_I.allocUnsafe(20);return r.writeInt32BE(this._a|0,0),r.writeInt32BE(this._b|0,4),r.writeInt32BE(this._c|0,8),r.writeInt32BE(this._d|0,12),r.writeInt32BE(this._e|0,16),r};var BI=Bh,PI=br,a_=Pf,RI=sr.Buffer,CI=[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],TI=new Array(64);function Ph(){this.init(),this._w=TI,a_.call(this,64,56)}PI(Ph,a_);Ph.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 LI(r,t,e){return e^r&(t^e)}function OI(r,t,e){return r&t|e&(r|t)}function UI(r){return(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10)}function NI(r){return(r>>>6|r<<26)^(r>>>11|r<<21)^(r>>>25|r<<7)}function DI(r){return(r>>>7|r<<25)^(r>>>18|r<<14)^r>>>3}function zI(r){return(r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10}Ph.prototype._update=function(r){for(var t=this._w,e=this._a|0,n=this._b|0,s=this._c|0,i=this._d|0,c=this._e|0,l=this._f|0,p=this._g|0,v=this._h|0,y=0;y<16;++y)t[y]=r.readInt32BE(y*4);for(;y<64;++y)t[y]=zI(t[y-2])+t[y-7]+DI(t[y-15])+t[y-16]|0;for(var E=0;E<64;++E){var M=v+NI(c)+LI(c,l,p)+CI[E]+t[E]|0,w=UI(e)+OI(e,n,s)|0;v=p,p=l,l=c,c=i+M|0,i=s,s=n,n=e,e=M+w|0}this._a=e+this._a|0,this._b=n+this._b|0,this._c=s+this._c|0,this._d=i+this._d|0,this._e=c+this._e|0,this._f=l+this._f|0,this._g=p+this._g|0,this._h=v+this._h|0};Ph.prototype._hash=function(){var r=RI.allocUnsafe(32);return r.writeInt32BE(this._a,0),r.writeInt32BE(this._b,4),r.writeInt32BE(this._c,8),r.writeInt32BE(this._d,12),r.writeInt32BE(this._e,16),r.writeInt32BE(this._f,20),r.writeInt32BE(this._g,24),r.writeInt32BE(this._h,28),r};var u_=Ph,qI=br,FI=u_,jI=Pf,$I=sr.Buffer,KI=new Array(64);function hd(){this.init(),this._w=KI,jI.call(this,64,56)}qI(hd,FI);hd.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};hd.prototype._hash=function(){var r=$I.allocUnsafe(28);return r.writeInt32BE(this._a,0),r.writeInt32BE(this._b,4),r.writeInt32BE(this._c,8),r.writeInt32BE(this._d,12),r.writeInt32BE(this._e,16),r.writeInt32BE(this._f,20),r.writeInt32BE(this._g,24),r};var HI=hd,VI=br,f_=Pf,ZI=sr.Buffer,qb=[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],WI=new Array(160);function Rh(){this.init(),this._w=WI,f_.call(this,128,112)}VI(Rh,f_);Rh.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 Fb(r,t,e){return e^r&(t^e)}function jb(r,t,e){return r&t|e&(r|t)}function $b(r,t){return(r>>>28|t<<4)^(t>>>2|r<<30)^(t>>>7|r<<25)}function Kb(r,t){return(r>>>14|t<<18)^(r>>>18|t<<14)^(t>>>9|r<<23)}function GI(r,t){return(r>>>1|t<<31)^(r>>>8|t<<24)^r>>>7}function YI(r,t){return(r>>>1|t<<31)^(r>>>8|t<<24)^(r>>>7|t<<25)}function XI(r,t){return(r>>>19|t<<13)^(t>>>29|r<<3)^r>>>6}function JI(r,t){return(r>>>19|t<<13)^(t>>>29|r<<3)^(r>>>6|t<<26)}function gn(r,t){return r>>>0>>0?1:0}Rh.prototype._update=function(r){for(var t=this._w,e=this._ah|0,n=this._bh|0,s=this._ch|0,i=this._dh|0,c=this._eh|0,l=this._fh|0,p=this._gh|0,v=this._hh|0,y=this._al|0,E=this._bl|0,M=this._cl|0,w=this._dl|0,_=this._el|0,k=this._fl|0,B=this._gl|0,P=this._hl|0,R=0;R<32;R+=2)t[R]=r.readInt32BE(R*4),t[R+1]=r.readInt32BE(R*4+4);for(;R<160;R+=2){var T=t[R-30],U=t[R-15*2+1],j=GI(T,U),Y=YI(U,T);T=t[R-2*2],U=t[R-2*2+1];var rt=XI(T,U),nt=JI(U,T),Z=t[R-7*2],x=t[R-7*2+1],d=t[R-16*2],o=t[R-16*2+1],a=Y+x|0,f=j+Z+gn(a,Y)|0;a=a+nt|0,f=f+rt+gn(a,nt)|0,a=a+o|0,f=f+d+gn(a,o)|0,t[R]=f,t[R+1]=a}for(var h=0;h<160;h+=2){f=t[h],a=t[h+1];var g=jb(e,n,s),A=jb(y,E,M),I=$b(e,y),b=$b(y,e),u=Kb(c,_),m=Kb(_,c),L=qb[h],q=qb[h+1],z=Fb(c,l,p),W=Fb(_,k,B),ot=P+m|0,ut=v+u+gn(ot,P)|0;ot=ot+W|0,ut=ut+z+gn(ot,W)|0,ot=ot+q|0,ut=ut+L+gn(ot,q)|0,ot=ot+a|0,ut=ut+f+gn(ot,a)|0;var Ct=b+A|0,yt=I+g+gn(Ct,b)|0;v=p,P=B,p=l,B=k,l=c,k=_,_=w+ot|0,c=i+ut+gn(_,w)|0,i=s,w=M,s=n,M=E,n=e,E=y,y=ot+Ct|0,e=ut+yt+gn(y,ot)|0}this._al=this._al+y|0,this._bl=this._bl+E|0,this._cl=this._cl+M|0,this._dl=this._dl+w|0,this._el=this._el+_|0,this._fl=this._fl+k|0,this._gl=this._gl+B|0,this._hl=this._hl+P|0,this._ah=this._ah+e+gn(this._al,y)|0,this._bh=this._bh+n+gn(this._bl,E)|0,this._ch=this._ch+s+gn(this._cl,M)|0,this._dh=this._dh+i+gn(this._dl,w)|0,this._eh=this._eh+c+gn(this._el,_)|0,this._fh=this._fh+l+gn(this._fl,k)|0,this._gh=this._gh+p+gn(this._gl,B)|0,this._hh=this._hh+v+gn(this._hl,P)|0};Rh.prototype._hash=function(){var r=ZI.allocUnsafe(64);function t(e,n,s){r.writeInt32BE(e,s),r.writeInt32BE(n,s+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),r};var c_=Rh,QI=br,tB=c_,eB=Pf,rB=sr.Buffer,nB=new Array(160);function ld(){this.init(),this._w=nB,eB.call(this,128,112)}QI(ld,tB);ld.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};ld.prototype._hash=function(){var r=rB.allocUnsafe(48);function t(e,n,s){r.writeInt32BE(e,s),r.writeInt32BE(n,s+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),r};var iB=ld,pu=n_.exports=function(t){t=t.toLowerCase();var e=pu[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};pu.sha=wI;pu.sha1=BI;pu.sha224=HI;pu.sha256=u_;pu.sha384=iB;pu.sha512=c_;var gg=n_.exports,h_=sr.Buffer,l_=eI.Transform,oB=rI().StringDecoder,sB=br;function bo(r){l_.call(this),this.hashMode=typeof r=="string",this.hashMode?this[r]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}sB(bo,l_);bo.prototype.update=function(r,t,e){typeof r=="string"&&(r=h_.from(r,t));var n=this._update(r);return this.hashMode?this:(e&&(n=this._toString(n,e)),n)};bo.prototype.setAutoPadding=function(){};bo.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")};bo.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")};bo.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")};bo.prototype._transform=function(r,t,e){var n;try{this.hashMode?this._update(r):this.push(this._update(r))}catch(s){n=s}finally{e(n)}};bo.prototype._flush=function(r){var t;try{this.push(this.__final())}catch(e){t=e}r(t)};bo.prototype._finalOrDigest=function(r){var t=this.__final()||h_.alloc(0);return r&&(t=this._toString(t,r,!0)),t};bo.prototype._toString=function(r,t,e){if(this._decoder||(this._decoder=new oB(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(r);return e&&(n+=this._decoder.end()),n};var la=bo,aB=br,uB=mg,fB=vg,cB=gg,d_=la;function dd(r){d_.call(this,"digest"),this._hash=r}aB(dd,d_);dd.prototype._update=function(r){this._hash.update(r)};dd.prototype._final=function(){return this._hash.digest()};var Ch=function(t){return t=t.toLowerCase(),t==="md5"?new uB:t==="rmd160"||t==="ripemd160"?new fB:new dd(cB(t))};const yg=W7(G7);var Je={},b1,Hb;function hB(){if(Hb)return b1;Hb=1;var r=br,t=sr.Buffer,e=la,n=t.alloc(128),s=64;function i(c,l){e.call(this,"digest"),typeof l=="string"&&(l=t.from(l)),this._alg=c,this._key=l,l.length>s?l=c(l):l.lengthE){var M=v==="rmd160"?new i:c(v);y=M.update(y).digest()}else y.lengthr||e!==e)throw new TypeError("Bad key length")},M1}var E1,Yb;function y_(){if(Yb)return E1;Yb=1;var r;if(Re.process&&Re.process.browser)r="utf-8";else if(Re.process&&Re.process.version){var t=parseInt(Gt.process.version.split(".")[0].slice(1),10);r=t>=6?"utf-8":"binary"}else r="utf-8";return E1=r,E1}var A1,Xb;function b_(){if(Xb)return A1;Xb=1;var r=sr.Buffer;return A1=function(t,e,n){if(r.isBuffer(t))return t;if(typeof t=="string")return r.from(t,e);if(ArrayBuffer.isView(t))return r.from(t.buffer);throw new TypeError(n+" must be a string, a Buffer, a typed array or a DataView")},A1}var S1,Jb;function w_(){if(Jb)return S1;Jb=1;var r=p_(),t=vg,e=gg,n=sr.Buffer,s=g_(),i=y_(),c=b_(),l=n.alloc(128),p={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function v(M,w,_){var k=y(M),B=M==="sha512"||M==="sha384"?128:64;w.length>B?w=k(w):w.length>>0},yi.writeUInt32BE=function(s,i,c){s[0+c]=i>>>24,s[1+c]=i>>>16&255,s[2+c]=i>>>8&255,s[3+c]=i&255},yi.ip=function(s,i,c,l){for(var p=0,v=0,y=6;y>=0;y-=2){for(var E=0;E<=24;E+=8)p<<=1,p|=i>>>E+y&1;for(var E=0;E<=24;E+=8)p<<=1,p|=s>>>E+y&1}for(var y=6;y>=0;y-=2){for(var E=1;E<=25;E+=8)v<<=1,v|=i>>>E+y&1;for(var E=1;E<=25;E+=8)v<<=1,v|=s>>>E+y&1}c[l+0]=p>>>0,c[l+1]=v>>>0},yi.rip=function(s,i,c,l){for(var p=0,v=0,y=0;y<4;y++)for(var E=24;E>=0;E-=8)p<<=1,p|=i>>>E+y&1,p<<=1,p|=s>>>E+y&1;for(var y=4;y<8;y++)for(var E=24;E>=0;E-=8)v<<=1,v|=i>>>E+y&1,v<<=1,v|=s>>>E+y&1;c[l+0]=p>>>0,c[l+1]=v>>>0},yi.pc1=function(s,i,c,l){for(var p=0,v=0,y=7;y>=5;y--){for(var E=0;E<=24;E+=8)p<<=1,p|=i>>E+y&1;for(var E=0;E<=24;E+=8)p<<=1,p|=s>>E+y&1}for(var E=0;E<=24;E+=8)p<<=1,p|=i>>E+y&1;for(var y=1;y<=3;y++){for(var E=0;E<=24;E+=8)v<<=1,v|=i>>E+y&1;for(var E=0;E<=24;E+=8)v<<=1,v|=s>>E+y&1}for(var E=0;E<=24;E+=8)v<<=1,v|=s>>E+y&1;c[l+0]=p>>>0,c[l+1]=v>>>0},yi.r28shl=function(s,i){return s<>>28-i};var r=[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];yi.pc2=function(s,i,c,l){for(var p=0,v=0,y=r.length>>>1,E=0;E>>r[E]&1;for(var E=y;E>>r[E]&1;c[l+0]=p>>>0,c[l+1]=v>>>0},yi.expand=function(s,i,c){var l=0,p=0;l=(s&1)<<5|s>>>27;for(var v=23;v>=15;v-=4)l<<=6,l|=s>>>v&63;for(var v=11;v>=3;v-=4)p|=s>>>v&63,p<<=6;p|=(s&31)<<1|s>>>31,i[c+0]=l>>>0,i[c+1]=p>>>0};var t=[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];yi.substitute=function(s,i){for(var c=0,l=0;l<4;l++){var p=s>>>18-l*6&63,v=t[l*64+p];c<<=4,c|=v}for(var l=0;l<4;l++){var p=i>>>18-l*6&63,v=t[4*64+l*64+p];c<<=4,c|=v}return c>>>0};var e=[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];return yi.permute=function(s){for(var i=0,c=0;c>>e[c]&1;return i>>>0},yi.padSplit=function(s,i,c){for(var l=s.toString(2);l.length0;c--)s+=this._buffer(n,s),i+=this._flushBuffer(l,i);return s+=this._buffer(n,s),l},t.prototype.final=function(n){var s;n&&(s=this.update(n));var i;return this.type==="encrypt"?i=this._finalEncrypt():i=this._finalDecrypt(),s?s.concat(i):i},t.prototype._pad=function(n,s){if(s===0)return!1;for(;s>>1];y=e.r28shl(y,w),E=e.r28shl(E,w),e.pc2(y,E,p.keys,M)}},i.prototype._update=function(p,v,y,E){var M=this._desState,w=e.readUInt32BE(p,v),_=e.readUInt32BE(p,v+4);e.ip(w,_,M.tmp,0),w=M.tmp[0],_=M.tmp[1],this.type==="encrypt"?this._encrypt(M,w,_,M.tmp,0):this._decrypt(M,w,_,M.tmp,0),w=M.tmp[0],_=M.tmp[1],e.writeUInt32BE(y,w,E),e.writeUInt32BE(y,_,E+4)},i.prototype._pad=function(p,v){if(this.padding===!1)return!1;for(var y=p.length-v,E=v;E>>0,w=U}e.rip(_,w,E,M)},i.prototype._decrypt=function(p,v,y,E,M){for(var w=y,_=v,k=p.keys.length-2;k>=0;k-=2){var B=p.keys[k],P=p.keys[k+1];e.expand(w,p.tmp,0),B^=p.tmp[0],P^=p.tmp[1];var R=e.substitute(B,P),T=e.permute(R),U=w;w=(_^T)>>>0,_=U}e.rip(w,_,E,M)},B1}var P1={},iw;function AB(){if(iw)return P1;iw=1;var r=Ji,t=br,e={};function n(i){r.equal(i.length,8,"Invalid IV length"),this.iv=new Array(8);for(var c=0;c>l%8,n._prev=e(n._prev,i?y:E);return v}function e(n,s){var i=n.length,c=-1,l=r.allocUnsafe(n.length);for(n=r.concat([n,r.from([s])]);++c>7;return l}return U1.encrypt=function(n,s,i){for(var c=s.length,l=r.allocUnsafe(c),p=-1;++p>>24]^w[P>>>16&255]^_[R>>>8&255]^k[T&255]^p[nt++],j=M[P>>>24]^w[R>>>16&255]^_[T>>>8&255]^k[B&255]^p[nt++],Y=M[R>>>24]^w[T>>>16&255]^_[B>>>8&255]^k[P&255]^p[nt++],rt=M[T>>>24]^w[B>>>16&255]^_[P>>>8&255]^k[R&255]^p[nt++],B=U,P=j,R=Y,T=rt;return U=(y[B>>>24]<<24|y[P>>>16&255]<<16|y[R>>>8&255]<<8|y[T&255])^p[nt++],j=(y[P>>>24]<<24|y[R>>>16&255]<<16|y[T>>>8&255]<<8|y[B&255])^p[nt++],Y=(y[R>>>24]<<24|y[T>>>16&255]<<16|y[B>>>8&255]<<8|y[P&255])^p[nt++],rt=(y[T>>>24]<<24|y[B>>>16&255]<<16|y[P>>>8&255]<<8|y[R&255])^p[nt++],U=U>>>0,j=j>>>0,Y=Y>>>0,rt=rt>>>0,[U,j,Y,rt]}var s=[0,1,2,4,8,16,32,64,128,27,54],i=function(){for(var l=new Array(256),p=0;p<256;p++)p<128?l[p]=p<<1:l[p]=p<<1^283;for(var v=[],y=[],E=[[],[],[],[]],M=[[],[],[],[]],w=0,_=0,k=0;k<256;++k){var B=_^_<<1^_<<2^_<<3^_<<4;B=B>>>8^B&255^99,v[w]=B,y[B]=w;var P=l[w],R=l[P],T=l[R],U=l[B]*257^B*16843008;E[0][w]=U<<24|U>>>8,E[1][w]=U<<16|U>>>16,E[2][w]=U<<8|U>>>24,E[3][w]=U,U=T*16843009^R*65537^P*257^w*16843008,M[0][B]=U<<24|U>>>8,M[1][B]=U<<16|U>>>16,M[2][B]=U<<8|U>>>24,M[3][B]=U,w===0?w=_=1:(w=P^l[l[l[T^P]]],_^=l[l[_]])}return{SBOX:v,INV_SBOX:y,SUB_MIX:E,INV_SUB_MIX:M}}();function c(l){this._key=t(l),this._reset()}return c.blockSize=4*4,c.keySize=256/8,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var l=this._key,p=l.length,v=p+6,y=(v+1)*4,E=[],M=0;M>>24,w=i.SBOX[w>>>24]<<24|i.SBOX[w>>>16&255]<<16|i.SBOX[w>>>8&255]<<8|i.SBOX[w&255],w^=s[M/p|0]<<24):p>6&&M%p===4&&(w=i.SBOX[w>>>24]<<24|i.SBOX[w>>>16&255]<<16|i.SBOX[w>>>8&255]<<8|i.SBOX[w&255]),E[M]=E[M-p]^w}for(var _=[],k=0;k>>24]]^i.INV_SUB_MIX[1][i.SBOX[P>>>16&255]]^i.INV_SUB_MIX[2][i.SBOX[P>>>8&255]]^i.INV_SUB_MIX[3][i.SBOX[P&255]]}this._nRounds=v,this._keySchedule=E,this._invKeySchedule=_},c.prototype.encryptBlockRaw=function(l){return l=t(l),n(l,this._keySchedule,i.SUB_MIX,i.SBOX,this._nRounds)},c.prototype.encryptBlock=function(l){var p=this.encryptBlockRaw(l),v=r.allocUnsafe(16);return v.writeUInt32BE(p[0],0),v.writeUInt32BE(p[1],4),v.writeUInt32BE(p[2],8),v.writeUInt32BE(p[3],12),v},c.prototype.decryptBlock=function(l){l=t(l);var p=l[1];l[1]=l[3],l[3]=p;var v=n(l,this._invKeySchedule,i.INV_SUB_MIX,i.INV_SBOX,this._nRounds),y=r.allocUnsafe(16);return y.writeUInt32BE(v[0],0),y.writeUInt32BE(v[3],4),y.writeUInt32BE(v[2],8),y.writeUInt32BE(v[1],12),y},c.prototype.scrub=function(){e(this._keySchedule),e(this._invKeySchedule),e(this._key)},F1.AES=c,F1}var j1,ww;function DB(){if(ww)return j1;ww=1;var r=sr.Buffer,t=r.alloc(16,0);function e(i){return[i.readUInt32BE(0),i.readUInt32BE(4),i.readUInt32BE(8),i.readUInt32BE(12)]}function n(i){var c=r.allocUnsafe(16);return c.writeUInt32BE(i[0]>>>0,0),c.writeUInt32BE(i[1]>>>0,4),c.writeUInt32BE(i[2]>>>0,8),c.writeUInt32BE(i[3]>>>0,12),c}function s(i){this.h=i,this.state=r.alloc(16,0),this.cache=r.allocUnsafe(0)}return s.prototype.ghash=function(i){for(var c=-1;++c0;l--)i[l]=i[l]>>>1|(i[l-1]&1)<<31;i[0]=i[0]>>>1,v&&(i[0]=i[0]^225<<24)}this.state=n(c)},s.prototype.update=function(i){this.cache=r.concat([this.cache,i]);for(var c;this.cache.length>=16;)c=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(c)},s.prototype.final=function(i,c){return this.cache.length&&this.ghash(r.concat([this.cache,t],16)),this.ghash(n([0,i,0,c])),this.state},j1=s,j1}var $1,xw;function k_(){if(xw)return $1;xw=1;var r=pd(),t=sr.Buffer,e=la,n=br,s=DB(),i=Th(),c=A_();function l(y,E){var M=0;y.length!==E.length&&M++;for(var w=Math.min(y.length,E.length),_=0;_0||c>0;){var E=new t;E.update(y),E.update(n),s&&E.update(s),y=E.digest();var M=0;if(l>0){var w=p.length-l;M=Math.min(l,y.length),y.copy(p,w,0,M),l-=M}if(M0){var _=v.length-c,k=Math.min(c,y.length-M);y.copy(v,_,M,M+k),c-=k}}return y.fill(0),{key:p,iv:v}}return H1=e,H1}var Ew;function zB(){if(Ew)return s0;Ew=1;var r=wg(),t=k_(),e=sr.Buffer,n=I_(),s=la,i=pd(),c=md(),l=br;function p(w,_,k){s.call(this),this._cache=new y,this._cipher=new i.AES(_),this._prev=e.from(k),this._mode=w,this._autopadding=!0}l(p,s),p.prototype._update=function(w){this._cache.add(w);for(var _,k,B=[];_=this._cache.get();)k=this._mode.encrypt(this,_),B.push(k);return e.concat(B)};var v=e.alloc(16,16);p.prototype._final=function(){var w=this._cache.flush();if(this._autopadding)return w=this._mode.encrypt(this,w),this._cipher.scrub(),w;if(!w.equals(v))throw this._cipher.scrub(),new Error("data not multiple of block length")},p.prototype.setAutoPadding=function(w){return this._autopadding=!!w,this};function y(){this.cache=e.allocUnsafe(0)}y.prototype.add=function(w){this.cache=e.concat([this.cache,w])},y.prototype.get=function(){if(this.cache.length>15){var w=this.cache.slice(0,16);return this.cache=this.cache.slice(16),w}return null},y.prototype.flush=function(){for(var w=16-this.cache.length,_=e.allocUnsafe(w),k=-1;++k16)return _=this.cache.slice(0,16),this.cache=this.cache.slice(16),_}else if(this.cache.length>=16)return _=this.cache.slice(0,16),this.cache=this.cache.slice(16),_;return null},v.prototype.flush=function(){if(this.cache.length)return this.cache};function y(w){var _=w[15];if(_<1||_>16)throw new Error("unable to decrypt data");for(var k=-1;++k<_;)if(w[k+(16-_)]!==_)throw new Error("unable to decrypt data");if(_!==16)return w.slice(0,16-_)}function E(w,_,k){var B=e[w.toLowerCase()];if(!B)throw new TypeError("invalid suite type");if(typeof k=="string"&&(k=t.from(k)),B.mode!=="GCM"&&k.length!==B.iv)throw new TypeError("invalid iv length "+k.length);if(typeof _=="string"&&(_=t.from(_)),_.length!==B.key/8)throw new TypeError("invalid key length "+_.length);return B.type==="stream"?new n(B.module,_,k,!0):B.type==="auth"?new r(B.module,_,k,!0):new p(B.module,_,k)}function M(w,_){var k=e[w.toLowerCase()];if(!k)throw new TypeError("invalid suite type");var B=c(_,!1,k.key,k.iv);return E(w,B.key,B.iv)}return f0.createDecipher=M,f0.createDecipheriv=E,f0}var Sw;function xg(){if(Sw)return Ti;Sw=1;var r=zB(),t=qB(),e=S_;function n(){return Object.keys(e)}return Ti.createCipher=Ti.Cipher=r.createCipher,Ti.createCipheriv=Ti.Cipheriv=r.createCipheriv,Ti.createDecipher=Ti.Decipher=t.createDecipher,Ti.createDecipheriv=Ti.Decipheriv=t.createDecipheriv,Ti.listCiphers=Ti.getCiphers=n,Ti}var V1={},kw;function FB(){return kw||(kw=1,function(r){r["des-ecb"]={key:8,iv:0},r["des-cbc"]=r.des={key:8,iv:8},r["des-ede3-cbc"]=r.des3={key:24,iv:8},r["des-ede3"]={key:24,iv:0},r["des-ede-cbc"]={key:16,iv:8},r["des-ede"]={key:16,iv:0}}(V1)),V1}var Iw;function jB(){if(Iw)return Ci;Iw=1;var r=IB(),t=xg(),e=wg(),n=FB(),s=md();function i(y,E){y=y.toLowerCase();var M,w;if(e[y])M=e[y].key,w=e[y].iv;else if(n[y])M=n[y].key*8,w=n[y].iv;else throw new TypeError("invalid suite type");var _=s(E,!1,M,w);return l(y,_.key,_.iv)}function c(y,E){y=y.toLowerCase();var M,w;if(e[y])M=e[y].key,w=e[y].iv;else if(n[y])M=n[y].key*8,w=n[y].iv;else throw new TypeError("invalid suite type");var _=s(E,!1,M,w);return p(y,_.key,_.iv)}function l(y,E,M){if(y=y.toLowerCase(),e[y])return t.createCipheriv(y,E,M);if(n[y])return new r({key:E,iv:M,mode:y});throw new TypeError("invalid suite type")}function p(y,E,M){if(y=y.toLowerCase(),e[y])return t.createDecipheriv(y,E,M);if(n[y])return new r({key:E,iv:M,mode:y,decrypt:!0});throw new TypeError("invalid suite type")}function v(){return Object.keys(n).concat(t.getCiphers())}return Ci.createCipher=Ci.Cipher=i,Ci.createCipheriv=Ci.Cipheriv=l,Ci.createDecipher=Ci.Decipher=c,Ci.createDecipheriv=Ci.Decipheriv=p,Ci.listCiphers=Ci.getCiphers=v,Ci}var ba={},X0={exports:{}};X0.exports;var Bw;function B_(){return Bw||(Bw=1,function(r){(function(t,e){function n(d,o){if(!d)throw new Error(o||"Assertion failed")}function s(d,o){d.super_=o;var a=function(){};a.prototype=o.prototype,d.prototype=new a,d.prototype.constructor=d}function i(d,o,a){if(i.isBN(d))return d;this.negative=0,this.words=null,this.length=0,this.red=null,d!==null&&((o==="le"||o==="be")&&(a=o,o=10),this._init(d||0,o||10,a||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=yr.Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,a){return o.cmp(a)>0?o:a},i.min=function(o,a){return o.cmp(a)<0?o:a},i.prototype._init=function(o,a,f){if(typeof o=="number")return this._initNumber(o,a,f);if(typeof o=="object")return this._initArray(o,a,f);a==="hex"&&(a=16),n(a===(a|0)&&a>=2&&a<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h=0;h-=3)A=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[g]|=A<>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);else if(f==="le")for(h=0,g=0;h>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);return this.strip()};function l(d,o){var a=d.charCodeAt(o);return a>=65&&a<=70?a-55:a>=97&&a<=102?a-87:a-48&15}function p(d,o,a){var f=l(d,a);return a-1>=o&&(f|=l(d,a-1)<<4),f}i.prototype._parseHex=function(o,a,f){this.length=Math.ceil((o.length-a)/6),this.words=new Array(this.length);for(var h=0;h=a;h-=2)I=p(o,a,h)<=18?(g-=18,A+=1,this.words[A]|=I>>>26):g+=8;else{var b=o.length-a;for(h=b%2===0?a+1:a;h=18?(g-=18,A+=1,this.words[A]|=I>>>26):g+=8}this.strip()};function v(d,o,a,f){for(var h=0,g=Math.min(d.length,a),A=o;A=49?h+=I-49+10:I>=17?h+=I-17+10:h+=I}return h}i.prototype._parseBase=function(o,a,f){this.words=[0],this.length=1;for(var h=0,g=1;g<=67108863;g*=a)h++;h--,g=g/a|0;for(var A=o.length-f,I=A%h,b=Math.min(A,A-I)+f,u=0,m=f;m1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var y=["","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"],E=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(o,a){o=o||10,a=a|0||1;var f;if(o===16||o==="hex"){f="";for(var h=0,g=0,A=0;A>>24-h&16777215,g!==0||A!==this.length-1?f=y[6-b.length]+b+f:f=b+f,h+=2,h>=26&&(h-=26,A--)}for(g!==0&&(f=g.toString(16)+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var u=E[o],m=M[o];f="";var L=this.clone();for(L.negative=0;!L.isZero();){var q=L.modn(m).toString(o);L=L.idivn(m),L.isZero()?f=q+f:f=y[u-q.length]+q+f}for(this.isZero()&&(f="0"+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,a){return n(typeof c<"u"),this.toArrayLike(c,o,a)},i.prototype.toArray=function(o,a){return this.toArrayLike(Array,o,a)},i.prototype.toArrayLike=function(o,a,f){var h=this.byteLength(),g=f||Math.max(1,h);n(h<=g,"byte array longer than desired length"),n(g>0,"Requested array length <= 0"),this.strip();var A=a==="le",I=new o(g),b,u,m=this.clone();if(A){for(u=0;!m.isZero();u++)b=m.andln(255),m.iushrn(8),I[u]=b;for(;u=4096&&(f+=13,a>>>=13),a>=64&&(f+=7,a>>>=7),a>=8&&(f+=4,a>>>=4),a>=2&&(f+=2,a>>>=2),f+a},i.prototype._zeroBits=function(o){if(o===0)return 26;var a=o,f=0;return a&8191||(f+=13,a>>>=13),a&127||(f+=7,a>>>=7),a&15||(f+=4,a>>>=4),a&3||(f+=2,a>>>=2),a&1||f++,f},i.prototype.bitLength=function(){var o=this.words[this.length-1],a=this._countBits(o);return(this.length-1)*26+a};function w(d){for(var o=new Array(d.bitLength()),a=0;a>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,a=0;ao.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var a;this.length>o.length?a=o:a=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var a,f;this.length>o.length?(a=this,f=o):(a=o,f=this);for(var h=0;ho.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var a=Math.ceil(o/26)|0,f=o%26;this._expand(a),f>0&&a--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-f),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,a){n(typeof o=="number"&&o>=0);var f=o/26|0,h=o%26;return this._expand(f+1),a?this.words[f]=this.words[f]|1<o.length?(f=this,h=o):(f=o,h=this);for(var g=0,A=0;A>>26;for(;g!==0&&A>>26;if(this.length=f.length,g!==0)this.words[this.length]=g,this.length++;else if(f!==this)for(;Ao.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var a=this.iadd(o);return o.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,g;f>0?(h=this,g=o):(h=o,g=this);for(var A=0,I=0;I>26,this.words[I]=a&67108863;for(;A!==0&&I>26,this.words[I]=a&67108863;if(A===0&&I>>26,L=b&67108863,q=Math.min(u,o.length-1),z=Math.max(0,u-d.length+1);z<=q;z++){var W=u-z|0;h=d.words[W]|0,g=o.words[z]|0,A=h*g+L,m+=A/67108864|0,L=A&67108863}a.words[u]=L|0,b=m|0}return b!==0?a.words[u]=b|0:a.length--,a.strip()}var k=function(o,a,f){var h=o.words,g=a.words,A=f.words,I=0,b,u,m,L=h[0]|0,q=L&8191,z=L>>>13,W=h[1]|0,ot=W&8191,ut=W>>>13,Ct=h[2]|0,yt=Ct&8191,mt=Ct>>>13,jt=h[3]|0,dt=jt&8191,ct=jt>>>13,Tt=h[4]|0,kt=Tt&8191,S=Tt>>>13,C=h[5]|0,O=C&8191,F=C>>>13,et=h[6]|0,Q=et&8191,it=et>>>13,qt=h[7]|0,It=qt&8191,xt=qt>>>13,Qt=h[8]|0,Rt=Qt&8191,Dt=Qt>>>13,Se=h[9]|0,te=Se&8191,Ut=Se>>>13,Te=g[0]|0,J=Te&8191,X=Te>>>13,st=g[1]|0,D=st&8191,K=st>>>13,gt=g[2]|0,ft=gt&8191,pt=gt>>>13,vt=g[3]|0,At=vt&8191,_t=vt>>>13,Wt=g[4]|0,Pt=Wt&8191,wt=Wt>>>13,se=g[5]|0,Lt=se&8191,Et=se>>>13,de=g[6]|0,Bt=de&8191,Mt=de>>>13,$=g[7]|0,G=$&8191,H=$>>>13,N=g[8]|0,V=N&8191,tt=N>>>13,lt=g[9]|0,at=lt&8191,ht=lt>>>13;f.negative=o.negative^a.negative,f.length=19,b=Math.imul(q,J),u=Math.imul(q,X),u=u+Math.imul(z,J)|0,m=Math.imul(z,X);var zt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(zt>>>26)|0,zt&=67108863,b=Math.imul(ot,J),u=Math.imul(ot,X),u=u+Math.imul(ut,J)|0,m=Math.imul(ut,X),b=b+Math.imul(q,D)|0,u=u+Math.imul(q,K)|0,u=u+Math.imul(z,D)|0,m=m+Math.imul(z,K)|0;var Zt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,b=Math.imul(yt,J),u=Math.imul(yt,X),u=u+Math.imul(mt,J)|0,m=Math.imul(mt,X),b=b+Math.imul(ot,D)|0,u=u+Math.imul(ot,K)|0,u=u+Math.imul(ut,D)|0,m=m+Math.imul(ut,K)|0,b=b+Math.imul(q,ft)|0,u=u+Math.imul(q,pt)|0,u=u+Math.imul(z,ft)|0,m=m+Math.imul(z,pt)|0;var ye=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ye>>>26)|0,ye&=67108863,b=Math.imul(dt,J),u=Math.imul(dt,X),u=u+Math.imul(ct,J)|0,m=Math.imul(ct,X),b=b+Math.imul(yt,D)|0,u=u+Math.imul(yt,K)|0,u=u+Math.imul(mt,D)|0,m=m+Math.imul(mt,K)|0,b=b+Math.imul(ot,ft)|0,u=u+Math.imul(ot,pt)|0,u=u+Math.imul(ut,ft)|0,m=m+Math.imul(ut,pt)|0,b=b+Math.imul(q,At)|0,u=u+Math.imul(q,_t)|0,u=u+Math.imul(z,At)|0,m=m+Math.imul(z,_t)|0;var Yt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,b=Math.imul(kt,J),u=Math.imul(kt,X),u=u+Math.imul(S,J)|0,m=Math.imul(S,X),b=b+Math.imul(dt,D)|0,u=u+Math.imul(dt,K)|0,u=u+Math.imul(ct,D)|0,m=m+Math.imul(ct,K)|0,b=b+Math.imul(yt,ft)|0,u=u+Math.imul(yt,pt)|0,u=u+Math.imul(mt,ft)|0,m=m+Math.imul(mt,pt)|0,b=b+Math.imul(ot,At)|0,u=u+Math.imul(ot,_t)|0,u=u+Math.imul(ut,At)|0,m=m+Math.imul(ut,_t)|0,b=b+Math.imul(q,Pt)|0,u=u+Math.imul(q,wt)|0,u=u+Math.imul(z,Pt)|0,m=m+Math.imul(z,wt)|0;var pe=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(pe>>>26)|0,pe&=67108863,b=Math.imul(O,J),u=Math.imul(O,X),u=u+Math.imul(F,J)|0,m=Math.imul(F,X),b=b+Math.imul(kt,D)|0,u=u+Math.imul(kt,K)|0,u=u+Math.imul(S,D)|0,m=m+Math.imul(S,K)|0,b=b+Math.imul(dt,ft)|0,u=u+Math.imul(dt,pt)|0,u=u+Math.imul(ct,ft)|0,m=m+Math.imul(ct,pt)|0,b=b+Math.imul(yt,At)|0,u=u+Math.imul(yt,_t)|0,u=u+Math.imul(mt,At)|0,m=m+Math.imul(mt,_t)|0,b=b+Math.imul(ot,Pt)|0,u=u+Math.imul(ot,wt)|0,u=u+Math.imul(ut,Pt)|0,m=m+Math.imul(ut,wt)|0,b=b+Math.imul(q,Lt)|0,u=u+Math.imul(q,Et)|0,u=u+Math.imul(z,Lt)|0,m=m+Math.imul(z,Et)|0;var ve=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ve>>>26)|0,ve&=67108863,b=Math.imul(Q,J),u=Math.imul(Q,X),u=u+Math.imul(it,J)|0,m=Math.imul(it,X),b=b+Math.imul(O,D)|0,u=u+Math.imul(O,K)|0,u=u+Math.imul(F,D)|0,m=m+Math.imul(F,K)|0,b=b+Math.imul(kt,ft)|0,u=u+Math.imul(kt,pt)|0,u=u+Math.imul(S,ft)|0,m=m+Math.imul(S,pt)|0,b=b+Math.imul(dt,At)|0,u=u+Math.imul(dt,_t)|0,u=u+Math.imul(ct,At)|0,m=m+Math.imul(ct,_t)|0,b=b+Math.imul(yt,Pt)|0,u=u+Math.imul(yt,wt)|0,u=u+Math.imul(mt,Pt)|0,m=m+Math.imul(mt,wt)|0,b=b+Math.imul(ot,Lt)|0,u=u+Math.imul(ot,Et)|0,u=u+Math.imul(ut,Lt)|0,m=m+Math.imul(ut,Et)|0,b=b+Math.imul(q,Bt)|0,u=u+Math.imul(q,Mt)|0,u=u+Math.imul(z,Bt)|0,m=m+Math.imul(z,Mt)|0;var ge=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ge>>>26)|0,ge&=67108863,b=Math.imul(It,J),u=Math.imul(It,X),u=u+Math.imul(xt,J)|0,m=Math.imul(xt,X),b=b+Math.imul(Q,D)|0,u=u+Math.imul(Q,K)|0,u=u+Math.imul(it,D)|0,m=m+Math.imul(it,K)|0,b=b+Math.imul(O,ft)|0,u=u+Math.imul(O,pt)|0,u=u+Math.imul(F,ft)|0,m=m+Math.imul(F,pt)|0,b=b+Math.imul(kt,At)|0,u=u+Math.imul(kt,_t)|0,u=u+Math.imul(S,At)|0,m=m+Math.imul(S,_t)|0,b=b+Math.imul(dt,Pt)|0,u=u+Math.imul(dt,wt)|0,u=u+Math.imul(ct,Pt)|0,m=m+Math.imul(ct,wt)|0,b=b+Math.imul(yt,Lt)|0,u=u+Math.imul(yt,Et)|0,u=u+Math.imul(mt,Lt)|0,m=m+Math.imul(mt,Et)|0,b=b+Math.imul(ot,Bt)|0,u=u+Math.imul(ot,Mt)|0,u=u+Math.imul(ut,Bt)|0,m=m+Math.imul(ut,Mt)|0,b=b+Math.imul(q,G)|0,u=u+Math.imul(q,H)|0,u=u+Math.imul(z,G)|0,m=m+Math.imul(z,H)|0;var ie=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ie>>>26)|0,ie&=67108863,b=Math.imul(Rt,J),u=Math.imul(Rt,X),u=u+Math.imul(Dt,J)|0,m=Math.imul(Dt,X),b=b+Math.imul(It,D)|0,u=u+Math.imul(It,K)|0,u=u+Math.imul(xt,D)|0,m=m+Math.imul(xt,K)|0,b=b+Math.imul(Q,ft)|0,u=u+Math.imul(Q,pt)|0,u=u+Math.imul(it,ft)|0,m=m+Math.imul(it,pt)|0,b=b+Math.imul(O,At)|0,u=u+Math.imul(O,_t)|0,u=u+Math.imul(F,At)|0,m=m+Math.imul(F,_t)|0,b=b+Math.imul(kt,Pt)|0,u=u+Math.imul(kt,wt)|0,u=u+Math.imul(S,Pt)|0,m=m+Math.imul(S,wt)|0,b=b+Math.imul(dt,Lt)|0,u=u+Math.imul(dt,Et)|0,u=u+Math.imul(ct,Lt)|0,m=m+Math.imul(ct,Et)|0,b=b+Math.imul(yt,Bt)|0,u=u+Math.imul(yt,Mt)|0,u=u+Math.imul(mt,Bt)|0,m=m+Math.imul(mt,Mt)|0,b=b+Math.imul(ot,G)|0,u=u+Math.imul(ot,H)|0,u=u+Math.imul(ut,G)|0,m=m+Math.imul(ut,H)|0,b=b+Math.imul(q,V)|0,u=u+Math.imul(q,tt)|0,u=u+Math.imul(z,V)|0,m=m+Math.imul(z,tt)|0;var ue=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ue>>>26)|0,ue&=67108863,b=Math.imul(te,J),u=Math.imul(te,X),u=u+Math.imul(Ut,J)|0,m=Math.imul(Ut,X),b=b+Math.imul(Rt,D)|0,u=u+Math.imul(Rt,K)|0,u=u+Math.imul(Dt,D)|0,m=m+Math.imul(Dt,K)|0,b=b+Math.imul(It,ft)|0,u=u+Math.imul(It,pt)|0,u=u+Math.imul(xt,ft)|0,m=m+Math.imul(xt,pt)|0,b=b+Math.imul(Q,At)|0,u=u+Math.imul(Q,_t)|0,u=u+Math.imul(it,At)|0,m=m+Math.imul(it,_t)|0,b=b+Math.imul(O,Pt)|0,u=u+Math.imul(O,wt)|0,u=u+Math.imul(F,Pt)|0,m=m+Math.imul(F,wt)|0,b=b+Math.imul(kt,Lt)|0,u=u+Math.imul(kt,Et)|0,u=u+Math.imul(S,Lt)|0,m=m+Math.imul(S,Et)|0,b=b+Math.imul(dt,Bt)|0,u=u+Math.imul(dt,Mt)|0,u=u+Math.imul(ct,Bt)|0,m=m+Math.imul(ct,Mt)|0,b=b+Math.imul(yt,G)|0,u=u+Math.imul(yt,H)|0,u=u+Math.imul(mt,G)|0,m=m+Math.imul(mt,H)|0,b=b+Math.imul(ot,V)|0,u=u+Math.imul(ot,tt)|0,u=u+Math.imul(ut,V)|0,m=m+Math.imul(ut,tt)|0,b=b+Math.imul(q,at)|0,u=u+Math.imul(q,ht)|0,u=u+Math.imul(z,at)|0,m=m+Math.imul(z,ht)|0;var fe=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(fe>>>26)|0,fe&=67108863,b=Math.imul(te,D),u=Math.imul(te,K),u=u+Math.imul(Ut,D)|0,m=Math.imul(Ut,K),b=b+Math.imul(Rt,ft)|0,u=u+Math.imul(Rt,pt)|0,u=u+Math.imul(Dt,ft)|0,m=m+Math.imul(Dt,pt)|0,b=b+Math.imul(It,At)|0,u=u+Math.imul(It,_t)|0,u=u+Math.imul(xt,At)|0,m=m+Math.imul(xt,_t)|0,b=b+Math.imul(Q,Pt)|0,u=u+Math.imul(Q,wt)|0,u=u+Math.imul(it,Pt)|0,m=m+Math.imul(it,wt)|0,b=b+Math.imul(O,Lt)|0,u=u+Math.imul(O,Et)|0,u=u+Math.imul(F,Lt)|0,m=m+Math.imul(F,Et)|0,b=b+Math.imul(kt,Bt)|0,u=u+Math.imul(kt,Mt)|0,u=u+Math.imul(S,Bt)|0,m=m+Math.imul(S,Mt)|0,b=b+Math.imul(dt,G)|0,u=u+Math.imul(dt,H)|0,u=u+Math.imul(ct,G)|0,m=m+Math.imul(ct,H)|0,b=b+Math.imul(yt,V)|0,u=u+Math.imul(yt,tt)|0,u=u+Math.imul(mt,V)|0,m=m+Math.imul(mt,tt)|0,b=b+Math.imul(ot,at)|0,u=u+Math.imul(ot,ht)|0,u=u+Math.imul(ut,at)|0,m=m+Math.imul(ut,ht)|0;var ce=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ce>>>26)|0,ce&=67108863,b=Math.imul(te,ft),u=Math.imul(te,pt),u=u+Math.imul(Ut,ft)|0,m=Math.imul(Ut,pt),b=b+Math.imul(Rt,At)|0,u=u+Math.imul(Rt,_t)|0,u=u+Math.imul(Dt,At)|0,m=m+Math.imul(Dt,_t)|0,b=b+Math.imul(It,Pt)|0,u=u+Math.imul(It,wt)|0,u=u+Math.imul(xt,Pt)|0,m=m+Math.imul(xt,wt)|0,b=b+Math.imul(Q,Lt)|0,u=u+Math.imul(Q,Et)|0,u=u+Math.imul(it,Lt)|0,m=m+Math.imul(it,Et)|0,b=b+Math.imul(O,Bt)|0,u=u+Math.imul(O,Mt)|0,u=u+Math.imul(F,Bt)|0,m=m+Math.imul(F,Mt)|0,b=b+Math.imul(kt,G)|0,u=u+Math.imul(kt,H)|0,u=u+Math.imul(S,G)|0,m=m+Math.imul(S,H)|0,b=b+Math.imul(dt,V)|0,u=u+Math.imul(dt,tt)|0,u=u+Math.imul(ct,V)|0,m=m+Math.imul(ct,tt)|0,b=b+Math.imul(yt,at)|0,u=u+Math.imul(yt,ht)|0,u=u+Math.imul(mt,at)|0,m=m+Math.imul(mt,ht)|0;var $t=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+($t>>>26)|0,$t&=67108863,b=Math.imul(te,At),u=Math.imul(te,_t),u=u+Math.imul(Ut,At)|0,m=Math.imul(Ut,_t),b=b+Math.imul(Rt,Pt)|0,u=u+Math.imul(Rt,wt)|0,u=u+Math.imul(Dt,Pt)|0,m=m+Math.imul(Dt,wt)|0,b=b+Math.imul(It,Lt)|0,u=u+Math.imul(It,Et)|0,u=u+Math.imul(xt,Lt)|0,m=m+Math.imul(xt,Et)|0,b=b+Math.imul(Q,Bt)|0,u=u+Math.imul(Q,Mt)|0,u=u+Math.imul(it,Bt)|0,m=m+Math.imul(it,Mt)|0,b=b+Math.imul(O,G)|0,u=u+Math.imul(O,H)|0,u=u+Math.imul(F,G)|0,m=m+Math.imul(F,H)|0,b=b+Math.imul(kt,V)|0,u=u+Math.imul(kt,tt)|0,u=u+Math.imul(S,V)|0,m=m+Math.imul(S,tt)|0,b=b+Math.imul(dt,at)|0,u=u+Math.imul(dt,ht)|0,u=u+Math.imul(ct,at)|0,m=m+Math.imul(ct,ht)|0;var oe=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(oe>>>26)|0,oe&=67108863,b=Math.imul(te,Pt),u=Math.imul(te,wt),u=u+Math.imul(Ut,Pt)|0,m=Math.imul(Ut,wt),b=b+Math.imul(Rt,Lt)|0,u=u+Math.imul(Rt,Et)|0,u=u+Math.imul(Dt,Lt)|0,m=m+Math.imul(Dt,Et)|0,b=b+Math.imul(It,Bt)|0,u=u+Math.imul(It,Mt)|0,u=u+Math.imul(xt,Bt)|0,m=m+Math.imul(xt,Mt)|0,b=b+Math.imul(Q,G)|0,u=u+Math.imul(Q,H)|0,u=u+Math.imul(it,G)|0,m=m+Math.imul(it,H)|0,b=b+Math.imul(O,V)|0,u=u+Math.imul(O,tt)|0,u=u+Math.imul(F,V)|0,m=m+Math.imul(F,tt)|0,b=b+Math.imul(kt,at)|0,u=u+Math.imul(kt,ht)|0,u=u+Math.imul(S,at)|0,m=m+Math.imul(S,ht)|0;var Jt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,b=Math.imul(te,Lt),u=Math.imul(te,Et),u=u+Math.imul(Ut,Lt)|0,m=Math.imul(Ut,Et),b=b+Math.imul(Rt,Bt)|0,u=u+Math.imul(Rt,Mt)|0,u=u+Math.imul(Dt,Bt)|0,m=m+Math.imul(Dt,Mt)|0,b=b+Math.imul(It,G)|0,u=u+Math.imul(It,H)|0,u=u+Math.imul(xt,G)|0,m=m+Math.imul(xt,H)|0,b=b+Math.imul(Q,V)|0,u=u+Math.imul(Q,tt)|0,u=u+Math.imul(it,V)|0,m=m+Math.imul(it,tt)|0,b=b+Math.imul(O,at)|0,u=u+Math.imul(O,ht)|0,u=u+Math.imul(F,at)|0,m=m+Math.imul(F,ht)|0;var le=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(le>>>26)|0,le&=67108863,b=Math.imul(te,Bt),u=Math.imul(te,Mt),u=u+Math.imul(Ut,Bt)|0,m=Math.imul(Ut,Mt),b=b+Math.imul(Rt,G)|0,u=u+Math.imul(Rt,H)|0,u=u+Math.imul(Dt,G)|0,m=m+Math.imul(Dt,H)|0,b=b+Math.imul(It,V)|0,u=u+Math.imul(It,tt)|0,u=u+Math.imul(xt,V)|0,m=m+Math.imul(xt,tt)|0,b=b+Math.imul(Q,at)|0,u=u+Math.imul(Q,ht)|0,u=u+Math.imul(it,at)|0,m=m+Math.imul(it,ht)|0;var ae=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ae>>>26)|0,ae&=67108863,b=Math.imul(te,G),u=Math.imul(te,H),u=u+Math.imul(Ut,G)|0,m=Math.imul(Ut,H),b=b+Math.imul(Rt,V)|0,u=u+Math.imul(Rt,tt)|0,u=u+Math.imul(Dt,V)|0,m=m+Math.imul(Dt,tt)|0,b=b+Math.imul(It,at)|0,u=u+Math.imul(It,ht)|0,u=u+Math.imul(xt,at)|0,m=m+Math.imul(xt,ht)|0;var ne=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ne>>>26)|0,ne&=67108863,b=Math.imul(te,V),u=Math.imul(te,tt),u=u+Math.imul(Ut,V)|0,m=Math.imul(Ut,tt),b=b+Math.imul(Rt,at)|0,u=u+Math.imul(Rt,ht)|0,u=u+Math.imul(Dt,at)|0,m=m+Math.imul(Dt,ht)|0;var Ot=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,b=Math.imul(te,at),u=Math.imul(te,ht),u=u+Math.imul(Ut,at)|0,m=Math.imul(Ut,ht);var Nt=(I+b|0)+((u&8191)<<13)|0;return I=(m+(u>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,A[0]=zt,A[1]=Zt,A[2]=ye,A[3]=Yt,A[4]=pe,A[5]=ve,A[6]=ge,A[7]=ie,A[8]=ue,A[9]=fe,A[10]=ce,A[11]=$t,A[12]=oe,A[13]=Jt,A[14]=le,A[15]=ae,A[16]=ne,A[17]=Ot,A[18]=Nt,I!==0&&(A[19]=I,f.length++),f};Math.imul||(k=_);function B(d,o,a){a.negative=o.negative^d.negative,a.length=d.length+o.length;for(var f=0,h=0,g=0;g>>26)|0,h+=A>>>26,A&=67108863}a.words[g]=I,f=A,A=h}return f!==0?a.words[g]=f:a.length--,a.strip()}function P(d,o,a){var f=new R;return f.mulp(d,o,a)}i.prototype.mulTo=function(o,a){var f,h=this.length+o.length;return this.length===10&&o.length===10?f=k(this,o,a):h<63?f=_(this,o,a):h<1024?f=B(this,o,a):f=P(this,o,a),f};function R(d,o){this.x=d,this.y=o}R.prototype.makeRBT=function(o){for(var a=new Array(o),f=i.prototype._countBits(o)-1,h=0;h>=1;return h},R.prototype.permute=function(o,a,f,h,g,A){for(var I=0;I>>1)g++;return 1<>>13,f[2*A+1]=g&8191,g=g>>>13;for(A=2*a;A>=26,a+=h/67108864|0,a+=g>>>26,this.words[f]=g&67108863}return a!==0&&(this.words[f]=a,this.length++),this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var a=w(o);if(a.length===0)return new i(1);for(var f=this,h=0;h=0);var a=o%26,f=(o-a)/26,h=67108863>>>26-a<<26-a,g;if(a!==0){var A=0;for(g=0;g>>26-a}A&&(this.words[g]=A,this.length++)}if(f!==0){for(g=this.length-1;g>=0;g--)this.words[g+f]=this.words[g];for(g=0;g=0);var h;a?h=(a-a%26)/26:h=0;var g=o%26,A=Math.min((o-g)/26,this.length),I=67108863^67108863>>>g<A)for(this.length-=A,u=0;u=0&&(m!==0||u>=h);u--){var L=this.words[u]|0;this.words[u]=m<<26-g|L>>>g,m=L&I}return b&&m!==0&&(b.words[b.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,a,f){return n(this.negative===0),this.iushrn(o,a,f)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var a=o%26,f=(o-a)/26,h=1<=0);var a=o%26,f=(o-a)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(a!==0&&f++,this.length=Math.min(f,this.length),a!==0){var h=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},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(b/67108864|0),this.words[g+f]=A&67108863}for(;g>26,this.words[g+f]=A&67108863;if(I===0)return this.strip();for(n(I===-1),I=0,g=0;g>26,this.words[g]=A&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,a){var f=this.length-o.length,h=this.clone(),g=o,A=g.words[g.length-1]|0,I=this._countBits(A);f=26-I,f!==0&&(g=g.ushln(f),h.iushln(f),A=g.words[g.length-1]|0);var b=h.length-g.length,u;if(a!=="mod"){u=new i(null),u.length=b+1,u.words=new Array(u.length);for(var m=0;m=0;q--){var z=(h.words[g.length+q]|0)*67108864+(h.words[g.length+q-1]|0);for(z=Math.min(z/A|0,67108863),h._ishlnsubmul(g,z,q);h.negative!==0;)z--,h.negative=0,h._ishlnsubmul(g,1,q),h.isZero()||(h.negative^=1);u&&(u.words[q]=z)}return u&&u.strip(),h.strip(),a!=="div"&&f!==0&&h.iushrn(f),{div:u||null,mod:h}},i.prototype.divmod=function(o,a,f){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,g,A;return this.negative!==0&&o.negative===0?(A=this.neg().divmod(o,a),a!=="mod"&&(h=A.div.neg()),a!=="div"&&(g=A.mod.neg(),f&&g.negative!==0&&g.iadd(o)),{div:h,mod:g}):this.negative===0&&o.negative!==0?(A=this.divmod(o.neg(),a),a!=="mod"&&(h=A.div.neg()),{div:h,mod:A.mod}):this.negative&o.negative?(A=this.neg().divmod(o.neg(),a),a!=="div"&&(g=A.mod.neg(),f&&g.negative!==0&&g.isub(o)),{div:A.div,mod:g}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?a==="div"?{div:this.divn(o.words[0]),mod:null}:a==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,a)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var a=this.divmod(o);if(a.mod.isZero())return a.div;var f=a.div.negative!==0?a.mod.isub(o):a.mod,h=o.ushrn(1),g=o.andln(1),A=f.cmp(h);return A<0||g===1&&A===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var a=(1<<26)%o,f=0,h=this.length-1;h>=0;h--)f=(a*f+(this.words[h]|0))%o;return f},i.prototype.idivn=function(o){n(o<=67108863);for(var a=0,f=this.length-1;f>=0;f--){var h=(this.words[f]|0)+a*67108864;this.words[f]=h/o|0,a=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),A=new i(0),I=new i(1),b=0;a.isEven()&&f.isEven();)a.iushrn(1),f.iushrn(1),++b;for(var u=f.clone(),m=a.clone();!a.isZero();){for(var L=0,q=1;!(a.words[0]&q)&&L<26;++L,q<<=1);if(L>0)for(a.iushrn(L);L-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(u),g.isub(m)),h.iushrn(1),g.iushrn(1);for(var z=0,W=1;!(f.words[0]&W)&&z<26;++z,W<<=1);if(z>0)for(f.iushrn(z);z-- >0;)(A.isOdd()||I.isOdd())&&(A.iadd(u),I.isub(m)),A.iushrn(1),I.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(A),g.isub(I)):(f.isub(a),A.isub(h),I.isub(g))}return{a:A,b:I,gcd:f.iushln(b)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),A=f.clone();a.cmpn(1)>0&&f.cmpn(1)>0;){for(var I=0,b=1;!(a.words[0]&b)&&I<26;++I,b<<=1);if(I>0)for(a.iushrn(I);I-- >0;)h.isOdd()&&h.iadd(A),h.iushrn(1);for(var u=0,m=1;!(f.words[0]&m)&&u<26;++u,m<<=1);if(u>0)for(f.iushrn(u);u-- >0;)g.isOdd()&&g.iadd(A),g.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(g)):(f.isub(a),g.isub(h))}var L;return a.cmpn(1)===0?L=h:L=g,L.cmpn(0)<0&&L.iadd(o),L},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var a=this.clone(),f=o.clone();a.negative=0,f.negative=0;for(var h=0;a.isEven()&&f.isEven();h++)a.iushrn(1),f.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;f.isEven();)f.iushrn(1);var g=a.cmp(f);if(g<0){var A=a;a=f,f=A}else if(g===0||f.cmpn(1)===0)break;a.isub(f)}while(!0);return f.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var a=o%26,f=(o-a)/26,h=1<>>26,I&=67108863,this.words[A]=I}return g!==0&&(this.words[A]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var a=o<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this.strip();var f;if(this.length>1)f=1;else{a&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;f=h===o?0:ho.length)return 1;if(this.length=0;f--){var h=this.words[f]|0,g=o.words[f]|0;if(h!==g){hg&&(a=1);break}}return a},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new Z(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var T={k256:null,p224:null,p192:null,p25519:null};function U(d,o){this.name=d,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},U.prototype.ireduce=function(o){var a=o,f;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),f=a.bitLength();while(f>this.n);var h=f0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},U.prototype.split=function(o,a){o.iushrn(this.n,0,a)},U.prototype.imulK=function(o){return o.imul(this.k)};function j(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(j,U),j.prototype.split=function(o,a){for(var f=4194303,h=Math.min(o.length,9),g=0;g>>22,A=I}A>>>=22,o.words[g-10]=A,A===0&&o.length>10?o.length-=10:o.length-=9},j.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var a=0,f=0;f>>=26,o.words[f]=g,a=h}return a!==0&&(o.words[o.length++]=a),o},i._prime=function(o){if(T[o])return T[o];var a;if(o==="k256")a=new j;else if(o==="p224")a=new Y;else if(o==="p192")a=new rt;else if(o==="p25519")a=new nt;else throw new Error("Unknown prime "+o);return T[o]=a,a};function Z(d){if(typeof d=="string"){var o=i._prime(d);this.m=o.p,this.prime=o}else n(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}Z.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},Z.prototype._verify2=function(o,a){n((o.negative|a.negative)===0,"red works only with positives"),n(o.red&&o.red===a.red,"red works only with red numbers")},Z.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},Z.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},Z.prototype.add=function(o,a){this._verify2(o,a);var f=o.add(a);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},Z.prototype.iadd=function(o,a){this._verify2(o,a);var f=o.iadd(a);return f.cmp(this.m)>=0&&f.isub(this.m),f},Z.prototype.sub=function(o,a){this._verify2(o,a);var f=o.sub(a);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},Z.prototype.isub=function(o,a){this._verify2(o,a);var f=o.isub(a);return f.cmpn(0)<0&&f.iadd(this.m),f},Z.prototype.shl=function(o,a){return this._verify1(o),this.imod(o.ushln(a))},Z.prototype.imul=function(o,a){return this._verify2(o,a),this.imod(o.imul(a))},Z.prototype.mul=function(o,a){return this._verify2(o,a),this.imod(o.mul(a))},Z.prototype.isqr=function(o){return this.imul(o,o.clone())},Z.prototype.sqr=function(o){return this.mul(o,o)},Z.prototype.sqrt=function(o){if(o.isZero())return o.clone();var a=this.m.andln(3);if(n(a%2===1),a===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(o,f)}for(var h=this.m.subn(1),g=0;!h.isZero()&&h.andln(1)===0;)g++,h.iushrn(1);n(!h.isZero());var A=new i(1).toRed(this),I=A.redNeg(),b=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,b).cmp(I)!==0;)u.redIAdd(I);for(var m=this.pow(u,h),L=this.pow(o,h.addn(1).iushrn(1)),q=this.pow(o,h),z=g;q.cmp(A)!==0;){for(var W=q,ot=0;W.cmp(A)!==0;ot++)W=W.redSqr();n(ot=0;g--){for(var m=a.words[g],L=u-1;L>=0;L--){var q=m>>L&1;if(A!==h[0]&&(A=this.sqr(A)),q===0&&I===0){b=0;continue}I<<=1,I|=q,b++,!(b!==f&&(g!==0||L!==0))&&(A=this.mul(A,h[I]),b=0,I=0)}u=26}return A},Z.prototype.convertTo=function(o){var a=o.umod(this.m);return a===o?a.clone():a},Z.prototype.convertFrom=function(o){var a=o.clone();return a.red=null,a},i.mont=function(o){return new x(o)};function x(d){Z.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(x,Z),x.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},x.prototype.convertFrom=function(o){var a=this.imod(o.mul(this.rinv));return a.red=null,a},x.prototype.imul=function(o,a){if(o.isZero()||a.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),A=g;return g.cmp(this.m)>=0?A=g.isub(this.m):g.cmpn(0)<0&&(A=g.iadd(this.m)),A._forceRed(this)},x.prototype.mul=function(o,a){if(o.isZero()||a.isZero())return new i(0)._forceRed(this);var f=o.mul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),A=g;return g.cmp(this.m)>=0?A=g.isub(this.m):g.cmpn(0)<0&&(A=g.iadd(this.m)),A._forceRed(this)},x.prototype.invm=function(o){var a=this.imod(o._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(r,Re)}(X0)),X0.exports}var J0={exports:{}};J0.exports;var Pw;function $B(){return Pw||(Pw=1,function(r){(function(t,e){function n(d,o){if(!d)throw new Error(o||"Assertion failed")}function s(d,o){d.super_=o;var a=function(){};a.prototype=o.prototype,d.prototype=new a,d.prototype.constructor=d}function i(d,o,a){if(i.isBN(d))return d;this.negative=0,this.words=null,this.length=0,this.red=null,d!==null&&((o==="le"||o==="be")&&(a=o,o=10),this._init(d||0,o||10,a||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=yr.Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,a){return o.cmp(a)>0?o:a},i.min=function(o,a){return o.cmp(a)<0?o:a},i.prototype._init=function(o,a,f){if(typeof o=="number")return this._initNumber(o,a,f);if(typeof o=="object")return this._initArray(o,a,f);a==="hex"&&(a=16),n(a===(a|0)&&a>=2&&a<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h=0;h-=3)A=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[g]|=A<>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);else if(f==="le")for(h=0,g=0;h>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);return this.strip()};function l(d,o){var a=d.charCodeAt(o);return a>=65&&a<=70?a-55:a>=97&&a<=102?a-87:a-48&15}function p(d,o,a){var f=l(d,a);return a-1>=o&&(f|=l(d,a-1)<<4),f}i.prototype._parseHex=function(o,a,f){this.length=Math.ceil((o.length-a)/6),this.words=new Array(this.length);for(var h=0;h=a;h-=2)I=p(o,a,h)<=18?(g-=18,A+=1,this.words[A]|=I>>>26):g+=8;else{var b=o.length-a;for(h=b%2===0?a+1:a;h=18?(g-=18,A+=1,this.words[A]|=I>>>26):g+=8}this.strip()};function v(d,o,a,f){for(var h=0,g=Math.min(d.length,a),A=o;A=49?h+=I-49+10:I>=17?h+=I-17+10:h+=I}return h}i.prototype._parseBase=function(o,a,f){this.words=[0],this.length=1;for(var h=0,g=1;g<=67108863;g*=a)h++;h--,g=g/a|0;for(var A=o.length-f,I=A%h,b=Math.min(A,A-I)+f,u=0,m=f;m1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var y=["","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"],E=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(o,a){o=o||10,a=a|0||1;var f;if(o===16||o==="hex"){f="";for(var h=0,g=0,A=0;A>>24-h&16777215,g!==0||A!==this.length-1?f=y[6-b.length]+b+f:f=b+f,h+=2,h>=26&&(h-=26,A--)}for(g!==0&&(f=g.toString(16)+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var u=E[o],m=M[o];f="";var L=this.clone();for(L.negative=0;!L.isZero();){var q=L.modn(m).toString(o);L=L.idivn(m),L.isZero()?f=q+f:f=y[u-q.length]+q+f}for(this.isZero()&&(f="0"+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,a){return n(typeof c<"u"),this.toArrayLike(c,o,a)},i.prototype.toArray=function(o,a){return this.toArrayLike(Array,o,a)},i.prototype.toArrayLike=function(o,a,f){var h=this.byteLength(),g=f||Math.max(1,h);n(h<=g,"byte array longer than desired length"),n(g>0,"Requested array length <= 0"),this.strip();var A=a==="le",I=new o(g),b,u,m=this.clone();if(A){for(u=0;!m.isZero();u++)b=m.andln(255),m.iushrn(8),I[u]=b;for(;u=4096&&(f+=13,a>>>=13),a>=64&&(f+=7,a>>>=7),a>=8&&(f+=4,a>>>=4),a>=2&&(f+=2,a>>>=2),f+a},i.prototype._zeroBits=function(o){if(o===0)return 26;var a=o,f=0;return a&8191||(f+=13,a>>>=13),a&127||(f+=7,a>>>=7),a&15||(f+=4,a>>>=4),a&3||(f+=2,a>>>=2),a&1||f++,f},i.prototype.bitLength=function(){var o=this.words[this.length-1],a=this._countBits(o);return(this.length-1)*26+a};function w(d){for(var o=new Array(d.bitLength()),a=0;a>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,a=0;ao.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var a;this.length>o.length?a=o:a=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var a,f;this.length>o.length?(a=this,f=o):(a=o,f=this);for(var h=0;ho.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var a=Math.ceil(o/26)|0,f=o%26;this._expand(a),f>0&&a--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-f),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,a){n(typeof o=="number"&&o>=0);var f=o/26|0,h=o%26;return this._expand(f+1),a?this.words[f]=this.words[f]|1<o.length?(f=this,h=o):(f=o,h=this);for(var g=0,A=0;A>>26;for(;g!==0&&A>>26;if(this.length=f.length,g!==0)this.words[this.length]=g,this.length++;else if(f!==this)for(;Ao.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var a=this.iadd(o);return o.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,g;f>0?(h=this,g=o):(h=o,g=this);for(var A=0,I=0;I>26,this.words[I]=a&67108863;for(;A!==0&&I>26,this.words[I]=a&67108863;if(A===0&&I>>26,L=b&67108863,q=Math.min(u,o.length-1),z=Math.max(0,u-d.length+1);z<=q;z++){var W=u-z|0;h=d.words[W]|0,g=o.words[z]|0,A=h*g+L,m+=A/67108864|0,L=A&67108863}a.words[u]=L|0,b=m|0}return b!==0?a.words[u]=b|0:a.length--,a.strip()}var k=function(o,a,f){var h=o.words,g=a.words,A=f.words,I=0,b,u,m,L=h[0]|0,q=L&8191,z=L>>>13,W=h[1]|0,ot=W&8191,ut=W>>>13,Ct=h[2]|0,yt=Ct&8191,mt=Ct>>>13,jt=h[3]|0,dt=jt&8191,ct=jt>>>13,Tt=h[4]|0,kt=Tt&8191,S=Tt>>>13,C=h[5]|0,O=C&8191,F=C>>>13,et=h[6]|0,Q=et&8191,it=et>>>13,qt=h[7]|0,It=qt&8191,xt=qt>>>13,Qt=h[8]|0,Rt=Qt&8191,Dt=Qt>>>13,Se=h[9]|0,te=Se&8191,Ut=Se>>>13,Te=g[0]|0,J=Te&8191,X=Te>>>13,st=g[1]|0,D=st&8191,K=st>>>13,gt=g[2]|0,ft=gt&8191,pt=gt>>>13,vt=g[3]|0,At=vt&8191,_t=vt>>>13,Wt=g[4]|0,Pt=Wt&8191,wt=Wt>>>13,se=g[5]|0,Lt=se&8191,Et=se>>>13,de=g[6]|0,Bt=de&8191,Mt=de>>>13,$=g[7]|0,G=$&8191,H=$>>>13,N=g[8]|0,V=N&8191,tt=N>>>13,lt=g[9]|0,at=lt&8191,ht=lt>>>13;f.negative=o.negative^a.negative,f.length=19,b=Math.imul(q,J),u=Math.imul(q,X),u=u+Math.imul(z,J)|0,m=Math.imul(z,X);var zt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(zt>>>26)|0,zt&=67108863,b=Math.imul(ot,J),u=Math.imul(ot,X),u=u+Math.imul(ut,J)|0,m=Math.imul(ut,X),b=b+Math.imul(q,D)|0,u=u+Math.imul(q,K)|0,u=u+Math.imul(z,D)|0,m=m+Math.imul(z,K)|0;var Zt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,b=Math.imul(yt,J),u=Math.imul(yt,X),u=u+Math.imul(mt,J)|0,m=Math.imul(mt,X),b=b+Math.imul(ot,D)|0,u=u+Math.imul(ot,K)|0,u=u+Math.imul(ut,D)|0,m=m+Math.imul(ut,K)|0,b=b+Math.imul(q,ft)|0,u=u+Math.imul(q,pt)|0,u=u+Math.imul(z,ft)|0,m=m+Math.imul(z,pt)|0;var ye=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ye>>>26)|0,ye&=67108863,b=Math.imul(dt,J),u=Math.imul(dt,X),u=u+Math.imul(ct,J)|0,m=Math.imul(ct,X),b=b+Math.imul(yt,D)|0,u=u+Math.imul(yt,K)|0,u=u+Math.imul(mt,D)|0,m=m+Math.imul(mt,K)|0,b=b+Math.imul(ot,ft)|0,u=u+Math.imul(ot,pt)|0,u=u+Math.imul(ut,ft)|0,m=m+Math.imul(ut,pt)|0,b=b+Math.imul(q,At)|0,u=u+Math.imul(q,_t)|0,u=u+Math.imul(z,At)|0,m=m+Math.imul(z,_t)|0;var Yt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,b=Math.imul(kt,J),u=Math.imul(kt,X),u=u+Math.imul(S,J)|0,m=Math.imul(S,X),b=b+Math.imul(dt,D)|0,u=u+Math.imul(dt,K)|0,u=u+Math.imul(ct,D)|0,m=m+Math.imul(ct,K)|0,b=b+Math.imul(yt,ft)|0,u=u+Math.imul(yt,pt)|0,u=u+Math.imul(mt,ft)|0,m=m+Math.imul(mt,pt)|0,b=b+Math.imul(ot,At)|0,u=u+Math.imul(ot,_t)|0,u=u+Math.imul(ut,At)|0,m=m+Math.imul(ut,_t)|0,b=b+Math.imul(q,Pt)|0,u=u+Math.imul(q,wt)|0,u=u+Math.imul(z,Pt)|0,m=m+Math.imul(z,wt)|0;var pe=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(pe>>>26)|0,pe&=67108863,b=Math.imul(O,J),u=Math.imul(O,X),u=u+Math.imul(F,J)|0,m=Math.imul(F,X),b=b+Math.imul(kt,D)|0,u=u+Math.imul(kt,K)|0,u=u+Math.imul(S,D)|0,m=m+Math.imul(S,K)|0,b=b+Math.imul(dt,ft)|0,u=u+Math.imul(dt,pt)|0,u=u+Math.imul(ct,ft)|0,m=m+Math.imul(ct,pt)|0,b=b+Math.imul(yt,At)|0,u=u+Math.imul(yt,_t)|0,u=u+Math.imul(mt,At)|0,m=m+Math.imul(mt,_t)|0,b=b+Math.imul(ot,Pt)|0,u=u+Math.imul(ot,wt)|0,u=u+Math.imul(ut,Pt)|0,m=m+Math.imul(ut,wt)|0,b=b+Math.imul(q,Lt)|0,u=u+Math.imul(q,Et)|0,u=u+Math.imul(z,Lt)|0,m=m+Math.imul(z,Et)|0;var ve=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ve>>>26)|0,ve&=67108863,b=Math.imul(Q,J),u=Math.imul(Q,X),u=u+Math.imul(it,J)|0,m=Math.imul(it,X),b=b+Math.imul(O,D)|0,u=u+Math.imul(O,K)|0,u=u+Math.imul(F,D)|0,m=m+Math.imul(F,K)|0,b=b+Math.imul(kt,ft)|0,u=u+Math.imul(kt,pt)|0,u=u+Math.imul(S,ft)|0,m=m+Math.imul(S,pt)|0,b=b+Math.imul(dt,At)|0,u=u+Math.imul(dt,_t)|0,u=u+Math.imul(ct,At)|0,m=m+Math.imul(ct,_t)|0,b=b+Math.imul(yt,Pt)|0,u=u+Math.imul(yt,wt)|0,u=u+Math.imul(mt,Pt)|0,m=m+Math.imul(mt,wt)|0,b=b+Math.imul(ot,Lt)|0,u=u+Math.imul(ot,Et)|0,u=u+Math.imul(ut,Lt)|0,m=m+Math.imul(ut,Et)|0,b=b+Math.imul(q,Bt)|0,u=u+Math.imul(q,Mt)|0,u=u+Math.imul(z,Bt)|0,m=m+Math.imul(z,Mt)|0;var ge=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ge>>>26)|0,ge&=67108863,b=Math.imul(It,J),u=Math.imul(It,X),u=u+Math.imul(xt,J)|0,m=Math.imul(xt,X),b=b+Math.imul(Q,D)|0,u=u+Math.imul(Q,K)|0,u=u+Math.imul(it,D)|0,m=m+Math.imul(it,K)|0,b=b+Math.imul(O,ft)|0,u=u+Math.imul(O,pt)|0,u=u+Math.imul(F,ft)|0,m=m+Math.imul(F,pt)|0,b=b+Math.imul(kt,At)|0,u=u+Math.imul(kt,_t)|0,u=u+Math.imul(S,At)|0,m=m+Math.imul(S,_t)|0,b=b+Math.imul(dt,Pt)|0,u=u+Math.imul(dt,wt)|0,u=u+Math.imul(ct,Pt)|0,m=m+Math.imul(ct,wt)|0,b=b+Math.imul(yt,Lt)|0,u=u+Math.imul(yt,Et)|0,u=u+Math.imul(mt,Lt)|0,m=m+Math.imul(mt,Et)|0,b=b+Math.imul(ot,Bt)|0,u=u+Math.imul(ot,Mt)|0,u=u+Math.imul(ut,Bt)|0,m=m+Math.imul(ut,Mt)|0,b=b+Math.imul(q,G)|0,u=u+Math.imul(q,H)|0,u=u+Math.imul(z,G)|0,m=m+Math.imul(z,H)|0;var ie=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ie>>>26)|0,ie&=67108863,b=Math.imul(Rt,J),u=Math.imul(Rt,X),u=u+Math.imul(Dt,J)|0,m=Math.imul(Dt,X),b=b+Math.imul(It,D)|0,u=u+Math.imul(It,K)|0,u=u+Math.imul(xt,D)|0,m=m+Math.imul(xt,K)|0,b=b+Math.imul(Q,ft)|0,u=u+Math.imul(Q,pt)|0,u=u+Math.imul(it,ft)|0,m=m+Math.imul(it,pt)|0,b=b+Math.imul(O,At)|0,u=u+Math.imul(O,_t)|0,u=u+Math.imul(F,At)|0,m=m+Math.imul(F,_t)|0,b=b+Math.imul(kt,Pt)|0,u=u+Math.imul(kt,wt)|0,u=u+Math.imul(S,Pt)|0,m=m+Math.imul(S,wt)|0,b=b+Math.imul(dt,Lt)|0,u=u+Math.imul(dt,Et)|0,u=u+Math.imul(ct,Lt)|0,m=m+Math.imul(ct,Et)|0,b=b+Math.imul(yt,Bt)|0,u=u+Math.imul(yt,Mt)|0,u=u+Math.imul(mt,Bt)|0,m=m+Math.imul(mt,Mt)|0,b=b+Math.imul(ot,G)|0,u=u+Math.imul(ot,H)|0,u=u+Math.imul(ut,G)|0,m=m+Math.imul(ut,H)|0,b=b+Math.imul(q,V)|0,u=u+Math.imul(q,tt)|0,u=u+Math.imul(z,V)|0,m=m+Math.imul(z,tt)|0;var ue=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ue>>>26)|0,ue&=67108863,b=Math.imul(te,J),u=Math.imul(te,X),u=u+Math.imul(Ut,J)|0,m=Math.imul(Ut,X),b=b+Math.imul(Rt,D)|0,u=u+Math.imul(Rt,K)|0,u=u+Math.imul(Dt,D)|0,m=m+Math.imul(Dt,K)|0,b=b+Math.imul(It,ft)|0,u=u+Math.imul(It,pt)|0,u=u+Math.imul(xt,ft)|0,m=m+Math.imul(xt,pt)|0,b=b+Math.imul(Q,At)|0,u=u+Math.imul(Q,_t)|0,u=u+Math.imul(it,At)|0,m=m+Math.imul(it,_t)|0,b=b+Math.imul(O,Pt)|0,u=u+Math.imul(O,wt)|0,u=u+Math.imul(F,Pt)|0,m=m+Math.imul(F,wt)|0,b=b+Math.imul(kt,Lt)|0,u=u+Math.imul(kt,Et)|0,u=u+Math.imul(S,Lt)|0,m=m+Math.imul(S,Et)|0,b=b+Math.imul(dt,Bt)|0,u=u+Math.imul(dt,Mt)|0,u=u+Math.imul(ct,Bt)|0,m=m+Math.imul(ct,Mt)|0,b=b+Math.imul(yt,G)|0,u=u+Math.imul(yt,H)|0,u=u+Math.imul(mt,G)|0,m=m+Math.imul(mt,H)|0,b=b+Math.imul(ot,V)|0,u=u+Math.imul(ot,tt)|0,u=u+Math.imul(ut,V)|0,m=m+Math.imul(ut,tt)|0,b=b+Math.imul(q,at)|0,u=u+Math.imul(q,ht)|0,u=u+Math.imul(z,at)|0,m=m+Math.imul(z,ht)|0;var fe=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(fe>>>26)|0,fe&=67108863,b=Math.imul(te,D),u=Math.imul(te,K),u=u+Math.imul(Ut,D)|0,m=Math.imul(Ut,K),b=b+Math.imul(Rt,ft)|0,u=u+Math.imul(Rt,pt)|0,u=u+Math.imul(Dt,ft)|0,m=m+Math.imul(Dt,pt)|0,b=b+Math.imul(It,At)|0,u=u+Math.imul(It,_t)|0,u=u+Math.imul(xt,At)|0,m=m+Math.imul(xt,_t)|0,b=b+Math.imul(Q,Pt)|0,u=u+Math.imul(Q,wt)|0,u=u+Math.imul(it,Pt)|0,m=m+Math.imul(it,wt)|0,b=b+Math.imul(O,Lt)|0,u=u+Math.imul(O,Et)|0,u=u+Math.imul(F,Lt)|0,m=m+Math.imul(F,Et)|0,b=b+Math.imul(kt,Bt)|0,u=u+Math.imul(kt,Mt)|0,u=u+Math.imul(S,Bt)|0,m=m+Math.imul(S,Mt)|0,b=b+Math.imul(dt,G)|0,u=u+Math.imul(dt,H)|0,u=u+Math.imul(ct,G)|0,m=m+Math.imul(ct,H)|0,b=b+Math.imul(yt,V)|0,u=u+Math.imul(yt,tt)|0,u=u+Math.imul(mt,V)|0,m=m+Math.imul(mt,tt)|0,b=b+Math.imul(ot,at)|0,u=u+Math.imul(ot,ht)|0,u=u+Math.imul(ut,at)|0,m=m+Math.imul(ut,ht)|0;var ce=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ce>>>26)|0,ce&=67108863,b=Math.imul(te,ft),u=Math.imul(te,pt),u=u+Math.imul(Ut,ft)|0,m=Math.imul(Ut,pt),b=b+Math.imul(Rt,At)|0,u=u+Math.imul(Rt,_t)|0,u=u+Math.imul(Dt,At)|0,m=m+Math.imul(Dt,_t)|0,b=b+Math.imul(It,Pt)|0,u=u+Math.imul(It,wt)|0,u=u+Math.imul(xt,Pt)|0,m=m+Math.imul(xt,wt)|0,b=b+Math.imul(Q,Lt)|0,u=u+Math.imul(Q,Et)|0,u=u+Math.imul(it,Lt)|0,m=m+Math.imul(it,Et)|0,b=b+Math.imul(O,Bt)|0,u=u+Math.imul(O,Mt)|0,u=u+Math.imul(F,Bt)|0,m=m+Math.imul(F,Mt)|0,b=b+Math.imul(kt,G)|0,u=u+Math.imul(kt,H)|0,u=u+Math.imul(S,G)|0,m=m+Math.imul(S,H)|0,b=b+Math.imul(dt,V)|0,u=u+Math.imul(dt,tt)|0,u=u+Math.imul(ct,V)|0,m=m+Math.imul(ct,tt)|0,b=b+Math.imul(yt,at)|0,u=u+Math.imul(yt,ht)|0,u=u+Math.imul(mt,at)|0,m=m+Math.imul(mt,ht)|0;var $t=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+($t>>>26)|0,$t&=67108863,b=Math.imul(te,At),u=Math.imul(te,_t),u=u+Math.imul(Ut,At)|0,m=Math.imul(Ut,_t),b=b+Math.imul(Rt,Pt)|0,u=u+Math.imul(Rt,wt)|0,u=u+Math.imul(Dt,Pt)|0,m=m+Math.imul(Dt,wt)|0,b=b+Math.imul(It,Lt)|0,u=u+Math.imul(It,Et)|0,u=u+Math.imul(xt,Lt)|0,m=m+Math.imul(xt,Et)|0,b=b+Math.imul(Q,Bt)|0,u=u+Math.imul(Q,Mt)|0,u=u+Math.imul(it,Bt)|0,m=m+Math.imul(it,Mt)|0,b=b+Math.imul(O,G)|0,u=u+Math.imul(O,H)|0,u=u+Math.imul(F,G)|0,m=m+Math.imul(F,H)|0,b=b+Math.imul(kt,V)|0,u=u+Math.imul(kt,tt)|0,u=u+Math.imul(S,V)|0,m=m+Math.imul(S,tt)|0,b=b+Math.imul(dt,at)|0,u=u+Math.imul(dt,ht)|0,u=u+Math.imul(ct,at)|0,m=m+Math.imul(ct,ht)|0;var oe=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(oe>>>26)|0,oe&=67108863,b=Math.imul(te,Pt),u=Math.imul(te,wt),u=u+Math.imul(Ut,Pt)|0,m=Math.imul(Ut,wt),b=b+Math.imul(Rt,Lt)|0,u=u+Math.imul(Rt,Et)|0,u=u+Math.imul(Dt,Lt)|0,m=m+Math.imul(Dt,Et)|0,b=b+Math.imul(It,Bt)|0,u=u+Math.imul(It,Mt)|0,u=u+Math.imul(xt,Bt)|0,m=m+Math.imul(xt,Mt)|0,b=b+Math.imul(Q,G)|0,u=u+Math.imul(Q,H)|0,u=u+Math.imul(it,G)|0,m=m+Math.imul(it,H)|0,b=b+Math.imul(O,V)|0,u=u+Math.imul(O,tt)|0,u=u+Math.imul(F,V)|0,m=m+Math.imul(F,tt)|0,b=b+Math.imul(kt,at)|0,u=u+Math.imul(kt,ht)|0,u=u+Math.imul(S,at)|0,m=m+Math.imul(S,ht)|0;var Jt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,b=Math.imul(te,Lt),u=Math.imul(te,Et),u=u+Math.imul(Ut,Lt)|0,m=Math.imul(Ut,Et),b=b+Math.imul(Rt,Bt)|0,u=u+Math.imul(Rt,Mt)|0,u=u+Math.imul(Dt,Bt)|0,m=m+Math.imul(Dt,Mt)|0,b=b+Math.imul(It,G)|0,u=u+Math.imul(It,H)|0,u=u+Math.imul(xt,G)|0,m=m+Math.imul(xt,H)|0,b=b+Math.imul(Q,V)|0,u=u+Math.imul(Q,tt)|0,u=u+Math.imul(it,V)|0,m=m+Math.imul(it,tt)|0,b=b+Math.imul(O,at)|0,u=u+Math.imul(O,ht)|0,u=u+Math.imul(F,at)|0,m=m+Math.imul(F,ht)|0;var le=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(le>>>26)|0,le&=67108863,b=Math.imul(te,Bt),u=Math.imul(te,Mt),u=u+Math.imul(Ut,Bt)|0,m=Math.imul(Ut,Mt),b=b+Math.imul(Rt,G)|0,u=u+Math.imul(Rt,H)|0,u=u+Math.imul(Dt,G)|0,m=m+Math.imul(Dt,H)|0,b=b+Math.imul(It,V)|0,u=u+Math.imul(It,tt)|0,u=u+Math.imul(xt,V)|0,m=m+Math.imul(xt,tt)|0,b=b+Math.imul(Q,at)|0,u=u+Math.imul(Q,ht)|0,u=u+Math.imul(it,at)|0,m=m+Math.imul(it,ht)|0;var ae=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ae>>>26)|0,ae&=67108863,b=Math.imul(te,G),u=Math.imul(te,H),u=u+Math.imul(Ut,G)|0,m=Math.imul(Ut,H),b=b+Math.imul(Rt,V)|0,u=u+Math.imul(Rt,tt)|0,u=u+Math.imul(Dt,V)|0,m=m+Math.imul(Dt,tt)|0,b=b+Math.imul(It,at)|0,u=u+Math.imul(It,ht)|0,u=u+Math.imul(xt,at)|0,m=m+Math.imul(xt,ht)|0;var ne=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ne>>>26)|0,ne&=67108863,b=Math.imul(te,V),u=Math.imul(te,tt),u=u+Math.imul(Ut,V)|0,m=Math.imul(Ut,tt),b=b+Math.imul(Rt,at)|0,u=u+Math.imul(Rt,ht)|0,u=u+Math.imul(Dt,at)|0,m=m+Math.imul(Dt,ht)|0;var Ot=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,b=Math.imul(te,at),u=Math.imul(te,ht),u=u+Math.imul(Ut,at)|0,m=Math.imul(Ut,ht);var Nt=(I+b|0)+((u&8191)<<13)|0;return I=(m+(u>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,A[0]=zt,A[1]=Zt,A[2]=ye,A[3]=Yt,A[4]=pe,A[5]=ve,A[6]=ge,A[7]=ie,A[8]=ue,A[9]=fe,A[10]=ce,A[11]=$t,A[12]=oe,A[13]=Jt,A[14]=le,A[15]=ae,A[16]=ne,A[17]=Ot,A[18]=Nt,I!==0&&(A[19]=I,f.length++),f};Math.imul||(k=_);function B(d,o,a){a.negative=o.negative^d.negative,a.length=d.length+o.length;for(var f=0,h=0,g=0;g>>26)|0,h+=A>>>26,A&=67108863}a.words[g]=I,f=A,A=h}return f!==0?a.words[g]=f:a.length--,a.strip()}function P(d,o,a){var f=new R;return f.mulp(d,o,a)}i.prototype.mulTo=function(o,a){var f,h=this.length+o.length;return this.length===10&&o.length===10?f=k(this,o,a):h<63?f=_(this,o,a):h<1024?f=B(this,o,a):f=P(this,o,a),f};function R(d,o){this.x=d,this.y=o}R.prototype.makeRBT=function(o){for(var a=new Array(o),f=i.prototype._countBits(o)-1,h=0;h>=1;return h},R.prototype.permute=function(o,a,f,h,g,A){for(var I=0;I>>1)g++;return 1<>>13,f[2*A+1]=g&8191,g=g>>>13;for(A=2*a;A>=26,a+=h/67108864|0,a+=g>>>26,this.words[f]=g&67108863}return a!==0&&(this.words[f]=a,this.length++),this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var a=w(o);if(a.length===0)return new i(1);for(var f=this,h=0;h=0);var a=o%26,f=(o-a)/26,h=67108863>>>26-a<<26-a,g;if(a!==0){var A=0;for(g=0;g>>26-a}A&&(this.words[g]=A,this.length++)}if(f!==0){for(g=this.length-1;g>=0;g--)this.words[g+f]=this.words[g];for(g=0;g=0);var h;a?h=(a-a%26)/26:h=0;var g=o%26,A=Math.min((o-g)/26,this.length),I=67108863^67108863>>>g<A)for(this.length-=A,u=0;u=0&&(m!==0||u>=h);u--){var L=this.words[u]|0;this.words[u]=m<<26-g|L>>>g,m=L&I}return b&&m!==0&&(b.words[b.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,a,f){return n(this.negative===0),this.iushrn(o,a,f)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var a=o%26,f=(o-a)/26,h=1<=0);var a=o%26,f=(o-a)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(a!==0&&f++,this.length=Math.min(f,this.length),a!==0){var h=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},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(b/67108864|0),this.words[g+f]=A&67108863}for(;g>26,this.words[g+f]=A&67108863;if(I===0)return this.strip();for(n(I===-1),I=0,g=0;g>26,this.words[g]=A&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,a){var f=this.length-o.length,h=this.clone(),g=o,A=g.words[g.length-1]|0,I=this._countBits(A);f=26-I,f!==0&&(g=g.ushln(f),h.iushln(f),A=g.words[g.length-1]|0);var b=h.length-g.length,u;if(a!=="mod"){u=new i(null),u.length=b+1,u.words=new Array(u.length);for(var m=0;m=0;q--){var z=(h.words[g.length+q]|0)*67108864+(h.words[g.length+q-1]|0);for(z=Math.min(z/A|0,67108863),h._ishlnsubmul(g,z,q);h.negative!==0;)z--,h.negative=0,h._ishlnsubmul(g,1,q),h.isZero()||(h.negative^=1);u&&(u.words[q]=z)}return u&&u.strip(),h.strip(),a!=="div"&&f!==0&&h.iushrn(f),{div:u||null,mod:h}},i.prototype.divmod=function(o,a,f){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,g,A;return this.negative!==0&&o.negative===0?(A=this.neg().divmod(o,a),a!=="mod"&&(h=A.div.neg()),a!=="div"&&(g=A.mod.neg(),f&&g.negative!==0&&g.iadd(o)),{div:h,mod:g}):this.negative===0&&o.negative!==0?(A=this.divmod(o.neg(),a),a!=="mod"&&(h=A.div.neg()),{div:h,mod:A.mod}):this.negative&o.negative?(A=this.neg().divmod(o.neg(),a),a!=="div"&&(g=A.mod.neg(),f&&g.negative!==0&&g.isub(o)),{div:A.div,mod:g}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?a==="div"?{div:this.divn(o.words[0]),mod:null}:a==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,a)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var a=this.divmod(o);if(a.mod.isZero())return a.div;var f=a.div.negative!==0?a.mod.isub(o):a.mod,h=o.ushrn(1),g=o.andln(1),A=f.cmp(h);return A<0||g===1&&A===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var a=(1<<26)%o,f=0,h=this.length-1;h>=0;h--)f=(a*f+(this.words[h]|0))%o;return f},i.prototype.idivn=function(o){n(o<=67108863);for(var a=0,f=this.length-1;f>=0;f--){var h=(this.words[f]|0)+a*67108864;this.words[f]=h/o|0,a=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),A=new i(0),I=new i(1),b=0;a.isEven()&&f.isEven();)a.iushrn(1),f.iushrn(1),++b;for(var u=f.clone(),m=a.clone();!a.isZero();){for(var L=0,q=1;!(a.words[0]&q)&&L<26;++L,q<<=1);if(L>0)for(a.iushrn(L);L-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(u),g.isub(m)),h.iushrn(1),g.iushrn(1);for(var z=0,W=1;!(f.words[0]&W)&&z<26;++z,W<<=1);if(z>0)for(f.iushrn(z);z-- >0;)(A.isOdd()||I.isOdd())&&(A.iadd(u),I.isub(m)),A.iushrn(1),I.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(A),g.isub(I)):(f.isub(a),A.isub(h),I.isub(g))}return{a:A,b:I,gcd:f.iushln(b)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),A=f.clone();a.cmpn(1)>0&&f.cmpn(1)>0;){for(var I=0,b=1;!(a.words[0]&b)&&I<26;++I,b<<=1);if(I>0)for(a.iushrn(I);I-- >0;)h.isOdd()&&h.iadd(A),h.iushrn(1);for(var u=0,m=1;!(f.words[0]&m)&&u<26;++u,m<<=1);if(u>0)for(f.iushrn(u);u-- >0;)g.isOdd()&&g.iadd(A),g.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(g)):(f.isub(a),g.isub(h))}var L;return a.cmpn(1)===0?L=h:L=g,L.cmpn(0)<0&&L.iadd(o),L},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var a=this.clone(),f=o.clone();a.negative=0,f.negative=0;for(var h=0;a.isEven()&&f.isEven();h++)a.iushrn(1),f.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;f.isEven();)f.iushrn(1);var g=a.cmp(f);if(g<0){var A=a;a=f,f=A}else if(g===0||f.cmpn(1)===0)break;a.isub(f)}while(!0);return f.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var a=o%26,f=(o-a)/26,h=1<>>26,I&=67108863,this.words[A]=I}return g!==0&&(this.words[A]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var a=o<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this.strip();var f;if(this.length>1)f=1;else{a&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;f=h===o?0:ho.length)return 1;if(this.length=0;f--){var h=this.words[f]|0,g=o.words[f]|0;if(h!==g){hg&&(a=1);break}}return a},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new Z(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var T={k256:null,p224:null,p192:null,p25519:null};function U(d,o){this.name=d,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},U.prototype.ireduce=function(o){var a=o,f;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),f=a.bitLength();while(f>this.n);var h=f0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},U.prototype.split=function(o,a){o.iushrn(this.n,0,a)},U.prototype.imulK=function(o){return o.imul(this.k)};function j(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(j,U),j.prototype.split=function(o,a){for(var f=4194303,h=Math.min(o.length,9),g=0;g>>22,A=I}A>>>=22,o.words[g-10]=A,A===0&&o.length>10?o.length-=10:o.length-=9},j.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var a=0,f=0;f>>=26,o.words[f]=g,a=h}return a!==0&&(o.words[o.length++]=a),o},i._prime=function(o){if(T[o])return T[o];var a;if(o==="k256")a=new j;else if(o==="p224")a=new Y;else if(o==="p192")a=new rt;else if(o==="p25519")a=new nt;else throw new Error("Unknown prime "+o);return T[o]=a,a};function Z(d){if(typeof d=="string"){var o=i._prime(d);this.m=o.p,this.prime=o}else n(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}Z.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},Z.prototype._verify2=function(o,a){n((o.negative|a.negative)===0,"red works only with positives"),n(o.red&&o.red===a.red,"red works only with red numbers")},Z.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},Z.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},Z.prototype.add=function(o,a){this._verify2(o,a);var f=o.add(a);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},Z.prototype.iadd=function(o,a){this._verify2(o,a);var f=o.iadd(a);return f.cmp(this.m)>=0&&f.isub(this.m),f},Z.prototype.sub=function(o,a){this._verify2(o,a);var f=o.sub(a);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},Z.prototype.isub=function(o,a){this._verify2(o,a);var f=o.isub(a);return f.cmpn(0)<0&&f.iadd(this.m),f},Z.prototype.shl=function(o,a){return this._verify1(o),this.imod(o.ushln(a))},Z.prototype.imul=function(o,a){return this._verify2(o,a),this.imod(o.imul(a))},Z.prototype.mul=function(o,a){return this._verify2(o,a),this.imod(o.mul(a))},Z.prototype.isqr=function(o){return this.imul(o,o.clone())},Z.prototype.sqr=function(o){return this.mul(o,o)},Z.prototype.sqrt=function(o){if(o.isZero())return o.clone();var a=this.m.andln(3);if(n(a%2===1),a===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(o,f)}for(var h=this.m.subn(1),g=0;!h.isZero()&&h.andln(1)===0;)g++,h.iushrn(1);n(!h.isZero());var A=new i(1).toRed(this),I=A.redNeg(),b=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,b).cmp(I)!==0;)u.redIAdd(I);for(var m=this.pow(u,h),L=this.pow(o,h.addn(1).iushrn(1)),q=this.pow(o,h),z=g;q.cmp(A)!==0;){for(var W=q,ot=0;W.cmp(A)!==0;ot++)W=W.redSqr();n(ot=0;g--){for(var m=a.words[g],L=u-1;L>=0;L--){var q=m>>L&1;if(A!==h[0]&&(A=this.sqr(A)),q===0&&I===0){b=0;continue}I<<=1,I|=q,b++,!(b!==f&&(g!==0||L!==0))&&(A=this.mul(A,h[I]),b=0,I=0)}u=26}return A},Z.prototype.convertTo=function(o){var a=o.umod(this.m);return a===o?a.clone():a},Z.prototype.convertFrom=function(o){var a=o.clone();return a.red=null,a},i.mont=function(o){return new x(o)};function x(d){Z.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(x,Z),x.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},x.prototype.convertFrom=function(o){var a=this.imod(o.mul(this.rinv));return a.red=null,a},x.prototype.imul=function(o,a){if(o.isZero()||a.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),A=g;return g.cmp(this.m)>=0?A=g.isub(this.m):g.cmpn(0)<0&&(A=g.iadd(this.m)),A._forceRed(this)},x.prototype.mul=function(o,a){if(o.isZero()||a.isZero())return new i(0)._forceRed(this);var f=o.mul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),A=g;return g.cmp(this.m)>=0?A=g.isub(this.m):g.cmpn(0)<0&&(A=g.iadd(this.m)),A._forceRed(this)},x.prototype.invm=function(o){var a=this.imod(o._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(r,Re)}(J0)),J0.exports}var c0={exports:{}},Rw;function _g(){if(Rw)return c0.exports;Rw=1;var r;c0.exports=function(s){return r||(r=new t(null)),r.generate(s)};function t(n){this.rand=n}if(c0.exports.Rand=t,t.prototype.generate=function(s){return this._rand(s)},t.prototype._rand=function(s){if(this.rand.getBytes)return this.rand.getBytes(s);for(var i=new Uint8Array(s),c=0;c=0);return l},e.prototype._randrange=function(s,i){var c=i.sub(s);return s.add(this._randbelow(c))},e.prototype.test=function(s,i,c){var l=s.bitLength(),p=r.mont(s),v=new r(1).toRed(p);i||(i=Math.max(1,l/48|0));for(var y=s.subn(1),E=0;!y.testn(E);E++);for(var M=s.shrn(E),w=y.toRed(p),_=!0;i>0;i--){var k=this._randrange(new r(2),y);c&&c(k);var B=k.toRed(p).redPow(M);if(!(B.cmp(v)===0||B.cmp(w)===0)){for(var P=1;P0;i--){var w=this._randrange(new r(2),v),_=s.gcd(w);if(_.cmpn(1)!==0)return _;var k=w.toRed(l).redPow(E);if(!(k.cmp(p)===0||k.cmp(M)===0)){for(var B=1;BP;)T.ishrn(1);if(T.isEven()&&T.iadd(i),T.testn(1)||T.iadd(c),R.cmp(c)){if(!R.cmp(l))for(;T.mod(p).cmp(v);)T.iadd(E)}else for(;T.mod(e).cmp(y);)T.iadd(E);if(U=T.shrn(1),_(U)&&_(T)&&k(U)&&k(T)&&s.test(U)&&s.test(T))return T}}return W1}const KB={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},HB={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},VB={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},ZB={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},WB={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},GB={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},YB={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},XB={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},JB={modp1:KB,modp2:HB,modp5:VB,modp14:ZB,modp15:WB,modp16:GB,modp17:YB,modp18:XB};var G1,Lw;function QB(){if(Lw)return G1;Lw=1;var r=B_(),t=P_(),e=new t,n=new r(24),s=new r(11),i=new r(10),c=new r(3),l=new r(7),p=R_(),v=Bf;G1=_;function y(B,P){return P=P||"utf8",Gt.Buffer.isBuffer(B)||(B=new Gt.Buffer(B,P)),this._pub=new r(B),this}function E(B,P){return P=P||"utf8",Gt.Buffer.isBuffer(B)||(B=new Gt.Buffer(B,P)),this._priv=new r(B),this}var M={};function w(B,P){var R=P.toString("hex"),T=[R,B.toString(16)].join("_");if(T in M)return M[T];var U=0;if(B.isEven()||!p.simpleSieve||!p.fermatTest(B)||!e.test(B))return U+=1,R==="02"||R==="05"?U+=8:U+=4,M[T]=U,U;e.test(B.shrn(1))||(U+=2);var j;switch(R){case"02":B.mod(n).cmp(s)&&(U+=8);break;case"05":j=B.mod(i),j.cmp(c)&&j.cmp(l)&&(U+=8);break;default:U+=4}return M[T]=U,U}function _(B,P,R){this.setGenerator(P),this.__prime=new r(B),this._prime=r.mont(this.__prime),this._primeLen=B.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,R?(this.setPublicKey=y,this.setPrivateKey=E):this._primeCode=8}Object.defineProperty(_.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=w(this.__prime,this.__gen)),this._primeCode}}),_.prototype.generateKeys=function(){return this._priv||(this._priv=new r(v(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},_.prototype.computeSecret=function(B){B=new r(B),B=B.toRed(this._prime);var P=B.redPow(this._priv).fromRed(),R=new Gt.Buffer(P.toArray()),T=this.getPrime();if(R.length=0||!l.umod(i.prime1)||!l.umod(i.prime2));return l}function s(i,c){var l=e(c),p=c.modulus.byteLength(),v=new r(i).mul(l.blinder).umod(c.modulus),y=v.toRed(r.mont(c.prime1)),E=v.toRed(r.mont(c.prime2)),M=c.coefficient,w=c.prime1,_=c.prime2,k=y.redPow(c.exponent1).fromRed(),B=E.redPow(c.exponent2).fromRed(),P=k.isub(B).imul(M).umod(w).imul(_);return B.iadd(P).imul(l.unblinder).umod(c.modulus).toArrayLike(Gt.Buffer,"be",p)}return s.getr=n,Y1=s,Y1}var X1={};const eP="elliptic",rP="6.5.4",nP="EC cryptography",iP="lib/elliptic.js",oP=["lib"],sP={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/"},aP={type:"git",url:"git@github.com:indutny/elliptic"},uP=["EC","Elliptic","curve","Cryptography"],fP="Fedor Indutny ",cP="MIT",hP={url:"https://github.com/indutny/elliptic/issues"},lP="https://github.com/indutny/elliptic",dP={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"},pP={"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"},mP={name:eP,version:rP,description:nP,main:iP,files:oP,scripts:sP,repository:aP,keywords:uP,author:fP,license:cP,bugs:hP,homepage:lP,devDependencies:dP,dependencies:pP};var Ri={},Eg={exports:{}};Eg.exports;(function(r){(function(t,e){function n(d,o){if(!d)throw new Error(o||"Assertion failed")}function s(d,o){d.super_=o;var a=function(){};a.prototype=o.prototype,d.prototype=new a,d.prototype.constructor=d}function i(d,o,a){if(i.isBN(d))return d;this.negative=0,this.words=null,this.length=0,this.red=null,d!==null&&((o==="le"||o==="be")&&(a=o,o=10),this._init(d||0,o||10,a||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=yr.Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,a){return o.cmp(a)>0?o:a},i.min=function(o,a){return o.cmp(a)<0?o:a},i.prototype._init=function(o,a,f){if(typeof o=="number")return this._initNumber(o,a,f);if(typeof o=="object")return this._initArray(o,a,f);a==="hex"&&(a=16),n(a===(a|0)&&a>=2&&a<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h=0;h-=3)A=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[g]|=A<>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);else if(f==="le")for(h=0,g=0;h>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);return this.strip()};function l(d,o){var a=d.charCodeAt(o);return a>=65&&a<=70?a-55:a>=97&&a<=102?a-87:a-48&15}function p(d,o,a){var f=l(d,a);return a-1>=o&&(f|=l(d,a-1)<<4),f}i.prototype._parseHex=function(o,a,f){this.length=Math.ceil((o.length-a)/6),this.words=new Array(this.length);for(var h=0;h=a;h-=2)I=p(o,a,h)<=18?(g-=18,A+=1,this.words[A]|=I>>>26):g+=8;else{var b=o.length-a;for(h=b%2===0?a+1:a;h=18?(g-=18,A+=1,this.words[A]|=I>>>26):g+=8}this.strip()};function v(d,o,a,f){for(var h=0,g=Math.min(d.length,a),A=o;A=49?h+=I-49+10:I>=17?h+=I-17+10:h+=I}return h}i.prototype._parseBase=function(o,a,f){this.words=[0],this.length=1;for(var h=0,g=1;g<=67108863;g*=a)h++;h--,g=g/a|0;for(var A=o.length-f,I=A%h,b=Math.min(A,A-I)+f,u=0,m=f;m1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var y=["","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"],E=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(o,a){o=o||10,a=a|0||1;var f;if(o===16||o==="hex"){f="";for(var h=0,g=0,A=0;A>>24-h&16777215,g!==0||A!==this.length-1?f=y[6-b.length]+b+f:f=b+f,h+=2,h>=26&&(h-=26,A--)}for(g!==0&&(f=g.toString(16)+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var u=E[o],m=M[o];f="";var L=this.clone();for(L.negative=0;!L.isZero();){var q=L.modn(m).toString(o);L=L.idivn(m),L.isZero()?f=q+f:f=y[u-q.length]+q+f}for(this.isZero()&&(f="0"+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,a){return n(typeof c<"u"),this.toArrayLike(c,o,a)},i.prototype.toArray=function(o,a){return this.toArrayLike(Array,o,a)},i.prototype.toArrayLike=function(o,a,f){var h=this.byteLength(),g=f||Math.max(1,h);n(h<=g,"byte array longer than desired length"),n(g>0,"Requested array length <= 0"),this.strip();var A=a==="le",I=new o(g),b,u,m=this.clone();if(A){for(u=0;!m.isZero();u++)b=m.andln(255),m.iushrn(8),I[u]=b;for(;u=4096&&(f+=13,a>>>=13),a>=64&&(f+=7,a>>>=7),a>=8&&(f+=4,a>>>=4),a>=2&&(f+=2,a>>>=2),f+a},i.prototype._zeroBits=function(o){if(o===0)return 26;var a=o,f=0;return a&8191||(f+=13,a>>>=13),a&127||(f+=7,a>>>=7),a&15||(f+=4,a>>>=4),a&3||(f+=2,a>>>=2),a&1||f++,f},i.prototype.bitLength=function(){var o=this.words[this.length-1],a=this._countBits(o);return(this.length-1)*26+a};function w(d){for(var o=new Array(d.bitLength()),a=0;a>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,a=0;ao.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var a;this.length>o.length?a=o:a=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var a,f;this.length>o.length?(a=this,f=o):(a=o,f=this);for(var h=0;ho.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var a=Math.ceil(o/26)|0,f=o%26;this._expand(a),f>0&&a--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-f),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,a){n(typeof o=="number"&&o>=0);var f=o/26|0,h=o%26;return this._expand(f+1),a?this.words[f]=this.words[f]|1<o.length?(f=this,h=o):(f=o,h=this);for(var g=0,A=0;A>>26;for(;g!==0&&A>>26;if(this.length=f.length,g!==0)this.words[this.length]=g,this.length++;else if(f!==this)for(;Ao.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var a=this.iadd(o);return o.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,g;f>0?(h=this,g=o):(h=o,g=this);for(var A=0,I=0;I>26,this.words[I]=a&67108863;for(;A!==0&&I>26,this.words[I]=a&67108863;if(A===0&&I>>26,L=b&67108863,q=Math.min(u,o.length-1),z=Math.max(0,u-d.length+1);z<=q;z++){var W=u-z|0;h=d.words[W]|0,g=o.words[z]|0,A=h*g+L,m+=A/67108864|0,L=A&67108863}a.words[u]=L|0,b=m|0}return b!==0?a.words[u]=b|0:a.length--,a.strip()}var k=function(o,a,f){var h=o.words,g=a.words,A=f.words,I=0,b,u,m,L=h[0]|0,q=L&8191,z=L>>>13,W=h[1]|0,ot=W&8191,ut=W>>>13,Ct=h[2]|0,yt=Ct&8191,mt=Ct>>>13,jt=h[3]|0,dt=jt&8191,ct=jt>>>13,Tt=h[4]|0,kt=Tt&8191,S=Tt>>>13,C=h[5]|0,O=C&8191,F=C>>>13,et=h[6]|0,Q=et&8191,it=et>>>13,qt=h[7]|0,It=qt&8191,xt=qt>>>13,Qt=h[8]|0,Rt=Qt&8191,Dt=Qt>>>13,Se=h[9]|0,te=Se&8191,Ut=Se>>>13,Te=g[0]|0,J=Te&8191,X=Te>>>13,st=g[1]|0,D=st&8191,K=st>>>13,gt=g[2]|0,ft=gt&8191,pt=gt>>>13,vt=g[3]|0,At=vt&8191,_t=vt>>>13,Wt=g[4]|0,Pt=Wt&8191,wt=Wt>>>13,se=g[5]|0,Lt=se&8191,Et=se>>>13,de=g[6]|0,Bt=de&8191,Mt=de>>>13,$=g[7]|0,G=$&8191,H=$>>>13,N=g[8]|0,V=N&8191,tt=N>>>13,lt=g[9]|0,at=lt&8191,ht=lt>>>13;f.negative=o.negative^a.negative,f.length=19,b=Math.imul(q,J),u=Math.imul(q,X),u=u+Math.imul(z,J)|0,m=Math.imul(z,X);var zt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(zt>>>26)|0,zt&=67108863,b=Math.imul(ot,J),u=Math.imul(ot,X),u=u+Math.imul(ut,J)|0,m=Math.imul(ut,X),b=b+Math.imul(q,D)|0,u=u+Math.imul(q,K)|0,u=u+Math.imul(z,D)|0,m=m+Math.imul(z,K)|0;var Zt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,b=Math.imul(yt,J),u=Math.imul(yt,X),u=u+Math.imul(mt,J)|0,m=Math.imul(mt,X),b=b+Math.imul(ot,D)|0,u=u+Math.imul(ot,K)|0,u=u+Math.imul(ut,D)|0,m=m+Math.imul(ut,K)|0,b=b+Math.imul(q,ft)|0,u=u+Math.imul(q,pt)|0,u=u+Math.imul(z,ft)|0,m=m+Math.imul(z,pt)|0;var ye=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ye>>>26)|0,ye&=67108863,b=Math.imul(dt,J),u=Math.imul(dt,X),u=u+Math.imul(ct,J)|0,m=Math.imul(ct,X),b=b+Math.imul(yt,D)|0,u=u+Math.imul(yt,K)|0,u=u+Math.imul(mt,D)|0,m=m+Math.imul(mt,K)|0,b=b+Math.imul(ot,ft)|0,u=u+Math.imul(ot,pt)|0,u=u+Math.imul(ut,ft)|0,m=m+Math.imul(ut,pt)|0,b=b+Math.imul(q,At)|0,u=u+Math.imul(q,_t)|0,u=u+Math.imul(z,At)|0,m=m+Math.imul(z,_t)|0;var Yt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,b=Math.imul(kt,J),u=Math.imul(kt,X),u=u+Math.imul(S,J)|0,m=Math.imul(S,X),b=b+Math.imul(dt,D)|0,u=u+Math.imul(dt,K)|0,u=u+Math.imul(ct,D)|0,m=m+Math.imul(ct,K)|0,b=b+Math.imul(yt,ft)|0,u=u+Math.imul(yt,pt)|0,u=u+Math.imul(mt,ft)|0,m=m+Math.imul(mt,pt)|0,b=b+Math.imul(ot,At)|0,u=u+Math.imul(ot,_t)|0,u=u+Math.imul(ut,At)|0,m=m+Math.imul(ut,_t)|0,b=b+Math.imul(q,Pt)|0,u=u+Math.imul(q,wt)|0,u=u+Math.imul(z,Pt)|0,m=m+Math.imul(z,wt)|0;var pe=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(pe>>>26)|0,pe&=67108863,b=Math.imul(O,J),u=Math.imul(O,X),u=u+Math.imul(F,J)|0,m=Math.imul(F,X),b=b+Math.imul(kt,D)|0,u=u+Math.imul(kt,K)|0,u=u+Math.imul(S,D)|0,m=m+Math.imul(S,K)|0,b=b+Math.imul(dt,ft)|0,u=u+Math.imul(dt,pt)|0,u=u+Math.imul(ct,ft)|0,m=m+Math.imul(ct,pt)|0,b=b+Math.imul(yt,At)|0,u=u+Math.imul(yt,_t)|0,u=u+Math.imul(mt,At)|0,m=m+Math.imul(mt,_t)|0,b=b+Math.imul(ot,Pt)|0,u=u+Math.imul(ot,wt)|0,u=u+Math.imul(ut,Pt)|0,m=m+Math.imul(ut,wt)|0,b=b+Math.imul(q,Lt)|0,u=u+Math.imul(q,Et)|0,u=u+Math.imul(z,Lt)|0,m=m+Math.imul(z,Et)|0;var ve=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ve>>>26)|0,ve&=67108863,b=Math.imul(Q,J),u=Math.imul(Q,X),u=u+Math.imul(it,J)|0,m=Math.imul(it,X),b=b+Math.imul(O,D)|0,u=u+Math.imul(O,K)|0,u=u+Math.imul(F,D)|0,m=m+Math.imul(F,K)|0,b=b+Math.imul(kt,ft)|0,u=u+Math.imul(kt,pt)|0,u=u+Math.imul(S,ft)|0,m=m+Math.imul(S,pt)|0,b=b+Math.imul(dt,At)|0,u=u+Math.imul(dt,_t)|0,u=u+Math.imul(ct,At)|0,m=m+Math.imul(ct,_t)|0,b=b+Math.imul(yt,Pt)|0,u=u+Math.imul(yt,wt)|0,u=u+Math.imul(mt,Pt)|0,m=m+Math.imul(mt,wt)|0,b=b+Math.imul(ot,Lt)|0,u=u+Math.imul(ot,Et)|0,u=u+Math.imul(ut,Lt)|0,m=m+Math.imul(ut,Et)|0,b=b+Math.imul(q,Bt)|0,u=u+Math.imul(q,Mt)|0,u=u+Math.imul(z,Bt)|0,m=m+Math.imul(z,Mt)|0;var ge=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ge>>>26)|0,ge&=67108863,b=Math.imul(It,J),u=Math.imul(It,X),u=u+Math.imul(xt,J)|0,m=Math.imul(xt,X),b=b+Math.imul(Q,D)|0,u=u+Math.imul(Q,K)|0,u=u+Math.imul(it,D)|0,m=m+Math.imul(it,K)|0,b=b+Math.imul(O,ft)|0,u=u+Math.imul(O,pt)|0,u=u+Math.imul(F,ft)|0,m=m+Math.imul(F,pt)|0,b=b+Math.imul(kt,At)|0,u=u+Math.imul(kt,_t)|0,u=u+Math.imul(S,At)|0,m=m+Math.imul(S,_t)|0,b=b+Math.imul(dt,Pt)|0,u=u+Math.imul(dt,wt)|0,u=u+Math.imul(ct,Pt)|0,m=m+Math.imul(ct,wt)|0,b=b+Math.imul(yt,Lt)|0,u=u+Math.imul(yt,Et)|0,u=u+Math.imul(mt,Lt)|0,m=m+Math.imul(mt,Et)|0,b=b+Math.imul(ot,Bt)|0,u=u+Math.imul(ot,Mt)|0,u=u+Math.imul(ut,Bt)|0,m=m+Math.imul(ut,Mt)|0,b=b+Math.imul(q,G)|0,u=u+Math.imul(q,H)|0,u=u+Math.imul(z,G)|0,m=m+Math.imul(z,H)|0;var ie=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ie>>>26)|0,ie&=67108863,b=Math.imul(Rt,J),u=Math.imul(Rt,X),u=u+Math.imul(Dt,J)|0,m=Math.imul(Dt,X),b=b+Math.imul(It,D)|0,u=u+Math.imul(It,K)|0,u=u+Math.imul(xt,D)|0,m=m+Math.imul(xt,K)|0,b=b+Math.imul(Q,ft)|0,u=u+Math.imul(Q,pt)|0,u=u+Math.imul(it,ft)|0,m=m+Math.imul(it,pt)|0,b=b+Math.imul(O,At)|0,u=u+Math.imul(O,_t)|0,u=u+Math.imul(F,At)|0,m=m+Math.imul(F,_t)|0,b=b+Math.imul(kt,Pt)|0,u=u+Math.imul(kt,wt)|0,u=u+Math.imul(S,Pt)|0,m=m+Math.imul(S,wt)|0,b=b+Math.imul(dt,Lt)|0,u=u+Math.imul(dt,Et)|0,u=u+Math.imul(ct,Lt)|0,m=m+Math.imul(ct,Et)|0,b=b+Math.imul(yt,Bt)|0,u=u+Math.imul(yt,Mt)|0,u=u+Math.imul(mt,Bt)|0,m=m+Math.imul(mt,Mt)|0,b=b+Math.imul(ot,G)|0,u=u+Math.imul(ot,H)|0,u=u+Math.imul(ut,G)|0,m=m+Math.imul(ut,H)|0,b=b+Math.imul(q,V)|0,u=u+Math.imul(q,tt)|0,u=u+Math.imul(z,V)|0,m=m+Math.imul(z,tt)|0;var ue=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ue>>>26)|0,ue&=67108863,b=Math.imul(te,J),u=Math.imul(te,X),u=u+Math.imul(Ut,J)|0,m=Math.imul(Ut,X),b=b+Math.imul(Rt,D)|0,u=u+Math.imul(Rt,K)|0,u=u+Math.imul(Dt,D)|0,m=m+Math.imul(Dt,K)|0,b=b+Math.imul(It,ft)|0,u=u+Math.imul(It,pt)|0,u=u+Math.imul(xt,ft)|0,m=m+Math.imul(xt,pt)|0,b=b+Math.imul(Q,At)|0,u=u+Math.imul(Q,_t)|0,u=u+Math.imul(it,At)|0,m=m+Math.imul(it,_t)|0,b=b+Math.imul(O,Pt)|0,u=u+Math.imul(O,wt)|0,u=u+Math.imul(F,Pt)|0,m=m+Math.imul(F,wt)|0,b=b+Math.imul(kt,Lt)|0,u=u+Math.imul(kt,Et)|0,u=u+Math.imul(S,Lt)|0,m=m+Math.imul(S,Et)|0,b=b+Math.imul(dt,Bt)|0,u=u+Math.imul(dt,Mt)|0,u=u+Math.imul(ct,Bt)|0,m=m+Math.imul(ct,Mt)|0,b=b+Math.imul(yt,G)|0,u=u+Math.imul(yt,H)|0,u=u+Math.imul(mt,G)|0,m=m+Math.imul(mt,H)|0,b=b+Math.imul(ot,V)|0,u=u+Math.imul(ot,tt)|0,u=u+Math.imul(ut,V)|0,m=m+Math.imul(ut,tt)|0,b=b+Math.imul(q,at)|0,u=u+Math.imul(q,ht)|0,u=u+Math.imul(z,at)|0,m=m+Math.imul(z,ht)|0;var fe=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(fe>>>26)|0,fe&=67108863,b=Math.imul(te,D),u=Math.imul(te,K),u=u+Math.imul(Ut,D)|0,m=Math.imul(Ut,K),b=b+Math.imul(Rt,ft)|0,u=u+Math.imul(Rt,pt)|0,u=u+Math.imul(Dt,ft)|0,m=m+Math.imul(Dt,pt)|0,b=b+Math.imul(It,At)|0,u=u+Math.imul(It,_t)|0,u=u+Math.imul(xt,At)|0,m=m+Math.imul(xt,_t)|0,b=b+Math.imul(Q,Pt)|0,u=u+Math.imul(Q,wt)|0,u=u+Math.imul(it,Pt)|0,m=m+Math.imul(it,wt)|0,b=b+Math.imul(O,Lt)|0,u=u+Math.imul(O,Et)|0,u=u+Math.imul(F,Lt)|0,m=m+Math.imul(F,Et)|0,b=b+Math.imul(kt,Bt)|0,u=u+Math.imul(kt,Mt)|0,u=u+Math.imul(S,Bt)|0,m=m+Math.imul(S,Mt)|0,b=b+Math.imul(dt,G)|0,u=u+Math.imul(dt,H)|0,u=u+Math.imul(ct,G)|0,m=m+Math.imul(ct,H)|0,b=b+Math.imul(yt,V)|0,u=u+Math.imul(yt,tt)|0,u=u+Math.imul(mt,V)|0,m=m+Math.imul(mt,tt)|0,b=b+Math.imul(ot,at)|0,u=u+Math.imul(ot,ht)|0,u=u+Math.imul(ut,at)|0,m=m+Math.imul(ut,ht)|0;var ce=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ce>>>26)|0,ce&=67108863,b=Math.imul(te,ft),u=Math.imul(te,pt),u=u+Math.imul(Ut,ft)|0,m=Math.imul(Ut,pt),b=b+Math.imul(Rt,At)|0,u=u+Math.imul(Rt,_t)|0,u=u+Math.imul(Dt,At)|0,m=m+Math.imul(Dt,_t)|0,b=b+Math.imul(It,Pt)|0,u=u+Math.imul(It,wt)|0,u=u+Math.imul(xt,Pt)|0,m=m+Math.imul(xt,wt)|0,b=b+Math.imul(Q,Lt)|0,u=u+Math.imul(Q,Et)|0,u=u+Math.imul(it,Lt)|0,m=m+Math.imul(it,Et)|0,b=b+Math.imul(O,Bt)|0,u=u+Math.imul(O,Mt)|0,u=u+Math.imul(F,Bt)|0,m=m+Math.imul(F,Mt)|0,b=b+Math.imul(kt,G)|0,u=u+Math.imul(kt,H)|0,u=u+Math.imul(S,G)|0,m=m+Math.imul(S,H)|0,b=b+Math.imul(dt,V)|0,u=u+Math.imul(dt,tt)|0,u=u+Math.imul(ct,V)|0,m=m+Math.imul(ct,tt)|0,b=b+Math.imul(yt,at)|0,u=u+Math.imul(yt,ht)|0,u=u+Math.imul(mt,at)|0,m=m+Math.imul(mt,ht)|0;var $t=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+($t>>>26)|0,$t&=67108863,b=Math.imul(te,At),u=Math.imul(te,_t),u=u+Math.imul(Ut,At)|0,m=Math.imul(Ut,_t),b=b+Math.imul(Rt,Pt)|0,u=u+Math.imul(Rt,wt)|0,u=u+Math.imul(Dt,Pt)|0,m=m+Math.imul(Dt,wt)|0,b=b+Math.imul(It,Lt)|0,u=u+Math.imul(It,Et)|0,u=u+Math.imul(xt,Lt)|0,m=m+Math.imul(xt,Et)|0,b=b+Math.imul(Q,Bt)|0,u=u+Math.imul(Q,Mt)|0,u=u+Math.imul(it,Bt)|0,m=m+Math.imul(it,Mt)|0,b=b+Math.imul(O,G)|0,u=u+Math.imul(O,H)|0,u=u+Math.imul(F,G)|0,m=m+Math.imul(F,H)|0,b=b+Math.imul(kt,V)|0,u=u+Math.imul(kt,tt)|0,u=u+Math.imul(S,V)|0,m=m+Math.imul(S,tt)|0,b=b+Math.imul(dt,at)|0,u=u+Math.imul(dt,ht)|0,u=u+Math.imul(ct,at)|0,m=m+Math.imul(ct,ht)|0;var oe=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(oe>>>26)|0,oe&=67108863,b=Math.imul(te,Pt),u=Math.imul(te,wt),u=u+Math.imul(Ut,Pt)|0,m=Math.imul(Ut,wt),b=b+Math.imul(Rt,Lt)|0,u=u+Math.imul(Rt,Et)|0,u=u+Math.imul(Dt,Lt)|0,m=m+Math.imul(Dt,Et)|0,b=b+Math.imul(It,Bt)|0,u=u+Math.imul(It,Mt)|0,u=u+Math.imul(xt,Bt)|0,m=m+Math.imul(xt,Mt)|0,b=b+Math.imul(Q,G)|0,u=u+Math.imul(Q,H)|0,u=u+Math.imul(it,G)|0,m=m+Math.imul(it,H)|0,b=b+Math.imul(O,V)|0,u=u+Math.imul(O,tt)|0,u=u+Math.imul(F,V)|0,m=m+Math.imul(F,tt)|0,b=b+Math.imul(kt,at)|0,u=u+Math.imul(kt,ht)|0,u=u+Math.imul(S,at)|0,m=m+Math.imul(S,ht)|0;var Jt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,b=Math.imul(te,Lt),u=Math.imul(te,Et),u=u+Math.imul(Ut,Lt)|0,m=Math.imul(Ut,Et),b=b+Math.imul(Rt,Bt)|0,u=u+Math.imul(Rt,Mt)|0,u=u+Math.imul(Dt,Bt)|0,m=m+Math.imul(Dt,Mt)|0,b=b+Math.imul(It,G)|0,u=u+Math.imul(It,H)|0,u=u+Math.imul(xt,G)|0,m=m+Math.imul(xt,H)|0,b=b+Math.imul(Q,V)|0,u=u+Math.imul(Q,tt)|0,u=u+Math.imul(it,V)|0,m=m+Math.imul(it,tt)|0,b=b+Math.imul(O,at)|0,u=u+Math.imul(O,ht)|0,u=u+Math.imul(F,at)|0,m=m+Math.imul(F,ht)|0;var le=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(le>>>26)|0,le&=67108863,b=Math.imul(te,Bt),u=Math.imul(te,Mt),u=u+Math.imul(Ut,Bt)|0,m=Math.imul(Ut,Mt),b=b+Math.imul(Rt,G)|0,u=u+Math.imul(Rt,H)|0,u=u+Math.imul(Dt,G)|0,m=m+Math.imul(Dt,H)|0,b=b+Math.imul(It,V)|0,u=u+Math.imul(It,tt)|0,u=u+Math.imul(xt,V)|0,m=m+Math.imul(xt,tt)|0,b=b+Math.imul(Q,at)|0,u=u+Math.imul(Q,ht)|0,u=u+Math.imul(it,at)|0,m=m+Math.imul(it,ht)|0;var ae=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ae>>>26)|0,ae&=67108863,b=Math.imul(te,G),u=Math.imul(te,H),u=u+Math.imul(Ut,G)|0,m=Math.imul(Ut,H),b=b+Math.imul(Rt,V)|0,u=u+Math.imul(Rt,tt)|0,u=u+Math.imul(Dt,V)|0,m=m+Math.imul(Dt,tt)|0,b=b+Math.imul(It,at)|0,u=u+Math.imul(It,ht)|0,u=u+Math.imul(xt,at)|0,m=m+Math.imul(xt,ht)|0;var ne=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ne>>>26)|0,ne&=67108863,b=Math.imul(te,V),u=Math.imul(te,tt),u=u+Math.imul(Ut,V)|0,m=Math.imul(Ut,tt),b=b+Math.imul(Rt,at)|0,u=u+Math.imul(Rt,ht)|0,u=u+Math.imul(Dt,at)|0,m=m+Math.imul(Dt,ht)|0;var Ot=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,b=Math.imul(te,at),u=Math.imul(te,ht),u=u+Math.imul(Ut,at)|0,m=Math.imul(Ut,ht);var Nt=(I+b|0)+((u&8191)<<13)|0;return I=(m+(u>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,A[0]=zt,A[1]=Zt,A[2]=ye,A[3]=Yt,A[4]=pe,A[5]=ve,A[6]=ge,A[7]=ie,A[8]=ue,A[9]=fe,A[10]=ce,A[11]=$t,A[12]=oe,A[13]=Jt,A[14]=le,A[15]=ae,A[16]=ne,A[17]=Ot,A[18]=Nt,I!==0&&(A[19]=I,f.length++),f};Math.imul||(k=_);function B(d,o,a){a.negative=o.negative^d.negative,a.length=d.length+o.length;for(var f=0,h=0,g=0;g>>26)|0,h+=A>>>26,A&=67108863}a.words[g]=I,f=A,A=h}return f!==0?a.words[g]=f:a.length--,a.strip()}function P(d,o,a){var f=new R;return f.mulp(d,o,a)}i.prototype.mulTo=function(o,a){var f,h=this.length+o.length;return this.length===10&&o.length===10?f=k(this,o,a):h<63?f=_(this,o,a):h<1024?f=B(this,o,a):f=P(this,o,a),f};function R(d,o){this.x=d,this.y=o}R.prototype.makeRBT=function(o){for(var a=new Array(o),f=i.prototype._countBits(o)-1,h=0;h>=1;return h},R.prototype.permute=function(o,a,f,h,g,A){for(var I=0;I>>1)g++;return 1<>>13,f[2*A+1]=g&8191,g=g>>>13;for(A=2*a;A>=26,a+=h/67108864|0,a+=g>>>26,this.words[f]=g&67108863}return a!==0&&(this.words[f]=a,this.length++),this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var a=w(o);if(a.length===0)return new i(1);for(var f=this,h=0;h=0);var a=o%26,f=(o-a)/26,h=67108863>>>26-a<<26-a,g;if(a!==0){var A=0;for(g=0;g>>26-a}A&&(this.words[g]=A,this.length++)}if(f!==0){for(g=this.length-1;g>=0;g--)this.words[g+f]=this.words[g];for(g=0;g=0);var h;a?h=(a-a%26)/26:h=0;var g=o%26,A=Math.min((o-g)/26,this.length),I=67108863^67108863>>>g<A)for(this.length-=A,u=0;u=0&&(m!==0||u>=h);u--){var L=this.words[u]|0;this.words[u]=m<<26-g|L>>>g,m=L&I}return b&&m!==0&&(b.words[b.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,a,f){return n(this.negative===0),this.iushrn(o,a,f)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var a=o%26,f=(o-a)/26,h=1<=0);var a=o%26,f=(o-a)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(a!==0&&f++,this.length=Math.min(f,this.length),a!==0){var h=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},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(b/67108864|0),this.words[g+f]=A&67108863}for(;g>26,this.words[g+f]=A&67108863;if(I===0)return this.strip();for(n(I===-1),I=0,g=0;g>26,this.words[g]=A&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,a){var f=this.length-o.length,h=this.clone(),g=o,A=g.words[g.length-1]|0,I=this._countBits(A);f=26-I,f!==0&&(g=g.ushln(f),h.iushln(f),A=g.words[g.length-1]|0);var b=h.length-g.length,u;if(a!=="mod"){u=new i(null),u.length=b+1,u.words=new Array(u.length);for(var m=0;m=0;q--){var z=(h.words[g.length+q]|0)*67108864+(h.words[g.length+q-1]|0);for(z=Math.min(z/A|0,67108863),h._ishlnsubmul(g,z,q);h.negative!==0;)z--,h.negative=0,h._ishlnsubmul(g,1,q),h.isZero()||(h.negative^=1);u&&(u.words[q]=z)}return u&&u.strip(),h.strip(),a!=="div"&&f!==0&&h.iushrn(f),{div:u||null,mod:h}},i.prototype.divmod=function(o,a,f){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,g,A;return this.negative!==0&&o.negative===0?(A=this.neg().divmod(o,a),a!=="mod"&&(h=A.div.neg()),a!=="div"&&(g=A.mod.neg(),f&&g.negative!==0&&g.iadd(o)),{div:h,mod:g}):this.negative===0&&o.negative!==0?(A=this.divmod(o.neg(),a),a!=="mod"&&(h=A.div.neg()),{div:h,mod:A.mod}):this.negative&o.negative?(A=this.neg().divmod(o.neg(),a),a!=="div"&&(g=A.mod.neg(),f&&g.negative!==0&&g.isub(o)),{div:A.div,mod:g}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?a==="div"?{div:this.divn(o.words[0]),mod:null}:a==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,a)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var a=this.divmod(o);if(a.mod.isZero())return a.div;var f=a.div.negative!==0?a.mod.isub(o):a.mod,h=o.ushrn(1),g=o.andln(1),A=f.cmp(h);return A<0||g===1&&A===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var a=(1<<26)%o,f=0,h=this.length-1;h>=0;h--)f=(a*f+(this.words[h]|0))%o;return f},i.prototype.idivn=function(o){n(o<=67108863);for(var a=0,f=this.length-1;f>=0;f--){var h=(this.words[f]|0)+a*67108864;this.words[f]=h/o|0,a=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),A=new i(0),I=new i(1),b=0;a.isEven()&&f.isEven();)a.iushrn(1),f.iushrn(1),++b;for(var u=f.clone(),m=a.clone();!a.isZero();){for(var L=0,q=1;!(a.words[0]&q)&&L<26;++L,q<<=1);if(L>0)for(a.iushrn(L);L-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(u),g.isub(m)),h.iushrn(1),g.iushrn(1);for(var z=0,W=1;!(f.words[0]&W)&&z<26;++z,W<<=1);if(z>0)for(f.iushrn(z);z-- >0;)(A.isOdd()||I.isOdd())&&(A.iadd(u),I.isub(m)),A.iushrn(1),I.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(A),g.isub(I)):(f.isub(a),A.isub(h),I.isub(g))}return{a:A,b:I,gcd:f.iushln(b)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),A=f.clone();a.cmpn(1)>0&&f.cmpn(1)>0;){for(var I=0,b=1;!(a.words[0]&b)&&I<26;++I,b<<=1);if(I>0)for(a.iushrn(I);I-- >0;)h.isOdd()&&h.iadd(A),h.iushrn(1);for(var u=0,m=1;!(f.words[0]&m)&&u<26;++u,m<<=1);if(u>0)for(f.iushrn(u);u-- >0;)g.isOdd()&&g.iadd(A),g.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(g)):(f.isub(a),g.isub(h))}var L;return a.cmpn(1)===0?L=h:L=g,L.cmpn(0)<0&&L.iadd(o),L},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var a=this.clone(),f=o.clone();a.negative=0,f.negative=0;for(var h=0;a.isEven()&&f.isEven();h++)a.iushrn(1),f.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;f.isEven();)f.iushrn(1);var g=a.cmp(f);if(g<0){var A=a;a=f,f=A}else if(g===0||f.cmpn(1)===0)break;a.isub(f)}while(!0);return f.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var a=o%26,f=(o-a)/26,h=1<>>26,I&=67108863,this.words[A]=I}return g!==0&&(this.words[A]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var a=o<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this.strip();var f;if(this.length>1)f=1;else{a&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;f=h===o?0:ho.length)return 1;if(this.length=0;f--){var h=this.words[f]|0,g=o.words[f]|0;if(h!==g){hg&&(a=1);break}}return a},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new Z(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var T={k256:null,p224:null,p192:null,p25519:null};function U(d,o){this.name=d,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},U.prototype.ireduce=function(o){var a=o,f;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),f=a.bitLength();while(f>this.n);var h=f0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},U.prototype.split=function(o,a){o.iushrn(this.n,0,a)},U.prototype.imulK=function(o){return o.imul(this.k)};function j(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(j,U),j.prototype.split=function(o,a){for(var f=4194303,h=Math.min(o.length,9),g=0;g>>22,A=I}A>>>=22,o.words[g-10]=A,A===0&&o.length>10?o.length-=10:o.length-=9},j.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var a=0,f=0;f>>=26,o.words[f]=g,a=h}return a!==0&&(o.words[o.length++]=a),o},i._prime=function(o){if(T[o])return T[o];var a;if(o==="k256")a=new j;else if(o==="p224")a=new Y;else if(o==="p192")a=new rt;else if(o==="p25519")a=new nt;else throw new Error("Unknown prime "+o);return T[o]=a,a};function Z(d){if(typeof d=="string"){var o=i._prime(d);this.m=o.p,this.prime=o}else n(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}Z.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},Z.prototype._verify2=function(o,a){n((o.negative|a.negative)===0,"red works only with positives"),n(o.red&&o.red===a.red,"red works only with red numbers")},Z.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},Z.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},Z.prototype.add=function(o,a){this._verify2(o,a);var f=o.add(a);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},Z.prototype.iadd=function(o,a){this._verify2(o,a);var f=o.iadd(a);return f.cmp(this.m)>=0&&f.isub(this.m),f},Z.prototype.sub=function(o,a){this._verify2(o,a);var f=o.sub(a);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},Z.prototype.isub=function(o,a){this._verify2(o,a);var f=o.isub(a);return f.cmpn(0)<0&&f.iadd(this.m),f},Z.prototype.shl=function(o,a){return this._verify1(o),this.imod(o.ushln(a))},Z.prototype.imul=function(o,a){return this._verify2(o,a),this.imod(o.imul(a))},Z.prototype.mul=function(o,a){return this._verify2(o,a),this.imod(o.mul(a))},Z.prototype.isqr=function(o){return this.imul(o,o.clone())},Z.prototype.sqr=function(o){return this.mul(o,o)},Z.prototype.sqrt=function(o){if(o.isZero())return o.clone();var a=this.m.andln(3);if(n(a%2===1),a===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(o,f)}for(var h=this.m.subn(1),g=0;!h.isZero()&&h.andln(1)===0;)g++,h.iushrn(1);n(!h.isZero());var A=new i(1).toRed(this),I=A.redNeg(),b=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,b).cmp(I)!==0;)u.redIAdd(I);for(var m=this.pow(u,h),L=this.pow(o,h.addn(1).iushrn(1)),q=this.pow(o,h),z=g;q.cmp(A)!==0;){for(var W=q,ot=0;W.cmp(A)!==0;ot++)W=W.redSqr();n(ot=0;g--){for(var m=a.words[g],L=u-1;L>=0;L--){var q=m>>L&1;if(A!==h[0]&&(A=this.sqr(A)),q===0&&I===0){b=0;continue}I<<=1,I|=q,b++,!(b!==f&&(g!==0||L!==0))&&(A=this.mul(A,h[I]),b=0,I=0)}u=26}return A},Z.prototype.convertTo=function(o){var a=o.umod(this.m);return a===o?a.clone():a},Z.prototype.convertFrom=function(o){var a=o.clone();return a.red=null,a},i.mont=function(o){return new x(o)};function x(d){Z.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(x,Z),x.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},x.prototype.convertFrom=function(o){var a=this.imod(o.mul(this.rinv));return a.red=null,a},x.prototype.imul=function(o,a){if(o.isZero()||a.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),A=g;return g.cmp(this.m)>=0?A=g.isub(this.m):g.cmpn(0)<0&&(A=g.iadd(this.m)),A._forceRed(this)},x.prototype.mul=function(o,a){if(o.isZero()||a.isZero())return new i(0)._forceRed(this);var f=o.mul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),A=g;return g.cmp(this.m)>=0?A=g.isub(this.m):g.cmpn(0)<0&&(A=g.iadd(this.m)),A._forceRed(this)},x.prototype.invm=function(o){var a=this.imod(o._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(r,Re)})(Eg);var Ts=Eg.exports,Ag={};(function(r){var t=r;function e(i,c){if(Array.isArray(i))return i.slice();if(!i)return[];var l=[];if(typeof i!="string"){for(var p=0;p>8,E=v&255;y?l.push(y,E):l.push(E)}return l}t.toArray=e;function n(i){return i.length===1?"0"+i:i}t.zero2=n;function s(i){for(var c="",l=0;l(_>>1)-1?P=(_>>1)-R:P=R,k.isubn(P)):P=0,w[B]=P,k.iushrn(1)}return w}t.getNAF=i;function c(y,E){var M=[[],[]];y=y.clone(),E=E.clone();for(var w=0,_=0,k;y.cmpn(-w)>0||E.cmpn(-_)>0;){var B=y.andln(3)+w&3,P=E.andln(3)+_&3;B===3&&(B=-1),P===3&&(P=-1);var R;B&1?(k=y.andln(7)+w&7,(k===3||k===5)&&P===2?R=-B:R=B):R=0,M[0].push(R);var T;P&1?(k=E.andln(7)+_&7,(k===3||k===5)&&B===2?T=-P:T=P):T=0,M[1].push(T),2*w===R+1&&(w=1-w),2*_===T+1&&(_=1-_),y.iushrn(1),E.iushrn(1)}return M}t.getJSF=c;function l(y,E,M){var w="_"+E;y.prototype[E]=function(){return this[w]!==void 0?this[w]:this[w]=M.call(this)}}t.cachedProperty=l;function p(y){return typeof y=="string"?t.toArray(y,"hex"):y}t.parseBytes=p;function v(y){return new e(y,"hex","le")}t.intFromLE=v})(Ri);var Sg={},wa=Ts,Lh=Ri,bl=Lh.getNAF,vP=Lh.getJSF,wl=Lh.assert;function da(r,t){this.type=r,this.p=new wa(t.p,16),this.red=t.prime?wa.red(t.prime):wa.mont(this.p),this.zero=new wa(0).toRed(this.red),this.one=new wa(1).toRed(this.red),this.two=new wa(2).toRed(this.red),this.n=t.n&&new wa(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.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 e=this.n&&this.p.div(this.n);!e||e.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var vd=da;da.prototype.point=function(){throw new Error("Not implemented")};da.prototype.validate=function(){throw new Error("Not implemented")};da.prototype._fixedNafMul=function(t,e){wl(t.precomputed);var n=t._getDoubles(),s=bl(e,1,this._bitLength),i=(1<=l;v--)p=(p<<1)+s[v];c.push(p)}for(var y=this.jpoint(null,null,null),E=this.jpoint(null,null,null),M=i;M>0;M--){for(l=0;l=0;p--){for(var v=0;p>=0&&c[p]===0;p--)v++;if(p>=0&&v++,l=l.dblp(v),p<0)break;var y=c[p];wl(y!==0),t.type==="affine"?y>0?l=l.mixedAdd(i[y-1>>1]):l=l.mixedAdd(i[-y-1>>1].neg()):y>0?l=l.add(i[y-1>>1]):l=l.add(i[-y-1>>1].neg())}return t.type==="affine"?l.toP():l};da.prototype._wnafMulAdd=function(t,e,n,s,i){var c=this._wnafT1,l=this._wnafT2,p=this._wnafT3,v=0,y,E,M;for(y=0;y=1;y-=2){var _=y-1,k=y;if(c[_]!==1||c[k]!==1){p[_]=bl(n[_],c[_],this._bitLength),p[k]=bl(n[k],c[k],this._bitLength),v=Math.max(p[_].length,v),v=Math.max(p[k].length,v);continue}var B=[e[_],null,null,e[k]];e[_].y.cmp(e[k].y)===0?(B[1]=e[_].add(e[k]),B[2]=e[_].toJ().mixedAdd(e[k].neg())):e[_].y.cmp(e[k].y.redNeg())===0?(B[1]=e[_].toJ().mixedAdd(e[k]),B[2]=e[_].add(e[k].neg())):(B[1]=e[_].toJ().mixedAdd(e[k]),B[2]=e[_].toJ().mixedAdd(e[k].neg()));var P=[-3,-1,-5,-7,0,7,5,1,3],R=vP(n[_],n[k]);for(v=Math.max(R[0].length,v),p[_]=new Array(v),p[k]=new Array(v),E=0;E=0;y--){for(var rt=0;y>=0;){var nt=!0;for(E=0;E=0&&rt++,j=j.dblp(rt),y<0)break;for(E=0;E0?M=l[E][Z-1>>1]:Z<0&&(M=l[E][-Z-1>>1].neg()),M.type==="affine"?j=j.mixedAdd(M):j=j.add(M))}}for(y=0;y=Math.ceil((t.bitLength()+1)/e.step):!1};Qi.prototype._getDoubles=function(t,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],s=this,i=0;i=0&&(w=v,_=y),E.negative&&(E=E.neg(),M=M.neg()),w.negative&&(w=w.neg(),_=_.neg()),[{a:E,b:M},{a:w,b:_}]};to.prototype._endoSplit=function(t){var e=this.endo.basis,n=e[0],s=e[1],i=s.b.mul(t).divRound(this.n),c=n.b.neg().mul(t).divRound(this.n),l=i.mul(n.a),p=c.mul(s.a),v=i.mul(n.b),y=c.mul(s.b),E=t.sub(l).sub(p),M=v.add(y).neg();return{k1:E,k2:M}};to.prototype.pointFromX=function(t,e){t=new nn(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr().redMul(t).redIAdd(t.redMul(this.a)).redIAdd(this.b),s=n.redSqrt();if(s.redSqr().redSub(n).cmp(this.zero)!==0)throw new Error("invalid point");var i=s.fromRed().isOdd();return(e&&!i||!e&&i)&&(s=s.redNeg()),this.point(t,s)};to.prototype.validate=function(t){if(t.inf)return!0;var e=t.x,n=t.y,s=this.a.redMul(e),i=e.redSqr().redMul(e).redIAdd(s).redIAdd(this.b);return n.redSqr().redISub(i).cmpn(0)===0};to.prototype._endoWnafMulAdd=function(t,e,n){for(var s=this._endoWnafT1,i=this._endoWnafT2,c=0;c":""};Sn.prototype.isInfinity=function(){return this.inf};Sn.prototype.add=function(t){if(this.inf)return t;if(t.inf)return this;if(this.eq(t))return this.dbl();if(this.neg().eq(t))return this.curve.point(null,null);if(this.x.cmp(t.x)===0)return this.curve.point(null,null);var e=this.y.redSub(t.y);e.cmpn(0)!==0&&(e=e.redMul(this.x.redSub(t.x).redInvm()));var n=e.redSqr().redISub(this.x).redISub(t.x),s=e.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,s)};Sn.prototype.dbl=function(){if(this.inf)return this;var t=this.y.redAdd(this.y);if(t.cmpn(0)===0)return this.curve.point(null,null);var e=this.curve.a,n=this.x.redSqr(),s=t.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(e).redMul(s),c=i.redSqr().redISub(this.x.redAdd(this.x)),l=i.redMul(this.x.redSub(c)).redISub(this.y);return this.curve.point(c,l)};Sn.prototype.getX=function(){return this.x.fromRed()};Sn.prototype.getY=function(){return this.y.fromRed()};Sn.prototype.mul=function(t){return t=new nn(t,16),this.isInfinity()?this:this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve.endo?this.curve._endoWnafMulAdd([this],[t]):this.curve._wnafMul(this,t)};Sn.prototype.mulAdd=function(t,e,n){var s=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(s,i):this.curve._wnafMulAdd(1,s,i,2)};Sn.prototype.jmulAdd=function(t,e,n){var s=[this,e],i=[t,n];return this.curve.endo?this.curve._endoWnafMulAdd(s,i,!0):this.curve._wnafMulAdd(1,s,i,2,!0)};Sn.prototype.eq=function(t){return this===t||this.inf===t.inf&&(this.inf||this.x.cmp(t.x)===0&&this.y.cmp(t.y)===0)};Sn.prototype.neg=function(t){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(t&&this.precomputed){var n=this.precomputed,s=function(i){return i.neg()};e.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(s)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(s)}}}return e};Sn.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var t=this.curve.jpoint(this.x,this.y,this.curve.one);return t};function Dn(r,t,e,n){Rf.BasePoint.call(this,r,"jacobian"),t===null&&e===null&&n===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new nn(0)):(this.x=new nn(t,16),this.y=new nn(e,16),this.z=new nn(n,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}kg(Dn,Rf.BasePoint);to.prototype.jpoint=function(t,e,n){return new Dn(this,t,e,n)};Dn.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var t=this.z.redInvm(),e=t.redSqr(),n=this.x.redMul(e),s=this.y.redMul(e).redMul(t);return this.curve.point(n,s)};Dn.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Dn.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.z.redSqr(),n=this.z.redSqr(),s=this.x.redMul(e),i=t.x.redMul(n),c=this.y.redMul(e.redMul(t.z)),l=t.y.redMul(n.redMul(this.z)),p=s.redSub(i),v=c.redSub(l);if(p.cmpn(0)===0)return v.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var y=p.redSqr(),E=y.redMul(p),M=s.redMul(y),w=v.redSqr().redIAdd(E).redISub(M).redISub(M),_=v.redMul(M.redISub(w)).redISub(c.redMul(E)),k=this.z.redMul(t.z).redMul(p);return this.curve.jpoint(w,_,k)};Dn.prototype.mixedAdd=function(t){if(this.isInfinity())return t.toJ();if(t.isInfinity())return this;var e=this.z.redSqr(),n=this.x,s=t.x.redMul(e),i=this.y,c=t.y.redMul(e).redMul(this.z),l=n.redSub(s),p=i.redSub(c);if(l.cmpn(0)===0)return p.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var v=l.redSqr(),y=v.redMul(l),E=n.redMul(v),M=p.redSqr().redIAdd(y).redISub(E).redISub(E),w=p.redMul(E.redISub(M)).redISub(i.redMul(y)),_=this.z.redMul(l);return this.curve.jpoint(M,w,_)};Dn.prototype.dblp=function(t){if(t===0)return this;if(this.isInfinity())return this;if(!t)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var n=this;for(e=0;e=0)return!1;if(n.redIAdd(i),this.x.cmp(n)===0)return!0}};Dn.prototype.inspect=function(){return this.isInfinity()?"":""};Dn.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var zu=Ts,C_=br,gd=vd,wP=Ri;function Cf(r){gd.call(this,"mont",r),this.a=new zu(r.a,16).toRed(this.red),this.b=new zu(r.b,16).toRed(this.red),this.i4=new zu(4).toRed(this.red).redInvm(),this.two=new zu(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}C_(Cf,gd);var xP=Cf;Cf.prototype.validate=function(t){var e=t.normalize().x,n=e.redSqr(),s=n.redMul(e).redAdd(n.redMul(this.a)).redAdd(e),i=s.redSqrt();return i.redSqr().cmp(s)===0};function An(r,t,e){gd.BasePoint.call(this,r,"projective"),t===null&&e===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new zu(t,16),this.z=new zu(e,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}C_(An,gd.BasePoint);Cf.prototype.decodePoint=function(t,e){return this.point(wP.toArray(t,e),1)};Cf.prototype.point=function(t,e){return new An(this,t,e)};Cf.prototype.pointFromJSON=function(t){return An.fromJSON(this,t)};An.prototype.precompute=function(){};An.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};An.fromJSON=function(t,e){return new An(t,e[0],e[1]||t.one)};An.prototype.inspect=function(){return this.isInfinity()?"":""};An.prototype.isInfinity=function(){return this.z.cmpn(0)===0};An.prototype.dbl=function(){var t=this.x.redAdd(this.z),e=t.redSqr(),n=this.x.redSub(this.z),s=n.redSqr(),i=e.redSub(s),c=e.redMul(s),l=i.redMul(s.redAdd(this.curve.a24.redMul(i)));return this.curve.point(c,l)};An.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};An.prototype.diffAdd=function(t,e){var n=this.x.redAdd(this.z),s=this.x.redSub(this.z),i=t.x.redAdd(t.z),c=t.x.redSub(t.z),l=c.redMul(n),p=i.redMul(s),v=e.z.redMul(l.redAdd(p).redSqr()),y=e.x.redMul(l.redISub(p).redSqr());return this.curve.point(v,y)};An.prototype.mul=function(t){for(var e=t.clone(),n=this,s=this.curve.point(null,null),i=this,c=[];e.cmpn(0)!==0;e.iushrn(1))c.push(e.andln(1));for(var l=c.length-1;l>=0;l--)c[l]===0?(n=n.diffAdd(s,i),s=s.dbl()):(s=n.diffAdd(s,i),n=n.dbl());return s};An.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};An.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};An.prototype.eq=function(t){return this.getX().cmp(t.getX())===0};An.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};An.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var _P=Ri,Is=Ts,T_=br,yd=vd,MP=_P.assert;function es(r){this.twisted=(r.a|0)!==1,this.mOneA=this.twisted&&(r.a|0)===-1,this.extended=this.mOneA,yd.call(this,"edwards",r),this.a=new Is(r.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new Is(r.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new Is(r.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),MP(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(r.c|0)===1}T_(es,yd);var EP=es;es.prototype._mulA=function(t){return this.mOneA?t.redNeg():this.a.redMul(t)};es.prototype._mulC=function(t){return this.oneC?t:this.c.redMul(t)};es.prototype.jpoint=function(t,e,n,s){return this.point(t,e,n,s)};es.prototype.pointFromX=function(t,e){t=new Is(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr(),s=this.c2.redSub(this.a.redMul(n)),i=this.one.redSub(this.c2.redMul(this.d).redMul(n)),c=s.redMul(i.redInvm()),l=c.redSqrt();if(l.redSqr().redSub(c).cmp(this.zero)!==0)throw new Error("invalid point");var p=l.fromRed().isOdd();return(e&&!p||!e&&p)&&(l=l.redNeg()),this.point(t,l)};es.prototype.pointFromY=function(t,e){t=new Is(t,16),t.red||(t=t.toRed(this.red));var n=t.redSqr(),s=n.redSub(this.c2),i=n.redMul(this.d).redMul(this.c2).redSub(this.a),c=s.redMul(i.redInvm());if(c.cmp(this.zero)===0){if(e)throw new Error("invalid point");return this.point(this.zero,t)}var l=c.redSqrt();if(l.redSqr().redSub(c).cmp(this.zero)!==0)throw new Error("invalid point");return l.fromRed().isOdd()!==e&&(l=l.redNeg()),this.point(l,t)};es.prototype.validate=function(t){if(t.isInfinity())return!0;t.normalize();var e=t.x.redSqr(),n=t.y.redSqr(),s=e.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(e).redMul(n)));return s.cmp(i)===0};function Ur(r,t,e,n,s){yd.BasePoint.call(this,r,"projective"),t===null&&e===null&&n===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 Is(t,16),this.y=new Is(e,16),this.z=n?new Is(n,16):this.curve.one,this.t=s&&new Is(s,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()))))}T_(Ur,yd.BasePoint);es.prototype.pointFromJSON=function(t){return Ur.fromJSON(this,t)};es.prototype.point=function(t,e,n,s){return new Ur(this,t,e,n,s)};Ur.fromJSON=function(t,e){return new Ur(t,e[0],e[1],e[2])};Ur.prototype.inspect=function(){return this.isInfinity()?"":""};Ur.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};Ur.prototype._extDbl=function(){var t=this.x.redSqr(),e=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var s=this.curve._mulA(t),i=this.x.redAdd(this.y).redSqr().redISub(t).redISub(e),c=s.redAdd(e),l=c.redSub(n),p=s.redSub(e),v=i.redMul(l),y=c.redMul(p),E=i.redMul(p),M=l.redMul(c);return this.curve.point(v,y,M,E)};Ur.prototype._projDbl=function(){var t=this.x.redAdd(this.y).redSqr(),e=this.x.redSqr(),n=this.y.redSqr(),s,i,c,l,p,v;if(this.curve.twisted){l=this.curve._mulA(e);var y=l.redAdd(n);this.zOne?(s=t.redSub(e).redSub(n).redMul(y.redSub(this.curve.two)),i=y.redMul(l.redSub(n)),c=y.redSqr().redSub(y).redSub(y)):(p=this.z.redSqr(),v=y.redSub(p).redISub(p),s=t.redSub(e).redISub(n).redMul(v),i=y.redMul(l.redSub(n)),c=y.redMul(v))}else l=e.redAdd(n),p=this.curve._mulC(this.z).redSqr(),v=l.redSub(p).redSub(p),s=this.curve._mulC(t.redISub(l)).redMul(v),i=this.curve._mulC(l).redMul(e.redISub(n)),c=l.redMul(v);return this.curve.point(s,i,c)};Ur.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};Ur.prototype._extAdd=function(t){var e=this.y.redSub(this.x).redMul(t.y.redSub(t.x)),n=this.y.redAdd(this.x).redMul(t.y.redAdd(t.x)),s=this.t.redMul(this.curve.dd).redMul(t.t),i=this.z.redMul(t.z.redAdd(t.z)),c=n.redSub(e),l=i.redSub(s),p=i.redAdd(s),v=n.redAdd(e),y=c.redMul(l),E=p.redMul(v),M=c.redMul(v),w=l.redMul(p);return this.curve.point(y,E,w,M)};Ur.prototype._projAdd=function(t){var e=this.z.redMul(t.z),n=e.redSqr(),s=this.x.redMul(t.x),i=this.y.redMul(t.y),c=this.curve.d.redMul(s).redMul(i),l=n.redSub(c),p=n.redAdd(c),v=this.x.redAdd(this.y).redMul(t.x.redAdd(t.y)).redISub(s).redISub(i),y=e.redMul(l).redMul(v),E,M;return this.curve.twisted?(E=e.redMul(p).redMul(i.redSub(this.curve._mulA(s))),M=l.redMul(p)):(E=e.redMul(p).redMul(i.redSub(s)),M=this.curve._mulC(l).redMul(p)),this.curve.point(y,E,M)};Ur.prototype.add=function(t){return this.isInfinity()?t:t.isInfinity()?this:this.curve.extended?this._extAdd(t):this._projAdd(t)};Ur.prototype.mul=function(t){return this._hasDoubles(t)?this.curve._fixedNafMul(this,t):this.curve._wnafMul(this,t)};Ur.prototype.mulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!1)};Ur.prototype.jmulAdd=function(t,e,n){return this.curve._wnafMulAdd(1,[this,e],[t,n],2,!0)};Ur.prototype.normalize=function(){if(this.zOne)return this;var t=this.z.redInvm();return this.x=this.x.redMul(t),this.y=this.y.redMul(t),this.t&&(this.t=this.t.redMul(t)),this.z=this.curve.one,this.zOne=!0,this};Ur.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};Ur.prototype.getX=function(){return this.normalize(),this.x.fromRed()};Ur.prototype.getY=function(){return this.normalize(),this.y.fromRed()};Ur.prototype.eq=function(t){return this===t||this.getX().cmp(t.getX())===0&&this.getY().cmp(t.getY())===0};Ur.prototype.eqXToP=function(t){var e=t.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(e)===0)return!0;for(var n=t.clone(),s=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(e.redIAdd(s),this.x.cmp(e)===0)return!0}};Ur.prototype.toP=Ur.prototype.normalize;Ur.prototype.mixedAdd=Ur.prototype.add;(function(r){var t=r;t.base=vd,t.short=bP,t.mont=xP,t.edwards=EP})(Sg);var bd={},Oh={},fr={},AP=Ji,SP=br;fr.inherits=SP;function kP(r,t){return(r.charCodeAt(t)&64512)!==55296||t<0||t+1>=r.length?!1:(r.charCodeAt(t+1)&64512)===56320}function IP(r,t){if(Array.isArray(r))return r.slice();if(!r)return[];var e=[];if(typeof r=="string")if(t){if(t==="hex")for(r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r),s=0;s>6|192,e[n++]=i&63|128):kP(r,s)?(i=65536+((i&1023)<<10)+(r.charCodeAt(++s)&1023),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}else for(s=0;s>>24|r>>>8&65280|r<<8&16711680|(r&255)<<24;return t>>>0}fr.htonl=L_;function PP(r,t){for(var e="",n=0;n>>0}return i}fr.join32=RP;function CP(r,t){for(var e=new Array(r.length*4),n=0,s=0;n>>24,e[s+1]=i>>>16&255,e[s+2]=i>>>8&255,e[s+3]=i&255):(e[s+3]=i>>>24,e[s+2]=i>>>16&255,e[s+1]=i>>>8&255,e[s]=i&255)}return e}fr.split32=CP;function TP(r,t){return r>>>t|r<<32-t}fr.rotr32=TP;function LP(r,t){return r<>>32-t}fr.rotl32=LP;function OP(r,t){return r+t>>>0}fr.sum32=OP;function UP(r,t,e){return r+t+e>>>0}fr.sum32_3=UP;function NP(r,t,e,n){return r+t+e+n>>>0}fr.sum32_4=NP;function DP(r,t,e,n,s){return r+t+e+n+s>>>0}fr.sum32_5=DP;function zP(r,t,e,n){var s=r[t],i=r[t+1],c=n+i>>>0,l=(c>>0,r[t+1]=c}fr.sum64=zP;function qP(r,t,e,n){var s=t+n>>>0,i=(s>>0}fr.sum64_hi=qP;function FP(r,t,e,n){var s=t+n;return s>>>0}fr.sum64_lo=FP;function jP(r,t,e,n,s,i,c,l){var p=0,v=t;v=v+n>>>0,p+=v>>0,p+=v>>0,p+=v>>0}fr.sum64_4_hi=jP;function $P(r,t,e,n,s,i,c,l){var p=t+n+i+l;return p>>>0}fr.sum64_4_lo=$P;function KP(r,t,e,n,s,i,c,l,p,v){var y=0,E=t;E=E+n>>>0,y+=E>>0,y+=E>>0,y+=E>>0,y+=E>>0}fr.sum64_5_hi=KP;function HP(r,t,e,n,s,i,c,l,p,v){var y=t+n+i+l+v;return y>>>0}fr.sum64_5_lo=HP;function VP(r,t,e){var n=t<<32-e|r>>>e;return n>>>0}fr.rotr64_hi=VP;function ZP(r,t,e){var n=r<<32-e|t>>>e;return n>>>0}fr.rotr64_lo=ZP;function WP(r,t,e){return r>>>e}fr.shr64_hi=WP;function GP(r,t,e){var n=r<<32-e|t>>>e;return n>>>0}fr.shr64_lo=GP;var Tf={},Nw=fr,YP=Ji;function wd(){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}Tf.BlockHash=wd;wd.prototype.update=function(t,e){if(t=Nw.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var n=t.length%this._delta8;this.pending=t.slice(t.length-n,t.length),this.pending.length===0&&(this.pending=null),t=Nw.join32(t,0,t.length-n,this.endian);for(var s=0;s>>24&255,s[i++]=t>>>16&255,s[i++]=t>>>8&255,s[i++]=t&255}else for(s[i++]=t&255,s[i++]=t>>>8&255,s[i++]=t>>>16&255,s[i++]=t>>>24&255,s[i++]=0,s[i++]=0,s[i++]=0,s[i++]=0,c=8;c>>3}rs.g0_256=eR;function rR(r){return $o(r,17)^$o(r,19)^r>>>10}rs.g1_256=rR;var cf=fr,nR=Tf,iR=rs,J1=cf.rotl32,nc=cf.sum32,oR=cf.sum32_5,sR=iR.ft_1,q_=nR.BlockHash,aR=[1518500249,1859775393,2400959708,3395469782];function Yo(){if(!(this instanceof Yo))return new Yo;q_.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}cf.inherits(Yo,q_);var uR=Yo;Yo.blockSize=512;Yo.outSize=160;Yo.hmacStrength=80;Yo.padLength=64;Yo.prototype._update=function(t,e){for(var n=this.W,s=0;s<16;s++)n[s]=t[e+s];for(;sthis.blockSize&&(t=new this.Hash().update(t).digest()),GR(t.length<=this.blockSize);for(var e=t.length;e=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,e,n)}var tC=aa;aa.prototype._init=function(t,e,n){var s=t.concat(e).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(t.concat(n||[])),this._reseed=1};aa.prototype.generate=function(t,e,n,s){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof e!="string"&&(s=n,n=e,e=null),n&&(n=Ya.toArray(n,s||"hex"),this._update(n));for(var i=[];i.length"};var xl=Ts,Ig=Ri,iC=Ig.assert;function xd(r,t){if(r instanceof xd)return r;this._importDER(r,t)||(iC(r.r&&r.s,"Signature without r or s"),this.r=new xl(r.r,16),this.s=new xl(r.s,16),r.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=r.recoveryParam)}var oC=xd;function sC(){this.place=0}function rp(r,t){var e=r[t.place++];if(!(e&128))return e;var n=e&15;if(n===0||n>4)return!1;for(var s=0,i=0,c=t.place;i>>=0;return s<=127?!1:(t.place=c,s)}function jw(r){for(var t=0,e=r.length-1;!r[t]&&!(r[t+1]&128)&&t>>3);for(r.push(e|128);--e;)r.push(t>>>(e<<3)&255);r.push(t)}xd.prototype.toDER=function(t){var e=this.r.toArray(),n=this.s.toArray();for(e[0]&128&&(e=[0].concat(e)),n[0]&128&&(n=[0].concat(n)),e=jw(e),n=jw(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var s=[2];np(s,e.length),s=s.concat(e),s.push(2),np(s,n.length);var i=s.concat(n),c=[48];return np(c,i.length),c=c.concat(i),Ig.encode(c,t)};var ip,$w;function aC(){if($w)return ip;$w=1;var r=Ts,t=tC,e=Ri,n=bd,s=_g(),i=e.assert,c=nC,l=oC;function p(v){if(!(this instanceof p))return new p(v);typeof v=="string"&&(i(Object.prototype.hasOwnProperty.call(n,v),"Unknown curve "+v),v=n[v]),v instanceof n.PresetCurve&&(v={curve:v}),this.curve=v.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=v.curve.g,this.g.precompute(v.curve.n.bitLength()+1),this.hash=v.hash||v.curve.hash}return ip=p,p.prototype.keyPair=function(y){return new c(this,y)},p.prototype.keyFromPrivate=function(y,E){return c.fromPrivate(this,y,E)},p.prototype.keyFromPublic=function(y,E){return c.fromPublic(this,y,E)},p.prototype.genKeyPair=function(y){y||(y={});for(var E=new t({hash:this.hash,pers:y.pers,persEnc:y.persEnc||"utf8",entropy:y.entropy||s(this.hash.hmacStrength),entropyEnc:y.entropy&&y.entropyEnc||"utf8",nonce:this.n.toArray()}),M=this.n.byteLength(),w=this.n.sub(new r(2));;){var _=new r(E.generate(M));if(!(_.cmp(w)>0))return _.iaddn(1),this.keyFromPrivate(_)}},p.prototype._truncateToN=function(y,E){var M=y.byteLength()*8-this.n.bitLength();return M>0&&(y=y.ushrn(M)),!E&&y.cmp(this.n)>=0?y.sub(this.n):y},p.prototype.sign=function(y,E,M,w){typeof M=="object"&&(w=M,M=null),w||(w={}),E=this.keyFromPrivate(E,M),y=this._truncateToN(new r(y,16));for(var _=this.n.byteLength(),k=E.getPrivate().toArray("be",_),B=y.toArray("be",_),P=new t({hash:this.hash,entropy:k,nonce:B,pers:w.pers,persEnc:w.persEnc||"utf8"}),R=this.n.sub(new r(1)),T=0;;T++){var U=w.k?w.k(T):new r(P.generate(this.n.byteLength()));if(U=this._truncateToN(U,!0),!(U.cmpn(1)<=0||U.cmp(R)>=0)){var j=this.g.mul(U);if(!j.isInfinity()){var Y=j.getX(),rt=Y.umod(this.n);if(rt.cmpn(0)!==0){var nt=U.invm(this.n).mul(rt.mul(E.getPrivate()).iadd(y));if(nt=nt.umod(this.n),nt.cmpn(0)!==0){var Z=(j.getY().isOdd()?1:0)|(Y.cmp(rt)!==0?2:0);return w.canonical&&nt.cmp(this.nh)>0&&(nt=this.n.sub(nt),Z^=1),new l({r:rt,s:nt,recoveryParam:Z})}}}}}},p.prototype.verify=function(y,E,M,w){y=this._truncateToN(new r(y,16)),M=this.keyFromPublic(M,w),E=new l(E,"hex");var _=E.r,k=E.s;if(_.cmpn(1)<0||_.cmp(this.n)>=0||k.cmpn(1)<0||k.cmp(this.n)>=0)return!1;var B=k.invm(this.n),P=B.mul(y).umod(this.n),R=B.mul(_).umod(this.n),T;return this.curve._maxwellTrick?(T=this.g.jmulAdd(P,M.getPublic(),R),T.isInfinity()?!1:T.eqXToP(_)):(T=this.g.mulAdd(P,M.getPublic(),R),T.isInfinity()?!1:T.getX().umod(this.n).cmp(_)===0)},p.prototype.recoverPubKey=function(v,y,E,M){i((3&E)===E,"The recovery param is more than two bits"),y=new l(y,M);var w=this.n,_=new r(v),k=y.r,B=y.s,P=E&1,R=E>>1;if(k.cmp(this.curve.p.umod(this.curve.n))>=0&&R)throw new Error("Unable to find sencond key candinate");R?k=this.curve.pointFromX(k.add(this.curve.n),P):k=this.curve.pointFromX(k,P);var T=y.r.invm(w),U=w.sub(_).mul(T).umod(w),j=B.mul(T).umod(w);return this.g.mulAdd(U,k,j)},p.prototype.getKeyRecoveryParam=function(v,y,E,M){if(y=new l(y,M),y.recoveryParam!==null)return y.recoveryParam;for(var w=0;w<4;w++){var _;try{_=this.recoverPubKey(v,y,w)}catch{continue}if(_.eq(E))return w}throw new Error("Unable to find valid recovery factor")},ip}var Uh=Ri,J_=Uh.assert,Kw=Uh.parseBytes,Uf=Uh.cachedProperty;function En(r,t){this.eddsa=r,this._secret=Kw(t.secret),r.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=Kw(t.pub)}En.fromPublic=function(t,e){return e instanceof En?e:new En(t,{pub:e})};En.fromSecret=function(t,e){return e instanceof En?e:new En(t,{secret:e})};En.prototype.secret=function(){return this._secret};Uf(En,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});Uf(En,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});Uf(En,"privBytes",function(){var t=this.eddsa,e=this.hash(),n=t.encodingLength-1,s=e.slice(0,t.encodingLength);return s[0]&=248,s[n]&=127,s[n]|=64,s});Uf(En,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});Uf(En,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});Uf(En,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});En.prototype.sign=function(t){return J_(this._secret,"KeyPair can only verify"),this.eddsa.sign(t,this)};En.prototype.verify=function(t,e){return this.eddsa.verify(t,e,this)};En.prototype.getSecret=function(t){return J_(this._secret,"KeyPair is public only"),Uh.encode(this.secret(),t)};En.prototype.getPublic=function(t){return Uh.encode(this.pubBytes(),t)};var uC=En,fC=Ts,_d=Ri,cC=_d.assert,Md=_d.cachedProperty,hC=_d.parseBytes;function mu(r,t){this.eddsa=r,typeof t!="object"&&(t=hC(t)),Array.isArray(t)&&(t={R:t.slice(0,r.encodingLength),S:t.slice(r.encodingLength)}),cC(t.R&&t.S,"Signature without R or S"),r.isPoint(t.R)&&(this._R=t.R),t.S instanceof fC&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}Md(mu,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});Md(mu,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});Md(mu,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});Md(mu,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});mu.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};mu.prototype.toHex=function(){return _d.encode(this.toBytes(),"hex").toUpperCase()};var lC=mu,dC=Oh,pC=bd,df=Ri,mC=df.assert,Q_=df.parseBytes,t9=uC,Hw=lC;function li(r){if(mC(r==="ed25519","only tested with ed25519 so far"),!(this instanceof li))return new li(r);r=pC[r].curve,this.curve=r,this.g=r.g,this.g.precompute(r.n.bitLength()+1),this.pointClass=r.point().constructor,this.encodingLength=Math.ceil(r.n.bitLength()/8),this.hash=dC.sha512}var vC=li;li.prototype.sign=function(t,e){t=Q_(t);var n=this.keyFromSecret(e),s=this.hashInt(n.messagePrefix(),t),i=this.g.mul(s),c=this.encodePoint(i),l=this.hashInt(c,n.pubBytes(),t).mul(n.priv()),p=s.add(l).umod(this.curve.n);return this.makeSignature({R:i,S:p,Rencoded:c})};li.prototype.verify=function(t,e,n){t=Q_(t),e=this.makeSignature(e);var s=this.keyFromPublic(n),i=this.hashInt(e.Rencoded(),s.pubBytes(),t),c=this.g.mul(e.S()),l=e.R().add(s.pub().mul(i));return l.eq(c)};li.prototype.hashInt=function(){for(var t=this.hash(),e=0;e0?o:a},i.min=function(o,a){return o.cmp(a)<0?o:a},i.prototype._init=function(o,a,f){if(typeof o=="number")return this._initNumber(o,a,f);if(typeof o=="object")return this._initArray(o,a,f);a==="hex"&&(a=16),n(a===(a|0)&&a>=2&&a<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h=0;h-=3)A=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[g]|=A<>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);else if(f==="le")for(h=0,g=0;h>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);return this.strip()};function l(d,o){var a=d.charCodeAt(o);return a>=65&&a<=70?a-55:a>=97&&a<=102?a-87:a-48&15}function p(d,o,a){var f=l(d,a);return a-1>=o&&(f|=l(d,a-1)<<4),f}i.prototype._parseHex=function(o,a,f){this.length=Math.ceil((o.length-a)/6),this.words=new Array(this.length);for(var h=0;h=a;h-=2)I=p(o,a,h)<=18?(g-=18,A+=1,this.words[A]|=I>>>26):g+=8;else{var b=o.length-a;for(h=b%2===0?a+1:a;h=18?(g-=18,A+=1,this.words[A]|=I>>>26):g+=8}this.strip()};function v(d,o,a,f){for(var h=0,g=Math.min(d.length,a),A=o;A=49?h+=I-49+10:I>=17?h+=I-17+10:h+=I}return h}i.prototype._parseBase=function(o,a,f){this.words=[0],this.length=1;for(var h=0,g=1;g<=67108863;g*=a)h++;h--,g=g/a|0;for(var A=o.length-f,I=A%h,b=Math.min(A,A-I)+f,u=0,m=f;m1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var y=["","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"],E=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(o,a){o=o||10,a=a|0||1;var f;if(o===16||o==="hex"){f="";for(var h=0,g=0,A=0;A>>24-h&16777215,g!==0||A!==this.length-1?f=y[6-b.length]+b+f:f=b+f,h+=2,h>=26&&(h-=26,A--)}for(g!==0&&(f=g.toString(16)+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var u=E[o],m=M[o];f="";var L=this.clone();for(L.negative=0;!L.isZero();){var q=L.modn(m).toString(o);L=L.idivn(m),L.isZero()?f=q+f:f=y[u-q.length]+q+f}for(this.isZero()&&(f="0"+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,a){return n(typeof c<"u"),this.toArrayLike(c,o,a)},i.prototype.toArray=function(o,a){return this.toArrayLike(Array,o,a)},i.prototype.toArrayLike=function(o,a,f){var h=this.byteLength(),g=f||Math.max(1,h);n(h<=g,"byte array longer than desired length"),n(g>0,"Requested array length <= 0"),this.strip();var A=a==="le",I=new o(g),b,u,m=this.clone();if(A){for(u=0;!m.isZero();u++)b=m.andln(255),m.iushrn(8),I[u]=b;for(;u=4096&&(f+=13,a>>>=13),a>=64&&(f+=7,a>>>=7),a>=8&&(f+=4,a>>>=4),a>=2&&(f+=2,a>>>=2),f+a},i.prototype._zeroBits=function(o){if(o===0)return 26;var a=o,f=0;return a&8191||(f+=13,a>>>=13),a&127||(f+=7,a>>>=7),a&15||(f+=4,a>>>=4),a&3||(f+=2,a>>>=2),a&1||f++,f},i.prototype.bitLength=function(){var o=this.words[this.length-1],a=this._countBits(o);return(this.length-1)*26+a};function w(d){for(var o=new Array(d.bitLength()),a=0;a>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,a=0;ao.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var a;this.length>o.length?a=o:a=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var a,f;this.length>o.length?(a=this,f=o):(a=o,f=this);for(var h=0;ho.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var a=Math.ceil(o/26)|0,f=o%26;this._expand(a),f>0&&a--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-f),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,a){n(typeof o=="number"&&o>=0);var f=o/26|0,h=o%26;return this._expand(f+1),a?this.words[f]=this.words[f]|1<o.length?(f=this,h=o):(f=o,h=this);for(var g=0,A=0;A>>26;for(;g!==0&&A>>26;if(this.length=f.length,g!==0)this.words[this.length]=g,this.length++;else if(f!==this)for(;Ao.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var a=this.iadd(o);return o.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,g;f>0?(h=this,g=o):(h=o,g=this);for(var A=0,I=0;I>26,this.words[I]=a&67108863;for(;A!==0&&I>26,this.words[I]=a&67108863;if(A===0&&I>>26,L=b&67108863,q=Math.min(u,o.length-1),z=Math.max(0,u-d.length+1);z<=q;z++){var W=u-z|0;h=d.words[W]|0,g=o.words[z]|0,A=h*g+L,m+=A/67108864|0,L=A&67108863}a.words[u]=L|0,b=m|0}return b!==0?a.words[u]=b|0:a.length--,a.strip()}var k=function(o,a,f){var h=o.words,g=a.words,A=f.words,I=0,b,u,m,L=h[0]|0,q=L&8191,z=L>>>13,W=h[1]|0,ot=W&8191,ut=W>>>13,Ct=h[2]|0,yt=Ct&8191,mt=Ct>>>13,jt=h[3]|0,dt=jt&8191,ct=jt>>>13,Tt=h[4]|0,kt=Tt&8191,S=Tt>>>13,C=h[5]|0,O=C&8191,F=C>>>13,et=h[6]|0,Q=et&8191,it=et>>>13,qt=h[7]|0,It=qt&8191,xt=qt>>>13,Qt=h[8]|0,Rt=Qt&8191,Dt=Qt>>>13,Se=h[9]|0,te=Se&8191,Ut=Se>>>13,Te=g[0]|0,J=Te&8191,X=Te>>>13,st=g[1]|0,D=st&8191,K=st>>>13,gt=g[2]|0,ft=gt&8191,pt=gt>>>13,vt=g[3]|0,At=vt&8191,_t=vt>>>13,Wt=g[4]|0,Pt=Wt&8191,wt=Wt>>>13,se=g[5]|0,Lt=se&8191,Et=se>>>13,de=g[6]|0,Bt=de&8191,Mt=de>>>13,$=g[7]|0,G=$&8191,H=$>>>13,N=g[8]|0,V=N&8191,tt=N>>>13,lt=g[9]|0,at=lt&8191,ht=lt>>>13;f.negative=o.negative^a.negative,f.length=19,b=Math.imul(q,J),u=Math.imul(q,X),u=u+Math.imul(z,J)|0,m=Math.imul(z,X);var zt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(zt>>>26)|0,zt&=67108863,b=Math.imul(ot,J),u=Math.imul(ot,X),u=u+Math.imul(ut,J)|0,m=Math.imul(ut,X),b=b+Math.imul(q,D)|0,u=u+Math.imul(q,K)|0,u=u+Math.imul(z,D)|0,m=m+Math.imul(z,K)|0;var Zt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,b=Math.imul(yt,J),u=Math.imul(yt,X),u=u+Math.imul(mt,J)|0,m=Math.imul(mt,X),b=b+Math.imul(ot,D)|0,u=u+Math.imul(ot,K)|0,u=u+Math.imul(ut,D)|0,m=m+Math.imul(ut,K)|0,b=b+Math.imul(q,ft)|0,u=u+Math.imul(q,pt)|0,u=u+Math.imul(z,ft)|0,m=m+Math.imul(z,pt)|0;var ye=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ye>>>26)|0,ye&=67108863,b=Math.imul(dt,J),u=Math.imul(dt,X),u=u+Math.imul(ct,J)|0,m=Math.imul(ct,X),b=b+Math.imul(yt,D)|0,u=u+Math.imul(yt,K)|0,u=u+Math.imul(mt,D)|0,m=m+Math.imul(mt,K)|0,b=b+Math.imul(ot,ft)|0,u=u+Math.imul(ot,pt)|0,u=u+Math.imul(ut,ft)|0,m=m+Math.imul(ut,pt)|0,b=b+Math.imul(q,At)|0,u=u+Math.imul(q,_t)|0,u=u+Math.imul(z,At)|0,m=m+Math.imul(z,_t)|0;var Yt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,b=Math.imul(kt,J),u=Math.imul(kt,X),u=u+Math.imul(S,J)|0,m=Math.imul(S,X),b=b+Math.imul(dt,D)|0,u=u+Math.imul(dt,K)|0,u=u+Math.imul(ct,D)|0,m=m+Math.imul(ct,K)|0,b=b+Math.imul(yt,ft)|0,u=u+Math.imul(yt,pt)|0,u=u+Math.imul(mt,ft)|0,m=m+Math.imul(mt,pt)|0,b=b+Math.imul(ot,At)|0,u=u+Math.imul(ot,_t)|0,u=u+Math.imul(ut,At)|0,m=m+Math.imul(ut,_t)|0,b=b+Math.imul(q,Pt)|0,u=u+Math.imul(q,wt)|0,u=u+Math.imul(z,Pt)|0,m=m+Math.imul(z,wt)|0;var pe=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(pe>>>26)|0,pe&=67108863,b=Math.imul(O,J),u=Math.imul(O,X),u=u+Math.imul(F,J)|0,m=Math.imul(F,X),b=b+Math.imul(kt,D)|0,u=u+Math.imul(kt,K)|0,u=u+Math.imul(S,D)|0,m=m+Math.imul(S,K)|0,b=b+Math.imul(dt,ft)|0,u=u+Math.imul(dt,pt)|0,u=u+Math.imul(ct,ft)|0,m=m+Math.imul(ct,pt)|0,b=b+Math.imul(yt,At)|0,u=u+Math.imul(yt,_t)|0,u=u+Math.imul(mt,At)|0,m=m+Math.imul(mt,_t)|0,b=b+Math.imul(ot,Pt)|0,u=u+Math.imul(ot,wt)|0,u=u+Math.imul(ut,Pt)|0,m=m+Math.imul(ut,wt)|0,b=b+Math.imul(q,Lt)|0,u=u+Math.imul(q,Et)|0,u=u+Math.imul(z,Lt)|0,m=m+Math.imul(z,Et)|0;var ve=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ve>>>26)|0,ve&=67108863,b=Math.imul(Q,J),u=Math.imul(Q,X),u=u+Math.imul(it,J)|0,m=Math.imul(it,X),b=b+Math.imul(O,D)|0,u=u+Math.imul(O,K)|0,u=u+Math.imul(F,D)|0,m=m+Math.imul(F,K)|0,b=b+Math.imul(kt,ft)|0,u=u+Math.imul(kt,pt)|0,u=u+Math.imul(S,ft)|0,m=m+Math.imul(S,pt)|0,b=b+Math.imul(dt,At)|0,u=u+Math.imul(dt,_t)|0,u=u+Math.imul(ct,At)|0,m=m+Math.imul(ct,_t)|0,b=b+Math.imul(yt,Pt)|0,u=u+Math.imul(yt,wt)|0,u=u+Math.imul(mt,Pt)|0,m=m+Math.imul(mt,wt)|0,b=b+Math.imul(ot,Lt)|0,u=u+Math.imul(ot,Et)|0,u=u+Math.imul(ut,Lt)|0,m=m+Math.imul(ut,Et)|0,b=b+Math.imul(q,Bt)|0,u=u+Math.imul(q,Mt)|0,u=u+Math.imul(z,Bt)|0,m=m+Math.imul(z,Mt)|0;var ge=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ge>>>26)|0,ge&=67108863,b=Math.imul(It,J),u=Math.imul(It,X),u=u+Math.imul(xt,J)|0,m=Math.imul(xt,X),b=b+Math.imul(Q,D)|0,u=u+Math.imul(Q,K)|0,u=u+Math.imul(it,D)|0,m=m+Math.imul(it,K)|0,b=b+Math.imul(O,ft)|0,u=u+Math.imul(O,pt)|0,u=u+Math.imul(F,ft)|0,m=m+Math.imul(F,pt)|0,b=b+Math.imul(kt,At)|0,u=u+Math.imul(kt,_t)|0,u=u+Math.imul(S,At)|0,m=m+Math.imul(S,_t)|0,b=b+Math.imul(dt,Pt)|0,u=u+Math.imul(dt,wt)|0,u=u+Math.imul(ct,Pt)|0,m=m+Math.imul(ct,wt)|0,b=b+Math.imul(yt,Lt)|0,u=u+Math.imul(yt,Et)|0,u=u+Math.imul(mt,Lt)|0,m=m+Math.imul(mt,Et)|0,b=b+Math.imul(ot,Bt)|0,u=u+Math.imul(ot,Mt)|0,u=u+Math.imul(ut,Bt)|0,m=m+Math.imul(ut,Mt)|0,b=b+Math.imul(q,G)|0,u=u+Math.imul(q,H)|0,u=u+Math.imul(z,G)|0,m=m+Math.imul(z,H)|0;var ie=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ie>>>26)|0,ie&=67108863,b=Math.imul(Rt,J),u=Math.imul(Rt,X),u=u+Math.imul(Dt,J)|0,m=Math.imul(Dt,X),b=b+Math.imul(It,D)|0,u=u+Math.imul(It,K)|0,u=u+Math.imul(xt,D)|0,m=m+Math.imul(xt,K)|0,b=b+Math.imul(Q,ft)|0,u=u+Math.imul(Q,pt)|0,u=u+Math.imul(it,ft)|0,m=m+Math.imul(it,pt)|0,b=b+Math.imul(O,At)|0,u=u+Math.imul(O,_t)|0,u=u+Math.imul(F,At)|0,m=m+Math.imul(F,_t)|0,b=b+Math.imul(kt,Pt)|0,u=u+Math.imul(kt,wt)|0,u=u+Math.imul(S,Pt)|0,m=m+Math.imul(S,wt)|0,b=b+Math.imul(dt,Lt)|0,u=u+Math.imul(dt,Et)|0,u=u+Math.imul(ct,Lt)|0,m=m+Math.imul(ct,Et)|0,b=b+Math.imul(yt,Bt)|0,u=u+Math.imul(yt,Mt)|0,u=u+Math.imul(mt,Bt)|0,m=m+Math.imul(mt,Mt)|0,b=b+Math.imul(ot,G)|0,u=u+Math.imul(ot,H)|0,u=u+Math.imul(ut,G)|0,m=m+Math.imul(ut,H)|0,b=b+Math.imul(q,V)|0,u=u+Math.imul(q,tt)|0,u=u+Math.imul(z,V)|0,m=m+Math.imul(z,tt)|0;var ue=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ue>>>26)|0,ue&=67108863,b=Math.imul(te,J),u=Math.imul(te,X),u=u+Math.imul(Ut,J)|0,m=Math.imul(Ut,X),b=b+Math.imul(Rt,D)|0,u=u+Math.imul(Rt,K)|0,u=u+Math.imul(Dt,D)|0,m=m+Math.imul(Dt,K)|0,b=b+Math.imul(It,ft)|0,u=u+Math.imul(It,pt)|0,u=u+Math.imul(xt,ft)|0,m=m+Math.imul(xt,pt)|0,b=b+Math.imul(Q,At)|0,u=u+Math.imul(Q,_t)|0,u=u+Math.imul(it,At)|0,m=m+Math.imul(it,_t)|0,b=b+Math.imul(O,Pt)|0,u=u+Math.imul(O,wt)|0,u=u+Math.imul(F,Pt)|0,m=m+Math.imul(F,wt)|0,b=b+Math.imul(kt,Lt)|0,u=u+Math.imul(kt,Et)|0,u=u+Math.imul(S,Lt)|0,m=m+Math.imul(S,Et)|0,b=b+Math.imul(dt,Bt)|0,u=u+Math.imul(dt,Mt)|0,u=u+Math.imul(ct,Bt)|0,m=m+Math.imul(ct,Mt)|0,b=b+Math.imul(yt,G)|0,u=u+Math.imul(yt,H)|0,u=u+Math.imul(mt,G)|0,m=m+Math.imul(mt,H)|0,b=b+Math.imul(ot,V)|0,u=u+Math.imul(ot,tt)|0,u=u+Math.imul(ut,V)|0,m=m+Math.imul(ut,tt)|0,b=b+Math.imul(q,at)|0,u=u+Math.imul(q,ht)|0,u=u+Math.imul(z,at)|0,m=m+Math.imul(z,ht)|0;var fe=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(fe>>>26)|0,fe&=67108863,b=Math.imul(te,D),u=Math.imul(te,K),u=u+Math.imul(Ut,D)|0,m=Math.imul(Ut,K),b=b+Math.imul(Rt,ft)|0,u=u+Math.imul(Rt,pt)|0,u=u+Math.imul(Dt,ft)|0,m=m+Math.imul(Dt,pt)|0,b=b+Math.imul(It,At)|0,u=u+Math.imul(It,_t)|0,u=u+Math.imul(xt,At)|0,m=m+Math.imul(xt,_t)|0,b=b+Math.imul(Q,Pt)|0,u=u+Math.imul(Q,wt)|0,u=u+Math.imul(it,Pt)|0,m=m+Math.imul(it,wt)|0,b=b+Math.imul(O,Lt)|0,u=u+Math.imul(O,Et)|0,u=u+Math.imul(F,Lt)|0,m=m+Math.imul(F,Et)|0,b=b+Math.imul(kt,Bt)|0,u=u+Math.imul(kt,Mt)|0,u=u+Math.imul(S,Bt)|0,m=m+Math.imul(S,Mt)|0,b=b+Math.imul(dt,G)|0,u=u+Math.imul(dt,H)|0,u=u+Math.imul(ct,G)|0,m=m+Math.imul(ct,H)|0,b=b+Math.imul(yt,V)|0,u=u+Math.imul(yt,tt)|0,u=u+Math.imul(mt,V)|0,m=m+Math.imul(mt,tt)|0,b=b+Math.imul(ot,at)|0,u=u+Math.imul(ot,ht)|0,u=u+Math.imul(ut,at)|0,m=m+Math.imul(ut,ht)|0;var ce=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ce>>>26)|0,ce&=67108863,b=Math.imul(te,ft),u=Math.imul(te,pt),u=u+Math.imul(Ut,ft)|0,m=Math.imul(Ut,pt),b=b+Math.imul(Rt,At)|0,u=u+Math.imul(Rt,_t)|0,u=u+Math.imul(Dt,At)|0,m=m+Math.imul(Dt,_t)|0,b=b+Math.imul(It,Pt)|0,u=u+Math.imul(It,wt)|0,u=u+Math.imul(xt,Pt)|0,m=m+Math.imul(xt,wt)|0,b=b+Math.imul(Q,Lt)|0,u=u+Math.imul(Q,Et)|0,u=u+Math.imul(it,Lt)|0,m=m+Math.imul(it,Et)|0,b=b+Math.imul(O,Bt)|0,u=u+Math.imul(O,Mt)|0,u=u+Math.imul(F,Bt)|0,m=m+Math.imul(F,Mt)|0,b=b+Math.imul(kt,G)|0,u=u+Math.imul(kt,H)|0,u=u+Math.imul(S,G)|0,m=m+Math.imul(S,H)|0,b=b+Math.imul(dt,V)|0,u=u+Math.imul(dt,tt)|0,u=u+Math.imul(ct,V)|0,m=m+Math.imul(ct,tt)|0,b=b+Math.imul(yt,at)|0,u=u+Math.imul(yt,ht)|0,u=u+Math.imul(mt,at)|0,m=m+Math.imul(mt,ht)|0;var $t=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+($t>>>26)|0,$t&=67108863,b=Math.imul(te,At),u=Math.imul(te,_t),u=u+Math.imul(Ut,At)|0,m=Math.imul(Ut,_t),b=b+Math.imul(Rt,Pt)|0,u=u+Math.imul(Rt,wt)|0,u=u+Math.imul(Dt,Pt)|0,m=m+Math.imul(Dt,wt)|0,b=b+Math.imul(It,Lt)|0,u=u+Math.imul(It,Et)|0,u=u+Math.imul(xt,Lt)|0,m=m+Math.imul(xt,Et)|0,b=b+Math.imul(Q,Bt)|0,u=u+Math.imul(Q,Mt)|0,u=u+Math.imul(it,Bt)|0,m=m+Math.imul(it,Mt)|0,b=b+Math.imul(O,G)|0,u=u+Math.imul(O,H)|0,u=u+Math.imul(F,G)|0,m=m+Math.imul(F,H)|0,b=b+Math.imul(kt,V)|0,u=u+Math.imul(kt,tt)|0,u=u+Math.imul(S,V)|0,m=m+Math.imul(S,tt)|0,b=b+Math.imul(dt,at)|0,u=u+Math.imul(dt,ht)|0,u=u+Math.imul(ct,at)|0,m=m+Math.imul(ct,ht)|0;var oe=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(oe>>>26)|0,oe&=67108863,b=Math.imul(te,Pt),u=Math.imul(te,wt),u=u+Math.imul(Ut,Pt)|0,m=Math.imul(Ut,wt),b=b+Math.imul(Rt,Lt)|0,u=u+Math.imul(Rt,Et)|0,u=u+Math.imul(Dt,Lt)|0,m=m+Math.imul(Dt,Et)|0,b=b+Math.imul(It,Bt)|0,u=u+Math.imul(It,Mt)|0,u=u+Math.imul(xt,Bt)|0,m=m+Math.imul(xt,Mt)|0,b=b+Math.imul(Q,G)|0,u=u+Math.imul(Q,H)|0,u=u+Math.imul(it,G)|0,m=m+Math.imul(it,H)|0,b=b+Math.imul(O,V)|0,u=u+Math.imul(O,tt)|0,u=u+Math.imul(F,V)|0,m=m+Math.imul(F,tt)|0,b=b+Math.imul(kt,at)|0,u=u+Math.imul(kt,ht)|0,u=u+Math.imul(S,at)|0,m=m+Math.imul(S,ht)|0;var Jt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,b=Math.imul(te,Lt),u=Math.imul(te,Et),u=u+Math.imul(Ut,Lt)|0,m=Math.imul(Ut,Et),b=b+Math.imul(Rt,Bt)|0,u=u+Math.imul(Rt,Mt)|0,u=u+Math.imul(Dt,Bt)|0,m=m+Math.imul(Dt,Mt)|0,b=b+Math.imul(It,G)|0,u=u+Math.imul(It,H)|0,u=u+Math.imul(xt,G)|0,m=m+Math.imul(xt,H)|0,b=b+Math.imul(Q,V)|0,u=u+Math.imul(Q,tt)|0,u=u+Math.imul(it,V)|0,m=m+Math.imul(it,tt)|0,b=b+Math.imul(O,at)|0,u=u+Math.imul(O,ht)|0,u=u+Math.imul(F,at)|0,m=m+Math.imul(F,ht)|0;var le=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(le>>>26)|0,le&=67108863,b=Math.imul(te,Bt),u=Math.imul(te,Mt),u=u+Math.imul(Ut,Bt)|0,m=Math.imul(Ut,Mt),b=b+Math.imul(Rt,G)|0,u=u+Math.imul(Rt,H)|0,u=u+Math.imul(Dt,G)|0,m=m+Math.imul(Dt,H)|0,b=b+Math.imul(It,V)|0,u=u+Math.imul(It,tt)|0,u=u+Math.imul(xt,V)|0,m=m+Math.imul(xt,tt)|0,b=b+Math.imul(Q,at)|0,u=u+Math.imul(Q,ht)|0,u=u+Math.imul(it,at)|0,m=m+Math.imul(it,ht)|0;var ae=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ae>>>26)|0,ae&=67108863,b=Math.imul(te,G),u=Math.imul(te,H),u=u+Math.imul(Ut,G)|0,m=Math.imul(Ut,H),b=b+Math.imul(Rt,V)|0,u=u+Math.imul(Rt,tt)|0,u=u+Math.imul(Dt,V)|0,m=m+Math.imul(Dt,tt)|0,b=b+Math.imul(It,at)|0,u=u+Math.imul(It,ht)|0,u=u+Math.imul(xt,at)|0,m=m+Math.imul(xt,ht)|0;var ne=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ne>>>26)|0,ne&=67108863,b=Math.imul(te,V),u=Math.imul(te,tt),u=u+Math.imul(Ut,V)|0,m=Math.imul(Ut,tt),b=b+Math.imul(Rt,at)|0,u=u+Math.imul(Rt,ht)|0,u=u+Math.imul(Dt,at)|0,m=m+Math.imul(Dt,ht)|0;var Ot=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,b=Math.imul(te,at),u=Math.imul(te,ht),u=u+Math.imul(Ut,at)|0,m=Math.imul(Ut,ht);var Nt=(I+b|0)+((u&8191)<<13)|0;return I=(m+(u>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,A[0]=zt,A[1]=Zt,A[2]=ye,A[3]=Yt,A[4]=pe,A[5]=ve,A[6]=ge,A[7]=ie,A[8]=ue,A[9]=fe,A[10]=ce,A[11]=$t,A[12]=oe,A[13]=Jt,A[14]=le,A[15]=ae,A[16]=ne,A[17]=Ot,A[18]=Nt,I!==0&&(A[19]=I,f.length++),f};Math.imul||(k=_);function B(d,o,a){a.negative=o.negative^d.negative,a.length=d.length+o.length;for(var f=0,h=0,g=0;g>>26)|0,h+=A>>>26,A&=67108863}a.words[g]=I,f=A,A=h}return f!==0?a.words[g]=f:a.length--,a.strip()}function P(d,o,a){var f=new R;return f.mulp(d,o,a)}i.prototype.mulTo=function(o,a){var f,h=this.length+o.length;return this.length===10&&o.length===10?f=k(this,o,a):h<63?f=_(this,o,a):h<1024?f=B(this,o,a):f=P(this,o,a),f};function R(d,o){this.x=d,this.y=o}R.prototype.makeRBT=function(o){for(var a=new Array(o),f=i.prototype._countBits(o)-1,h=0;h>=1;return h},R.prototype.permute=function(o,a,f,h,g,A){for(var I=0;I>>1)g++;return 1<>>13,f[2*A+1]=g&8191,g=g>>>13;for(A=2*a;A>=26,a+=h/67108864|0,a+=g>>>26,this.words[f]=g&67108863}return a!==0&&(this.words[f]=a,this.length++),this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var a=w(o);if(a.length===0)return new i(1);for(var f=this,h=0;h=0);var a=o%26,f=(o-a)/26,h=67108863>>>26-a<<26-a,g;if(a!==0){var A=0;for(g=0;g>>26-a}A&&(this.words[g]=A,this.length++)}if(f!==0){for(g=this.length-1;g>=0;g--)this.words[g+f]=this.words[g];for(g=0;g=0);var h;a?h=(a-a%26)/26:h=0;var g=o%26,A=Math.min((o-g)/26,this.length),I=67108863^67108863>>>g<A)for(this.length-=A,u=0;u=0&&(m!==0||u>=h);u--){var L=this.words[u]|0;this.words[u]=m<<26-g|L>>>g,m=L&I}return b&&m!==0&&(b.words[b.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,a,f){return n(this.negative===0),this.iushrn(o,a,f)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var a=o%26,f=(o-a)/26,h=1<=0);var a=o%26,f=(o-a)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(a!==0&&f++,this.length=Math.min(f,this.length),a!==0){var h=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},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(b/67108864|0),this.words[g+f]=A&67108863}for(;g>26,this.words[g+f]=A&67108863;if(I===0)return this.strip();for(n(I===-1),I=0,g=0;g>26,this.words[g]=A&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,a){var f=this.length-o.length,h=this.clone(),g=o,A=g.words[g.length-1]|0,I=this._countBits(A);f=26-I,f!==0&&(g=g.ushln(f),h.iushln(f),A=g.words[g.length-1]|0);var b=h.length-g.length,u;if(a!=="mod"){u=new i(null),u.length=b+1,u.words=new Array(u.length);for(var m=0;m=0;q--){var z=(h.words[g.length+q]|0)*67108864+(h.words[g.length+q-1]|0);for(z=Math.min(z/A|0,67108863),h._ishlnsubmul(g,z,q);h.negative!==0;)z--,h.negative=0,h._ishlnsubmul(g,1,q),h.isZero()||(h.negative^=1);u&&(u.words[q]=z)}return u&&u.strip(),h.strip(),a!=="div"&&f!==0&&h.iushrn(f),{div:u||null,mod:h}},i.prototype.divmod=function(o,a,f){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,g,A;return this.negative!==0&&o.negative===0?(A=this.neg().divmod(o,a),a!=="mod"&&(h=A.div.neg()),a!=="div"&&(g=A.mod.neg(),f&&g.negative!==0&&g.iadd(o)),{div:h,mod:g}):this.negative===0&&o.negative!==0?(A=this.divmod(o.neg(),a),a!=="mod"&&(h=A.div.neg()),{div:h,mod:A.mod}):this.negative&o.negative?(A=this.neg().divmod(o.neg(),a),a!=="div"&&(g=A.mod.neg(),f&&g.negative!==0&&g.isub(o)),{div:A.div,mod:g}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?a==="div"?{div:this.divn(o.words[0]),mod:null}:a==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,a)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var a=this.divmod(o);if(a.mod.isZero())return a.div;var f=a.div.negative!==0?a.mod.isub(o):a.mod,h=o.ushrn(1),g=o.andln(1),A=f.cmp(h);return A<0||g===1&&A===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var a=(1<<26)%o,f=0,h=this.length-1;h>=0;h--)f=(a*f+(this.words[h]|0))%o;return f},i.prototype.idivn=function(o){n(o<=67108863);for(var a=0,f=this.length-1;f>=0;f--){var h=(this.words[f]|0)+a*67108864;this.words[f]=h/o|0,a=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),A=new i(0),I=new i(1),b=0;a.isEven()&&f.isEven();)a.iushrn(1),f.iushrn(1),++b;for(var u=f.clone(),m=a.clone();!a.isZero();){for(var L=0,q=1;!(a.words[0]&q)&&L<26;++L,q<<=1);if(L>0)for(a.iushrn(L);L-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(u),g.isub(m)),h.iushrn(1),g.iushrn(1);for(var z=0,W=1;!(f.words[0]&W)&&z<26;++z,W<<=1);if(z>0)for(f.iushrn(z);z-- >0;)(A.isOdd()||I.isOdd())&&(A.iadd(u),I.isub(m)),A.iushrn(1),I.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(A),g.isub(I)):(f.isub(a),A.isub(h),I.isub(g))}return{a:A,b:I,gcd:f.iushln(b)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),A=f.clone();a.cmpn(1)>0&&f.cmpn(1)>0;){for(var I=0,b=1;!(a.words[0]&b)&&I<26;++I,b<<=1);if(I>0)for(a.iushrn(I);I-- >0;)h.isOdd()&&h.iadd(A),h.iushrn(1);for(var u=0,m=1;!(f.words[0]&m)&&u<26;++u,m<<=1);if(u>0)for(f.iushrn(u);u-- >0;)g.isOdd()&&g.iadd(A),g.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(g)):(f.isub(a),g.isub(h))}var L;return a.cmpn(1)===0?L=h:L=g,L.cmpn(0)<0&&L.iadd(o),L},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var a=this.clone(),f=o.clone();a.negative=0,f.negative=0;for(var h=0;a.isEven()&&f.isEven();h++)a.iushrn(1),f.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;f.isEven();)f.iushrn(1);var g=a.cmp(f);if(g<0){var A=a;a=f,f=A}else if(g===0||f.cmpn(1)===0)break;a.isub(f)}while(!0);return f.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var a=o%26,f=(o-a)/26,h=1<>>26,I&=67108863,this.words[A]=I}return g!==0&&(this.words[A]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var a=o<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this.strip();var f;if(this.length>1)f=1;else{a&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;f=h===o?0:ho.length)return 1;if(this.length=0;f--){var h=this.words[f]|0,g=o.words[f]|0;if(h!==g){hg&&(a=1);break}}return a},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new Z(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var T={k256:null,p224:null,p192:null,p25519:null};function U(d,o){this.name=d,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},U.prototype.ireduce=function(o){var a=o,f;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),f=a.bitLength();while(f>this.n);var h=f0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},U.prototype.split=function(o,a){o.iushrn(this.n,0,a)},U.prototype.imulK=function(o){return o.imul(this.k)};function j(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(j,U),j.prototype.split=function(o,a){for(var f=4194303,h=Math.min(o.length,9),g=0;g>>22,A=I}A>>>=22,o.words[g-10]=A,A===0&&o.length>10?o.length-=10:o.length-=9},j.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var a=0,f=0;f>>=26,o.words[f]=g,a=h}return a!==0&&(o.words[o.length++]=a),o},i._prime=function(o){if(T[o])return T[o];var a;if(o==="k256")a=new j;else if(o==="p224")a=new Y;else if(o==="p192")a=new rt;else if(o==="p25519")a=new nt;else throw new Error("Unknown prime "+o);return T[o]=a,a};function Z(d){if(typeof d=="string"){var o=i._prime(d);this.m=o.p,this.prime=o}else n(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}Z.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},Z.prototype._verify2=function(o,a){n((o.negative|a.negative)===0,"red works only with positives"),n(o.red&&o.red===a.red,"red works only with red numbers")},Z.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},Z.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},Z.prototype.add=function(o,a){this._verify2(o,a);var f=o.add(a);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},Z.prototype.iadd=function(o,a){this._verify2(o,a);var f=o.iadd(a);return f.cmp(this.m)>=0&&f.isub(this.m),f},Z.prototype.sub=function(o,a){this._verify2(o,a);var f=o.sub(a);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},Z.prototype.isub=function(o,a){this._verify2(o,a);var f=o.isub(a);return f.cmpn(0)<0&&f.iadd(this.m),f},Z.prototype.shl=function(o,a){return this._verify1(o),this.imod(o.ushln(a))},Z.prototype.imul=function(o,a){return this._verify2(o,a),this.imod(o.imul(a))},Z.prototype.mul=function(o,a){return this._verify2(o,a),this.imod(o.mul(a))},Z.prototype.isqr=function(o){return this.imul(o,o.clone())},Z.prototype.sqr=function(o){return this.mul(o,o)},Z.prototype.sqrt=function(o){if(o.isZero())return o.clone();var a=this.m.andln(3);if(n(a%2===1),a===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(o,f)}for(var h=this.m.subn(1),g=0;!h.isZero()&&h.andln(1)===0;)g++,h.iushrn(1);n(!h.isZero());var A=new i(1).toRed(this),I=A.redNeg(),b=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,b).cmp(I)!==0;)u.redIAdd(I);for(var m=this.pow(u,h),L=this.pow(o,h.addn(1).iushrn(1)),q=this.pow(o,h),z=g;q.cmp(A)!==0;){for(var W=q,ot=0;W.cmp(A)!==0;ot++)W=W.redSqr();n(ot=0;g--){for(var m=a.words[g],L=u-1;L>=0;L--){var q=m>>L&1;if(A!==h[0]&&(A=this.sqr(A)),q===0&&I===0){b=0;continue}I<<=1,I|=q,b++,!(b!==f&&(g!==0||L!==0))&&(A=this.mul(A,h[I]),b=0,I=0)}u=26}return A},Z.prototype.convertTo=function(o){var a=o.umod(this.m);return a===o?a.clone():a},Z.prototype.convertFrom=function(o){var a=o.clone();return a.red=null,a},i.mont=function(o){return new x(o)};function x(d){Z.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(x,Z),x.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},x.prototype.convertFrom=function(o){var a=this.imod(o.mul(this.rinv));return a.red=null,a},x.prototype.imul=function(o,a){if(o.isZero()||a.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),A=g;return g.cmp(this.m)>=0?A=g.isub(this.m):g.cmpn(0)<0&&(A=g.iadd(this.m)),A._forceRed(this)},x.prototype.mul=function(o,a){if(o.isZero()||a.isZero())return new i(0)._forceRed(this);var f=o.mul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),A=g;return g.cmp(this.m)>=0?A=g.isub(this.m):g.cmpn(0)<0&&(A=g.iadd(this.m)),A._forceRed(this)},x.prototype.invm=function(o){var a=this.imod(o._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(r,Re)}(Q0)),Q0.exports}var sp={},ap={},up,Ww;function Pg(){if(Ww)return up;Ww=1;var r=yr,t=r.Buffer,e={},n;for(n in r)r.hasOwnProperty(n)&&(n==="SlowBuffer"||n==="Buffer"||(e[n]=r[n]));var s=e.Buffer={};for(n in t)t.hasOwnProperty(n)&&(n==="allocUnsafe"||n==="allocUnsafeSlow"||(s[n]=t[n]));if(e.Buffer.prototype=t.prototype,(!s.from||s.from===Uint8Array.from)&&(s.from=function(i,c,l){if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type '+typeof i);if(i&&typeof i.length>"u")throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);return t(i,c,l)}),s.alloc||(s.alloc=function(i,c,l){if(typeof i!="number")throw new TypeError('The "size" argument must be of type number. Received type '+typeof i);if(i<0||i>=2*(1<<30))throw new RangeError('The value "'+i+'" is invalid for option "size"');var p=t(i);return!c||c.length===0?p.fill(0):typeof l=="string"?p.fill(c,l):p.fill(c),p}),!e.kStringMaxLength)try{e.kStringMaxLength=Gt.process.binding("buffer").kStringMaxLength}catch{}return e.constants||(e.constants={MAX_LENGTH:e.kMaxLength},e.kStringMaxLength&&(e.constants.MAX_STRING_LENGTH=e.kStringMaxLength)),up=e,up}var fp={},Gw;function Rg(){if(Gw)return fp;Gw=1;const r=br;function t(n){this._reporterState={obj:null,path:[],options:n||{},errors:[]}}fp.Reporter=t,t.prototype.isError=function(s){return s instanceof e},t.prototype.save=function(){const s=this._reporterState;return{obj:s.obj,pathLen:s.path.length}},t.prototype.restore=function(s){const i=this._reporterState;i.obj=s.obj,i.path=i.path.slice(0,s.pathLen)},t.prototype.enterKey=function(s){return this._reporterState.path.push(s)},t.prototype.exitKey=function(s){const i=this._reporterState;i.path=i.path.slice(0,s-1)},t.prototype.leaveKey=function(s,i,c){const l=this._reporterState;this.exitKey(s),l.obj!==null&&(l.obj[i]=c)},t.prototype.path=function(){return this._reporterState.path.join("/")},t.prototype.enterObject=function(){const s=this._reporterState,i=s.obj;return s.obj={},i},t.prototype.leaveObject=function(s){const i=this._reporterState,c=i.obj;return i.obj=s,c},t.prototype.error=function(s){let i;const c=this._reporterState,l=s instanceof e;if(l?i=s:i=new e(c.path.map(function(p){return"["+JSON.stringify(p)+"]"}).join(""),s.message||s,s.stack),!c.options.partial)throw i;return l||c.errors.push(i),i},t.prototype.wrapResult=function(s){const i=this._reporterState;return i.options.partial?{result:this.isError(s)?null:s,errors:i.errors}:s};function e(n,s){this.path=n,this.rethrow(s)}return r(e,Error),e.prototype.rethrow=function(s){if(this.message=s+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,e),!this.stack)try{throw new Error(this.message)}catch(i){this.stack=i.stack}return this},fp}var l0={},Yw;function Zc(){if(Yw)return l0;Yw=1;const r=br,t=Rg().Reporter,e=Pg().Buffer;function n(i,c){if(t.call(this,c),!e.isBuffer(i)){this.error("Input not Buffer");return}this.base=i,this.offset=0,this.length=i.length}r(n,t),l0.DecoderBuffer=n,n.isDecoderBuffer=function(c){return c instanceof n?!0:typeof c=="object"&&e.isBuffer(c.base)&&c.constructor.name==="DecoderBuffer"&&typeof c.offset=="number"&&typeof c.length=="number"&&typeof c.save=="function"&&typeof c.restore=="function"&&typeof c.isEmpty=="function"&&typeof c.readUInt8=="function"&&typeof c.skip=="function"&&typeof c.raw=="function"},n.prototype.save=function(){return{offset:this.offset,reporter:t.prototype.save.call(this)}},n.prototype.restore=function(c){const l=new n(this.base);return l.offset=c.offset,l.length=this.offset,this.offset=c.offset,t.prototype.restore.call(this,c.reporter),l},n.prototype.isEmpty=function(){return this.offset===this.length},n.prototype.readUInt8=function(c){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(c||"DecoderBuffer overrun")},n.prototype.skip=function(c,l){if(!(this.offset+c<=this.length))return this.error(l||"DecoderBuffer overrun");const p=new n(this.base);return p._reporterState=this._reporterState,p.offset=this.offset,p.length=this.offset+c,this.offset+=c,p},n.prototype.raw=function(c){return this.base.slice(c?c.offset:this.offset,this.length)};function s(i,c){if(Array.isArray(i))this.length=0,this.value=i.map(function(l){return s.isEncoderBuffer(l)||(l=new s(l,c)),this.length+=l.length,l},this);else if(typeof i=="number"){if(!(0<=i&&i<=255))return c.error("non-byte EncoderBuffer value");this.value=i,this.length=1}else if(typeof i=="string")this.value=i,this.length=e.byteLength(i);else if(e.isBuffer(i))this.value=i,this.length=i.length;else return c.error("Unsupported type: "+typeof i)}return l0.EncoderBuffer=s,s.isEncoderBuffer=function(c){return c instanceof s?!0:typeof c=="object"&&c.constructor.name==="EncoderBuffer"&&typeof c.length=="number"&&typeof c.join=="function"},s.prototype.join=function(c,l){return c||(c=e.alloc(this.length)),l||(l=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(p){p.join(c,l),l+=p.length}):(typeof this.value=="number"?c[l]=this.value:typeof this.value=="string"?c.write(this.value,l):e.isBuffer(this.value)&&this.value.copy(c,l),l+=this.length)),c},l0}var cp,Xw;function Cg(){if(Xw)return cp;Xw=1;const r=Rg().Reporter,t=Zc().EncoderBuffer,e=Zc().DecoderBuffer,n=Ji,s=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],i=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s),c=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function l(v,y,E){const M={};this._baseState=M,M.name=E,M.enc=v,M.parent=y||null,M.children=null,M.tag=null,M.args=null,M.reverseArgs=null,M.choice=null,M.optional=!1,M.any=!1,M.obj=!1,M.use=null,M.useDecoder=null,M.key=null,M.default=null,M.explicit=null,M.implicit=null,M.contains=null,M.parent||(M.children=[],this._wrap())}cp=l;const p=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];return l.prototype.clone=function(){const y=this._baseState,E={};p.forEach(function(w){E[w]=y[w]});const M=new this.constructor(E.parent);return M._baseState=E,M},l.prototype._wrap=function(){const y=this._baseState;i.forEach(function(E){this[E]=function(){const w=new this.constructor(this);return y.children.push(w),w[E].apply(w,arguments)}},this)},l.prototype._init=function(y){const E=this._baseState;n(E.parent===null),y.call(this),E.children=E.children.filter(function(M){return M._baseState.parent===this},this),n.equal(E.children.length,1,"Root node can have only one child")},l.prototype._useArgs=function(y){const E=this._baseState,M=y.filter(function(w){return w instanceof this.constructor},this);y=y.filter(function(w){return!(w instanceof this.constructor)},this),M.length!==0&&(n(E.children===null),E.children=M,M.forEach(function(w){w._baseState.parent=this},this)),y.length!==0&&(n(E.args===null),E.args=y,E.reverseArgs=y.map(function(w){if(typeof w!="object"||w.constructor!==Object)return w;const _={};return Object.keys(w).forEach(function(k){k==(k|0)&&(k|=0);const B=w[k];_[B]=k}),_}))},c.forEach(function(v){l.prototype[v]=function(){const E=this._baseState;throw new Error(v+" not implemented for encoding: "+E.enc)}}),s.forEach(function(v){l.prototype[v]=function(){const E=this._baseState,M=Array.prototype.slice.call(arguments);return n(E.tag===null),E.tag=v,this._useArgs(M),this}}),l.prototype.use=function(y){n(y);const E=this._baseState;return n(E.use===null),E.use=y,this},l.prototype.optional=function(){const y=this._baseState;return y.optional=!0,this},l.prototype.def=function(y){const E=this._baseState;return n(E.default===null),E.default=y,E.optional=!0,this},l.prototype.explicit=function(y){const E=this._baseState;return n(E.explicit===null&&E.implicit===null),E.explicit=y,this},l.prototype.implicit=function(y){const E=this._baseState;return n(E.explicit===null&&E.implicit===null),E.implicit=y,this},l.prototype.obj=function(){const y=this._baseState,E=Array.prototype.slice.call(arguments);return y.obj=!0,E.length!==0&&this._useArgs(E),this},l.prototype.key=function(y){const E=this._baseState;return n(E.key===null),E.key=y,this},l.prototype.any=function(){const y=this._baseState;return y.any=!0,this},l.prototype.choice=function(y){const E=this._baseState;return n(E.choice===null),E.choice=y,this._useArgs(Object.keys(y).map(function(M){return y[M]})),this},l.prototype.contains=function(y){const E=this._baseState;return n(E.use===null),E.contains=y,this},l.prototype._decode=function(y,E){const M=this._baseState;if(M.parent===null)return y.wrapResult(M.children[0]._decode(y,E));let w=M.default,_=!0,k=null;if(M.key!==null&&(k=y.enterKey(M.key)),M.optional){let P=null;if(M.explicit!==null?P=M.explicit:M.implicit!==null?P=M.implicit:M.tag!==null&&(P=M.tag),P===null&&!M.any){const R=y.save();try{M.choice===null?this._decodeGeneric(M.tag,y,E):this._decodeChoice(y,E),_=!0}catch{_=!1}y.restore(R)}else if(_=this._peekTag(y,P,M.any),y.isError(_))return _}let B;if(M.obj&&_&&(B=y.enterObject()),_){if(M.explicit!==null){const R=this._decodeTag(y,M.explicit);if(y.isError(R))return R;y=R}const P=y.offset;if(M.use===null&&M.choice===null){let R;M.any&&(R=y.save());const T=this._decodeTag(y,M.implicit!==null?M.implicit:M.tag,M.any);if(y.isError(T))return T;M.any?w=y.raw(R):y=T}if(E&&E.track&&M.tag!==null&&E.track(y.path(),P,y.length,"tagged"),E&&E.track&&M.tag!==null&&E.track(y.path(),y.offset,y.length,"content"),M.any||(M.choice===null?w=this._decodeGeneric(M.tag,y,E):w=this._decodeChoice(y,E)),y.isError(w))return w;if(!M.any&&M.choice===null&&M.children!==null&&M.children.forEach(function(T){T._decode(y,E)}),M.contains&&(M.tag==="octstr"||M.tag==="bitstr")){const R=new e(w);w=this._getUse(M.contains,y._reporterState.obj)._decode(R,E)}}return M.obj&&_&&(w=y.leaveObject(B)),M.key!==null&&(w!==null||_===!0)?y.leaveKey(k,M.key,w):k!==null&&y.exitKey(k),w},l.prototype._decodeGeneric=function(y,E,M){const w=this._baseState;return y==="seq"||y==="set"?null:y==="seqof"||y==="setof"?this._decodeList(E,y,w.args[0],M):/str$/.test(y)?this._decodeStr(E,y,M):y==="objid"&&w.args?this._decodeObjid(E,w.args[0],w.args[1],M):y==="objid"?this._decodeObjid(E,null,null,M):y==="gentime"||y==="utctime"?this._decodeTime(E,y,M):y==="null_"?this._decodeNull(E,M):y==="bool"?this._decodeBool(E,M):y==="objDesc"?this._decodeStr(E,y,M):y==="int"||y==="enum"?this._decodeInt(E,w.args&&w.args[0],M):w.use!==null?this._getUse(w.use,E._reporterState.obj)._decode(E,M):E.error("unknown tag: "+y)},l.prototype._getUse=function(y,E){const M=this._baseState;return M.useDecoder=this._use(y,E),n(M.useDecoder._baseState.parent===null),M.useDecoder=M.useDecoder._baseState.children[0],M.implicit!==M.useDecoder._baseState.implicit&&(M.useDecoder=M.useDecoder.clone(),M.useDecoder._baseState.implicit=M.implicit),M.useDecoder},l.prototype._decodeChoice=function(y,E){const M=this._baseState;let w=null,_=!1;return Object.keys(M.choice).some(function(k){const B=y.save(),P=M.choice[k];try{const R=P._decode(y,E);if(y.isError(R))return!1;w={type:k,value:R},_=!0}catch{return y.restore(B),!1}return!0},this),_?w:y.error("Choice not matched")},l.prototype._createEncoderBuffer=function(y){return new t(y,this.reporter)},l.prototype._encode=function(y,E,M){const w=this._baseState;if(w.default!==null&&w.default===y)return;const _=this._encodeValue(y,E,M);if(_!==void 0&&!this._skipDefault(_,E,M))return _},l.prototype._encodeValue=function(y,E,M){const w=this._baseState;if(w.parent===null)return w.children[0]._encode(y,E||new r);let _=null;if(this.reporter=E,w.optional&&y===void 0)if(w.default!==null)y=w.default;else return;let k=null,B=!1;if(w.any)_=this._createEncoderBuffer(y);else if(w.choice)_=this._encodeChoice(y,E);else if(w.contains)k=this._getUse(w.contains,M)._encode(y,E),B=!0;else if(w.children)k=w.children.map(function(P){if(P._baseState.tag==="null_")return P._encode(null,E,y);if(P._baseState.key===null)return E.error("Child should have a key");const R=E.enterKey(P._baseState.key);if(typeof y!="object")return E.error("Child expected, but input is not object");const T=P._encode(y[P._baseState.key],E,y);return E.leaveKey(R),T},this).filter(function(P){return P}),k=this._createEncoderBuffer(k);else if(w.tag==="seqof"||w.tag==="setof"){if(!(w.args&&w.args.length===1))return E.error("Too many args for : "+w.tag);if(!Array.isArray(y))return E.error("seqof/setof, but data is not Array");const P=this.clone();P._baseState.implicit=null,k=this._createEncoderBuffer(y.map(function(R){const T=this._baseState;return this._getUse(T.args[0],y)._encode(R,E)},P))}else w.use!==null?_=this._getUse(w.use,M)._encode(y,E):(k=this._encodePrimitive(w.tag,y),B=!0);if(!w.any&&w.choice===null){const P=w.implicit!==null?w.implicit:w.tag,R=w.implicit===null?"universal":"context";P===null?w.use===null&&E.error("Tag could be omitted only for .use()"):w.use===null&&(_=this._encodeComposite(P,B,R,k))}return w.explicit!==null&&(_=this._encodeComposite(w.explicit,!1,"context",_)),_},l.prototype._encodeChoice=function(y,E){const M=this._baseState,w=M.choice[y.type];return w||n(!1,y.type+" not found in "+JSON.stringify(Object.keys(M.choice))),w._encode(y.value,E)},l.prototype._encodePrimitive=function(y,E){const M=this._baseState;if(/str$/.test(y))return this._encodeStr(E,y);if(y==="objid"&&M.args)return this._encodeObjid(E,M.reverseArgs[0],M.args[1]);if(y==="objid")return this._encodeObjid(E,null,null);if(y==="gentime"||y==="utctime")return this._encodeTime(E,y);if(y==="null_")return this._encodeNull();if(y==="int"||y==="enum")return this._encodeInt(E,M.args&&M.reverseArgs[0]);if(y==="bool")return this._encodeBool(E);if(y==="objDesc")return this._encodeStr(E,y);throw new Error("Unsupported tag: "+y)},l.prototype._isNumstr=function(y){return/^[0-9 ]*$/.test(y)},l.prototype._isPrintstr=function(y){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(y)},cp}var hp={},Jw;function Tg(){return Jw||(Jw=1,function(r){function t(e){const n={};return Object.keys(e).forEach(function(s){(s|0)==s&&(s=s|0);const i=e[s];n[i]=s}),n}r.tagClass={0:"universal",1:"application",2:"context",3:"private"},r.tagClassByName=t(r.tagClass),r.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},r.tagByName=t(r.tag)}(hp)),hp}var lp,Qw;function r9(){if(Qw)return lp;Qw=1;const r=br,t=Pg().Buffer,e=Cg(),n=Tg();function s(p){this.enc="der",this.name=p.name,this.entity=p,this.tree=new i,this.tree._init(p.body)}lp=s,s.prototype.encode=function(v,y){return this.tree._encode(v,y).join()};function i(p){e.call(this,"der",p)}r(i,e),i.prototype._encodeComposite=function(v,y,E,M){const w=l(v,y,E,this.reporter);if(M.length<128){const B=t.alloc(2);return B[0]=w,B[1]=M.length,this._createEncoderBuffer([B,M])}let _=1;for(let B=M.length;B>=256;B>>=8)_++;const k=t.alloc(1+1+_);k[0]=w,k[1]=128|_;for(let B=1+_,P=M.length;P>0;B--,P>>=8)k[B]=P&255;return this._createEncoderBuffer([k,M])},i.prototype._encodeStr=function(v,y){if(y==="bitstr")return this._createEncoderBuffer([v.unused|0,v.data]);if(y==="bmpstr"){const E=t.alloc(v.length*2);for(let M=0;M=40)return this.reporter.error("Second objid identifier OOB");v.splice(0,2,v[0]*40+v[1])}let M=0;for(let k=0;k=128;B>>=7)M++}const w=t.alloc(M);let _=w.length-1;for(let k=v.length-1;k>=0;k--){let B=v[k];for(w[_--]=B&127;(B>>=7)>0;)w[_--]=128|B&127}return this._createEncoderBuffer(w)};function c(p){return p<10?"0"+p:p}i.prototype._encodeTime=function(v,y){let E;const M=new Date(v);return y==="gentime"?E=[c(M.getUTCFullYear()),c(M.getUTCMonth()+1),c(M.getUTCDate()),c(M.getUTCHours()),c(M.getUTCMinutes()),c(M.getUTCSeconds()),"Z"].join(""):y==="utctime"?E=[c(M.getUTCFullYear()%100),c(M.getUTCMonth()+1),c(M.getUTCDate()),c(M.getUTCHours()),c(M.getUTCMinutes()),c(M.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+y+" time is not supported yet"),this._encodeStr(E,"octstr")},i.prototype._encodeNull=function(){return this._createEncoderBuffer("")},i.prototype._encodeInt=function(v,y){if(typeof v=="string"){if(!y)return this.reporter.error("String int or enum given, but no values map");if(!y.hasOwnProperty(v))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(v));v=y[v]}if(typeof v!="number"&&!t.isBuffer(v)){const w=v.toArray();!v.sign&&w[0]&128&&w.unshift(0),v=t.from(w)}if(t.isBuffer(v)){let w=v.length;v.length===0&&w++;const _=t.alloc(w);return v.copy(_),v.length===0&&(_[0]=0),this._createEncoderBuffer(_)}if(v<128)return this._createEncoderBuffer(v);if(v<256)return this._createEncoderBuffer([0,v]);let E=1;for(let w=v;w>=256;w>>=8)E++;const M=new Array(E);for(let w=M.length-1;w>=0;w--)M[w]=v&255,v>>=8;return M[0]&128&&M.unshift(0),this._createEncoderBuffer(t.from(M))},i.prototype._encodeBool=function(v){return this._createEncoderBuffer(v?255:0)},i.prototype._use=function(v,y){return typeof v=="function"&&(v=v(y)),v._getEncoder("der").tree},i.prototype._skipDefault=function(v,y,E){const M=this._baseState;let w;if(M.default===null)return!1;const _=v.join();if(M.defaultBuffer===void 0&&(M.defaultBuffer=this._encodeValue(M.default,y,E).join()),_.length!==M.defaultBuffer.length)return!1;for(w=0;w<_.length;w++)if(_[w]!==M.defaultBuffer[w])return!1;return!0};function l(p,v,y,E){let M;if(p==="seqof"?p="seq":p==="setof"&&(p="set"),n.tagByName.hasOwnProperty(p))M=n.tagByName[p];else if(typeof p=="number"&&(p|0)===p)M=p;else return E.error("Unknown tag: "+p);return M>=31?E.error("Multi-octet tag encoding unsupported"):(v||(M|=32),M|=n.tagClassByName[y||"universal"]<<6,M)}return lp}var dp,t6;function gC(){if(t6)return dp;t6=1;const r=br,t=r9();function e(n){t.call(this,n),this.enc="pem"}return r(e,t),dp=e,e.prototype.encode=function(s,i){const l=t.prototype.encode.call(this,s).toString("base64"),p=["-----BEGIN "+i.label+"-----"];for(let v=0;v>6],w=(E&32)===0;if((E&31)===31){let k=E;for(E=0;(k&128)===128;){if(k=v.readUInt8(y),v.isError(k))return k;E<<=7,E|=k&127}}else E&=31;const _=s.tag[E];return{cls:M,primitive:w,tag:E,tagStr:_}}function p(v,y,E){let M=v.readUInt8(E);if(v.isError(M))return M;if(!y&&M===128)return null;if(!(M&128))return M;const w=M&127;if(w>4)return v.error("length octect is too long");M=0;for(let _=0;_0&&T.ishrn(U),T}function _(P,R){P=w(P,R),P=P.mod(R);var T=r.from(P.toArray());if(T.length=0)throw new Error("invalid sig")}return _p=i,_p}var Mp,m6;function IC(){if(m6)return Mp;m6=1;var r=sr.Buffer,t=Ch,e=J7,n=br,s=SC(),i=kC(),c=v_;Object.keys(c).forEach(function(E){c[E].id=r.from(c[E].id,"hex"),c[E.toLowerCase()]=c[E]});function l(E){e.Writable.call(this);var M=c[E];if(!M)throw new Error("Unknown message digest");this._hashType=M.hash,this._hash=t(M.hash),this._tag=M.id,this._signType=M.sign}n(l,e.Writable),l.prototype._write=function(M,w,_){this._hash.update(M),_()},l.prototype.update=function(M,w){return this._hash.update(typeof M=="string"?r.from(M,w):M),this},l.prototype.sign=function(M,w){this.end();var _=this._hash.digest(),k=s(_,M,this._hashType,this._signType,this._tag);return w?k.toString(w):k};function p(E){e.Writable.call(this);var M=c[E];if(!M)throw new Error("Unknown message digest");this._hash=t(M.hash),this._tag=M.id,this._signType=M.sign}n(p,e.Writable),p.prototype._write=function(M,w,_){this._hash.update(M),_()},p.prototype.update=function(M,w){return this._hash.update(typeof M=="string"?r.from(M,w):M),this},p.prototype.verify=function(M,w,_){var k=typeof w=="string"?r.from(w,_):w;this.end();var B=this._hash.digest();return i(k,B,M,this._signType,this._tag)};function v(E){return new l(E)}function y(E){return new p(E)}return Mp={Sign:v,Verify:y,createSign:v,createVerify:y},Mp}var tl={exports:{}};tl.exports;var v6;function BC(){return v6||(v6=1,function(r){(function(t,e){function n(d,o){if(!d)throw new Error(o||"Assertion failed")}function s(d,o){d.super_=o;var a=function(){};a.prototype=o.prototype,d.prototype=new a,d.prototype.constructor=d}function i(d,o,a){if(i.isBN(d))return d;this.negative=0,this.words=null,this.length=0,this.red=null,d!==null&&((o==="le"||o==="be")&&(a=o,o=10),this._init(d||0,o||10,a||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=yr.Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,a){return o.cmp(a)>0?o:a},i.min=function(o,a){return o.cmp(a)<0?o:a},i.prototype._init=function(o,a,f){if(typeof o=="number")return this._initNumber(o,a,f);if(typeof o=="object")return this._initArray(o,a,f);a==="hex"&&(a=16),n(a===(a|0)&&a>=2&&a<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h=0;h-=3)A=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[g]|=A<>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);else if(f==="le")for(h=0,g=0;h>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);return this.strip()};function l(d,o){var a=d.charCodeAt(o);return a>=65&&a<=70?a-55:a>=97&&a<=102?a-87:a-48&15}function p(d,o,a){var f=l(d,a);return a-1>=o&&(f|=l(d,a-1)<<4),f}i.prototype._parseHex=function(o,a,f){this.length=Math.ceil((o.length-a)/6),this.words=new Array(this.length);for(var h=0;h=a;h-=2)I=p(o,a,h)<=18?(g-=18,A+=1,this.words[A]|=I>>>26):g+=8;else{var b=o.length-a;for(h=b%2===0?a+1:a;h=18?(g-=18,A+=1,this.words[A]|=I>>>26):g+=8}this.strip()};function v(d,o,a,f){for(var h=0,g=Math.min(d.length,a),A=o;A=49?h+=I-49+10:I>=17?h+=I-17+10:h+=I}return h}i.prototype._parseBase=function(o,a,f){this.words=[0],this.length=1;for(var h=0,g=1;g<=67108863;g*=a)h++;h--,g=g/a|0;for(var A=o.length-f,I=A%h,b=Math.min(A,A-I)+f,u=0,m=f;m1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var y=["","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"],E=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(o,a){o=o||10,a=a|0||1;var f;if(o===16||o==="hex"){f="";for(var h=0,g=0,A=0;A>>24-h&16777215,g!==0||A!==this.length-1?f=y[6-b.length]+b+f:f=b+f,h+=2,h>=26&&(h-=26,A--)}for(g!==0&&(f=g.toString(16)+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var u=E[o],m=M[o];f="";var L=this.clone();for(L.negative=0;!L.isZero();){var q=L.modn(m).toString(o);L=L.idivn(m),L.isZero()?f=q+f:f=y[u-q.length]+q+f}for(this.isZero()&&(f="0"+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,a){return n(typeof c<"u"),this.toArrayLike(c,o,a)},i.prototype.toArray=function(o,a){return this.toArrayLike(Array,o,a)},i.prototype.toArrayLike=function(o,a,f){var h=this.byteLength(),g=f||Math.max(1,h);n(h<=g,"byte array longer than desired length"),n(g>0,"Requested array length <= 0"),this.strip();var A=a==="le",I=new o(g),b,u,m=this.clone();if(A){for(u=0;!m.isZero();u++)b=m.andln(255),m.iushrn(8),I[u]=b;for(;u=4096&&(f+=13,a>>>=13),a>=64&&(f+=7,a>>>=7),a>=8&&(f+=4,a>>>=4),a>=2&&(f+=2,a>>>=2),f+a},i.prototype._zeroBits=function(o){if(o===0)return 26;var a=o,f=0;return a&8191||(f+=13,a>>>=13),a&127||(f+=7,a>>>=7),a&15||(f+=4,a>>>=4),a&3||(f+=2,a>>>=2),a&1||f++,f},i.prototype.bitLength=function(){var o=this.words[this.length-1],a=this._countBits(o);return(this.length-1)*26+a};function w(d){for(var o=new Array(d.bitLength()),a=0;a>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,a=0;ao.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var a;this.length>o.length?a=o:a=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var a,f;this.length>o.length?(a=this,f=o):(a=o,f=this);for(var h=0;ho.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var a=Math.ceil(o/26)|0,f=o%26;this._expand(a),f>0&&a--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-f),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,a){n(typeof o=="number"&&o>=0);var f=o/26|0,h=o%26;return this._expand(f+1),a?this.words[f]=this.words[f]|1<o.length?(f=this,h=o):(f=o,h=this);for(var g=0,A=0;A>>26;for(;g!==0&&A>>26;if(this.length=f.length,g!==0)this.words[this.length]=g,this.length++;else if(f!==this)for(;Ao.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var a=this.iadd(o);return o.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,g;f>0?(h=this,g=o):(h=o,g=this);for(var A=0,I=0;I>26,this.words[I]=a&67108863;for(;A!==0&&I>26,this.words[I]=a&67108863;if(A===0&&I>>26,L=b&67108863,q=Math.min(u,o.length-1),z=Math.max(0,u-d.length+1);z<=q;z++){var W=u-z|0;h=d.words[W]|0,g=o.words[z]|0,A=h*g+L,m+=A/67108864|0,L=A&67108863}a.words[u]=L|0,b=m|0}return b!==0?a.words[u]=b|0:a.length--,a.strip()}var k=function(o,a,f){var h=o.words,g=a.words,A=f.words,I=0,b,u,m,L=h[0]|0,q=L&8191,z=L>>>13,W=h[1]|0,ot=W&8191,ut=W>>>13,Ct=h[2]|0,yt=Ct&8191,mt=Ct>>>13,jt=h[3]|0,dt=jt&8191,ct=jt>>>13,Tt=h[4]|0,kt=Tt&8191,S=Tt>>>13,C=h[5]|0,O=C&8191,F=C>>>13,et=h[6]|0,Q=et&8191,it=et>>>13,qt=h[7]|0,It=qt&8191,xt=qt>>>13,Qt=h[8]|0,Rt=Qt&8191,Dt=Qt>>>13,Se=h[9]|0,te=Se&8191,Ut=Se>>>13,Te=g[0]|0,J=Te&8191,X=Te>>>13,st=g[1]|0,D=st&8191,K=st>>>13,gt=g[2]|0,ft=gt&8191,pt=gt>>>13,vt=g[3]|0,At=vt&8191,_t=vt>>>13,Wt=g[4]|0,Pt=Wt&8191,wt=Wt>>>13,se=g[5]|0,Lt=se&8191,Et=se>>>13,de=g[6]|0,Bt=de&8191,Mt=de>>>13,$=g[7]|0,G=$&8191,H=$>>>13,N=g[8]|0,V=N&8191,tt=N>>>13,lt=g[9]|0,at=lt&8191,ht=lt>>>13;f.negative=o.negative^a.negative,f.length=19,b=Math.imul(q,J),u=Math.imul(q,X),u=u+Math.imul(z,J)|0,m=Math.imul(z,X);var zt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(zt>>>26)|0,zt&=67108863,b=Math.imul(ot,J),u=Math.imul(ot,X),u=u+Math.imul(ut,J)|0,m=Math.imul(ut,X),b=b+Math.imul(q,D)|0,u=u+Math.imul(q,K)|0,u=u+Math.imul(z,D)|0,m=m+Math.imul(z,K)|0;var Zt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,b=Math.imul(yt,J),u=Math.imul(yt,X),u=u+Math.imul(mt,J)|0,m=Math.imul(mt,X),b=b+Math.imul(ot,D)|0,u=u+Math.imul(ot,K)|0,u=u+Math.imul(ut,D)|0,m=m+Math.imul(ut,K)|0,b=b+Math.imul(q,ft)|0,u=u+Math.imul(q,pt)|0,u=u+Math.imul(z,ft)|0,m=m+Math.imul(z,pt)|0;var ye=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ye>>>26)|0,ye&=67108863,b=Math.imul(dt,J),u=Math.imul(dt,X),u=u+Math.imul(ct,J)|0,m=Math.imul(ct,X),b=b+Math.imul(yt,D)|0,u=u+Math.imul(yt,K)|0,u=u+Math.imul(mt,D)|0,m=m+Math.imul(mt,K)|0,b=b+Math.imul(ot,ft)|0,u=u+Math.imul(ot,pt)|0,u=u+Math.imul(ut,ft)|0,m=m+Math.imul(ut,pt)|0,b=b+Math.imul(q,At)|0,u=u+Math.imul(q,_t)|0,u=u+Math.imul(z,At)|0,m=m+Math.imul(z,_t)|0;var Yt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,b=Math.imul(kt,J),u=Math.imul(kt,X),u=u+Math.imul(S,J)|0,m=Math.imul(S,X),b=b+Math.imul(dt,D)|0,u=u+Math.imul(dt,K)|0,u=u+Math.imul(ct,D)|0,m=m+Math.imul(ct,K)|0,b=b+Math.imul(yt,ft)|0,u=u+Math.imul(yt,pt)|0,u=u+Math.imul(mt,ft)|0,m=m+Math.imul(mt,pt)|0,b=b+Math.imul(ot,At)|0,u=u+Math.imul(ot,_t)|0,u=u+Math.imul(ut,At)|0,m=m+Math.imul(ut,_t)|0,b=b+Math.imul(q,Pt)|0,u=u+Math.imul(q,wt)|0,u=u+Math.imul(z,Pt)|0,m=m+Math.imul(z,wt)|0;var pe=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(pe>>>26)|0,pe&=67108863,b=Math.imul(O,J),u=Math.imul(O,X),u=u+Math.imul(F,J)|0,m=Math.imul(F,X),b=b+Math.imul(kt,D)|0,u=u+Math.imul(kt,K)|0,u=u+Math.imul(S,D)|0,m=m+Math.imul(S,K)|0,b=b+Math.imul(dt,ft)|0,u=u+Math.imul(dt,pt)|0,u=u+Math.imul(ct,ft)|0,m=m+Math.imul(ct,pt)|0,b=b+Math.imul(yt,At)|0,u=u+Math.imul(yt,_t)|0,u=u+Math.imul(mt,At)|0,m=m+Math.imul(mt,_t)|0,b=b+Math.imul(ot,Pt)|0,u=u+Math.imul(ot,wt)|0,u=u+Math.imul(ut,Pt)|0,m=m+Math.imul(ut,wt)|0,b=b+Math.imul(q,Lt)|0,u=u+Math.imul(q,Et)|0,u=u+Math.imul(z,Lt)|0,m=m+Math.imul(z,Et)|0;var ve=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ve>>>26)|0,ve&=67108863,b=Math.imul(Q,J),u=Math.imul(Q,X),u=u+Math.imul(it,J)|0,m=Math.imul(it,X),b=b+Math.imul(O,D)|0,u=u+Math.imul(O,K)|0,u=u+Math.imul(F,D)|0,m=m+Math.imul(F,K)|0,b=b+Math.imul(kt,ft)|0,u=u+Math.imul(kt,pt)|0,u=u+Math.imul(S,ft)|0,m=m+Math.imul(S,pt)|0,b=b+Math.imul(dt,At)|0,u=u+Math.imul(dt,_t)|0,u=u+Math.imul(ct,At)|0,m=m+Math.imul(ct,_t)|0,b=b+Math.imul(yt,Pt)|0,u=u+Math.imul(yt,wt)|0,u=u+Math.imul(mt,Pt)|0,m=m+Math.imul(mt,wt)|0,b=b+Math.imul(ot,Lt)|0,u=u+Math.imul(ot,Et)|0,u=u+Math.imul(ut,Lt)|0,m=m+Math.imul(ut,Et)|0,b=b+Math.imul(q,Bt)|0,u=u+Math.imul(q,Mt)|0,u=u+Math.imul(z,Bt)|0,m=m+Math.imul(z,Mt)|0;var ge=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ge>>>26)|0,ge&=67108863,b=Math.imul(It,J),u=Math.imul(It,X),u=u+Math.imul(xt,J)|0,m=Math.imul(xt,X),b=b+Math.imul(Q,D)|0,u=u+Math.imul(Q,K)|0,u=u+Math.imul(it,D)|0,m=m+Math.imul(it,K)|0,b=b+Math.imul(O,ft)|0,u=u+Math.imul(O,pt)|0,u=u+Math.imul(F,ft)|0,m=m+Math.imul(F,pt)|0,b=b+Math.imul(kt,At)|0,u=u+Math.imul(kt,_t)|0,u=u+Math.imul(S,At)|0,m=m+Math.imul(S,_t)|0,b=b+Math.imul(dt,Pt)|0,u=u+Math.imul(dt,wt)|0,u=u+Math.imul(ct,Pt)|0,m=m+Math.imul(ct,wt)|0,b=b+Math.imul(yt,Lt)|0,u=u+Math.imul(yt,Et)|0,u=u+Math.imul(mt,Lt)|0,m=m+Math.imul(mt,Et)|0,b=b+Math.imul(ot,Bt)|0,u=u+Math.imul(ot,Mt)|0,u=u+Math.imul(ut,Bt)|0,m=m+Math.imul(ut,Mt)|0,b=b+Math.imul(q,G)|0,u=u+Math.imul(q,H)|0,u=u+Math.imul(z,G)|0,m=m+Math.imul(z,H)|0;var ie=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ie>>>26)|0,ie&=67108863,b=Math.imul(Rt,J),u=Math.imul(Rt,X),u=u+Math.imul(Dt,J)|0,m=Math.imul(Dt,X),b=b+Math.imul(It,D)|0,u=u+Math.imul(It,K)|0,u=u+Math.imul(xt,D)|0,m=m+Math.imul(xt,K)|0,b=b+Math.imul(Q,ft)|0,u=u+Math.imul(Q,pt)|0,u=u+Math.imul(it,ft)|0,m=m+Math.imul(it,pt)|0,b=b+Math.imul(O,At)|0,u=u+Math.imul(O,_t)|0,u=u+Math.imul(F,At)|0,m=m+Math.imul(F,_t)|0,b=b+Math.imul(kt,Pt)|0,u=u+Math.imul(kt,wt)|0,u=u+Math.imul(S,Pt)|0,m=m+Math.imul(S,wt)|0,b=b+Math.imul(dt,Lt)|0,u=u+Math.imul(dt,Et)|0,u=u+Math.imul(ct,Lt)|0,m=m+Math.imul(ct,Et)|0,b=b+Math.imul(yt,Bt)|0,u=u+Math.imul(yt,Mt)|0,u=u+Math.imul(mt,Bt)|0,m=m+Math.imul(mt,Mt)|0,b=b+Math.imul(ot,G)|0,u=u+Math.imul(ot,H)|0,u=u+Math.imul(ut,G)|0,m=m+Math.imul(ut,H)|0,b=b+Math.imul(q,V)|0,u=u+Math.imul(q,tt)|0,u=u+Math.imul(z,V)|0,m=m+Math.imul(z,tt)|0;var ue=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ue>>>26)|0,ue&=67108863,b=Math.imul(te,J),u=Math.imul(te,X),u=u+Math.imul(Ut,J)|0,m=Math.imul(Ut,X),b=b+Math.imul(Rt,D)|0,u=u+Math.imul(Rt,K)|0,u=u+Math.imul(Dt,D)|0,m=m+Math.imul(Dt,K)|0,b=b+Math.imul(It,ft)|0,u=u+Math.imul(It,pt)|0,u=u+Math.imul(xt,ft)|0,m=m+Math.imul(xt,pt)|0,b=b+Math.imul(Q,At)|0,u=u+Math.imul(Q,_t)|0,u=u+Math.imul(it,At)|0,m=m+Math.imul(it,_t)|0,b=b+Math.imul(O,Pt)|0,u=u+Math.imul(O,wt)|0,u=u+Math.imul(F,Pt)|0,m=m+Math.imul(F,wt)|0,b=b+Math.imul(kt,Lt)|0,u=u+Math.imul(kt,Et)|0,u=u+Math.imul(S,Lt)|0,m=m+Math.imul(S,Et)|0,b=b+Math.imul(dt,Bt)|0,u=u+Math.imul(dt,Mt)|0,u=u+Math.imul(ct,Bt)|0,m=m+Math.imul(ct,Mt)|0,b=b+Math.imul(yt,G)|0,u=u+Math.imul(yt,H)|0,u=u+Math.imul(mt,G)|0,m=m+Math.imul(mt,H)|0,b=b+Math.imul(ot,V)|0,u=u+Math.imul(ot,tt)|0,u=u+Math.imul(ut,V)|0,m=m+Math.imul(ut,tt)|0,b=b+Math.imul(q,at)|0,u=u+Math.imul(q,ht)|0,u=u+Math.imul(z,at)|0,m=m+Math.imul(z,ht)|0;var fe=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(fe>>>26)|0,fe&=67108863,b=Math.imul(te,D),u=Math.imul(te,K),u=u+Math.imul(Ut,D)|0,m=Math.imul(Ut,K),b=b+Math.imul(Rt,ft)|0,u=u+Math.imul(Rt,pt)|0,u=u+Math.imul(Dt,ft)|0,m=m+Math.imul(Dt,pt)|0,b=b+Math.imul(It,At)|0,u=u+Math.imul(It,_t)|0,u=u+Math.imul(xt,At)|0,m=m+Math.imul(xt,_t)|0,b=b+Math.imul(Q,Pt)|0,u=u+Math.imul(Q,wt)|0,u=u+Math.imul(it,Pt)|0,m=m+Math.imul(it,wt)|0,b=b+Math.imul(O,Lt)|0,u=u+Math.imul(O,Et)|0,u=u+Math.imul(F,Lt)|0,m=m+Math.imul(F,Et)|0,b=b+Math.imul(kt,Bt)|0,u=u+Math.imul(kt,Mt)|0,u=u+Math.imul(S,Bt)|0,m=m+Math.imul(S,Mt)|0,b=b+Math.imul(dt,G)|0,u=u+Math.imul(dt,H)|0,u=u+Math.imul(ct,G)|0,m=m+Math.imul(ct,H)|0,b=b+Math.imul(yt,V)|0,u=u+Math.imul(yt,tt)|0,u=u+Math.imul(mt,V)|0,m=m+Math.imul(mt,tt)|0,b=b+Math.imul(ot,at)|0,u=u+Math.imul(ot,ht)|0,u=u+Math.imul(ut,at)|0,m=m+Math.imul(ut,ht)|0;var ce=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ce>>>26)|0,ce&=67108863,b=Math.imul(te,ft),u=Math.imul(te,pt),u=u+Math.imul(Ut,ft)|0,m=Math.imul(Ut,pt),b=b+Math.imul(Rt,At)|0,u=u+Math.imul(Rt,_t)|0,u=u+Math.imul(Dt,At)|0,m=m+Math.imul(Dt,_t)|0,b=b+Math.imul(It,Pt)|0,u=u+Math.imul(It,wt)|0,u=u+Math.imul(xt,Pt)|0,m=m+Math.imul(xt,wt)|0,b=b+Math.imul(Q,Lt)|0,u=u+Math.imul(Q,Et)|0,u=u+Math.imul(it,Lt)|0,m=m+Math.imul(it,Et)|0,b=b+Math.imul(O,Bt)|0,u=u+Math.imul(O,Mt)|0,u=u+Math.imul(F,Bt)|0,m=m+Math.imul(F,Mt)|0,b=b+Math.imul(kt,G)|0,u=u+Math.imul(kt,H)|0,u=u+Math.imul(S,G)|0,m=m+Math.imul(S,H)|0,b=b+Math.imul(dt,V)|0,u=u+Math.imul(dt,tt)|0,u=u+Math.imul(ct,V)|0,m=m+Math.imul(ct,tt)|0,b=b+Math.imul(yt,at)|0,u=u+Math.imul(yt,ht)|0,u=u+Math.imul(mt,at)|0,m=m+Math.imul(mt,ht)|0;var $t=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+($t>>>26)|0,$t&=67108863,b=Math.imul(te,At),u=Math.imul(te,_t),u=u+Math.imul(Ut,At)|0,m=Math.imul(Ut,_t),b=b+Math.imul(Rt,Pt)|0,u=u+Math.imul(Rt,wt)|0,u=u+Math.imul(Dt,Pt)|0,m=m+Math.imul(Dt,wt)|0,b=b+Math.imul(It,Lt)|0,u=u+Math.imul(It,Et)|0,u=u+Math.imul(xt,Lt)|0,m=m+Math.imul(xt,Et)|0,b=b+Math.imul(Q,Bt)|0,u=u+Math.imul(Q,Mt)|0,u=u+Math.imul(it,Bt)|0,m=m+Math.imul(it,Mt)|0,b=b+Math.imul(O,G)|0,u=u+Math.imul(O,H)|0,u=u+Math.imul(F,G)|0,m=m+Math.imul(F,H)|0,b=b+Math.imul(kt,V)|0,u=u+Math.imul(kt,tt)|0,u=u+Math.imul(S,V)|0,m=m+Math.imul(S,tt)|0,b=b+Math.imul(dt,at)|0,u=u+Math.imul(dt,ht)|0,u=u+Math.imul(ct,at)|0,m=m+Math.imul(ct,ht)|0;var oe=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(oe>>>26)|0,oe&=67108863,b=Math.imul(te,Pt),u=Math.imul(te,wt),u=u+Math.imul(Ut,Pt)|0,m=Math.imul(Ut,wt),b=b+Math.imul(Rt,Lt)|0,u=u+Math.imul(Rt,Et)|0,u=u+Math.imul(Dt,Lt)|0,m=m+Math.imul(Dt,Et)|0,b=b+Math.imul(It,Bt)|0,u=u+Math.imul(It,Mt)|0,u=u+Math.imul(xt,Bt)|0,m=m+Math.imul(xt,Mt)|0,b=b+Math.imul(Q,G)|0,u=u+Math.imul(Q,H)|0,u=u+Math.imul(it,G)|0,m=m+Math.imul(it,H)|0,b=b+Math.imul(O,V)|0,u=u+Math.imul(O,tt)|0,u=u+Math.imul(F,V)|0,m=m+Math.imul(F,tt)|0,b=b+Math.imul(kt,at)|0,u=u+Math.imul(kt,ht)|0,u=u+Math.imul(S,at)|0,m=m+Math.imul(S,ht)|0;var Jt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,b=Math.imul(te,Lt),u=Math.imul(te,Et),u=u+Math.imul(Ut,Lt)|0,m=Math.imul(Ut,Et),b=b+Math.imul(Rt,Bt)|0,u=u+Math.imul(Rt,Mt)|0,u=u+Math.imul(Dt,Bt)|0,m=m+Math.imul(Dt,Mt)|0,b=b+Math.imul(It,G)|0,u=u+Math.imul(It,H)|0,u=u+Math.imul(xt,G)|0,m=m+Math.imul(xt,H)|0,b=b+Math.imul(Q,V)|0,u=u+Math.imul(Q,tt)|0,u=u+Math.imul(it,V)|0,m=m+Math.imul(it,tt)|0,b=b+Math.imul(O,at)|0,u=u+Math.imul(O,ht)|0,u=u+Math.imul(F,at)|0,m=m+Math.imul(F,ht)|0;var le=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(le>>>26)|0,le&=67108863,b=Math.imul(te,Bt),u=Math.imul(te,Mt),u=u+Math.imul(Ut,Bt)|0,m=Math.imul(Ut,Mt),b=b+Math.imul(Rt,G)|0,u=u+Math.imul(Rt,H)|0,u=u+Math.imul(Dt,G)|0,m=m+Math.imul(Dt,H)|0,b=b+Math.imul(It,V)|0,u=u+Math.imul(It,tt)|0,u=u+Math.imul(xt,V)|0,m=m+Math.imul(xt,tt)|0,b=b+Math.imul(Q,at)|0,u=u+Math.imul(Q,ht)|0,u=u+Math.imul(it,at)|0,m=m+Math.imul(it,ht)|0;var ae=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ae>>>26)|0,ae&=67108863,b=Math.imul(te,G),u=Math.imul(te,H),u=u+Math.imul(Ut,G)|0,m=Math.imul(Ut,H),b=b+Math.imul(Rt,V)|0,u=u+Math.imul(Rt,tt)|0,u=u+Math.imul(Dt,V)|0,m=m+Math.imul(Dt,tt)|0,b=b+Math.imul(It,at)|0,u=u+Math.imul(It,ht)|0,u=u+Math.imul(xt,at)|0,m=m+Math.imul(xt,ht)|0;var ne=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ne>>>26)|0,ne&=67108863,b=Math.imul(te,V),u=Math.imul(te,tt),u=u+Math.imul(Ut,V)|0,m=Math.imul(Ut,tt),b=b+Math.imul(Rt,at)|0,u=u+Math.imul(Rt,ht)|0,u=u+Math.imul(Dt,at)|0,m=m+Math.imul(Dt,ht)|0;var Ot=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,b=Math.imul(te,at),u=Math.imul(te,ht),u=u+Math.imul(Ut,at)|0,m=Math.imul(Ut,ht);var Nt=(I+b|0)+((u&8191)<<13)|0;return I=(m+(u>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,A[0]=zt,A[1]=Zt,A[2]=ye,A[3]=Yt,A[4]=pe,A[5]=ve,A[6]=ge,A[7]=ie,A[8]=ue,A[9]=fe,A[10]=ce,A[11]=$t,A[12]=oe,A[13]=Jt,A[14]=le,A[15]=ae,A[16]=ne,A[17]=Ot,A[18]=Nt,I!==0&&(A[19]=I,f.length++),f};Math.imul||(k=_);function B(d,o,a){a.negative=o.negative^d.negative,a.length=d.length+o.length;for(var f=0,h=0,g=0;g>>26)|0,h+=A>>>26,A&=67108863}a.words[g]=I,f=A,A=h}return f!==0?a.words[g]=f:a.length--,a.strip()}function P(d,o,a){var f=new R;return f.mulp(d,o,a)}i.prototype.mulTo=function(o,a){var f,h=this.length+o.length;return this.length===10&&o.length===10?f=k(this,o,a):h<63?f=_(this,o,a):h<1024?f=B(this,o,a):f=P(this,o,a),f};function R(d,o){this.x=d,this.y=o}R.prototype.makeRBT=function(o){for(var a=new Array(o),f=i.prototype._countBits(o)-1,h=0;h>=1;return h},R.prototype.permute=function(o,a,f,h,g,A){for(var I=0;I>>1)g++;return 1<>>13,f[2*A+1]=g&8191,g=g>>>13;for(A=2*a;A>=26,a+=h/67108864|0,a+=g>>>26,this.words[f]=g&67108863}return a!==0&&(this.words[f]=a,this.length++),this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var a=w(o);if(a.length===0)return new i(1);for(var f=this,h=0;h=0);var a=o%26,f=(o-a)/26,h=67108863>>>26-a<<26-a,g;if(a!==0){var A=0;for(g=0;g>>26-a}A&&(this.words[g]=A,this.length++)}if(f!==0){for(g=this.length-1;g>=0;g--)this.words[g+f]=this.words[g];for(g=0;g=0);var h;a?h=(a-a%26)/26:h=0;var g=o%26,A=Math.min((o-g)/26,this.length),I=67108863^67108863>>>g<A)for(this.length-=A,u=0;u=0&&(m!==0||u>=h);u--){var L=this.words[u]|0;this.words[u]=m<<26-g|L>>>g,m=L&I}return b&&m!==0&&(b.words[b.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,a,f){return n(this.negative===0),this.iushrn(o,a,f)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var a=o%26,f=(o-a)/26,h=1<=0);var a=o%26,f=(o-a)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(a!==0&&f++,this.length=Math.min(f,this.length),a!==0){var h=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},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(b/67108864|0),this.words[g+f]=A&67108863}for(;g>26,this.words[g+f]=A&67108863;if(I===0)return this.strip();for(n(I===-1),I=0,g=0;g>26,this.words[g]=A&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,a){var f=this.length-o.length,h=this.clone(),g=o,A=g.words[g.length-1]|0,I=this._countBits(A);f=26-I,f!==0&&(g=g.ushln(f),h.iushln(f),A=g.words[g.length-1]|0);var b=h.length-g.length,u;if(a!=="mod"){u=new i(null),u.length=b+1,u.words=new Array(u.length);for(var m=0;m=0;q--){var z=(h.words[g.length+q]|0)*67108864+(h.words[g.length+q-1]|0);for(z=Math.min(z/A|0,67108863),h._ishlnsubmul(g,z,q);h.negative!==0;)z--,h.negative=0,h._ishlnsubmul(g,1,q),h.isZero()||(h.negative^=1);u&&(u.words[q]=z)}return u&&u.strip(),h.strip(),a!=="div"&&f!==0&&h.iushrn(f),{div:u||null,mod:h}},i.prototype.divmod=function(o,a,f){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,g,A;return this.negative!==0&&o.negative===0?(A=this.neg().divmod(o,a),a!=="mod"&&(h=A.div.neg()),a!=="div"&&(g=A.mod.neg(),f&&g.negative!==0&&g.iadd(o)),{div:h,mod:g}):this.negative===0&&o.negative!==0?(A=this.divmod(o.neg(),a),a!=="mod"&&(h=A.div.neg()),{div:h,mod:A.mod}):this.negative&o.negative?(A=this.neg().divmod(o.neg(),a),a!=="div"&&(g=A.mod.neg(),f&&g.negative!==0&&g.isub(o)),{div:A.div,mod:g}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?a==="div"?{div:this.divn(o.words[0]),mod:null}:a==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,a)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var a=this.divmod(o);if(a.mod.isZero())return a.div;var f=a.div.negative!==0?a.mod.isub(o):a.mod,h=o.ushrn(1),g=o.andln(1),A=f.cmp(h);return A<0||g===1&&A===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var a=(1<<26)%o,f=0,h=this.length-1;h>=0;h--)f=(a*f+(this.words[h]|0))%o;return f},i.prototype.idivn=function(o){n(o<=67108863);for(var a=0,f=this.length-1;f>=0;f--){var h=(this.words[f]|0)+a*67108864;this.words[f]=h/o|0,a=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),A=new i(0),I=new i(1),b=0;a.isEven()&&f.isEven();)a.iushrn(1),f.iushrn(1),++b;for(var u=f.clone(),m=a.clone();!a.isZero();){for(var L=0,q=1;!(a.words[0]&q)&&L<26;++L,q<<=1);if(L>0)for(a.iushrn(L);L-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(u),g.isub(m)),h.iushrn(1),g.iushrn(1);for(var z=0,W=1;!(f.words[0]&W)&&z<26;++z,W<<=1);if(z>0)for(f.iushrn(z);z-- >0;)(A.isOdd()||I.isOdd())&&(A.iadd(u),I.isub(m)),A.iushrn(1),I.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(A),g.isub(I)):(f.isub(a),A.isub(h),I.isub(g))}return{a:A,b:I,gcd:f.iushln(b)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),A=f.clone();a.cmpn(1)>0&&f.cmpn(1)>0;){for(var I=0,b=1;!(a.words[0]&b)&&I<26;++I,b<<=1);if(I>0)for(a.iushrn(I);I-- >0;)h.isOdd()&&h.iadd(A),h.iushrn(1);for(var u=0,m=1;!(f.words[0]&m)&&u<26;++u,m<<=1);if(u>0)for(f.iushrn(u);u-- >0;)g.isOdd()&&g.iadd(A),g.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(g)):(f.isub(a),g.isub(h))}var L;return a.cmpn(1)===0?L=h:L=g,L.cmpn(0)<0&&L.iadd(o),L},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var a=this.clone(),f=o.clone();a.negative=0,f.negative=0;for(var h=0;a.isEven()&&f.isEven();h++)a.iushrn(1),f.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;f.isEven();)f.iushrn(1);var g=a.cmp(f);if(g<0){var A=a;a=f,f=A}else if(g===0||f.cmpn(1)===0)break;a.isub(f)}while(!0);return f.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var a=o%26,f=(o-a)/26,h=1<>>26,I&=67108863,this.words[A]=I}return g!==0&&(this.words[A]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var a=o<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this.strip();var f;if(this.length>1)f=1;else{a&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;f=h===o?0:ho.length)return 1;if(this.length=0;f--){var h=this.words[f]|0,g=o.words[f]|0;if(h!==g){hg&&(a=1);break}}return a},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new Z(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var T={k256:null,p224:null,p192:null,p25519:null};function U(d,o){this.name=d,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},U.prototype.ireduce=function(o){var a=o,f;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),f=a.bitLength();while(f>this.n);var h=f0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},U.prototype.split=function(o,a){o.iushrn(this.n,0,a)},U.prototype.imulK=function(o){return o.imul(this.k)};function j(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(j,U),j.prototype.split=function(o,a){for(var f=4194303,h=Math.min(o.length,9),g=0;g>>22,A=I}A>>>=22,o.words[g-10]=A,A===0&&o.length>10?o.length-=10:o.length-=9},j.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var a=0,f=0;f>>=26,o.words[f]=g,a=h}return a!==0&&(o.words[o.length++]=a),o},i._prime=function(o){if(T[o])return T[o];var a;if(o==="k256")a=new j;else if(o==="p224")a=new Y;else if(o==="p192")a=new rt;else if(o==="p25519")a=new nt;else throw new Error("Unknown prime "+o);return T[o]=a,a};function Z(d){if(typeof d=="string"){var o=i._prime(d);this.m=o.p,this.prime=o}else n(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}Z.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},Z.prototype._verify2=function(o,a){n((o.negative|a.negative)===0,"red works only with positives"),n(o.red&&o.red===a.red,"red works only with red numbers")},Z.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},Z.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},Z.prototype.add=function(o,a){this._verify2(o,a);var f=o.add(a);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},Z.prototype.iadd=function(o,a){this._verify2(o,a);var f=o.iadd(a);return f.cmp(this.m)>=0&&f.isub(this.m),f},Z.prototype.sub=function(o,a){this._verify2(o,a);var f=o.sub(a);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},Z.prototype.isub=function(o,a){this._verify2(o,a);var f=o.isub(a);return f.cmpn(0)<0&&f.iadd(this.m),f},Z.prototype.shl=function(o,a){return this._verify1(o),this.imod(o.ushln(a))},Z.prototype.imul=function(o,a){return this._verify2(o,a),this.imod(o.imul(a))},Z.prototype.mul=function(o,a){return this._verify2(o,a),this.imod(o.mul(a))},Z.prototype.isqr=function(o){return this.imul(o,o.clone())},Z.prototype.sqr=function(o){return this.mul(o,o)},Z.prototype.sqrt=function(o){if(o.isZero())return o.clone();var a=this.m.andln(3);if(n(a%2===1),a===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(o,f)}for(var h=this.m.subn(1),g=0;!h.isZero()&&h.andln(1)===0;)g++,h.iushrn(1);n(!h.isZero());var A=new i(1).toRed(this),I=A.redNeg(),b=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,b).cmp(I)!==0;)u.redIAdd(I);for(var m=this.pow(u,h),L=this.pow(o,h.addn(1).iushrn(1)),q=this.pow(o,h),z=g;q.cmp(A)!==0;){for(var W=q,ot=0;W.cmp(A)!==0;ot++)W=W.redSqr();n(ot=0;g--){for(var m=a.words[g],L=u-1;L>=0;L--){var q=m>>L&1;if(A!==h[0]&&(A=this.sqr(A)),q===0&&I===0){b=0;continue}I<<=1,I|=q,b++,!(b!==f&&(g!==0||L!==0))&&(A=this.mul(A,h[I]),b=0,I=0)}u=26}return A},Z.prototype.convertTo=function(o){var a=o.umod(this.m);return a===o?a.clone():a},Z.prototype.convertFrom=function(o){var a=o.clone();return a.red=null,a},i.mont=function(o){return new x(o)};function x(d){Z.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(x,Z),x.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},x.prototype.convertFrom=function(o){var a=this.imod(o.mul(this.rinv));return a.red=null,a},x.prototype.imul=function(o,a){if(o.isZero()||a.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),A=g;return g.cmp(this.m)>=0?A=g.isub(this.m):g.cmpn(0)<0&&(A=g.iadd(this.m)),A._forceRed(this)},x.prototype.mul=function(o,a){if(o.isZero()||a.isZero())return new i(0)._forceRed(this);var f=o.mul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),A=g;return g.cmp(this.m)>=0?A=g.isub(this.m):g.cmpn(0)<0&&(A=g.iadd(this.m)),A._forceRed(this)},x.prototype.invm=function(o){var a=this.imod(o._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(r,Re)}(tl)),tl.exports}var Ep,g6;function PC(){if(g6)return Ep;g6=1;var r=Bg(),t=BC();Ep=function(c){return new n(c)};var e={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}};e.p224=e.secp224r1,e.p256=e.secp256r1=e.prime256v1,e.p192=e.secp192r1=e.prime192v1,e.p384=e.secp384r1,e.p521=e.secp521r1;function n(i){this.curveType=e[i],this.curveType||(this.curveType={name:i}),this.curve=new r.ec(this.curveType.name),this.keys=void 0}n.prototype.generateKeys=function(i,c){return this.keys=this.curve.genKeyPair(),this.getPublicKey(i,c)},n.prototype.computeSecret=function(i,c,l){c=c||"utf8",Gt.Buffer.isBuffer(i)||(i=new Gt.Buffer(i,c));var p=this.curve.keyFromPublic(i).getPublic(),v=p.mul(this.keys.getPrivate()).getX();return s(v,l,this.curveType.byteLength)},n.prototype.getPublicKey=function(i,c){var l=this.keys.getPublic(c==="compressed",!0);return c==="hybrid"&&(l[l.length-1]%2?l[0]=7:l[0]=6),s(l,i)},n.prototype.getPrivateKey=function(i){return s(this.keys.getPrivate(),i)},n.prototype.setPublicKey=function(i,c){return c=c||"utf8",Gt.Buffer.isBuffer(i)||(i=new Gt.Buffer(i,c)),this.keys._importPublic(i),this},n.prototype.setPrivateKey=function(i,c){c=c||"utf8",Gt.Buffer.isBuffer(i)||(i=new Gt.Buffer(i,c));var l=new t(i);return l=l.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(l),this};function s(i,c,l){Array.isArray(i)||(i=i.toArray());var p=new Gt.Buffer(i);if(l&&p.length0?o:a},i.min=function(o,a){return o.cmp(a)<0?o:a},i.prototype._init=function(o,a,f){if(typeof o=="number")return this._initNumber(o,a,f);if(typeof o=="object")return this._initArray(o,a,f);a==="hex"&&(a=16),n(a===(a|0)&&a>=2&&a<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h=0;h-=3)A=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[g]|=A<>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);else if(f==="le")for(h=0,g=0;h>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);return this.strip()};function l(d,o){var a=d.charCodeAt(o);return a>=65&&a<=70?a-55:a>=97&&a<=102?a-87:a-48&15}function p(d,o,a){var f=l(d,a);return a-1>=o&&(f|=l(d,a-1)<<4),f}i.prototype._parseHex=function(o,a,f){this.length=Math.ceil((o.length-a)/6),this.words=new Array(this.length);for(var h=0;h=a;h-=2)I=p(o,a,h)<=18?(g-=18,A+=1,this.words[A]|=I>>>26):g+=8;else{var b=o.length-a;for(h=b%2===0?a+1:a;h=18?(g-=18,A+=1,this.words[A]|=I>>>26):g+=8}this.strip()};function v(d,o,a,f){for(var h=0,g=Math.min(d.length,a),A=o;A=49?h+=I-49+10:I>=17?h+=I-17+10:h+=I}return h}i.prototype._parseBase=function(o,a,f){this.words=[0],this.length=1;for(var h=0,g=1;g<=67108863;g*=a)h++;h--,g=g/a|0;for(var A=o.length-f,I=A%h,b=Math.min(A,A-I)+f,u=0,m=f;m1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var y=["","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"],E=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],M=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(o,a){o=o||10,a=a|0||1;var f;if(o===16||o==="hex"){f="";for(var h=0,g=0,A=0;A>>24-h&16777215,g!==0||A!==this.length-1?f=y[6-b.length]+b+f:f=b+f,h+=2,h>=26&&(h-=26,A--)}for(g!==0&&(f=g.toString(16)+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var u=E[o],m=M[o];f="";var L=this.clone();for(L.negative=0;!L.isZero();){var q=L.modn(m).toString(o);L=L.idivn(m),L.isZero()?f=q+f:f=y[u-q.length]+q+f}for(this.isZero()&&(f="0"+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,a){return n(typeof c<"u"),this.toArrayLike(c,o,a)},i.prototype.toArray=function(o,a){return this.toArrayLike(Array,o,a)},i.prototype.toArrayLike=function(o,a,f){var h=this.byteLength(),g=f||Math.max(1,h);n(h<=g,"byte array longer than desired length"),n(g>0,"Requested array length <= 0"),this.strip();var A=a==="le",I=new o(g),b,u,m=this.clone();if(A){for(u=0;!m.isZero();u++)b=m.andln(255),m.iushrn(8),I[u]=b;for(;u=4096&&(f+=13,a>>>=13),a>=64&&(f+=7,a>>>=7),a>=8&&(f+=4,a>>>=4),a>=2&&(f+=2,a>>>=2),f+a},i.prototype._zeroBits=function(o){if(o===0)return 26;var a=o,f=0;return a&8191||(f+=13,a>>>=13),a&127||(f+=7,a>>>=7),a&15||(f+=4,a>>>=4),a&3||(f+=2,a>>>=2),a&1||f++,f},i.prototype.bitLength=function(){var o=this.words[this.length-1],a=this._countBits(o);return(this.length-1)*26+a};function w(d){for(var o=new Array(d.bitLength()),a=0;a>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,a=0;ao.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var a;this.length>o.length?a=o:a=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var a,f;this.length>o.length?(a=this,f=o):(a=o,f=this);for(var h=0;ho.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var a=Math.ceil(o/26)|0,f=o%26;this._expand(a),f>0&&a--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-f),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,a){n(typeof o=="number"&&o>=0);var f=o/26|0,h=o%26;return this._expand(f+1),a?this.words[f]=this.words[f]|1<o.length?(f=this,h=o):(f=o,h=this);for(var g=0,A=0;A>>26;for(;g!==0&&A>>26;if(this.length=f.length,g!==0)this.words[this.length]=g,this.length++;else if(f!==this)for(;Ao.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var a=this.iadd(o);return o.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,g;f>0?(h=this,g=o):(h=o,g=this);for(var A=0,I=0;I>26,this.words[I]=a&67108863;for(;A!==0&&I>26,this.words[I]=a&67108863;if(A===0&&I>>26,L=b&67108863,q=Math.min(u,o.length-1),z=Math.max(0,u-d.length+1);z<=q;z++){var W=u-z|0;h=d.words[W]|0,g=o.words[z]|0,A=h*g+L,m+=A/67108864|0,L=A&67108863}a.words[u]=L|0,b=m|0}return b!==0?a.words[u]=b|0:a.length--,a.strip()}var k=function(o,a,f){var h=o.words,g=a.words,A=f.words,I=0,b,u,m,L=h[0]|0,q=L&8191,z=L>>>13,W=h[1]|0,ot=W&8191,ut=W>>>13,Ct=h[2]|0,yt=Ct&8191,mt=Ct>>>13,jt=h[3]|0,dt=jt&8191,ct=jt>>>13,Tt=h[4]|0,kt=Tt&8191,S=Tt>>>13,C=h[5]|0,O=C&8191,F=C>>>13,et=h[6]|0,Q=et&8191,it=et>>>13,qt=h[7]|0,It=qt&8191,xt=qt>>>13,Qt=h[8]|0,Rt=Qt&8191,Dt=Qt>>>13,Se=h[9]|0,te=Se&8191,Ut=Se>>>13,Te=g[0]|0,J=Te&8191,X=Te>>>13,st=g[1]|0,D=st&8191,K=st>>>13,gt=g[2]|0,ft=gt&8191,pt=gt>>>13,vt=g[3]|0,At=vt&8191,_t=vt>>>13,Wt=g[4]|0,Pt=Wt&8191,wt=Wt>>>13,se=g[5]|0,Lt=se&8191,Et=se>>>13,de=g[6]|0,Bt=de&8191,Mt=de>>>13,$=g[7]|0,G=$&8191,H=$>>>13,N=g[8]|0,V=N&8191,tt=N>>>13,lt=g[9]|0,at=lt&8191,ht=lt>>>13;f.negative=o.negative^a.negative,f.length=19,b=Math.imul(q,J),u=Math.imul(q,X),u=u+Math.imul(z,J)|0,m=Math.imul(z,X);var zt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(zt>>>26)|0,zt&=67108863,b=Math.imul(ot,J),u=Math.imul(ot,X),u=u+Math.imul(ut,J)|0,m=Math.imul(ut,X),b=b+Math.imul(q,D)|0,u=u+Math.imul(q,K)|0,u=u+Math.imul(z,D)|0,m=m+Math.imul(z,K)|0;var Zt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,b=Math.imul(yt,J),u=Math.imul(yt,X),u=u+Math.imul(mt,J)|0,m=Math.imul(mt,X),b=b+Math.imul(ot,D)|0,u=u+Math.imul(ot,K)|0,u=u+Math.imul(ut,D)|0,m=m+Math.imul(ut,K)|0,b=b+Math.imul(q,ft)|0,u=u+Math.imul(q,pt)|0,u=u+Math.imul(z,ft)|0,m=m+Math.imul(z,pt)|0;var ye=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ye>>>26)|0,ye&=67108863,b=Math.imul(dt,J),u=Math.imul(dt,X),u=u+Math.imul(ct,J)|0,m=Math.imul(ct,X),b=b+Math.imul(yt,D)|0,u=u+Math.imul(yt,K)|0,u=u+Math.imul(mt,D)|0,m=m+Math.imul(mt,K)|0,b=b+Math.imul(ot,ft)|0,u=u+Math.imul(ot,pt)|0,u=u+Math.imul(ut,ft)|0,m=m+Math.imul(ut,pt)|0,b=b+Math.imul(q,At)|0,u=u+Math.imul(q,_t)|0,u=u+Math.imul(z,At)|0,m=m+Math.imul(z,_t)|0;var Yt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,b=Math.imul(kt,J),u=Math.imul(kt,X),u=u+Math.imul(S,J)|0,m=Math.imul(S,X),b=b+Math.imul(dt,D)|0,u=u+Math.imul(dt,K)|0,u=u+Math.imul(ct,D)|0,m=m+Math.imul(ct,K)|0,b=b+Math.imul(yt,ft)|0,u=u+Math.imul(yt,pt)|0,u=u+Math.imul(mt,ft)|0,m=m+Math.imul(mt,pt)|0,b=b+Math.imul(ot,At)|0,u=u+Math.imul(ot,_t)|0,u=u+Math.imul(ut,At)|0,m=m+Math.imul(ut,_t)|0,b=b+Math.imul(q,Pt)|0,u=u+Math.imul(q,wt)|0,u=u+Math.imul(z,Pt)|0,m=m+Math.imul(z,wt)|0;var pe=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(pe>>>26)|0,pe&=67108863,b=Math.imul(O,J),u=Math.imul(O,X),u=u+Math.imul(F,J)|0,m=Math.imul(F,X),b=b+Math.imul(kt,D)|0,u=u+Math.imul(kt,K)|0,u=u+Math.imul(S,D)|0,m=m+Math.imul(S,K)|0,b=b+Math.imul(dt,ft)|0,u=u+Math.imul(dt,pt)|0,u=u+Math.imul(ct,ft)|0,m=m+Math.imul(ct,pt)|0,b=b+Math.imul(yt,At)|0,u=u+Math.imul(yt,_t)|0,u=u+Math.imul(mt,At)|0,m=m+Math.imul(mt,_t)|0,b=b+Math.imul(ot,Pt)|0,u=u+Math.imul(ot,wt)|0,u=u+Math.imul(ut,Pt)|0,m=m+Math.imul(ut,wt)|0,b=b+Math.imul(q,Lt)|0,u=u+Math.imul(q,Et)|0,u=u+Math.imul(z,Lt)|0,m=m+Math.imul(z,Et)|0;var ve=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ve>>>26)|0,ve&=67108863,b=Math.imul(Q,J),u=Math.imul(Q,X),u=u+Math.imul(it,J)|0,m=Math.imul(it,X),b=b+Math.imul(O,D)|0,u=u+Math.imul(O,K)|0,u=u+Math.imul(F,D)|0,m=m+Math.imul(F,K)|0,b=b+Math.imul(kt,ft)|0,u=u+Math.imul(kt,pt)|0,u=u+Math.imul(S,ft)|0,m=m+Math.imul(S,pt)|0,b=b+Math.imul(dt,At)|0,u=u+Math.imul(dt,_t)|0,u=u+Math.imul(ct,At)|0,m=m+Math.imul(ct,_t)|0,b=b+Math.imul(yt,Pt)|0,u=u+Math.imul(yt,wt)|0,u=u+Math.imul(mt,Pt)|0,m=m+Math.imul(mt,wt)|0,b=b+Math.imul(ot,Lt)|0,u=u+Math.imul(ot,Et)|0,u=u+Math.imul(ut,Lt)|0,m=m+Math.imul(ut,Et)|0,b=b+Math.imul(q,Bt)|0,u=u+Math.imul(q,Mt)|0,u=u+Math.imul(z,Bt)|0,m=m+Math.imul(z,Mt)|0;var ge=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ge>>>26)|0,ge&=67108863,b=Math.imul(It,J),u=Math.imul(It,X),u=u+Math.imul(xt,J)|0,m=Math.imul(xt,X),b=b+Math.imul(Q,D)|0,u=u+Math.imul(Q,K)|0,u=u+Math.imul(it,D)|0,m=m+Math.imul(it,K)|0,b=b+Math.imul(O,ft)|0,u=u+Math.imul(O,pt)|0,u=u+Math.imul(F,ft)|0,m=m+Math.imul(F,pt)|0,b=b+Math.imul(kt,At)|0,u=u+Math.imul(kt,_t)|0,u=u+Math.imul(S,At)|0,m=m+Math.imul(S,_t)|0,b=b+Math.imul(dt,Pt)|0,u=u+Math.imul(dt,wt)|0,u=u+Math.imul(ct,Pt)|0,m=m+Math.imul(ct,wt)|0,b=b+Math.imul(yt,Lt)|0,u=u+Math.imul(yt,Et)|0,u=u+Math.imul(mt,Lt)|0,m=m+Math.imul(mt,Et)|0,b=b+Math.imul(ot,Bt)|0,u=u+Math.imul(ot,Mt)|0,u=u+Math.imul(ut,Bt)|0,m=m+Math.imul(ut,Mt)|0,b=b+Math.imul(q,G)|0,u=u+Math.imul(q,H)|0,u=u+Math.imul(z,G)|0,m=m+Math.imul(z,H)|0;var ie=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ie>>>26)|0,ie&=67108863,b=Math.imul(Rt,J),u=Math.imul(Rt,X),u=u+Math.imul(Dt,J)|0,m=Math.imul(Dt,X),b=b+Math.imul(It,D)|0,u=u+Math.imul(It,K)|0,u=u+Math.imul(xt,D)|0,m=m+Math.imul(xt,K)|0,b=b+Math.imul(Q,ft)|0,u=u+Math.imul(Q,pt)|0,u=u+Math.imul(it,ft)|0,m=m+Math.imul(it,pt)|0,b=b+Math.imul(O,At)|0,u=u+Math.imul(O,_t)|0,u=u+Math.imul(F,At)|0,m=m+Math.imul(F,_t)|0,b=b+Math.imul(kt,Pt)|0,u=u+Math.imul(kt,wt)|0,u=u+Math.imul(S,Pt)|0,m=m+Math.imul(S,wt)|0,b=b+Math.imul(dt,Lt)|0,u=u+Math.imul(dt,Et)|0,u=u+Math.imul(ct,Lt)|0,m=m+Math.imul(ct,Et)|0,b=b+Math.imul(yt,Bt)|0,u=u+Math.imul(yt,Mt)|0,u=u+Math.imul(mt,Bt)|0,m=m+Math.imul(mt,Mt)|0,b=b+Math.imul(ot,G)|0,u=u+Math.imul(ot,H)|0,u=u+Math.imul(ut,G)|0,m=m+Math.imul(ut,H)|0,b=b+Math.imul(q,V)|0,u=u+Math.imul(q,tt)|0,u=u+Math.imul(z,V)|0,m=m+Math.imul(z,tt)|0;var ue=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ue>>>26)|0,ue&=67108863,b=Math.imul(te,J),u=Math.imul(te,X),u=u+Math.imul(Ut,J)|0,m=Math.imul(Ut,X),b=b+Math.imul(Rt,D)|0,u=u+Math.imul(Rt,K)|0,u=u+Math.imul(Dt,D)|0,m=m+Math.imul(Dt,K)|0,b=b+Math.imul(It,ft)|0,u=u+Math.imul(It,pt)|0,u=u+Math.imul(xt,ft)|0,m=m+Math.imul(xt,pt)|0,b=b+Math.imul(Q,At)|0,u=u+Math.imul(Q,_t)|0,u=u+Math.imul(it,At)|0,m=m+Math.imul(it,_t)|0,b=b+Math.imul(O,Pt)|0,u=u+Math.imul(O,wt)|0,u=u+Math.imul(F,Pt)|0,m=m+Math.imul(F,wt)|0,b=b+Math.imul(kt,Lt)|0,u=u+Math.imul(kt,Et)|0,u=u+Math.imul(S,Lt)|0,m=m+Math.imul(S,Et)|0,b=b+Math.imul(dt,Bt)|0,u=u+Math.imul(dt,Mt)|0,u=u+Math.imul(ct,Bt)|0,m=m+Math.imul(ct,Mt)|0,b=b+Math.imul(yt,G)|0,u=u+Math.imul(yt,H)|0,u=u+Math.imul(mt,G)|0,m=m+Math.imul(mt,H)|0,b=b+Math.imul(ot,V)|0,u=u+Math.imul(ot,tt)|0,u=u+Math.imul(ut,V)|0,m=m+Math.imul(ut,tt)|0,b=b+Math.imul(q,at)|0,u=u+Math.imul(q,ht)|0,u=u+Math.imul(z,at)|0,m=m+Math.imul(z,ht)|0;var fe=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(fe>>>26)|0,fe&=67108863,b=Math.imul(te,D),u=Math.imul(te,K),u=u+Math.imul(Ut,D)|0,m=Math.imul(Ut,K),b=b+Math.imul(Rt,ft)|0,u=u+Math.imul(Rt,pt)|0,u=u+Math.imul(Dt,ft)|0,m=m+Math.imul(Dt,pt)|0,b=b+Math.imul(It,At)|0,u=u+Math.imul(It,_t)|0,u=u+Math.imul(xt,At)|0,m=m+Math.imul(xt,_t)|0,b=b+Math.imul(Q,Pt)|0,u=u+Math.imul(Q,wt)|0,u=u+Math.imul(it,Pt)|0,m=m+Math.imul(it,wt)|0,b=b+Math.imul(O,Lt)|0,u=u+Math.imul(O,Et)|0,u=u+Math.imul(F,Lt)|0,m=m+Math.imul(F,Et)|0,b=b+Math.imul(kt,Bt)|0,u=u+Math.imul(kt,Mt)|0,u=u+Math.imul(S,Bt)|0,m=m+Math.imul(S,Mt)|0,b=b+Math.imul(dt,G)|0,u=u+Math.imul(dt,H)|0,u=u+Math.imul(ct,G)|0,m=m+Math.imul(ct,H)|0,b=b+Math.imul(yt,V)|0,u=u+Math.imul(yt,tt)|0,u=u+Math.imul(mt,V)|0,m=m+Math.imul(mt,tt)|0,b=b+Math.imul(ot,at)|0,u=u+Math.imul(ot,ht)|0,u=u+Math.imul(ut,at)|0,m=m+Math.imul(ut,ht)|0;var ce=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ce>>>26)|0,ce&=67108863,b=Math.imul(te,ft),u=Math.imul(te,pt),u=u+Math.imul(Ut,ft)|0,m=Math.imul(Ut,pt),b=b+Math.imul(Rt,At)|0,u=u+Math.imul(Rt,_t)|0,u=u+Math.imul(Dt,At)|0,m=m+Math.imul(Dt,_t)|0,b=b+Math.imul(It,Pt)|0,u=u+Math.imul(It,wt)|0,u=u+Math.imul(xt,Pt)|0,m=m+Math.imul(xt,wt)|0,b=b+Math.imul(Q,Lt)|0,u=u+Math.imul(Q,Et)|0,u=u+Math.imul(it,Lt)|0,m=m+Math.imul(it,Et)|0,b=b+Math.imul(O,Bt)|0,u=u+Math.imul(O,Mt)|0,u=u+Math.imul(F,Bt)|0,m=m+Math.imul(F,Mt)|0,b=b+Math.imul(kt,G)|0,u=u+Math.imul(kt,H)|0,u=u+Math.imul(S,G)|0,m=m+Math.imul(S,H)|0,b=b+Math.imul(dt,V)|0,u=u+Math.imul(dt,tt)|0,u=u+Math.imul(ct,V)|0,m=m+Math.imul(ct,tt)|0,b=b+Math.imul(yt,at)|0,u=u+Math.imul(yt,ht)|0,u=u+Math.imul(mt,at)|0,m=m+Math.imul(mt,ht)|0;var $t=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+($t>>>26)|0,$t&=67108863,b=Math.imul(te,At),u=Math.imul(te,_t),u=u+Math.imul(Ut,At)|0,m=Math.imul(Ut,_t),b=b+Math.imul(Rt,Pt)|0,u=u+Math.imul(Rt,wt)|0,u=u+Math.imul(Dt,Pt)|0,m=m+Math.imul(Dt,wt)|0,b=b+Math.imul(It,Lt)|0,u=u+Math.imul(It,Et)|0,u=u+Math.imul(xt,Lt)|0,m=m+Math.imul(xt,Et)|0,b=b+Math.imul(Q,Bt)|0,u=u+Math.imul(Q,Mt)|0,u=u+Math.imul(it,Bt)|0,m=m+Math.imul(it,Mt)|0,b=b+Math.imul(O,G)|0,u=u+Math.imul(O,H)|0,u=u+Math.imul(F,G)|0,m=m+Math.imul(F,H)|0,b=b+Math.imul(kt,V)|0,u=u+Math.imul(kt,tt)|0,u=u+Math.imul(S,V)|0,m=m+Math.imul(S,tt)|0,b=b+Math.imul(dt,at)|0,u=u+Math.imul(dt,ht)|0,u=u+Math.imul(ct,at)|0,m=m+Math.imul(ct,ht)|0;var oe=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(oe>>>26)|0,oe&=67108863,b=Math.imul(te,Pt),u=Math.imul(te,wt),u=u+Math.imul(Ut,Pt)|0,m=Math.imul(Ut,wt),b=b+Math.imul(Rt,Lt)|0,u=u+Math.imul(Rt,Et)|0,u=u+Math.imul(Dt,Lt)|0,m=m+Math.imul(Dt,Et)|0,b=b+Math.imul(It,Bt)|0,u=u+Math.imul(It,Mt)|0,u=u+Math.imul(xt,Bt)|0,m=m+Math.imul(xt,Mt)|0,b=b+Math.imul(Q,G)|0,u=u+Math.imul(Q,H)|0,u=u+Math.imul(it,G)|0,m=m+Math.imul(it,H)|0,b=b+Math.imul(O,V)|0,u=u+Math.imul(O,tt)|0,u=u+Math.imul(F,V)|0,m=m+Math.imul(F,tt)|0,b=b+Math.imul(kt,at)|0,u=u+Math.imul(kt,ht)|0,u=u+Math.imul(S,at)|0,m=m+Math.imul(S,ht)|0;var Jt=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,b=Math.imul(te,Lt),u=Math.imul(te,Et),u=u+Math.imul(Ut,Lt)|0,m=Math.imul(Ut,Et),b=b+Math.imul(Rt,Bt)|0,u=u+Math.imul(Rt,Mt)|0,u=u+Math.imul(Dt,Bt)|0,m=m+Math.imul(Dt,Mt)|0,b=b+Math.imul(It,G)|0,u=u+Math.imul(It,H)|0,u=u+Math.imul(xt,G)|0,m=m+Math.imul(xt,H)|0,b=b+Math.imul(Q,V)|0,u=u+Math.imul(Q,tt)|0,u=u+Math.imul(it,V)|0,m=m+Math.imul(it,tt)|0,b=b+Math.imul(O,at)|0,u=u+Math.imul(O,ht)|0,u=u+Math.imul(F,at)|0,m=m+Math.imul(F,ht)|0;var le=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(le>>>26)|0,le&=67108863,b=Math.imul(te,Bt),u=Math.imul(te,Mt),u=u+Math.imul(Ut,Bt)|0,m=Math.imul(Ut,Mt),b=b+Math.imul(Rt,G)|0,u=u+Math.imul(Rt,H)|0,u=u+Math.imul(Dt,G)|0,m=m+Math.imul(Dt,H)|0,b=b+Math.imul(It,V)|0,u=u+Math.imul(It,tt)|0,u=u+Math.imul(xt,V)|0,m=m+Math.imul(xt,tt)|0,b=b+Math.imul(Q,at)|0,u=u+Math.imul(Q,ht)|0,u=u+Math.imul(it,at)|0,m=m+Math.imul(it,ht)|0;var ae=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ae>>>26)|0,ae&=67108863,b=Math.imul(te,G),u=Math.imul(te,H),u=u+Math.imul(Ut,G)|0,m=Math.imul(Ut,H),b=b+Math.imul(Rt,V)|0,u=u+Math.imul(Rt,tt)|0,u=u+Math.imul(Dt,V)|0,m=m+Math.imul(Dt,tt)|0,b=b+Math.imul(It,at)|0,u=u+Math.imul(It,ht)|0,u=u+Math.imul(xt,at)|0,m=m+Math.imul(xt,ht)|0;var ne=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(ne>>>26)|0,ne&=67108863,b=Math.imul(te,V),u=Math.imul(te,tt),u=u+Math.imul(Ut,V)|0,m=Math.imul(Ut,tt),b=b+Math.imul(Rt,at)|0,u=u+Math.imul(Rt,ht)|0,u=u+Math.imul(Dt,at)|0,m=m+Math.imul(Dt,ht)|0;var Ot=(I+b|0)+((u&8191)<<13)|0;I=(m+(u>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,b=Math.imul(te,at),u=Math.imul(te,ht),u=u+Math.imul(Ut,at)|0,m=Math.imul(Ut,ht);var Nt=(I+b|0)+((u&8191)<<13)|0;return I=(m+(u>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,A[0]=zt,A[1]=Zt,A[2]=ye,A[3]=Yt,A[4]=pe,A[5]=ve,A[6]=ge,A[7]=ie,A[8]=ue,A[9]=fe,A[10]=ce,A[11]=$t,A[12]=oe,A[13]=Jt,A[14]=le,A[15]=ae,A[16]=ne,A[17]=Ot,A[18]=Nt,I!==0&&(A[19]=I,f.length++),f};Math.imul||(k=_);function B(d,o,a){a.negative=o.negative^d.negative,a.length=d.length+o.length;for(var f=0,h=0,g=0;g>>26)|0,h+=A>>>26,A&=67108863}a.words[g]=I,f=A,A=h}return f!==0?a.words[g]=f:a.length--,a.strip()}function P(d,o,a){var f=new R;return f.mulp(d,o,a)}i.prototype.mulTo=function(o,a){var f,h=this.length+o.length;return this.length===10&&o.length===10?f=k(this,o,a):h<63?f=_(this,o,a):h<1024?f=B(this,o,a):f=P(this,o,a),f};function R(d,o){this.x=d,this.y=o}R.prototype.makeRBT=function(o){for(var a=new Array(o),f=i.prototype._countBits(o)-1,h=0;h>=1;return h},R.prototype.permute=function(o,a,f,h,g,A){for(var I=0;I>>1)g++;return 1<>>13,f[2*A+1]=g&8191,g=g>>>13;for(A=2*a;A>=26,a+=h/67108864|0,a+=g>>>26,this.words[f]=g&67108863}return a!==0&&(this.words[f]=a,this.length++),this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var a=w(o);if(a.length===0)return new i(1);for(var f=this,h=0;h=0);var a=o%26,f=(o-a)/26,h=67108863>>>26-a<<26-a,g;if(a!==0){var A=0;for(g=0;g>>26-a}A&&(this.words[g]=A,this.length++)}if(f!==0){for(g=this.length-1;g>=0;g--)this.words[g+f]=this.words[g];for(g=0;g=0);var h;a?h=(a-a%26)/26:h=0;var g=o%26,A=Math.min((o-g)/26,this.length),I=67108863^67108863>>>g<A)for(this.length-=A,u=0;u=0&&(m!==0||u>=h);u--){var L=this.words[u]|0;this.words[u]=m<<26-g|L>>>g,m=L&I}return b&&m!==0&&(b.words[b.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,a,f){return n(this.negative===0),this.iushrn(o,a,f)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var a=o%26,f=(o-a)/26,h=1<=0);var a=o%26,f=(o-a)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(a!==0&&f++,this.length=Math.min(f,this.length),a!==0){var h=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},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(b/67108864|0),this.words[g+f]=A&67108863}for(;g>26,this.words[g+f]=A&67108863;if(I===0)return this.strip();for(n(I===-1),I=0,g=0;g>26,this.words[g]=A&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,a){var f=this.length-o.length,h=this.clone(),g=o,A=g.words[g.length-1]|0,I=this._countBits(A);f=26-I,f!==0&&(g=g.ushln(f),h.iushln(f),A=g.words[g.length-1]|0);var b=h.length-g.length,u;if(a!=="mod"){u=new i(null),u.length=b+1,u.words=new Array(u.length);for(var m=0;m=0;q--){var z=(h.words[g.length+q]|0)*67108864+(h.words[g.length+q-1]|0);for(z=Math.min(z/A|0,67108863),h._ishlnsubmul(g,z,q);h.negative!==0;)z--,h.negative=0,h._ishlnsubmul(g,1,q),h.isZero()||(h.negative^=1);u&&(u.words[q]=z)}return u&&u.strip(),h.strip(),a!=="div"&&f!==0&&h.iushrn(f),{div:u||null,mod:h}},i.prototype.divmod=function(o,a,f){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,g,A;return this.negative!==0&&o.negative===0?(A=this.neg().divmod(o,a),a!=="mod"&&(h=A.div.neg()),a!=="div"&&(g=A.mod.neg(),f&&g.negative!==0&&g.iadd(o)),{div:h,mod:g}):this.negative===0&&o.negative!==0?(A=this.divmod(o.neg(),a),a!=="mod"&&(h=A.div.neg()),{div:h,mod:A.mod}):this.negative&o.negative?(A=this.neg().divmod(o.neg(),a),a!=="div"&&(g=A.mod.neg(),f&&g.negative!==0&&g.isub(o)),{div:A.div,mod:g}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?a==="div"?{div:this.divn(o.words[0]),mod:null}:a==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,a)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var a=this.divmod(o);if(a.mod.isZero())return a.div;var f=a.div.negative!==0?a.mod.isub(o):a.mod,h=o.ushrn(1),g=o.andln(1),A=f.cmp(h);return A<0||g===1&&A===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var a=(1<<26)%o,f=0,h=this.length-1;h>=0;h--)f=(a*f+(this.words[h]|0))%o;return f},i.prototype.idivn=function(o){n(o<=67108863);for(var a=0,f=this.length-1;f>=0;f--){var h=(this.words[f]|0)+a*67108864;this.words[f]=h/o|0,a=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),A=new i(0),I=new i(1),b=0;a.isEven()&&f.isEven();)a.iushrn(1),f.iushrn(1),++b;for(var u=f.clone(),m=a.clone();!a.isZero();){for(var L=0,q=1;!(a.words[0]&q)&&L<26;++L,q<<=1);if(L>0)for(a.iushrn(L);L-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(u),g.isub(m)),h.iushrn(1),g.iushrn(1);for(var z=0,W=1;!(f.words[0]&W)&&z<26;++z,W<<=1);if(z>0)for(f.iushrn(z);z-- >0;)(A.isOdd()||I.isOdd())&&(A.iadd(u),I.isub(m)),A.iushrn(1),I.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(A),g.isub(I)):(f.isub(a),A.isub(h),I.isub(g))}return{a:A,b:I,gcd:f.iushln(b)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),A=f.clone();a.cmpn(1)>0&&f.cmpn(1)>0;){for(var I=0,b=1;!(a.words[0]&b)&&I<26;++I,b<<=1);if(I>0)for(a.iushrn(I);I-- >0;)h.isOdd()&&h.iadd(A),h.iushrn(1);for(var u=0,m=1;!(f.words[0]&m)&&u<26;++u,m<<=1);if(u>0)for(f.iushrn(u);u-- >0;)g.isOdd()&&g.iadd(A),g.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(g)):(f.isub(a),g.isub(h))}var L;return a.cmpn(1)===0?L=h:L=g,L.cmpn(0)<0&&L.iadd(o),L},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var a=this.clone(),f=o.clone();a.negative=0,f.negative=0;for(var h=0;a.isEven()&&f.isEven();h++)a.iushrn(1),f.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;f.isEven();)f.iushrn(1);var g=a.cmp(f);if(g<0){var A=a;a=f,f=A}else if(g===0||f.cmpn(1)===0)break;a.isub(f)}while(!0);return f.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var a=o%26,f=(o-a)/26,h=1<>>26,I&=67108863,this.words[A]=I}return g!==0&&(this.words[A]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var a=o<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this.strip();var f;if(this.length>1)f=1;else{a&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;f=h===o?0:ho.length)return 1;if(this.length=0;f--){var h=this.words[f]|0,g=o.words[f]|0;if(h!==g){hg&&(a=1);break}}return a},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new Z(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var T={k256:null,p224:null,p192:null,p25519:null};function U(d,o){this.name=d,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}U.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},U.prototype.ireduce=function(o){var a=o,f;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),f=a.bitLength();while(f>this.n);var h=f0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},U.prototype.split=function(o,a){o.iushrn(this.n,0,a)},U.prototype.imulK=function(o){return o.imul(this.k)};function j(){U.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(j,U),j.prototype.split=function(o,a){for(var f=4194303,h=Math.min(o.length,9),g=0;g>>22,A=I}A>>>=22,o.words[g-10]=A,A===0&&o.length>10?o.length-=10:o.length-=9},j.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var a=0,f=0;f>>=26,o.words[f]=g,a=h}return a!==0&&(o.words[o.length++]=a),o},i._prime=function(o){if(T[o])return T[o];var a;if(o==="k256")a=new j;else if(o==="p224")a=new Y;else if(o==="p192")a=new rt;else if(o==="p25519")a=new nt;else throw new Error("Unknown prime "+o);return T[o]=a,a};function Z(d){if(typeof d=="string"){var o=i._prime(d);this.m=o.p,this.prime=o}else n(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}Z.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},Z.prototype._verify2=function(o,a){n((o.negative|a.negative)===0,"red works only with positives"),n(o.red&&o.red===a.red,"red works only with red numbers")},Z.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},Z.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},Z.prototype.add=function(o,a){this._verify2(o,a);var f=o.add(a);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},Z.prototype.iadd=function(o,a){this._verify2(o,a);var f=o.iadd(a);return f.cmp(this.m)>=0&&f.isub(this.m),f},Z.prototype.sub=function(o,a){this._verify2(o,a);var f=o.sub(a);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},Z.prototype.isub=function(o,a){this._verify2(o,a);var f=o.isub(a);return f.cmpn(0)<0&&f.iadd(this.m),f},Z.prototype.shl=function(o,a){return this._verify1(o),this.imod(o.ushln(a))},Z.prototype.imul=function(o,a){return this._verify2(o,a),this.imod(o.imul(a))},Z.prototype.mul=function(o,a){return this._verify2(o,a),this.imod(o.mul(a))},Z.prototype.isqr=function(o){return this.imul(o,o.clone())},Z.prototype.sqr=function(o){return this.mul(o,o)},Z.prototype.sqrt=function(o){if(o.isZero())return o.clone();var a=this.m.andln(3);if(n(a%2===1),a===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(o,f)}for(var h=this.m.subn(1),g=0;!h.isZero()&&h.andln(1)===0;)g++,h.iushrn(1);n(!h.isZero());var A=new i(1).toRed(this),I=A.redNeg(),b=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,b).cmp(I)!==0;)u.redIAdd(I);for(var m=this.pow(u,h),L=this.pow(o,h.addn(1).iushrn(1)),q=this.pow(o,h),z=g;q.cmp(A)!==0;){for(var W=q,ot=0;W.cmp(A)!==0;ot++)W=W.redSqr();n(ot=0;g--){for(var m=a.words[g],L=u-1;L>=0;L--){var q=m>>L&1;if(A!==h[0]&&(A=this.sqr(A)),q===0&&I===0){b=0;continue}I<<=1,I|=q,b++,!(b!==f&&(g!==0||L!==0))&&(A=this.mul(A,h[I]),b=0,I=0)}u=26}return A},Z.prototype.convertTo=function(o){var a=o.umod(this.m);return a===o?a.clone():a},Z.prototype.convertFrom=function(o){var a=o.clone();return a.red=null,a},i.mont=function(o){return new x(o)};function x(d){Z.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(x,Z),x.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},x.prototype.convertFrom=function(o){var a=this.imod(o.mul(this.rinv));return a.red=null,a},x.prototype.imul=function(o,a){if(o.isZero()||a.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),A=g;return g.cmp(this.m)>=0?A=g.isub(this.m):g.cmpn(0)<0&&(A=g.iadd(this.m)),A._forceRed(this)},x.prototype.mul=function(o,a){if(o.isZero()||a.isZero())return new i(0)._forceRed(this);var f=o.mul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),A=g;return g.cmp(this.m)>=0?A=g.isub(this.m):g.cmpn(0)<0&&(A=g.iadd(this.m)),A._forceRed(this)},x.prototype.invm=function(o){var a=this.imod(o._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(r,Re)}(el)),el.exports}var Ip,x6;function c9(){if(x6)return Ip;x6=1;var r=Lg(),t=sr.Buffer;function e(n,s){return t.from(n.toRed(r.mont(s.modulus)).redPow(new r(s.publicExponent)).fromRed().toArray())}return Ip=e,Ip}var Bp,_6;function RC(){if(_6)return Bp;_6=1;var r=Ed(),t=Bf,e=Ch,n=u9(),s=f9(),i=Lg(),c=c9(),l=Mg(),p=sr.Buffer;Bp=function(w,_,k){var B;w.padding?B=w.padding:k?B=1:B=4;var P=r(w),R;if(B===4)R=v(P,_);else if(B===1)R=y(P,_,k);else if(B===3){if(R=new i(_),R.cmp(P.modulus)>=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return k?l(R,P):c(R,P)};function v(M,w){var _=M.modulus.byteLength(),k=w.length,B=e("sha1").update(p.alloc(0)).digest(),P=B.length,R=2*P;if(k>_-R-2)throw new Error("message too long");var T=p.alloc(_-k-R-2),U=_-P-1,j=t(P),Y=s(p.concat([B,T,p.alloc(1,1),w],U),n(j,U)),rt=s(j,n(Y,P));return new i(p.concat([p.alloc(1),rt,Y],_))}function y(M,w,_){var k=w.length,B=M.modulus.byteLength();if(k>B-11)throw new Error("message too long");var P;return _?P=p.alloc(B-k-3,255):P=E(B-k-3),new i(p.concat([p.from([0,_?1:2]),P,p.alloc(1),w],B))}function E(M){for(var w=p.allocUnsafe(M),_=0,k=t(M*2),B=0,P;_P||new n(w).cmp(B.modulus)>=0)throw new Error("decryption error");var R;_?R=c(new n(w),B):R=s(w,B);var T=l.alloc(P-R.length);if(R=l.concat([T,R],P),k===4)return p(B,R);if(k===1)return v(B,R,_);if(k===3)return R;throw new Error("unknown padding")};function p(E,M){var w=E.modulus.byteLength(),_=i("sha1").update(l.alloc(0)).digest(),k=_.length;if(M[0]!==0)throw new Error("decryption error");var B=M.slice(1,k+1),P=M.slice(k+1),R=e(B,t(P,k)),T=e(P,t(R,w-k-1));if(y(_,T.slice(0,k)))throw new Error("decryption error");for(var U=k;T[U]===0;)U++;if(T[U++]!==1)throw new Error("decryption error");return T.slice(U)}function v(E,M,w){for(var _=M.slice(0,2),k=2,B=0;M[k++]!==0;)if(k>=M.length){B++;break}var P=M.slice(2,k-1);if((_.toString("hex")!=="0002"&&!w||_.toString("hex")!=="0001"&&w)&&B++,P.length<8&&B++,B)throw new Error("decryption error");return M.slice(k)}function y(E,M){E=l.from(E),M=l.from(M);var w=0,_=E.length;E.length!==M.length&&(w++,_=Math.min(E.length,M.length));for(var k=-1;++k<_;)w+=E[k]^M[k];return w}return Pp}var E6;function TC(){return E6||(E6=1,function(r){r.publicEncrypt=RC(),r.privateDecrypt=CC(),r.privateEncrypt=function(e,n){return r.publicEncrypt(e,n,!0)},r.publicDecrypt=function(e,n){return r.privateDecrypt(e,n,!0)}}(Ap)),Ap}var _u={},A6;function LC(){if(A6)return _u;A6=1;function r(){throw new Error(`secure random number generation not supported by this browser -use chrome, FireFox or Internet Explorer 11`)}var t=sr,e=Bf,n=t.Buffer,s=t.kMaxLength,i=Re.crypto||Re.msCrypto,c=Math.pow(2,32)-1;function l(M,w){if(typeof M!="number"||M!==M)throw new TypeError("offset must be a number");if(M>c||M<0)throw new TypeError("offset must be a uint32");if(M>s||M>w)throw new RangeError("offset out of range")}function p(M,w,_){if(typeof M!="number"||M!==M)throw new TypeError("size must be a number");if(M>c||M<0)throw new TypeError("size must be a uint32");if(M+w>_||M>s)throw new RangeError("buffer too small")}i&&i.getRandomValues||!Gt.process.browser?(_u.randomFill=v,_u.randomFillSync=E):(_u.randomFill=r,_u.randomFillSync=r);function v(M,w,_,k){if(!n.isBuffer(M)&&!(M instanceof Re.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof w=="function")k=w,w=0,_=M.length;else if(typeof _=="function")k=_,_=M.length-w;else if(typeof k!="function")throw new TypeError('"cb" argument must be a function');return l(w,M.length),p(_,w,M.length),y(M,w,_,k)}function y(M,w,_,k){if(Gt.process.browser){var B=M.buffer,P=new Uint8Array(B,w,_);if(i.getRandomValues(P),k){Gt.process.nextTick(function(){k(null,M)});return}return M}if(k){e(_,function(T,U){if(T)return k(T);U.copy(M,w),k(null,M)});return}var R=e(_);return R.copy(M,w),M}function E(M,w,_){if(typeof w>"u"&&(w=0),!n.isBuffer(M)&&!(M instanceof Re.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return l(w,M.length),_===void 0&&(_=M.length-w),p(_,w,M.length),y(M,w,_)}return _u}var S6;function h9(){if(S6)return Je;S6=1,Je.randomBytes=Je.rng=Je.pseudoRandomBytes=Je.prng=Bf,Je.createHash=Je.Hash=Ch,Je.createHmac=Je.Hmac=m_();var r=MB(),t=Object.keys(r),e=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(t);Je.getHashes=function(){return e};var n=x_();Je.pbkdf2=n.pbkdf2,Je.pbkdf2Sync=n.pbkdf2Sync;var s=jB();Je.Cipher=s.Cipher,Je.createCipher=s.createCipher,Je.Cipheriv=s.Cipheriv,Je.createCipheriv=s.createCipheriv,Je.Decipher=s.Decipher,Je.createDecipher=s.createDecipher,Je.Decipheriv=s.Decipheriv,Je.createDecipheriv=s.createDecipheriv,Je.getCiphers=s.getCiphers,Je.listCiphers=s.listCiphers;var i=tP();Je.DiffieHellmanGroup=i.DiffieHellmanGroup,Je.createDiffieHellmanGroup=i.createDiffieHellmanGroup,Je.getDiffieHellman=i.getDiffieHellman,Je.createDiffieHellman=i.createDiffieHellman,Je.DiffieHellman=i.DiffieHellman;var c=IC();Je.createSign=c.createSign,Je.Sign=c.Sign,Je.createVerify=c.createVerify,Je.Verify=c.Verify,Je.createECDH=PC();var l=TC();Je.publicEncrypt=l.publicEncrypt,Je.privateEncrypt=l.privateEncrypt,Je.publicDecrypt=l.publicDecrypt,Je.privateDecrypt=l.privateDecrypt;var p=LC();return Je.randomFill=p.randomFill,Je.randomFillSync=p.randomFillSync,Je.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join(` -`))},Je.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},Je}var OC=function(r){return function(t,e){var n=xe.useRef(!1);r(function(){return function(){n.current=!1}},[]),r(function(){if(!n.current)n.current=!0;else return t()},e)}},Bv=function(r){return typeof r=="function"},UC=function(r){return typeof r>"u"},NC=!1;const DC=NC;function zC(r){DC&&(Bv(r)||console.error("useMemoizedFn expected parameter is a function, got ".concat(typeof r)));var t=xe.useRef(r);t.current=xe.useMemo(function(){return r},[r]);var e=xe.useRef();return e.current||(e.current=function(){for(var n=[],s=0;s{},emptyCart:()=>{},removeFromCart:()=>{},referrerKey:void 0}),VC=({children:r,referrerKey:t}={})=>{const[e={},n]=HC("bonfida-widget-cart",{defaultValue:{}}),s=p=>{n({...e,[p.domain]:p})},i=p=>{const v={...e};delete v[p],n(v)},c=()=>n({}),l=!Object.values(e).length;return St.jsx(Nh.Provider,{value:{cart:e,addToCart:s,removeFromCart:i,isCartEmpty:l,emptyCart:c,referrerKey:t},children:r})},Ad=xe.createContext({status:null,setStatus:()=>{},setError:()=>{}}),ZC=({children:r})=>{const[t,e]=xe.useState(null),n=s=>{e({status:"error",message:s})};return St.jsx(Ad.Provider,{value:{status:t,setStatus:e,setError:n},children:r})},Og=xe.createContext({connection:null});function Ug(){return xe.useContext(Og)}const WC=({children:r})=>{const{connection:t}=Fk();return St.jsx(Og.Provider,{value:{connection:t},children:r})},GC=({children:r,connection:t})=>t?t?St.jsx(Og.Provider,{value:{connection:t},children:r}):St.jsx(St.Fragment,{children:r}):St.jsx(WC,{children:r}),YC={publicKey:null,wallets:[],wallet:null,connect:async()=>{},select:()=>{},connecting:!1,connected:!1,disconnect:async()=>{},visible:!1,setVisible:()=>{},connection:null,signAllTransactions:async r=>r},Ng=xe.createContext(YC);function Sd(){return xe.useContext(Ng)}const XC=({children:r})=>{const t=jk(),{connection:e}=Ug(),{visible:n,setVisible:s}=$k(),i={visible:n,setVisible:s,connection:e,...t};return St.jsx(Ng.Provider,{value:i,children:r})},JC=({children:r,passthroughWallet:t})=>{const{connection:e}=Ug();return t?t?St.jsx(Ng.Provider,{value:{...t,connection:e},children:r}):St.jsx(St.Fragment,{children:r}):St.jsx(XC,{children:r})},QC=({children:r,endpoint:t,connection:e,passthroughWallet:n})=>{const s=xe.useMemo(()=>t&&!e?({children:c})=>St.jsx(iI,{endpoint:t,children:c}):xe.Fragment,[t,e]),i=xe.useMemo(()=>n?xe.Fragment:({children:c})=>St.jsx(Kk,{wallets:[new Hk],autoConnect:!0,children:c}),[n]);return St.jsx(s,{children:St.jsx(i,{children:St.jsx(Vk,{children:St.jsx(GC,{connection:e,children:St.jsx(JC,{passthroughWallet:n,children:r})})})})})};function Wc(){return Wc=Object.assign||function(r){for(var t=1;t{const t=r.decode.bind(r),e=r.encode.bind(r);return{decode:t,encode:e}},lT=r=>t=>{const e=Y7(r,t),{encode:n,decode:s}=Fg(e),i=e;return i.decode=(c,l)=>{const p=s(c,l);return Zk(Gt.Buffer.from(p))},i.encode=(c,l,p)=>{const v=Wk(c,r);return n(v,l,p)},i},dT=lT(8),pT=r=>{const t=nd(r),{encode:e,decode:n}=Fg(t),s=t;return s.decode=(i,c)=>!!n(i,c),s.encode=(i,c,l)=>{const p=Number(i);return e(p,c,l)},s},I6=r=>{const t=Y7(32,r),{encode:e,decode:n}=Fg(t),s=t;return s.decode=(i,c)=>{const l=n(i,c);return new Ne(l)},s.encode=(i,c,l)=>{const p=i.toBuffer();return e(p,c,l)},s};class mT extends Error{constructor(t){super(t)}}class vT extends mT{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var _l;(function(r){r[r.InitializeMint=0]="InitializeMint",r[r.InitializeAccount=1]="InitializeAccount",r[r.InitializeMultisig=2]="InitializeMultisig",r[r.Transfer=3]="Transfer",r[r.Approve=4]="Approve",r[r.Revoke=5]="Revoke",r[r.SetAuthority=6]="SetAuthority",r[r.MintTo=7]="MintTo",r[r.Burn=8]="Burn",r[r.CloseAccount=9]="CloseAccount",r[r.FreezeAccount=10]="FreezeAccount",r[r.ThawAccount=11]="ThawAccount",r[r.TransferChecked=12]="TransferChecked",r[r.ApproveChecked=13]="ApproveChecked",r[r.MintToChecked=14]="MintToChecked",r[r.BurnChecked=15]="BurnChecked",r[r.InitializeAccount2=16]="InitializeAccount2",r[r.SyncNative=17]="SyncNative",r[r.InitializeAccount3=18]="InitializeAccount3",r[r.InitializeMultisig2=19]="InitializeMultisig2",r[r.InitializeMint2=20]="InitializeMint2",r[r.GetAccountDataSize=21]="GetAccountDataSize",r[r.InitializeImmutableOwner=22]="InitializeImmutableOwner",r[r.AmountToUiAmount=23]="AmountToUiAmount",r[r.UiAmountToAmount=24]="UiAmountToAmount",r[r.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",r[r.TransferFeeExtension=26]="TransferFeeExtension",r[r.ConfidentialTransferExtension=27]="ConfidentialTransferExtension",r[r.DefaultAccountStateExtension=28]="DefaultAccountStateExtension",r[r.Reallocate=29]="Reallocate",r[r.MemoTransferExtension=30]="MemoTransferExtension",r[r.CreateNativeMint=31]="CreateNativeMint",r[r.InitializeNonTransferableMint=32]="InitializeNonTransferableMint",r[r.InterestBearingMintExtension=33]="InterestBearingMintExtension",r[r.CpiGuardExtension=34]="CpiGuardExtension",r[r.InitializePermanentDelegate=35]="InitializePermanentDelegate"})(_l||(_l={}));function gT(r,t,e){if(e.length){r.push({pubkey:t,isSigner:!1,isWritable:!1});for(const n of e)r.push({pubkey:n instanceof Ne?n:n.publicKey,isSigner:!0,isWritable:!1})}else r.push({pubkey:t,isSigner:!0,isWritable:!1});return r}const B6=dg([nd("instruction")]);function yT(r,t,e,n=[],s=Dh){const i=gT([{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:t,isSigner:!1,isWritable:!0}],e,n),c=Gt.Buffer.alloc(B6.span);return B6.encode({instruction:_l.CloseAccount},c),new kh({keys:i,programId:s,data:c})}const bT=dg([Tb("mintAuthorityOption"),I6("mintAuthority"),dT("supply"),nd("decimals"),pT("isInitialized"),Tb("freezeAuthorityOption"),I6("freezeAuthority")]);bT.span;function d9(r,t,e=!1,n=Dh,s=zg){if(!e&&!Ne.isOnCurve(t.toBuffer()))throw new vT;const[i]=Ne.findProgramAddressSync([t.toBuffer(),n.toBuffer(),r.toBuffer()],s);return i}function wT(r,t,e,n,s=Dh,i=zg){return xT(r,t,e,n,Gt.Buffer.alloc(0),s,i)}function xT(r,t,e,n,s,i=Dh,c=zg){const l=[{pubkey:r,isSigner:!0,isWritable:!0},{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:id.programId,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1}];return new kh({keys:l,programId:c,data:s})}const P6=dg([nd("instruction")]);function _T(r,t=Dh){const e=[{pubkey:r,isSigner:!1,isWritable:!0}],n=Gt.Buffer.alloc(P6.span);return P6.encode({instruction:_l.SyncNative},n),new kh({keys:e,programId:t,data:n})}const MT="logger/5.7.0";let R6=!1,C6=!1;const rl={debug:1,default:2,info:2,warning:3,error:4,off:5};let T6=rl.default,Rp=null;function ET(){try{const r=[];if(["NFD","NFC","NFKD","NFKC"].forEach(t=>{try{if("test".normalize(t)!=="test")throw new Error("bad normalize")}catch{r.push(t)}}),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}const L6=ET();var Pv;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(Pv||(Pv={}));var ao;(function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED",r.ACTION_REJECTED="ACTION_REJECTED"})(ao||(ao={}));const O6="0123456789abcdef";class Jr{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const n=t.toLowerCase();rl[n]==null&&this.throwArgumentError("invalid log level name","logLevel",t),!(T6>rl[n])&&console.log.apply(console,e)}debug(...t){this._log(Jr.levels.DEBUG,t)}info(...t){this._log(Jr.levels.INFO,t)}warn(...t){this._log(Jr.levels.WARNING,t)}makeError(t,e,n){if(C6)return this.makeError("censored error",e,{});e||(e=Jr.errors.UNKNOWN_ERROR),n||(n={});const s=[];Object.keys(n).forEach(p=>{const v=n[p];try{if(v instanceof Uint8Array){let y="";for(let E=0;E>4],y+=O6[v[E]&15];s.push(p+"=Uint8Array(0x"+y+")")}else s.push(p+"="+JSON.stringify(v))}catch{s.push(p+"="+JSON.stringify(n[p].toString()))}}),s.push(`code=${e}`),s.push(`version=${this.version}`);const i=t;let c="";switch(e){case ao.NUMERIC_FAULT:{c="NUMERIC_FAULT";const p=t;switch(p){case"overflow":case"underflow":case"division-by-zero":c+="-"+p;break;case"negative-power":case"negative-width":c+="-unsupported";break;case"unbound-bitwise-result":c+="-unbound-result";break}break}case ao.CALL_EXCEPTION:case ao.INSUFFICIENT_FUNDS:case ao.MISSING_NEW:case ao.NONCE_EXPIRED:case ao.REPLACEMENT_UNDERPRICED:case ao.TRANSACTION_REPLACED:case ao.UNPREDICTABLE_GAS_LIMIT:c=e;break}c&&(t+=" [ See: https://links.ethers.org/v5-errors-"+c+" ]"),s.length&&(t+=" ("+s.join(", ")+")");const l=new Error(t);return l.reason=i,l.code=e,Object.keys(n).forEach(function(p){l[p]=n[p]}),l}throwError(t,e,n){throw this.makeError(t,e,n)}throwArgumentError(t,e,n){return this.throwError(t,Jr.errors.INVALID_ARGUMENT,{argument:e,value:n})}assert(t,e,n,s){t||this.throwError(e,n,s)}assertArgument(t,e,n,s){t||this.throwArgumentError(e,n,s)}checkNormalize(t){L6&&this.throwError("platform missing String.prototype.normalize",Jr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:L6})}checkSafeUint53(t,e){typeof t=="number"&&(e==null&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Jr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Jr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,n){n?n=": "+n:n="",te&&this.throwError("too many arguments"+n,Jr.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){(t===Object||t==null)&&this.throwError("missing new",Jr.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Jr.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):(t===Object||t==null)&&this.throwError("missing new",Jr.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Rp||(Rp=new Jr(MT)),Rp}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Jr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),R6){if(!t)return;this.globalLogger().throwError("error censorship permanent",Jr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}C6=!!t,R6=!!e}static setLogLevel(t){const e=rl[t.toLowerCase()];if(e==null){Jr.globalLogger().warn("invalid log level - "+t);return}T6=e}static from(t){return new Jr(t)}}Jr.errors=ao;Jr.levels=Pv;const AT="bytes/5.7.0",Cp=new Jr(AT);function ST(r){return!!r.toHexString}function nl(r){return r.slice||(r.slice=function(){const t=Array.prototype.slice.call(arguments);return nl(new Uint8Array(Array.prototype.slice.apply(r,t)))}),r}function U6(r){return typeof r=="number"&&r==r&&r%1===0}function kT(r){if(r==null)return!1;if(r.constructor===Uint8Array)return!0;if(typeof r=="string"||!U6(r.length)||r.length<0)return!1;for(let t=0;t=256)return!1}return!0}function IT(r,t){if(t||(t={}),typeof r=="number"){Cp.checkSafeUint53(r,"invalid arrayify value");const e=[];for(;r;)e.unshift(r&255),r=parseInt(String(r/256));return e.length===0&&e.push(0),nl(new Uint8Array(e))}if(t.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),ST(r)&&(r=r.toHexString()),BT(r)){let e=r.substring(2);e.length%2&&(t.hexPad==="left"?e="0"+e:t.hexPad==="right"?e+="0":Cp.throwArgumentError("hex data is odd-length","value",r));const n=[];for(let s=0;s= 0 and <= "+t,r)}function TT(r,t){t===void 0&&(t=0),jg(t,"offset");var e=r[t],n=r[t+7];(e===void 0||n===void 0)&&p9(t,r.length-8);var s=r[t+4]+r[t+5]*Math.pow(2,8)+r[t+6]*Math.pow(2,16)+(n<<24);return(BigInt(s)<0&&y[y.length-1])&&(_[0]===6||_[0]===2)){l=0;continue}if(_[0]===3&&(!y||_[1]>y[0]&&_[1]0&&v[v.length-1])&&(w[0]===6||w[0]===2)){c=0;continue}if(w[0]===3&&(!v||w[1]>v[0]&&w[1]=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),e=0;e>>0,T=new Uint8Array(R);B!==P;){for(var U=w[B],j=0,Y=R-1;(U!==0||j>>0,T[Y]=U%c>>>0,U=U/c>>>0;if(U!==0)throw new Error("Non-zero carry");k=j,B++}for(var rt=R-k;rt!==R&&T[rt]===0;)rt++;for(var nt=l.repeat(_);rt>>0,R=new Uint8Array(P);w[_];){var T=t[w.charCodeAt(_)];if(T===255)return;for(var U=0,j=P-1;(T!==0||U>>0,R[j]=T%256>>>0,T=T/256>>>0;if(T!==0)throw new Error("Non-zero carry");B=U,_++}for(var Y=P-B;Y!==P&&R[Y]===0;)Y++;var rt=d0.allocUnsafe(k+(P-Y));rt.fill(0,0,k);for(var nt=k;Y!==P;)rt[nt++]=R[Y++];return rt}function M(w){var _=E(w);if(_)return _;throw new Error("Non-base"+c+" character")}return{encode:y,decodeUnsafe:E,decode:M}}var zT=DT,qT=zT,FT="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",jT=qT(FT);const Ku=lg(jT);var p0={exports:{}},F6;function $g(){if(F6)return p0.exports;F6=1;const r=/[\p{Lu}]/u,t=/[\p{Ll}]/u,e=/^[\p{Lu}](?![\p{Lu}])/gu,n=/([\p{Alpha}\p{N}_]|$)/u,s=/[_.\- ]+/,i=new RegExp("^"+s.source),c=new RegExp(s.source+n.source,"gu"),l=new RegExp("\\d+"+n.source,"gu"),p=(M,w,_)=>{let k=!1,B=!1,P=!1;for(let R=0;R(e.lastIndex=0,M.replace(e,_=>w(_))),y=(M,w)=>(c.lastIndex=0,l.lastIndex=0,M.replace(c,(_,k)=>w(k)).replace(l,_=>w(_))),E=(M,w)=>{if(!(typeof M=="string"||Array.isArray(M)))throw new TypeError("Expected the input to be `string | string[]`");if(w={pascalCase:!1,preserveConsecutiveUppercase:!1,...w},Array.isArray(M)?M=M.map(P=>P.trim()).filter(P=>P.length).join("-"):M=M.trim(),M.length===0)return"";const _=w.locale===!1?P=>P.toLowerCase():P=>P.toLocaleLowerCase(w.locale),k=w.locale===!1?P=>P.toUpperCase():P=>P.toLocaleUpperCase(w.locale);return M.length===1?w.pascalCase?k(M):_(M):(M!==_(M)&&(M=p(M,_,k)),M=M.replace(i,""),w.preserveConsecutiveUppercase?M=v(M,_):M=_(M),w.pascalCase&&(M=k(M.charAt(0))+M.slice(1)),y(M,k))};return p0.exports=E,p0.exports.default=E,p0.exports}var $T=$g();const Nr=lg($T);var Up={},Be={},j6;function $6(){if(j6)return Be;j6=1;class r{constructor(u,m){if(!Number.isInteger(u))throw new TypeError("span must be an integer");this.span=u,this.property=m}makeDestinationObject(){return{}}decode(u,m){throw new Error("Layout is abstract")}encode(u,m,L){throw new Error("Layout is abstract")}getSpan(u,m){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(u){const m=Object.create(this.constructor.prototype);return Object.assign(m,this),m.property=u,m}fromArray(u){}}Be.Layout=r;function t(b,u){return u.property?b+"["+u.property+"]":b}Be.nameWithProperty=t;function e(b,u){if(typeof b!="function")throw new TypeError("Class must be constructor");if(b.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(u&&u instanceof r))throw new TypeError("layout must be a Layout");if(u.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");b.layout_=u,u.boundConstructor_=b,u.makeDestinationObject=()=>new b,Object.defineProperty(b.prototype,"encode",{value:function(m,L){return u.encode(this,m,L)},writable:!0}),Object.defineProperty(b,"decode",{value:function(m,L){return u.decode(m,L)},writable:!0})}Be.bindConstructorLayout=e;class n extends r{isCount(){throw new Error("ExternalLayout is abstract")}}class s extends n{constructor(u,m){if(u===void 0&&(u=1),!Number.isInteger(u)||0>=u)throw new TypeError("elementSpan must be a (positive) integer");super(-1,m),this.elementSpan=u}isCount(){return!0}decode(u,m){m===void 0&&(m=0);const L=u.length-m;return Math.floor(L/this.elementSpan)}encode(u,m,L){return 0}}class i extends n{constructor(u,m,L){if(!(u instanceof r))throw new TypeError("layout must be a Layout");if(m===void 0)m=0;else if(!Number.isInteger(m))throw new TypeError("offset must be integer or undefined");super(u.span,L||u.property),this.layout=u,this.offset=m}isCount(){return this.layout instanceof c||this.layout instanceof l}decode(u,m){return m===void 0&&(m=0),this.layout.decode(u,m+this.offset)}encode(u,m,L){return L===void 0&&(L=0),this.layout.encode(u,m,L+this.offset)}}class c extends r{constructor(u,m){if(super(u,m),6W+q.encode(ot,m,L+W),0);return this.count instanceof n&&this.count.encode(u.length,m,L),z}}class Y extends r{constructor(u,m,L){if(!(Array.isArray(u)&&u.reduce((z,W)=>z&&W instanceof r,!0)))throw new TypeError("fields must be array of Layout instances");typeof m=="boolean"&&L===void 0&&(L=m,m=void 0);for(const z of u)if(0>z.span&&z.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let q=-1;try{q=u.reduce((z,W)=>z+W.getSpan(),0)}catch{}super(q,m),this.fields=u,this.decodePrefixes=!!L}getSpan(u,m){if(0<=this.span)return this.span;m===void 0&&(m=0);let L=0;try{L=this.fields.reduce((q,z)=>{const W=z.getSpan(u,m);return m+=W,q+W},0)}catch{throw new RangeError("indeterminate span")}return L}decode(u,m){m===void 0&&(m=0);const L=this.makeDestinationObject();for(const q of this.fields)if(q.property!==void 0&&(L[q.property]=q.decode(u,m)),m+=q.getSpan(u,m),this.decodePrefixes&&u.length===m)break;return L}encode(u,m,L){L===void 0&&(L=0);const q=L;let z=0,W=0;for(const ot of this.fields){let ut=ot.span;if(W=0ut&&(ut=ot.getSpan(m,L)))}z=L,L+=ut}return z+W-q}fromArray(u){const m=this.makeDestinationObject();for(const L of this.fields)L.property!==void 0&&0L.span?m=-1:0<=m&&(m+=L.span)}}}class rt{constructor(u){this.property=u}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class nt extends rt{constructor(u,m){if(!(u instanceof n&&u.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(m||u.property||"variant"),this.layout=u}decode(u,m){return this.layout.decode(u,m)}encode(u,m,L){return this.layout.encode(u,m,L)}}class Z extends r{constructor(u,m,L){const q=u instanceof c||u instanceof l;if(q)u=new nt(new i(u));else if(u instanceof n&&u.isCount())u=new nt(u);else if(!(u instanceof rt))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(m===void 0&&(m=null),!(m===null||m instanceof r))throw new TypeError("defaultLayout must be null or a Layout");if(m!==null){if(0>m.span)throw new Error("defaultLayout must have constant span");m.property===void 0&&(m=m.replicate("content"))}let z=-1;m&&(z=m.span,0<=z&&q&&(z+=u.layout.span)),super(z,L),this.discriminator=u,this.usesPrefixDiscriminator=q,this.defaultLayout=m,this.registry={};let W=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(ot){return W(ot)},this.configGetSourceVariant=function(ot){W=ot.bind(this)}}getSpan(u,m){if(0<=this.span)return this.span;m===void 0&&(m=0);const L=this.getVariant(u,m);if(!L)throw new Error("unable to determine span for unrecognized variant");return L.getSpan(u,m)}defaultGetSourceVariant(u){if(u.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&u.hasOwnProperty(this.defaultLayout.property))return;const m=this.registry[u[this.discriminator.property]];if(m&&(!m.layout||u.hasOwnProperty(m.property)))return m}else for(const m in this.registry){const L=this.registry[m];if(u.hasOwnProperty(L.property))return L}throw new Error("unable to infer src variant")}decode(u,m){m===void 0&&(m=0);let L;const q=this.discriminator,z=q.decode(u,m);let W=this.registry[z];if(W===void 0){let ot=0;W=this.defaultLayout,this.usesPrefixDiscriminator&&(ot=q.layout.span),L=this.makeDestinationObject(),L[q.property]=z,L[W.property]=this.defaultLayout.decode(u,m+ot)}else L=W.decode(u,m);return L}encode(u,m,L){L===void 0&&(L=0);const q=this.getSourceVariant(u);if(q===void 0){const z=this.discriminator,W=this.defaultLayout;let ot=0;return this.usesPrefixDiscriminator&&(ot=z.layout.span),z.encode(u[z.property],m,L),ot+W.encode(u[W.property],m,L+ot)}return q.encode(u,m,L)}addVariant(u,m,L){const q=new x(this,u,m,L);return this.registry[u]=q,q}getVariant(u,m){let L=u;return Gt.Buffer.isBuffer(u)&&(m===void 0&&(m=0),L=this.discriminator.decode(u,m)),this.registry[L]}}class x extends r{constructor(u,m,L,q){if(!(u instanceof Z))throw new TypeError("union must be a Union");if(!Number.isInteger(m)||0>m)throw new TypeError("variant must be a (non-negative) integer");if(typeof L=="string"&&q===void 0&&(q=L,L=null),L){if(!(L instanceof r))throw new TypeError("layout must be a Layout");if(u.defaultLayout!==null&&0<=L.span&&L.span>u.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof q!="string")throw new TypeError("variant must have a String property")}let z=u.span;0>u.span&&(z=L?L.span:0,0<=z&&u.usesPrefixDiscriminator&&(z+=u.discriminator.layout.span)),super(z,q),this.union=u,this.variant=m,this.layout=L||null}getSpan(u,m){if(0<=this.span)return this.span;m===void 0&&(m=0);let L=0;return this.union.usesPrefixDiscriminator&&(L=this.union.discriminator.layout.span),L+this.layout.getSpan(u,m+L)}decode(u,m){const L=this.makeDestinationObject();if(m===void 0&&(m=0),this!==this.union.getVariant(u,m))throw new Error("variant mismatch");let q=0;return this.union.usesPrefixDiscriminator&&(q=this.union.discriminator.layout.span),this.layout?L[this.property]=this.layout.decode(u,m+q):this.property?L[this.property]=!0:this.union.usesPrefixDiscriminator&&(L[this.union.discriminator.property]=this.variant),L}encode(u,m,L){L===void 0&&(L=0);let q=0;if(this.union.usesPrefixDiscriminator&&(q=this.union.discriminator.layout.span),this.layout&&!u.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,m,L);let z=q;if(this.layout&&(this.layout.encode(u[this.property],m,L+q),z+=this.layout.getSpan(m,L+q),0<=this.union.span&&z>this.union.span))throw new Error("encoded variant overruns containing union");return z}fromArray(u){if(this.layout)return this.layout.fromArray(u)}}function d(b){return 0>b&&(b+=4294967296),b}class o extends r{constructor(u,m,L){if(!(u instanceof c||u instanceof l))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof m=="string"&&L===void 0&&(L=m,m=void 0),4=m)throw new TypeError("bits must be positive integer");const q=8*u.span,z=u.fields.reduce((W,ot)=>W+ot.bits,0);if(m+z>q)throw new Error("bits too long for span remainder ("+(q-z)+" of "+q+" remain)");this.container=u,this.bits=m,this.valueMask=(1<>>this.start}encode(u){if(!Number.isInteger(u)||u!==d(u&this.valueMask))throw new TypeError(t("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const m=this.container._packedGetValue(),L=d(u<L&&(L=this.length.decode(u,m)),L}decode(u,m){m===void 0&&(m=0);let L=this.span;return 0>L&&(L=this.length.decode(u,m)),u.slice(m,m+L)}encode(u,m,L){let q=this.length;if(this.length instanceof n&&(q=u.length),!(Gt.Buffer.isBuffer(u)&&q===u.length))throw new TypeError(t("Blob.encode",this)+" requires (length "+q+") Buffer as src");if(L+q>m.length)throw new RangeError("encoding overruns Buffer");return m.write(u.toString("hex"),L,q,"hex"),this.length instanceof n&&this.length.encode(q,m,L),q}}class g extends r{constructor(u){super(-1,u)}getSpan(u,m){if(!Gt.Buffer.isBuffer(u))throw new TypeError("b must be a Buffer");m===void 0&&(m=0);let L=m;for(;Lm.length)throw new RangeError("encoding overruns Buffer");return q.copy(m,L),m[L+z]=0,z+1}}class A extends r{constructor(u,m){if(typeof u=="string"&&m===void 0&&(m=u,u=void 0),u===void 0)u=-1;else if(!Number.isInteger(u))throw new TypeError("maxSpan must be an integer");super(-1,m),this.maxSpan=u}getSpan(u,m){if(!Gt.Buffer.isBuffer(u))throw new TypeError("b must be a Buffer");return m===void 0&&(m=0),u.length-m}decode(u,m,L){m===void 0&&(m=0);let q=this.getSpan(u,m);if(0<=this.maxSpan&&this.maxSpanm.length)throw new RangeError("encoding overruns Buffer");return q.copy(m,L),z}}class I extends r{constructor(u,m){super(0,m),this.value=u}decode(u,m,L){return this.value}encode(u,m,L){return 0}}return Be.ExternalLayout=n,Be.GreedyCount=s,Be.OffsetLayout=i,Be.UInt=c,Be.UIntBE=l,Be.Int=p,Be.IntBE=v,Be.Float=P,Be.FloatBE=R,Be.Double=T,Be.DoubleBE=U,Be.Sequence=j,Be.Structure=Y,Be.UnionDiscriminator=rt,Be.UnionLayoutDiscriminator=nt,Be.Union=Z,Be.VariantLayout=x,Be.BitStructure=o,Be.BitField=a,Be.Boolean=f,Be.Blob=h,Be.CString=g,Be.UTF8=A,Be.Constant=I,Be.greedy=(b,u)=>new s(b,u),Be.offset=(b,u,m)=>new i(b,u,m),Be.u8=b=>new c(1,b),Be.u16=b=>new c(2,b),Be.u24=b=>new c(3,b),Be.u32=b=>new c(4,b),Be.u40=b=>new c(5,b),Be.u48=b=>new c(6,b),Be.nu64=b=>new w(b),Be.u16be=b=>new l(2,b),Be.u24be=b=>new l(3,b),Be.u32be=b=>new l(4,b),Be.u40be=b=>new l(5,b),Be.u48be=b=>new l(6,b),Be.nu64be=b=>new _(b),Be.s8=b=>new p(1,b),Be.s16=b=>new p(2,b),Be.s24=b=>new p(3,b),Be.s32=b=>new p(4,b),Be.s40=b=>new p(5,b),Be.s48=b=>new p(6,b),Be.ns64=b=>new k(b),Be.s16be=b=>new v(2,b),Be.s24be=b=>new v(3,b),Be.s32be=b=>new v(4,b),Be.s40be=b=>new v(5,b),Be.s48be=b=>new v(6,b),Be.ns64be=b=>new B(b),Be.f32=b=>new P(b),Be.f32be=b=>new R(b),Be.f64=b=>new T(b),Be.f64be=b=>new U(b),Be.struct=(b,u,m)=>new Y(b,u,m),Be.bits=(b,u,m)=>new o(b,u,m),Be.seq=(b,u,m)=>new j(b,u,m),Be.union=(b,u,m)=>new Z(b,u,m),Be.unionLayoutDiscriminator=(b,u)=>new nt(b,u),Be.blob=(b,u)=>new h(b,u),Be.cstr=b=>new g(b),Be.utf8=(b,u)=>new A(b,u),Be.const=(b,u)=>new I(b,u),Be}var K6;function Kg(){return K6||(K6=1,function(r){var t=Re&&Re.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(r,"__esModule",{value:!0}),r.map=r.array=r.rustEnum=r.str=r.vecU8=r.tagged=r.vec=r.bool=r.option=r.publicKey=r.i256=r.u256=r.i128=r.u128=r.i64=r.u64=r.struct=r.f64=r.f32=r.i32=r.u32=r.i16=r.u16=r.i8=r.u8=void 0;const e=$6(),n=yg,s=t(rd);var i=$6();Object.defineProperty(r,"u8",{enumerable:!0,get:function(){return i.u8}}),Object.defineProperty(r,"i8",{enumerable:!0,get:function(){return i.s8}}),Object.defineProperty(r,"u16",{enumerable:!0,get:function(){return i.u16}}),Object.defineProperty(r,"i16",{enumerable:!0,get:function(){return i.s16}}),Object.defineProperty(r,"u32",{enumerable:!0,get:function(){return i.u32}}),Object.defineProperty(r,"i32",{enumerable:!0,get:function(){return i.s32}}),Object.defineProperty(r,"f32",{enumerable:!0,get:function(){return i.f32}}),Object.defineProperty(r,"f64",{enumerable:!0,get:function(){return i.f64}}),Object.defineProperty(r,"struct",{enumerable:!0,get:function(){return i.struct}});class c extends e.Layout{constructor(a,f,h){super(a,h),this.blob=(0,e.blob)(a),this.signed=f}decode(a,f=0){const h=new s.default(this.blob.decode(a,f),10,"le");return this.signed?h.fromTwos(this.span*8).clone():h}encode(a,f,h=0){return this.signed&&(a=a.toTwos(this.span*8)),this.blob.encode(a.toArrayLike(Gt.Buffer,"le",this.span),f,h)}}function l(o){return new c(8,!1,o)}r.u64=l;function p(o){return new c(8,!0,o)}r.i64=p;function v(o){return new c(16,!1,o)}r.u128=v;function y(o){return new c(16,!0,o)}r.i128=y;function E(o){return new c(32,!1,o)}r.u256=E;function M(o){return new c(32,!0,o)}r.i256=M;class w extends e.Layout{constructor(a,f,h,g){super(a.span,g),this.layout=a,this.decoder=f,this.encoder=h}decode(a,f){return this.decoder(this.layout.decode(a,f))}encode(a,f,h){return this.layout.encode(this.encoder(a),f,h)}getSpan(a,f){return this.layout.getSpan(a,f)}}function _(o){return new w((0,e.blob)(32),a=>new n.PublicKey(a),a=>a.toBuffer(),o)}r.publicKey=_;class k extends e.Layout{constructor(a,f){super(-1,f),this.layout=a,this.discriminator=(0,e.u8)()}encode(a,f,h=0){return a==null?this.discriminator.encode(0,f,h):(this.discriminator.encode(1,f,h),this.layout.encode(a,f,h+1)+1)}decode(a,f=0){const h=this.discriminator.decode(a,f);if(h===0)return null;if(h===1)return this.layout.decode(a,f+1);throw new Error("Invalid option "+this.property)}getSpan(a,f=0){const h=this.discriminator.decode(a,f);if(h===0)return 1;if(h===1)return this.layout.getSpan(a,f+1)+1;throw new Error("Invalid option "+this.property)}}function B(o,a){return new k(o,a)}r.option=B;function P(o){return new w((0,e.u8)(),R,T,o)}r.bool=P;function R(o){if(o===0)return!1;if(o===1)return!0;throw new Error("Invalid bool: "+o)}function T(o){return o?1:0}function U(o,a){const f=(0,e.u32)("length"),h=(0,e.struct)([f,(0,e.seq)(o,(0,e.offset)(f,-f.span),"values")]);return new w(h,({values:g})=>g,g=>({values:g}),a)}r.vec=U;function j(o,a,f){const h=(0,e.struct)([l("tag"),a.replicate("data")]);function g({tag:A,data:I}){if(!A.eq(o))throw new Error("Invalid tag, expected: "+o.toString("hex")+", got: "+A.toString("hex"));return I}return new w(h,g,A=>({tag:o,data:A}),f)}r.tagged=j;function Y(o){const a=(0,e.u32)("length"),f=(0,e.struct)([a,(0,e.blob)((0,e.offset)(a,-a.span),"data")]);return new w(f,({data:h})=>h,h=>({data:h}),o)}r.vecU8=Y;function rt(o){return new w(Y(),a=>a.toString("utf-8"),a=>Gt.Buffer.from(a,"utf-8"),o)}r.str=rt;function nt(o,a,f){const h=(0,e.union)(f??(0,e.u8)(),a);return o.forEach((g,A)=>h.addVariant(A,g,g.property)),h}r.rustEnum=nt;function Z(o,a,f){const h=(0,e.struct)([(0,e.seq)(o,a,"values")]);return new w(h,({values:g})=>g,g=>({values:g}),f)}r.array=Z;class x extends e.Layout{constructor(a,f,h){super(a.span+f.span,h),this.keyLayout=a,this.valueLayout=f}decode(a,f){f=f||0;const h=this.keyLayout.decode(a,f),g=this.valueLayout.decode(a,f+this.keyLayout.getSpan(a,f));return[h,g]}encode(a,f,h){h=h||0;const g=this.keyLayout.encode(a[0],f,h),A=this.valueLayout.encode(a[1],f,h+g);return g+A}getSpan(a,f){return this.keyLayout.getSpan(a,f)+this.valueLayout.getSpan(a,f)}}function d(o,a,f){const h=(0,e.u32)("length"),g=(0,e.struct)([h,(0,e.seq)(new x(o,a),(0,e.offset)(h,-h.span),"values")]);return new w(g,({values:A})=>new Map(A),A=>({values:Array.from(A.entries())}),f)}r.map=d}(Up)),Up}var Ye=Kg();/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const KT=4,H6=0,V6=1,HT=2;function Nf(r){let t=r.length;for(;--t>=0;)r[t]=0}const VT=0,m9=1,ZT=2,WT=3,GT=258,Hg=29,zh=256,Gc=zh+1+Hg,Hu=30,Vg=19,v9=2*Gc+1,Ua=15,Np=16,YT=7,Zg=256,g9=16,y9=17,b9=18,Rv=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]),il=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]),XT=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),w9=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),JT=512,ms=new Array((Gc+2)*2);Nf(ms);const Uc=new Array(Hu*2);Nf(Uc);const Yc=new Array(JT);Nf(Yc);const Xc=new Array(GT-WT+1);Nf(Xc);const Wg=new Array(Hg);Nf(Wg);const Ml=new Array(Hu);Nf(Ml);function Dp(r,t,e,n,s){this.static_tree=r,this.extra_bits=t,this.extra_base=e,this.elems=n,this.max_length=s,this.has_stree=r&&r.length}let x9,_9,M9;function zp(r,t){this.dyn_tree=r,this.max_code=0,this.stat_desc=t}const E9=r=>r<256?Yc[r]:Yc[256+(r>>>7)],Jc=(r,t)=>{r.pending_buf[r.pending++]=t&255,r.pending_buf[r.pending++]=t>>>8&255},ui=(r,t,e)=>{r.bi_valid>Np-e?(r.bi_buf|=t<>Np-r.bi_valid,r.bi_valid+=e-Np):(r.bi_buf|=t<{ui(r,e[t*2],e[t*2+1])},A9=(r,t)=>{let e=0;do e|=r&1,r>>>=1,e<<=1;while(--t>0);return e>>>1},QT=r=>{r.bi_valid===16?(Jc(r,r.bi_buf),r.bi_buf=0,r.bi_valid=0):r.bi_valid>=8&&(r.pending_buf[r.pending++]=r.bi_buf&255,r.bi_buf>>=8,r.bi_valid-=8)},tL=(r,t)=>{const e=t.dyn_tree,n=t.max_code,s=t.stat_desc.static_tree,i=t.stat_desc.has_stree,c=t.stat_desc.extra_bits,l=t.stat_desc.extra_base,p=t.stat_desc.max_length;let v,y,E,M,w,_,k=0;for(M=0;M<=Ua;M++)r.bl_count[M]=0;for(e[r.heap[r.heap_max]*2+1]=0,v=r.heap_max+1;vp&&(M=p,k++),e[y*2+1]=M,!(y>n)&&(r.bl_count[M]++,w=0,y>=l&&(w=c[y-l]),_=e[y*2],r.opt_len+=_*(M+w),i&&(r.static_len+=_*(s[y*2+1]+w)));if(k!==0){do{for(M=p-1;r.bl_count[M]===0;)M--;r.bl_count[M]--,r.bl_count[M+1]+=2,r.bl_count[p]--,k-=2}while(k>0);for(M=p;M!==0;M--)for(y=r.bl_count[M];y!==0;)E=r.heap[--v],!(E>n)&&(e[E*2+1]!==M&&(r.opt_len+=(M-e[E*2+1])*e[E*2],e[E*2+1]=M),y--)}},S9=(r,t,e)=>{const n=new Array(Ua+1);let s=0,i,c;for(i=1;i<=Ua;i++)s=s+e[i-1]<<1,n[i]=s;for(c=0;c<=t;c++){let l=r[c*2+1];l!==0&&(r[c*2]=A9(n[l]++,l))}},eL=()=>{let r,t,e,n,s;const i=new Array(Ua+1);for(e=0,n=0;n>=7;n{let t;for(t=0;t{r.bi_valid>8?Jc(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},Z6=(r,t,e,n)=>{const s=t*2,i=e*2;return r[s]{const n=r.heap[e];let s=e<<1;for(;s<=r.heap_len&&(s{let n,s,i=0,c,l;if(r.sym_next!==0)do n=r.pending_buf[r.sym_buf+i++]&255,n+=(r.pending_buf[r.sym_buf+i++]&255)<<8,s=r.pending_buf[r.sym_buf+i++],n===0?jo(r,s,t):(c=Xc[s],jo(r,c+zh+1,t),l=Rv[c],l!==0&&(s-=Wg[c],ui(r,s,l)),n--,c=E9(n),jo(r,c,e),l=il[c],l!==0&&(n-=Ml[c],ui(r,n,l)));while(i{const e=t.dyn_tree,n=t.stat_desc.static_tree,s=t.stat_desc.has_stree,i=t.stat_desc.elems;let c,l,p=-1,v;for(r.heap_len=0,r.heap_max=v9,c=0;c>1;c>=1;c--)qp(r,e,c);v=i;do c=r.heap[1],r.heap[1]=r.heap[r.heap_len--],qp(r,e,1),l=r.heap[1],r.heap[--r.heap_max]=c,r.heap[--r.heap_max]=l,e[v*2]=e[c*2]+e[l*2],r.depth[v]=(r.depth[c]>=r.depth[l]?r.depth[c]:r.depth[l])+1,e[c*2+1]=e[l*2+1]=v,r.heap[1]=v++,qp(r,e,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],tL(r,t),S9(e,p,r.bl_count)},G6=(r,t,e)=>{let n,s=-1,i,c=t[0*2+1],l=0,p=7,v=4;for(c===0&&(p=138,v=3),t[(e+1)*2+1]=65535,n=0;n<=e;n++)i=c,c=t[(n+1)*2+1],!(++l{let n,s=-1,i,c=t[0*2+1],l=0,p=7,v=4;for(c===0&&(p=138,v=3),n=0;n<=e;n++)if(i=c,c=t[(n+1)*2+1],!(++l{let t;for(G6(r,r.dyn_ltree,r.l_desc.max_code),G6(r,r.dyn_dtree,r.d_desc.max_code),Cv(r,r.bl_desc),t=Vg-1;t>=3&&r.bl_tree[w9[t]*2+1]===0;t--);return r.opt_len+=3*(t+1)+5+5+4,t},nL=(r,t,e,n)=>{let s;for(ui(r,t-257,5),ui(r,e-1,5),ui(r,n-4,4),s=0;s{let t=4093624447,e;for(e=0;e<=31;e++,t>>>=1)if(t&1&&r.dyn_ltree[e*2]!==0)return H6;if(r.dyn_ltree[9*2]!==0||r.dyn_ltree[10*2]!==0||r.dyn_ltree[13*2]!==0)return V6;for(e=32;e{X6||(eL(),X6=!0),r.l_desc=new zp(r.dyn_ltree,x9),r.d_desc=new zp(r.dyn_dtree,_9),r.bl_desc=new zp(r.bl_tree,M9),r.bi_buf=0,r.bi_valid=0,k9(r)},B9=(r,t,e,n)=>{ui(r,(VT<<1)+(n?1:0),3),I9(r),Jc(r,e),Jc(r,~e),e&&r.pending_buf.set(r.window.subarray(t,t+e),r.pending),r.pending+=e},sL=r=>{ui(r,m9<<1,3),jo(r,Zg,ms),QT(r)},aL=(r,t,e,n)=>{let s,i,c=0;r.level>0?(r.strm.data_type===HT&&(r.strm.data_type=iL(r)),Cv(r,r.l_desc),Cv(r,r.d_desc),c=rL(r),s=r.opt_len+3+7>>>3,i=r.static_len+3+7>>>3,i<=s&&(s=i)):s=i=e+5,e+4<=s&&t!==-1?B9(r,t,e,n):r.strategy===KT||i===s?(ui(r,(m9<<1)+(n?1:0),3),W6(r,ms,Uc)):(ui(r,(ZT<<1)+(n?1:0),3),nL(r,r.l_desc.max_code+1,r.d_desc.max_code+1,c+1),W6(r,r.dyn_ltree,r.dyn_dtree)),k9(r),n&&I9(r)},uL=(r,t,e)=>(r.pending_buf[r.sym_buf+r.sym_next++]=t,r.pending_buf[r.sym_buf+r.sym_next++]=t>>8,r.pending_buf[r.sym_buf+r.sym_next++]=e,t===0?r.dyn_ltree[e*2]++:(r.matches++,t--,r.dyn_ltree[(Xc[e]+zh+1)*2]++,r.dyn_dtree[E9(t)*2]++),r.sym_next===r.sym_end);var fL=oL,cL=B9,hL=aL,lL=uL,dL=sL,pL={_tr_init:fL,_tr_stored_block:cL,_tr_flush_block:hL,_tr_tally:lL,_tr_align:dL};const mL=(r,t,e,n)=>{let s=r&65535|0,i=r>>>16&65535|0,c=0;for(;e!==0;){c=e>2e3?2e3:e,e-=c;do s=s+t[n++]|0,i=i+s|0;while(--c);s%=65521,i%=65521}return s|i<<16|0};var Qc=mL;const vL=()=>{let r,t=[];for(var e=0;e<256;e++){r=e;for(var n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;t[e]=r}return t},gL=new Uint32Array(vL()),yL=(r,t,e,n)=>{const s=gL,i=n+e;r^=-1;for(let c=n;c>>8^s[(r^t[c])&255];return r^-1};var wn=yL,mf={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"},qh={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:bL,_tr_stored_block:Tv,_tr_flush_block:wL,_tr_tally:Qs,_tr_align:xL}=pL,{Z_NO_FLUSH:ta,Z_PARTIAL_FLUSH:_L,Z_FULL_FLUSH:ML,Z_FINISH:Hi,Z_BLOCK:J6,Z_OK:Cn,Z_STREAM_END:Q6,Z_STREAM_ERROR:Vo,Z_DATA_ERROR:EL,Z_BUF_ERROR:Fp,Z_DEFAULT_COMPRESSION:AL,Z_FILTERED:SL,Z_HUFFMAN_ONLY:m0,Z_RLE:kL,Z_FIXED:IL,Z_DEFAULT_STRATEGY:BL,Z_UNKNOWN:PL,Z_DEFLATED:kd}=qh,RL=9,CL=15,TL=8,LL=29,OL=256,Lv=OL+1+LL,UL=30,NL=19,DL=2*Lv+1,zL=15,hr=3,Ws=258,Zo=Ws+hr+1,qL=32,vf=42,Gg=57,Ov=69,Uv=73,Nv=91,Dv=103,Na=113,Tc=666,ei=1,Df=2,iu=3,zf=4,FL=3,Da=(r,t)=>(r.msg=mf[t],t),t3=r=>r*2-(r>4?9:0),Vs=r=>{let t=r.length;for(;--t>=0;)r[t]=0},jL=r=>{let t,e,n,s=r.w_size;t=r.hash_size,n=t;do e=r.head[--n],r.head[n]=e>=s?e-s:0;while(--t);t=s,n=t;do e=r.prev[--n],r.prev[n]=e>=s?e-s:0;while(--t)};let $L=(r,t,e)=>(t<{const t=r.state;let e=t.pending;e>r.avail_out&&(e=r.avail_out),e!==0&&(r.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+e),r.next_out),r.next_out+=e,t.pending_out+=e,r.total_out+=e,r.avail_out-=e,t.pending-=e,t.pending===0&&(t.pending_out=0))},Bi=(r,t)=>{wL(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,t),r.block_start=r.strstart,Mi(r.strm)},Er=(r,t)=>{r.pending_buf[r.pending++]=t},ac=(r,t)=>{r.pending_buf[r.pending++]=t>>>8&255,r.pending_buf[r.pending++]=t&255},zv=(r,t,e,n)=>{let s=r.avail_in;return s>n&&(s=n),s===0?0:(r.avail_in-=s,t.set(r.input.subarray(r.next_in,r.next_in+s),e),r.state.wrap===1?r.adler=Qc(r.adler,t,s,e):r.state.wrap===2&&(r.adler=wn(r.adler,t,s,e)),r.next_in+=s,r.total_in+=s,s)},P9=(r,t)=>{let e=r.max_chain_length,n=r.strstart,s,i,c=r.prev_length,l=r.nice_match;const p=r.strstart>r.w_size-Zo?r.strstart-(r.w_size-Zo):0,v=r.window,y=r.w_mask,E=r.prev,M=r.strstart+Ws;let w=v[n+c-1],_=v[n+c];r.prev_length>=r.good_match&&(e>>=2),l>r.lookahead&&(l=r.lookahead);do if(s=t,!(v[s+c]!==_||v[s+c-1]!==w||v[s]!==v[n]||v[++s]!==v[n+1])){n+=2,s++;do;while(v[++n]===v[++s]&&v[++n]===v[++s]&&v[++n]===v[++s]&&v[++n]===v[++s]&&v[++n]===v[++s]&&v[++n]===v[++s]&&v[++n]===v[++s]&&v[++n]===v[++s]&&nc){if(r.match_start=t,c=i,i>=l)break;w=v[n+c-1],_=v[n+c]}}while((t=E[t&y])>p&&--e!==0);return c<=r.lookahead?c:r.lookahead},gf=r=>{const t=r.w_size;let e,n,s;do{if(n=r.window_size-r.lookahead-r.strstart,r.strstart>=t+(t-Zo)&&(r.window.set(r.window.subarray(t,t+t-n),0),r.match_start-=t,r.strstart-=t,r.block_start-=t,r.insert>r.strstart&&(r.insert=r.strstart),jL(r),n+=t),r.strm.avail_in===0)break;if(e=zv(r.strm,r.window,r.strstart+r.lookahead,n),r.lookahead+=e,r.lookahead+r.insert>=hr)for(s=r.strstart-r.insert,r.ins_h=r.window[s],r.ins_h=ea(r,r.ins_h,r.window[s+1]);r.insert&&(r.ins_h=ea(r,r.ins_h,r.window[s+hr-1]),r.prev[s&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=s,s++,r.insert--,!(r.lookahead+r.insert{let e=r.pending_buf_size-5>r.w_size?r.w_size:r.pending_buf_size-5,n,s,i,c=0,l=r.strm.avail_in;do{if(n=65535,i=r.bi_valid+42>>3,r.strm.avail_outs+r.strm.avail_in&&(n=s+r.strm.avail_in),n>i&&(n=i),n>8,r.pending_buf[r.pending-2]=~n,r.pending_buf[r.pending-1]=~n>>8,Mi(r.strm),s&&(s>n&&(s=n),r.strm.output.set(r.window.subarray(r.block_start,r.block_start+s),r.strm.next_out),r.strm.next_out+=s,r.strm.avail_out-=s,r.strm.total_out+=s,r.block_start+=s,n-=s),n&&(zv(r.strm,r.strm.output,r.strm.next_out,n),r.strm.next_out+=n,r.strm.avail_out-=n,r.strm.total_out+=n)}while(c===0);return l-=r.strm.avail_in,l&&(l>=r.w_size?(r.matches=2,r.window.set(r.strm.input.subarray(r.strm.next_in-r.w_size,r.strm.next_in),0),r.strstart=r.w_size,r.insert=r.strstart):(r.window_size-r.strstart<=l&&(r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,r.insert>r.strstart&&(r.insert=r.strstart)),r.window.set(r.strm.input.subarray(r.strm.next_in-l,r.strm.next_in),r.strstart),r.strstart+=l,r.insert+=l>r.w_size-r.insert?r.w_size-r.insert:l),r.block_start=r.strstart),r.high_wateri&&r.block_start>=r.w_size&&(r.block_start-=r.w_size,r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,i+=r.w_size,r.insert>r.strstart&&(r.insert=r.strstart)),i>r.strm.avail_in&&(i=r.strm.avail_in),i&&(zv(r.strm,r.window,r.strstart,i),r.strstart+=i,r.insert+=i>r.w_size-r.insert?r.w_size-r.insert:i),r.high_water>3,i=r.pending_buf_size-i>65535?65535:r.pending_buf_size-i,e=i>r.w_size?r.w_size:i,s=r.strstart-r.block_start,(s>=e||(s||t===Hi)&&t!==ta&&r.strm.avail_in===0&&s<=i)&&(n=s>i?i:s,c=t===Hi&&r.strm.avail_in===0&&n===s?1:0,Tv(r,r.block_start,n,c),r.block_start+=n,Mi(r.strm)),c?iu:ei)},jp=(r,t)=>{let e,n;for(;;){if(r.lookahead=hr&&(r.ins_h=ea(r,r.ins_h,r.window[r.strstart+hr-1]),e=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),e!==0&&r.strstart-e<=r.w_size-Zo&&(r.match_length=P9(r,e)),r.match_length>=hr)if(n=Qs(r,r.strstart-r.match_start,r.match_length-hr),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=hr){r.match_length--;do r.strstart++,r.ins_h=ea(r,r.ins_h,r.window[r.strstart+hr-1]),e=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart;while(--r.match_length!==0);r.strstart++}else r.strstart+=r.match_length,r.match_length=0,r.ins_h=r.window[r.strstart],r.ins_h=ea(r,r.ins_h,r.window[r.strstart+1]);else n=Qs(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(n&&(Bi(r,!1),r.strm.avail_out===0))return ei}return r.insert=r.strstart{let e,n,s;for(;;){if(r.lookahead=hr&&(r.ins_h=ea(r,r.ins_h,r.window[r.strstart+hr-1]),e=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),r.prev_length=r.match_length,r.prev_match=r.match_start,r.match_length=hr-1,e!==0&&r.prev_length4096)&&(r.match_length=hr-1)),r.prev_length>=hr&&r.match_length<=r.prev_length){s=r.strstart+r.lookahead-hr,n=Qs(r,r.strstart-1-r.prev_match,r.prev_length-hr),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=s&&(r.ins_h=ea(r,r.ins_h,r.window[r.strstart+hr-1]),e=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart);while(--r.prev_length!==0);if(r.match_available=0,r.match_length=hr-1,r.strstart++,n&&(Bi(r,!1),r.strm.avail_out===0))return ei}else if(r.match_available){if(n=Qs(r,0,r.window[r.strstart-1]),n&&Bi(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return ei}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(n=Qs(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart{let e,n,s,i;const c=r.window;for(;;){if(r.lookahead<=Ws){if(gf(r),r.lookahead<=Ws&&t===ta)return ei;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=hr&&r.strstart>0&&(s=r.strstart-1,n=c[s],n===c[++s]&&n===c[++s]&&n===c[++s])){i=r.strstart+Ws;do;while(n===c[++s]&&n===c[++s]&&n===c[++s]&&n===c[++s]&&n===c[++s]&&n===c[++s]&&n===c[++s]&&n===c[++s]&&sr.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=hr?(e=Qs(r,1,r.match_length-hr),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(e=Qs(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),e&&(Bi(r,!1),r.strm.avail_out===0))return ei}return r.insert=0,t===Hi?(Bi(r,!0),r.strm.avail_out===0?iu:zf):r.sym_next&&(Bi(r,!1),r.strm.avail_out===0)?ei:Df},HL=(r,t)=>{let e;for(;;){if(r.lookahead===0&&(gf(r),r.lookahead===0)){if(t===ta)return ei;break}if(r.match_length=0,e=Qs(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,e&&(Bi(r,!1),r.strm.avail_out===0))return ei}return r.insert=0,t===Hi?(Bi(r,!0),r.strm.avail_out===0?iu:zf):r.sym_next&&(Bi(r,!1),r.strm.avail_out===0)?ei:Df};function _o(r,t,e,n,s){this.good_length=r,this.max_lazy=t,this.nice_length=e,this.max_chain=n,this.func=s}const Lc=[new _o(0,0,0,0,R9),new _o(4,4,8,4,jp),new _o(4,5,16,8,jp),new _o(4,6,32,32,jp),new _o(4,4,16,16,Mu),new _o(8,16,32,32,Mu),new _o(8,16,128,128,Mu),new _o(8,32,128,256,Mu),new _o(32,128,258,1024,Mu),new _o(32,258,258,4096,Mu)],VL=r=>{r.window_size=2*r.w_size,Vs(r.head),r.max_lazy_match=Lc[r.level].max_lazy,r.good_match=Lc[r.level].good_length,r.nice_match=Lc[r.level].nice_length,r.max_chain_length=Lc[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=hr-1,r.match_available=0,r.ins_h=0};function ZL(){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=kd,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(DL*2),this.dyn_dtree=new Uint16Array((2*UL+1)*2),this.bl_tree=new Uint16Array((2*NL+1)*2),Vs(this.dyn_ltree),Vs(this.dyn_dtree),Vs(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(zL+1),this.heap=new Uint16Array(2*Lv+1),Vs(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Lv+1),Vs(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 Fh=r=>{if(!r)return 1;const t=r.state;return!t||t.strm!==r||t.status!==vf&&t.status!==Gg&&t.status!==Ov&&t.status!==Uv&&t.status!==Nv&&t.status!==Dv&&t.status!==Na&&t.status!==Tc?1:0},C9=r=>{if(Fh(r))return Da(r,Vo);r.total_in=r.total_out=0,r.data_type=PL;const t=r.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?Gg:t.wrap?vf:Na,r.adler=t.wrap===2?0:1,t.last_flush=-2,bL(t),Cn},T9=r=>{const t=C9(r);return t===Cn&&VL(r.state),t},WL=(r,t)=>Fh(r)||r.state.wrap!==2?Vo:(r.state.gzhead=t,Cn),L9=(r,t,e,n,s,i)=>{if(!r)return Vo;let c=1;if(t===AL&&(t=6),n<0?(c=0,n=-n):n>15&&(c=2,n-=16),s<1||s>RL||e!==kd||n<8||n>15||t<0||t>9||i<0||i>IL||n===8&&c!==1)return Da(r,Vo);n===8&&(n=9);const l=new ZL;return r.state=l,l.strm=r,l.status=vf,l.wrap=c,l.gzhead=null,l.w_bits=n,l.w_size=1<L9(r,t,kd,CL,TL,BL),YL=(r,t)=>{if(Fh(r)||t>J6||t<0)return r?Da(r,Vo):Vo;const e=r.state;if(!r.output||r.avail_in!==0&&!r.input||e.status===Tc&&t!==Hi)return Da(r,r.avail_out===0?Fp:Vo);const n=e.last_flush;if(e.last_flush=t,e.pending!==0){if(Mi(r),r.avail_out===0)return e.last_flush=-1,Cn}else if(r.avail_in===0&&t3(t)<=t3(n)&&t!==Hi)return Da(r,Fp);if(e.status===Tc&&r.avail_in!==0)return Da(r,Fp);if(e.status===vf&&e.wrap===0&&(e.status=Na),e.status===vf){let s=kd+(e.w_bits-8<<4)<<8,i=-1;if(e.strategy>=m0||e.level<2?i=0:e.level<6?i=1:e.level===6?i=2:i=3,s|=i<<6,e.strstart!==0&&(s|=qL),s+=31-s%31,ac(e,s),e.strstart!==0&&(ac(e,r.adler>>>16),ac(e,r.adler&65535)),r.adler=1,e.status=Na,Mi(r),e.pending!==0)return e.last_flush=-1,Cn}if(e.status===Gg){if(r.adler=0,Er(e,31),Er(e,139),Er(e,8),e.gzhead)Er(e,(e.gzhead.text?1:0)+(e.gzhead.hcrc?2:0)+(e.gzhead.extra?4:0)+(e.gzhead.name?8:0)+(e.gzhead.comment?16:0)),Er(e,e.gzhead.time&255),Er(e,e.gzhead.time>>8&255),Er(e,e.gzhead.time>>16&255),Er(e,e.gzhead.time>>24&255),Er(e,e.level===9?2:e.strategy>=m0||e.level<2?4:0),Er(e,e.gzhead.os&255),e.gzhead.extra&&e.gzhead.extra.length&&(Er(e,e.gzhead.extra.length&255),Er(e,e.gzhead.extra.length>>8&255)),e.gzhead.hcrc&&(r.adler=wn(r.adler,e.pending_buf,e.pending,0)),e.gzindex=0,e.status=Ov;else if(Er(e,0),Er(e,0),Er(e,0),Er(e,0),Er(e,0),Er(e,e.level===9?2:e.strategy>=m0||e.level<2?4:0),Er(e,FL),e.status=Na,Mi(r),e.pending!==0)return e.last_flush=-1,Cn}if(e.status===Ov){if(e.gzhead.extra){let s=e.pending,i=(e.gzhead.extra.length&65535)-e.gzindex;for(;e.pending+i>e.pending_buf_size;){let l=e.pending_buf_size-e.pending;if(e.pending_buf.set(e.gzhead.extra.subarray(e.gzindex,e.gzindex+l),e.pending),e.pending=e.pending_buf_size,e.gzhead.hcrc&&e.pending>s&&(r.adler=wn(r.adler,e.pending_buf,e.pending-s,s)),e.gzindex+=l,Mi(r),e.pending!==0)return e.last_flush=-1,Cn;s=0,i-=l}let c=new Uint8Array(e.gzhead.extra);e.pending_buf.set(c.subarray(e.gzindex,e.gzindex+i),e.pending),e.pending+=i,e.gzhead.hcrc&&e.pending>s&&(r.adler=wn(r.adler,e.pending_buf,e.pending-s,s)),e.gzindex=0}e.status=Uv}if(e.status===Uv){if(e.gzhead.name){let s=e.pending,i;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>s&&(r.adler=wn(r.adler,e.pending_buf,e.pending-s,s)),Mi(r),e.pending!==0)return e.last_flush=-1,Cn;s=0}e.gzindexs&&(r.adler=wn(r.adler,e.pending_buf,e.pending-s,s)),e.gzindex=0}e.status=Nv}if(e.status===Nv){if(e.gzhead.comment){let s=e.pending,i;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>s&&(r.adler=wn(r.adler,e.pending_buf,e.pending-s,s)),Mi(r),e.pending!==0)return e.last_flush=-1,Cn;s=0}e.gzindexs&&(r.adler=wn(r.adler,e.pending_buf,e.pending-s,s))}e.status=Dv}if(e.status===Dv){if(e.gzhead.hcrc){if(e.pending+2>e.pending_buf_size&&(Mi(r),e.pending!==0))return e.last_flush=-1,Cn;Er(e,r.adler&255),Er(e,r.adler>>8&255),r.adler=0}if(e.status=Na,Mi(r),e.pending!==0)return e.last_flush=-1,Cn}if(r.avail_in!==0||e.lookahead!==0||t!==ta&&e.status!==Tc){let s=e.level===0?R9(e,t):e.strategy===m0?HL(e,t):e.strategy===kL?KL(e,t):Lc[e.level].func(e,t);if((s===iu||s===zf)&&(e.status=Tc),s===ei||s===iu)return r.avail_out===0&&(e.last_flush=-1),Cn;if(s===Df&&(t===_L?xL(e):t!==J6&&(Tv(e,0,0,!1),t===ML&&(Vs(e.head),e.lookahead===0&&(e.strstart=0,e.block_start=0,e.insert=0))),Mi(r),r.avail_out===0))return e.last_flush=-1,Cn}return t!==Hi?Cn:e.wrap<=0?Q6:(e.wrap===2?(Er(e,r.adler&255),Er(e,r.adler>>8&255),Er(e,r.adler>>16&255),Er(e,r.adler>>24&255),Er(e,r.total_in&255),Er(e,r.total_in>>8&255),Er(e,r.total_in>>16&255),Er(e,r.total_in>>24&255)):(ac(e,r.adler>>>16),ac(e,r.adler&65535)),Mi(r),e.wrap>0&&(e.wrap=-e.wrap),e.pending!==0?Cn:Q6)},XL=r=>{if(Fh(r))return Vo;const t=r.state.status;return r.state=null,t===Na?Da(r,EL):Cn},JL=(r,t)=>{let e=t.length;if(Fh(r))return Vo;const n=r.state,s=n.wrap;if(s===2||s===1&&n.status!==vf||n.lookahead)return Vo;if(s===1&&(r.adler=Qc(r.adler,t,e,0)),n.wrap=0,e>=n.w_size){s===0&&(Vs(n.head),n.strstart=0,n.block_start=0,n.insert=0);let p=new Uint8Array(n.w_size);p.set(t.subarray(e-n.w_size,e),0),t=p,e=n.w_size}const i=r.avail_in,c=r.next_in,l=r.input;for(r.avail_in=e,r.next_in=0,r.input=t,gf(n);n.lookahead>=hr;){let p=n.strstart,v=n.lookahead-(hr-1);do n.ins_h=ea(n,n.ins_h,n.window[p+hr-1]),n.prev[p&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=p,p++;while(--v);n.strstart=p,n.lookahead=hr-1,gf(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=hr-1,n.match_available=0,r.next_in=c,r.input=l,r.avail_in=i,n.wrap=s,Cn};var QL=GL,tO=L9,eO=T9,rO=C9,nO=WL,iO=YL,oO=XL,sO=JL,aO="pako deflate (from Nodeca project)",Nc={deflateInit:QL,deflateInit2:tO,deflateReset:eO,deflateResetKeep:rO,deflateSetHeader:nO,deflate:iO,deflateEnd:oO,deflateSetDictionary:sO,deflateInfo:aO};const uO=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);var fO=function(r){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(const n in e)uO(e,n)&&(r[n]=e[n])}}return r},cO=r=>{let t=0;for(let n=0,s=r.length;n=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;th[254]=th[254]=1;var hO=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let t,e,n,s,i,c=r.length,l=0;for(s=0;s>>6,t[i++]=128|e&63):e<65536?(t[i++]=224|e>>>12,t[i++]=128|e>>>6&63,t[i++]=128|e&63):(t[i++]=240|e>>>18,t[i++]=128|e>>>12&63,t[i++]=128|e>>>6&63,t[i++]=128|e&63);return t};const lO=(r,t)=>{if(t<65534&&r.subarray&&O9)return String.fromCharCode.apply(null,r.length===t?r:r.subarray(0,t));let e="";for(let n=0;n{const e=t||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,t));let n,s;const i=new Array(e*2);for(s=0,n=0;n4){i[s++]=65533,n+=l-1;continue}for(c&=l===2?31:l===3?15:7;l>1&&n1){i[s++]=65533;continue}c<65536?i[s++]=c:(c-=65536,i[s++]=55296|c>>10&1023,i[s++]=56320|c&1023)}return lO(i,s)},pO=(r,t)=>{t=t||r.length,t>r.length&&(t=r.length);let e=t-1;for(;e>=0&&(r[e]&192)===128;)e--;return e<0||e===0?t:e+th[r[e]]>t?e:t},eh={string2buf:hO,buf2string:dO,utf8border:pO};function mO(){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 U9=mO;const N9=Object.prototype.toString,{Z_NO_FLUSH:vO,Z_SYNC_FLUSH:gO,Z_FULL_FLUSH:yO,Z_FINISH:bO,Z_OK:El,Z_STREAM_END:wO,Z_DEFAULT_COMPRESSION:xO,Z_DEFAULT_STRATEGY:_O,Z_DEFLATED:MO}=qh;function Yg(r){this.options=Id.assign({level:xO,method:MO,chunkSize:16384,windowBits:15,memLevel:8,strategy:_O},r||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new U9,this.strm.avail_out=0;let e=Nc.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(e!==El)throw new Error(mf[e]);if(t.header&&Nc.deflateSetHeader(this.strm,t.header),t.dictionary){let n;if(typeof t.dictionary=="string"?n=eh.string2buf(t.dictionary):N9.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,e=Nc.deflateSetDictionary(this.strm,n),e!==El)throw new Error(mf[e]);this._dict_set=!0}}Yg.prototype.push=function(r,t){const e=this.strm,n=this.options.chunkSize;let s,i;if(this.ended)return!1;for(t===~~t?i=t:i=t===!0?bO:vO,typeof r=="string"?e.input=eh.string2buf(r):N9.call(r)==="[object ArrayBuffer]"?e.input=new Uint8Array(r):e.input=r,e.next_in=0,e.avail_in=e.input.length;;){if(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),(i===gO||i===yO)&&e.avail_out<=6){this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;continue}if(s=Nc.deflate(e,i),s===wO)return e.next_out>0&&this.onData(e.output.subarray(0,e.next_out)),s=Nc.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===El;if(e.avail_out===0){this.onData(e.output);continue}if(i>0&&e.next_out>0){this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;continue}if(e.avail_in===0)break}return!0};Yg.prototype.onData=function(r){this.chunks.push(r)};Yg.prototype.onEnd=function(r){r===El&&(this.result=Id.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};const v0=16209,EO=16191;var AO=function(t,e){let n,s,i,c,l,p,v,y,E,M,w,_,k,B,P,R,T,U,j,Y,rt,nt,Z,x;const d=t.state;n=t.next_in,Z=t.input,s=n+(t.avail_in-5),i=t.next_out,x=t.output,c=i-(e-t.avail_out),l=i+(t.avail_out-257),p=d.dmax,v=d.wsize,y=d.whave,E=d.wnext,M=d.window,w=d.hold,_=d.bits,k=d.lencode,B=d.distcode,P=(1<>>24,w>>>=U,_-=U,U=T>>>16&255,U===0)x[i++]=T&65535;else if(U&16){j=T&65535,U&=15,U&&(_>>=U,_-=U),_<15&&(w+=Z[n++]<<_,_+=8,w+=Z[n++]<<_,_+=8),T=B[w&R];r:for(;;){if(U=T>>>24,w>>>=U,_-=U,U=T>>>16&255,U&16){if(Y=T&65535,U&=15,_p){t.msg="invalid distance too far back",d.mode=v0;break t}if(w>>>=U,_-=U,U=i-c,Y>U){if(U=Y-U,U>y&&d.sane){t.msg="invalid distance too far back",d.mode=v0;break t}if(rt=0,nt=M,E===0){if(rt+=v-U,U2;)x[i++]=nt[rt++],x[i++]=nt[rt++],x[i++]=nt[rt++],j-=3;j&&(x[i++]=nt[rt++],j>1&&(x[i++]=nt[rt++]))}else{rt=i-Y;do x[i++]=x[rt++],x[i++]=x[rt++],x[i++]=x[rt++],j-=3;while(j>2);j&&(x[i++]=x[rt++],j>1&&(x[i++]=x[rt++]))}}else if(U&64){t.msg="invalid distance code",d.mode=v0;break t}else{T=B[(T&65535)+(w&(1<>3,n-=j,_-=j<<3,w&=(1<<_)-1,t.next_in=n,t.next_out=i,t.avail_in=n{const p=l.bits;let v=0,y=0,E=0,M=0,w=0,_=0,k=0,B=0,P=0,R=0,T,U,j,Y,rt,nt=null,Z;const x=new Uint16Array(Eu+1),d=new Uint16Array(Eu+1);let o=null,a,f,h;for(v=0;v<=Eu;v++)x[v]=0;for(y=0;y=1&&x[M]===0;M--);if(w>M&&(w=M),M===0)return s[i++]=1<<24|64<<16|0,s[i++]=1<<24|64<<16|0,l.bits=1,0;for(E=1;E0&&(r===n3||M!==1))return-1;for(d[1]=0,v=1;ve3||r===i3&&P>r3)return 1;for(;;){a=v-k,c[y]+1=Z?(f=o[c[y]-Z],h=nt[c[y]-Z]):(f=32+64,h=0),T=1<>k)+U]=a<<24|f<<16|h|0;while(U!==0);for(T=1<>=1;if(T!==0?(R&=T-1,R+=T):R=0,y++,--x[v]===0){if(v===M)break;v=t[e+c[y]]}if(v>w&&(R&Y)!==j){for(k===0&&(k=w),rt+=E,_=v-k,B=1<<_;_+ke3||r===i3&&P>r3)return 1;j=R&Y,s[j]=w<<24|_<<16|rt-i|0}}return R!==0&&(s[rt+R]=v-k<<24|64<<16|0),l.bits=w,0};var Dc=PO;const RO=0,D9=1,z9=2,{Z_FINISH:o3,Z_BLOCK:CO,Z_TREES:g0,Z_OK:ou,Z_STREAM_END:TO,Z_NEED_DICT:LO,Z_STREAM_ERROR:Gi,Z_DATA_ERROR:q9,Z_MEM_ERROR:F9,Z_BUF_ERROR:OO,Z_DEFLATED:s3}=qh,Bd=16180,a3=16181,u3=16182,f3=16183,c3=16184,h3=16185,l3=16186,d3=16187,p3=16188,m3=16189,Al=16190,os=16191,Kp=16192,v3=16193,Hp=16194,g3=16195,y3=16196,b3=16197,w3=16198,y0=16199,b0=16200,x3=16201,_3=16202,M3=16203,E3=16204,A3=16205,Vp=16206,S3=16207,k3=16208,zr=16209,j9=16210,$9=16211,UO=852,NO=592,DO=15,zO=DO,I3=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function qO(){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 vu=r=>{if(!r)return 1;const t=r.state;return!t||t.strm!==r||t.mode$9?1:0},K9=r=>{if(vu(r))return Gi;const t=r.state;return r.total_in=r.total_out=t.total=0,r.msg="",t.wrap&&(r.adler=t.wrap&1),t.mode=Bd,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(UO),t.distcode=t.distdyn=new Int32Array(NO),t.sane=1,t.back=-1,ou},H9=r=>{if(vu(r))return Gi;const t=r.state;return t.wsize=0,t.whave=0,t.wnext=0,K9(r)},V9=(r,t)=>{let e;if(vu(r))return Gi;const n=r.state;return t<0?(e=0,t=-t):(e=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?Gi:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=e,n.wbits=t,H9(r))},Z9=(r,t)=>{if(!r)return Gi;const e=new qO;r.state=e,e.strm=r,e.window=null,e.mode=Bd;const n=V9(r,t);return n!==ou&&(r.state=null),n},FO=r=>Z9(r,zO);let B3=!0,Zp,Wp;const jO=r=>{if(B3){Zp=new Int32Array(512),Wp=new Int32Array(32);let t=0;for(;t<144;)r.lens[t++]=8;for(;t<256;)r.lens[t++]=9;for(;t<280;)r.lens[t++]=7;for(;t<288;)r.lens[t++]=8;for(Dc(D9,r.lens,0,288,Zp,0,r.work,{bits:9}),t=0;t<32;)r.lens[t++]=5;Dc(z9,r.lens,0,32,Wp,0,r.work,{bits:5}),B3=!1}r.lencode=Zp,r.lenbits=9,r.distcode=Wp,r.distbits=5},W9=(r,t,e,n)=>{let s;const i=r.state;return i.window===null&&(i.wsize=1<=i.wsize?(i.window.set(t.subarray(e-i.wsize,e),0),i.wnext=0,i.whave=i.wsize):(s=i.wsize-i.wnext,s>n&&(s=n),i.window.set(t.subarray(e-n,e-n+s),i.wnext),n-=s,n?(i.window.set(t.subarray(e-n,e),0),i.wnext=n,i.whave=i.wsize):(i.wnext+=s,i.wnext===i.wsize&&(i.wnext=0),i.whave{let e,n,s,i,c,l,p,v,y,E,M,w,_,k,B=0,P,R,T,U,j,Y,rt,nt;const Z=new Uint8Array(4);let x,d;const o=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(vu(r)||!r.output||!r.input&&r.avail_in!==0)return Gi;e=r.state,e.mode===os&&(e.mode=Kp),c=r.next_out,s=r.output,p=r.avail_out,i=r.next_in,n=r.input,l=r.avail_in,v=e.hold,y=e.bits,E=l,M=p,nt=ou;t:for(;;)switch(e.mode){case Bd:if(e.wrap===0){e.mode=Kp;break}for(;y<16;){if(l===0)break t;l--,v+=n[i++]<>>8&255,e.check=wn(e.check,Z,2,0),v=0,y=0,e.mode=a3;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((v&255)<<8)+(v>>8))%31){r.msg="incorrect header check",e.mode=zr;break}if((v&15)!==s3){r.msg="unknown compression method",e.mode=zr;break}if(v>>>=4,y-=4,rt=(v&15)+8,e.wbits===0&&(e.wbits=rt),rt>15||rt>e.wbits){r.msg="invalid window size",e.mode=zr;break}e.dmax=1<>8&1),e.flags&512&&e.wrap&4&&(Z[0]=v&255,Z[1]=v>>>8&255,e.check=wn(e.check,Z,2,0)),v=0,y=0,e.mode=u3;case u3:for(;y<32;){if(l===0)break t;l--,v+=n[i++]<>>8&255,Z[2]=v>>>16&255,Z[3]=v>>>24&255,e.check=wn(e.check,Z,4,0)),v=0,y=0,e.mode=f3;case f3:for(;y<16;){if(l===0)break t;l--,v+=n[i++]<>8),e.flags&512&&e.wrap&4&&(Z[0]=v&255,Z[1]=v>>>8&255,e.check=wn(e.check,Z,2,0)),v=0,y=0,e.mode=c3;case c3:if(e.flags&1024){for(;y<16;){if(l===0)break t;l--,v+=n[i++]<>>8&255,e.check=wn(e.check,Z,2,0)),v=0,y=0}else e.head&&(e.head.extra=null);e.mode=h3;case h3:if(e.flags&1024&&(w=e.length,w>l&&(w=l),w&&(e.head&&(rt=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(n.subarray(i,i+w),rt)),e.flags&512&&e.wrap&4&&(e.check=wn(e.check,n,w,i)),l-=w,i+=w,e.length-=w),e.length))break t;e.length=0,e.mode=l3;case l3:if(e.flags&2048){if(l===0)break t;w=0;do rt=n[i+w++],e.head&&rt&&e.length<65536&&(e.head.name+=String.fromCharCode(rt));while(rt&&w>9&1,e.head.done=!0),r.adler=e.check=0,e.mode=os;break;case m3:for(;y<32;){if(l===0)break t;l--,v+=n[i++]<>>=y&7,y-=y&7,e.mode=Vp;break}for(;y<3;){if(l===0)break t;l--,v+=n[i++]<>>=1,y-=1,v&3){case 0:e.mode=v3;break;case 1:if(jO(e),e.mode=y0,t===g0){v>>>=2,y-=2;break t}break;case 2:e.mode=y3;break;case 3:r.msg="invalid block type",e.mode=zr}v>>>=2,y-=2;break;case v3:for(v>>>=y&7,y-=y&7;y<32;){if(l===0)break t;l--,v+=n[i++]<>>16^65535)){r.msg="invalid stored block lengths",e.mode=zr;break}if(e.length=v&65535,v=0,y=0,e.mode=Hp,t===g0)break t;case Hp:e.mode=g3;case g3:if(w=e.length,w){if(w>l&&(w=l),w>p&&(w=p),w===0)break t;s.set(n.subarray(i,i+w),c),l-=w,i+=w,p-=w,c+=w,e.length-=w;break}e.mode=os;break;case y3:for(;y<14;){if(l===0)break t;l--,v+=n[i++]<>>=5,y-=5,e.ndist=(v&31)+1,v>>>=5,y-=5,e.ncode=(v&15)+4,v>>>=4,y-=4,e.nlen>286||e.ndist>30){r.msg="too many length or distance symbols",e.mode=zr;break}e.have=0,e.mode=b3;case b3:for(;e.have>>=3,y-=3}for(;e.have<19;)e.lens[o[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,x={bits:e.lenbits},nt=Dc(RO,e.lens,0,19,e.lencode,0,e.work,x),e.lenbits=x.bits,nt){r.msg="invalid code lengths set",e.mode=zr;break}e.have=0,e.mode=w3;case w3:for(;e.have>>24,R=B>>>16&255,T=B&65535,!(P<=y);){if(l===0)break t;l--,v+=n[i++]<>>=P,y-=P,e.lens[e.have++]=T;else{if(T===16){for(d=P+2;y>>=P,y-=P,e.have===0){r.msg="invalid bit length repeat",e.mode=zr;break}rt=e.lens[e.have-1],w=3+(v&3),v>>>=2,y-=2}else if(T===17){for(d=P+3;y>>=P,y-=P,rt=0,w=3+(v&7),v>>>=3,y-=3}else{for(d=P+7;y>>=P,y-=P,rt=0,w=11+(v&127),v>>>=7,y-=7}if(e.have+w>e.nlen+e.ndist){r.msg="invalid bit length repeat",e.mode=zr;break}for(;w--;)e.lens[e.have++]=rt}}if(e.mode===zr)break;if(e.lens[256]===0){r.msg="invalid code -- missing end-of-block",e.mode=zr;break}if(e.lenbits=9,x={bits:e.lenbits},nt=Dc(D9,e.lens,0,e.nlen,e.lencode,0,e.work,x),e.lenbits=x.bits,nt){r.msg="invalid literal/lengths set",e.mode=zr;break}if(e.distbits=6,e.distcode=e.distdyn,x={bits:e.distbits},nt=Dc(z9,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,x),e.distbits=x.bits,nt){r.msg="invalid distances set",e.mode=zr;break}if(e.mode=y0,t===g0)break t;case y0:e.mode=b0;case b0:if(l>=6&&p>=258){r.next_out=c,r.avail_out=p,r.next_in=i,r.avail_in=l,e.hold=v,e.bits=y,AO(r,M),c=r.next_out,s=r.output,p=r.avail_out,i=r.next_in,n=r.input,l=r.avail_in,v=e.hold,y=e.bits,e.mode===os&&(e.back=-1);break}for(e.back=0;B=e.lencode[v&(1<>>24,R=B>>>16&255,T=B&65535,!(P<=y);){if(l===0)break t;l--,v+=n[i++]<>U)],P=B>>>24,R=B>>>16&255,T=B&65535,!(U+P<=y);){if(l===0)break t;l--,v+=n[i++]<>>=U,y-=U,e.back+=U}if(v>>>=P,y-=P,e.back+=P,e.length=T,R===0){e.mode=A3;break}if(R&32){e.back=-1,e.mode=os;break}if(R&64){r.msg="invalid literal/length code",e.mode=zr;break}e.extra=R&15,e.mode=x3;case x3:if(e.extra){for(d=e.extra;y>>=e.extra,y-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=_3;case _3:for(;B=e.distcode[v&(1<>>24,R=B>>>16&255,T=B&65535,!(P<=y);){if(l===0)break t;l--,v+=n[i++]<>U)],P=B>>>24,R=B>>>16&255,T=B&65535,!(U+P<=y);){if(l===0)break t;l--,v+=n[i++]<>>=U,y-=U,e.back+=U}if(v>>>=P,y-=P,e.back+=P,R&64){r.msg="invalid distance code",e.mode=zr;break}e.offset=T,e.extra=R&15,e.mode=M3;case M3:if(e.extra){for(d=e.extra;y>>=e.extra,y-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){r.msg="invalid distance too far back",e.mode=zr;break}e.mode=E3;case E3:if(p===0)break t;if(w=M-p,e.offset>w){if(w=e.offset-w,w>e.whave&&e.sane){r.msg="invalid distance too far back",e.mode=zr;break}w>e.wnext?(w-=e.wnext,_=e.wsize-w):_=e.wnext-w,w>e.length&&(w=e.length),k=e.window}else k=s,_=c-e.offset,w=e.length;w>p&&(w=p),p-=w,e.length-=w;do s[c++]=k[_++];while(--w);e.length===0&&(e.mode=b0);break;case A3:if(p===0)break t;s[c++]=e.length,p--,e.mode=b0;break;case Vp:if(e.wrap){for(;y<32;){if(l===0)break t;l--,v|=n[i++]<{if(vu(r))return Gi;let t=r.state;return t.window&&(t.window=null),r.state=null,ou},HO=(r,t)=>{if(vu(r))return Gi;const e=r.state;return e.wrap&2?(e.head=t,t.done=!1,ou):Gi},VO=(r,t)=>{const e=t.length;let n,s,i;return vu(r)||(n=r.state,n.wrap!==0&&n.mode!==Al)?Gi:n.mode===Al&&(s=1,s=Qc(s,t,e,0),s!==n.check)?q9:(i=W9(r,t,e,e),i?(n.mode=j9,F9):(n.havedict=1,ou))};var ZO=H9,WO=V9,GO=K9,YO=FO,XO=Z9,JO=$O,QO=KO,tU=HO,eU=VO,rU="pako inflate (from Nodeca project)",vs={inflateReset:ZO,inflateReset2:WO,inflateResetKeep:GO,inflateInit:YO,inflateInit2:XO,inflate:JO,inflateEnd:QO,inflateGetHeader:tU,inflateSetDictionary:eU,inflateInfo:rU};function nU(){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 iU=nU;const G9=Object.prototype.toString,{Z_NO_FLUSH:oU,Z_FINISH:sU,Z_OK:rh,Z_STREAM_END:Gp,Z_NEED_DICT:Yp,Z_STREAM_ERROR:aU,Z_DATA_ERROR:P3,Z_MEM_ERROR:uU}=qh;function jh(r){this.options=Id.assign({chunkSize:1024*64,windowBits:15,to:""},r||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(r&&r.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new U9,this.strm.avail_out=0;let e=vs.inflateInit2(this.strm,t.windowBits);if(e!==rh)throw new Error(mf[e]);if(this.header=new iU,vs.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=eh.string2buf(t.dictionary):G9.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=vs.inflateSetDictionary(this.strm,t.dictionary),e!==rh)))throw new Error(mf[e])}jh.prototype.push=function(r,t){const e=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let i,c,l;if(this.ended)return!1;for(t===~~t?c=t:c=t===!0?sU:oU,G9.call(r)==="[object ArrayBuffer]"?e.input=new Uint8Array(r):e.input=r,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),i=vs.inflate(e,c),i===Yp&&s&&(i=vs.inflateSetDictionary(e,s),i===rh?i=vs.inflate(e,c):i===P3&&(i=Yp));e.avail_in>0&&i===Gp&&e.state.wrap>0&&r[e.next_in]!==0;)vs.inflateReset(e),i=vs.inflate(e,c);switch(i){case aU:case P3:case Yp:case uU:return this.onEnd(i),this.ended=!0,!1}if(l=e.avail_out,e.next_out&&(e.avail_out===0||i===Gp))if(this.options.to==="string"){let p=eh.utf8border(e.output,e.next_out),v=e.next_out-p,y=eh.buf2string(e.output,p);e.next_out=v,e.avail_out=n-v,v&&e.output.set(e.output.subarray(p,p+v),0),this.onData(y)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(!(i===rh&&l===0)){if(i===Gp)return i=vs.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(e.avail_in===0)break}}return!0};jh.prototype.onData=function(r){this.chunks.push(r)};jh.prototype.onEnd=function(r){r===rh&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Id.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function Xg(r,t){const e=new jh(t);if(e.push(r),e.err)throw e.msg||mf[e.err];return e.result}function fU(r,t){return t=t||{},t.raw=!0,Xg(r,t)}var cU=jh,hU=Xg,lU=fU,dU=Xg,pU=qh,mU={Inflate:cU,inflate:hU,inflateRaw:lU,ungzip:dU,constants:pU};const{Inflate:PG,inflate:vU,inflateRaw:RG,ungzip:CG}=mU;var gU=vU;function yU(r,t){return Array.apply(0,new Array(Math.ceil(r.length/t))).map((e,n)=>r.slice(n*t,(n+1)*t))}const uc=r=>"version"in r;function bU(r){return r.reduce((t,e)=>t+e.toString(16).padStart(2,"0"),"0x")}function wU(r){r.indexOf("0x")===0&&(r=r.substr(2)),r.length%2===1&&(r="0"+r);let t=r.match(/.{2}/g);return t===null?yr.Buffer.from([]):yr.Buffer.from(t.map(e=>parseInt(e,16)))}var xU=Object.freeze({__proto__:null,encode:bU,decode:wU});function Y9(r){return new TextDecoder("utf-8").decode(r)}function X9(r){return new TextEncoder().encode(r)}var _U=Object.freeze({__proto__:null,decode:Y9,encode:X9});function qv(r){return Ku.encode(r)}function MU(r){return Ku.decode(r)}var EU=Object.freeze({__proto__:null,encode:qv,decode:MU});function AU(r){return Av(r)}function J9(r){return yr.Buffer.from(X7(r))}var SU=Object.freeze({__proto__:null,encode:AU,decode:J9}),kU=Object.freeze({__proto__:null,hex:xU,utf8:_U,bs58:EU,base64:SU});function Q9(r){const t=new Map;return r.errors&&r.errors.forEach(e=>{var n;let s=(n=e.msg)!==null&&n!==void 0?n:e.name;t.set(e.code,s)}),t}function tM(r,...t){if(r.args.length!=t.length)throw new Error("Invalid argument length");const e={};let n=0;return r.args.forEach(s=>{e[s.name]=t[n],n+=1}),e}function Jg(r,t={}){r.forEach(e=>{if("accounts"in e)Jg(e.accounts,t[e.name]);else if(t[e.name]===void 0)throw new Error(`Invalid arguments: ${e.name} not provided.`)})}function fi(r){return r instanceof Ne?r:new Ne(r)}class IU extends TypeError{constructor(t,e){let n;const{message:s,...i}=t,{path:c}=t,l=c.length===0?s:"At path: "+c.join(".")+" -- "+s;super(l),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,i),this.name=this.constructor.name,this.failures=()=>{var p;return(p=n)!=null?p:n=[t,...e()]}}}function BU(r){return Vu(r)&&typeof r[Symbol.iterator]=="function"}function Vu(r){return typeof r=="object"&&r!=null}function ua(r){return typeof r=="string"?JSON.stringify(r):""+r}function PU(r){const{done:t,value:e}=r.next();return t?void 0:e}function RU(r,t,e,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:s,branch:i}=t,{type:c}=e,{refinement:l,message:p="Expected a value of type `"+c+"`"+(l?" with refinement `"+l+"`":"")+", but received: `"+ua(n)+"`"}=r;return{value:n,type:c,refinement:l,key:s[s.length-1],path:s,branch:i,...r,message:p}}function*R3(r,t,e,n){BU(r)||(r=[r]);for(const s of r){const i=RU(s,t,e,n);i&&(yield i)}}function*Qg(r,t,e){e===void 0&&(e={});const{path:n=[],branch:s=[r],coerce:i=!1,mask:c=!1}=e,l={path:n,branch:s};if(i&&(r=t.coercer(r,l),c&&t.type!=="type"&&Vu(t.schema)&&Vu(r)&&!Array.isArray(r)))for(const v in r)t.schema[v]===void 0&&delete r[v];let p=!0;for(const v of t.validator(r,l))p=!1,yield[v,void 0];for(let[v,y,E]of t.entries(r,l)){const M=Qg(y,E,{path:v===void 0?n:[...n,v],branch:v===void 0?s:[...s,y],coerce:i,mask:c});for(const w of M)w[0]?(p=!1,yield[w[0],void 0]):i&&(y=w[1],v===void 0?r=y:r instanceof Map?r.set(v,y):r instanceof Set?r.add(y):Vu(r)&&(r[v]=y))}if(p)for(const v of t.refiner(r,l))p=!1,yield[v,void 0];p&&(yield[void 0,r])}class pa{constructor(t){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:e,schema:n,validator:s,refiner:i,coercer:c=p=>p,entries:l=function*(){}}=t;this.type=e,this.schema=n,this.entries=l,this.coercer=c,s?this.validator=(p,v)=>{const y=s(p,v);return R3(y,v,this,p)}:this.validator=()=>[],i?this.refiner=(p,v)=>{const y=i(p,v);return R3(y,v,this,p)}:this.refiner=()=>[]}assert(t){return CU(t,this)}create(t){return ty(t,this)}is(t){return eM(t,this)}mask(t){return TU(t,this)}validate(t,e){return e===void 0&&(e={}),$h(t,this,e)}}function CU(r,t){const e=$h(r,t);if(e[0])throw e[0]}function ty(r,t){const e=$h(r,t,{coerce:!0});if(e[0])throw e[0];return e[1]}function TU(r,t){const e=$h(r,t,{coerce:!0,mask:!0});if(e[0])throw e[0];return e[1]}function eM(r,t){return!$h(r,t)[0]}function $h(r,t,e){e===void 0&&(e={});const n=Qg(r,t,e),s=PU(n);return s[0]?[new IU(s[0],function*(){for(const c of n)c[0]&&(yield c[0])}),void 0]:[void 0,s[1]]}function Kh(r,t){return new pa({type:r,schema:null,validator:t})}function LU(){return Kh("any",()=>!0)}function Xp(r){return new pa({type:"array",schema:r,*entries(t){if(r&&Array.isArray(t))for(const[e,n]of t.entries())yield[e,n,r]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||"Expected an array value, but received: "+ua(t)}})}function OU(){return Kh("boolean",r=>typeof r=="boolean")}function C3(r){const t=ua(r),e=typeof r;return new pa({type:"literal",schema:e==="string"||e==="number"||e==="boolean"?r:null,validator(n){return n===r||"Expected the literal `"+t+"`, but received: "+ua(n)}})}function w0(r){return new pa({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function ol(){return Kh("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+ua(r))}function sl(r){return new pa({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function za(){return Kh("string",r=>typeof r=="string"||"Expected a string, but received: "+ua(r))}function ra(r){const t=Object.keys(r);return new pa({type:"type",schema:r,*entries(e){if(Vu(e))for(const n of t)yield[n,e[n],r[n]]},validator(e){return Vu(e)||"Expected an object, but received: "+ua(e)}})}function rM(r){const t=r.map(e=>e.type).join(" | ");return new pa({type:"union",schema:null,coercer(e,n){return(r.find(i=>{const[c]=i.validate(e,{coerce:!0});return!c})||ey()).coercer(e,n)},validator(e,n){const s=[];for(const i of r){const[...c]=Qg(e,i,n),[l]=c;if(l[0])for(const[p]of c)p&&s.push(p);else return[]}return["Expected the value to satisfy a union of `"+t+"`, but received: "+ua(e),...s]}})}function ey(){return Kh("unknown",()=>!0)}function UU(r,t,e){return new pa({...r,coercer:(n,s)=>eM(n,t)?r.coercer(e(n,s),s):r.coercer(n,s)})}async function NU(r,t,e,n){r=fi(r),n||(n=nh());const s=new sd;if(s.add(new kh({programId:r,keys:t??[],data:e})),n.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");return await n.sendAndConfirm(s,[])}const T3=99;async function DU(r,t,e){return(await ry(r,t,e)).map(s=>s?{publicKey:s.publicKey,account:s.account}:null)}async function ry(r,t,e){if(t.length<=T3)return await L3(r,t,e);{const n=yU(t,T3);return(await Promise.all(n.map(i=>L3(r,i,e)))).flat()}}async function L3(r,t,e){const n=e??r.commitment,{value:s,context:i}=await r.getMultipleAccountsInfoAndContext(t,n);return s.map((l,p)=>l===null?null:{publicKey:t[p],account:l,context:i})}async function nM(r,t,e,n,s){var i;e&&e.length>0&&t.sign(...e);const c=t._compile(),l=c.serialize(),v=t._serialize(l).toString("base64"),y={encoding:"base64",commitment:n??r.commitment};if(s){const _=(Array.isArray(s)?s:c.nonProgramIds()).map(k=>k.toBase58());y.accounts={encoding:"base64",addresses:_}}e&&(y.sigVerify=!0);const E=[v,y],M=await r._rpcRequest("simulateTransaction",E),w=ty(M,jU);if("error"in w){let _;if("data"in w.error&&(_=(i=w.error.data)===null||i===void 0?void 0:i.logs,_&&Array.isArray(_))){const k=` - `,B=k+_.join(k);console.error(w.error.message,B)}throw new Ev("failed to simulate transaction: "+w.error.message,_)}return w.result}function zU(r){return UU(iM(r),qU,t=>"error"in t?t:{...t,result:ty(t.result,r)})}const qU=iM(ey());function iM(r){return rM([ra({jsonrpc:C3("2.0"),id:za(),result:r}),ra({jsonrpc:C3("2.0"),id:za(),error:ra({code:ey(),message:za(),data:sl(LU())})})])}function FU(r){return zU(ra({context:ra({slot:ol()}),value:r}))}const jU=FU(ra({err:w0(rM([ra({}),za()])),logs:w0(Xp(za())),accounts:sl(w0(Xp(w0(ra({executable:OU(),owner:za(),lamports:ol(),data:Xp(za()),rentEpoch:sl(ol())}))))),unitsConsumed:sl(ol())}));var $U=Object.freeze({__proto__:null,invoke:NU,getMultipleAccounts:DU,getMultipleAccountsAndContext:ry,simulateTransaction:nM});class oM{constructor(t,e,n){this.connection=t,this.wallet=e,this.opts=n,this.publicKey=e==null?void 0:e.publicKey}static defaultOptions(){return{preflightCommitment:"processed",commitment:"processed"}}static local(t,e){throw new Error("Provider local is not available on browser.")}static env(){throw new Error("Provider env is not available on browser.")}async sendAndConfirm(t,e,n){var s,i,c,l;if(n===void 0&&(n=this.opts),uc(t))e&&t.sign(e);else if(t.feePayer=(s=t.feePayer)!==null&&s!==void 0?s:this.wallet.publicKey,t.recentBlockhash=(await this.connection.getLatestBlockhash(n.preflightCommitment)).blockhash,e)for(const v of e)t.partialSign(v);t=await this.wallet.signTransaction(t);const p=t.serialize();try{return await O3(this.connection,p,n)}catch(v){if(v instanceof Fv){const y=qv(uc(t)?((i=t.signatures)===null||i===void 0?void 0:i[0])||new Uint8Array:(c=t.signature)!==null&&c!==void 0?c:new Uint8Array),E=await this.connection.getTransaction(y,{commitment:"confirmed"});if(E){const M=(l=E.meta)===null||l===void 0?void 0:l.logMessages;throw M?new Ev(v.message,M):v}else throw v}else throw v}}async sendAll(t,e){var n,s,i;e===void 0&&(e=this.opts);const c=(await this.connection.getLatestBlockhash(e.preflightCommitment)).blockhash;let l=t.map(y=>{var E,M;if(uc(y.tx)){let w=y.tx;return y.signers&&w.sign(y.signers),w}else{let w=y.tx,_=(E=y.signers)!==null&&E!==void 0?E:[];return w.feePayer=(M=w.feePayer)!==null&&M!==void 0?M:this.wallet.publicKey,w.recentBlockhash=c,_.forEach(k=>{w.partialSign(k)}),w}});const p=await this.wallet.signAllTransactions(l),v=[];for(let y=0;yM.startsWith("Program log: AnchorError"));if(e===-1)return null;const n=t[e],s=[n];let i;if(e+11)return null;s=l[0].match(/([0-9]+)/g)[0]}let i;try{i=parseInt(s)}catch{return null}let c=e.get(i);return c!==void 0?new oh(i,c,t.logs):(c=aM.get(i),c!==void 0?new oh(i,c,t.logs):null)}get program(){var t;return(t=this._programErrorStack)===null||t===void 0?void 0:t.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){var t;return(t=this._programErrorStack)===null||t===void 0?void 0:t.stack}toString(){return this.msg}}function iy(r,t){ny("debug-logs")&&console.log("Translating error:",r);const e=Zu.parse(r.logs);if(e)return e;const n=oh.parse(r,t);if(n)return n;if(r.logs){const s={get:function(i,c){return c==="programErrorStack"?i.programErrorStack.stack:c==="program"?i.programErrorStack.stack[r.programErrorStack.stack.length-1]:Reflect.get(...arguments)}};return r.programErrorStack=qf.parse(r.logs),new Proxy(r,s)}return r}const ze={InstructionMissing:100,InstructionFallbackNotFound:101,InstructionDidNotDeserialize:102,InstructionDidNotSerialize:103,IdlInstructionStub:1e3,IdlInstructionInvalidProgram:1001,ConstraintMut:2e3,ConstraintHasOne:2001,ConstraintSigner:2002,ConstraintRaw:2003,ConstraintOwner:2004,ConstraintRentExempt:2005,ConstraintSeeds:2006,ConstraintExecutable:2007,ConstraintState:2008,ConstraintAssociated:2009,ConstraintAssociatedInit:2010,ConstraintClose:2011,ConstraintAddress:2012,ConstraintZero:2013,ConstraintTokenMint:2014,ConstraintTokenOwner:2015,ConstraintMintMintAuthority:2016,ConstraintMintFreezeAuthority:2017,ConstraintMintDecimals:2018,ConstraintSpace:2019,ConstraintAccountIsNone:2020,RequireViolated:2500,RequireEqViolated:2501,RequireKeysEqViolated:2502,RequireNeqViolated:2503,RequireKeysNeqViolated:2504,RequireGtViolated:2505,RequireGteViolated:2506,AccountDiscriminatorAlreadySet:3e3,AccountDiscriminatorNotFound:3001,AccountDiscriminatorMismatch:3002,AccountDidNotDeserialize:3003,AccountDidNotSerialize:3004,AccountNotEnoughKeys:3005,AccountNotMutable:3006,AccountOwnedByWrongProgram:3007,InvalidProgramId:3008,InvalidProgramExecutable:3009,AccountNotSigner:3010,AccountNotSystemOwned:3011,AccountNotInitialized:3012,AccountNotProgramData:3013,AccountNotAssociatedTokenAccount:3014,AccountSysvarMismatch:3015,AccountReallocExceedsLimit:3016,AccountDuplicateReallocs:3017,DeclaredProgramIdMismatch:4100,Deprecated:5e3},aM=new Map([[ze.InstructionMissing,"8 byte instruction identifier not provided"],[ze.InstructionFallbackNotFound,"Fallback functions are not supported"],[ze.InstructionDidNotDeserialize,"The program could not deserialize the given instruction"],[ze.InstructionDidNotSerialize,"The program could not serialize the given instruction"],[ze.IdlInstructionStub,"The program was compiled without idl instructions"],[ze.IdlInstructionInvalidProgram,"The transaction was given an invalid program for the IDL instruction"],[ze.ConstraintMut,"A mut constraint was violated"],[ze.ConstraintHasOne,"A has one constraint was violated"],[ze.ConstraintSigner,"A signer constraint was violated"],[ze.ConstraintRaw,"A raw constraint was violated"],[ze.ConstraintOwner,"An owner constraint was violated"],[ze.ConstraintRentExempt,"A rent exemption constraint was violated"],[ze.ConstraintSeeds,"A seeds constraint was violated"],[ze.ConstraintExecutable,"An executable constraint was violated"],[ze.ConstraintState,"Deprecated Error, feel free to replace with something else"],[ze.ConstraintAssociated,"An associated constraint was violated"],[ze.ConstraintAssociatedInit,"An associated init constraint was violated"],[ze.ConstraintClose,"A close constraint was violated"],[ze.ConstraintAddress,"An address constraint was violated"],[ze.ConstraintZero,"Expected zero account discriminant"],[ze.ConstraintTokenMint,"A token mint constraint was violated"],[ze.ConstraintTokenOwner,"A token owner constraint was violated"],[ze.ConstraintMintMintAuthority,"A mint mint authority constraint was violated"],[ze.ConstraintMintFreezeAuthority,"A mint freeze authority constraint was violated"],[ze.ConstraintMintDecimals,"A mint decimals constraint was violated"],[ze.ConstraintSpace,"A space constraint was violated"],[ze.ConstraintAccountIsNone,"A required account for the constraint is None"],[ze.RequireViolated,"A require expression was violated"],[ze.RequireEqViolated,"A require_eq expression was violated"],[ze.RequireKeysEqViolated,"A require_keys_eq expression was violated"],[ze.RequireNeqViolated,"A require_neq expression was violated"],[ze.RequireKeysNeqViolated,"A require_keys_neq expression was violated"],[ze.RequireGtViolated,"A require_gt expression was violated"],[ze.RequireGteViolated,"A require_gte expression was violated"],[ze.AccountDiscriminatorAlreadySet,"The account discriminator was already set on this account"],[ze.AccountDiscriminatorNotFound,"No 8 byte discriminator was found on the account"],[ze.AccountDiscriminatorMismatch,"8 byte discriminator did not match what was expected"],[ze.AccountDidNotDeserialize,"Failed to deserialize the account"],[ze.AccountDidNotSerialize,"Failed to serialize the account"],[ze.AccountNotEnoughKeys,"Not enough account keys given to the instruction"],[ze.AccountNotMutable,"The given account is not mutable"],[ze.AccountOwnedByWrongProgram,"The given account is owned by a different program than expected"],[ze.InvalidProgramId,"Program ID was not as expected"],[ze.InvalidProgramExecutable,"Program account is not executable"],[ze.AccountNotSigner,"The given account did not sign"],[ze.AccountNotSystemOwned,"The given account is not owned by the system program"],[ze.AccountNotInitialized,"The program expected this account to be already initialized"],[ze.AccountNotProgramData,"The given account is not a program data account"],[ze.AccountNotAssociatedTokenAccount,"The given account is not the associated token account"],[ze.AccountSysvarMismatch,"The given public key does not match the required sysvar"],[ze.AccountReallocExceedsLimit,"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"],[ze.AccountDuplicateReallocs,"The account was duplicated for more than one reallocation"],[ze.DeclaredProgramIdMismatch,"The declared program id does not match the actual program id"],[ze.Deprecated,"The API being used is deprecated and should no longer be used"]]);var $v=function(){return $v=Object.assign||function(t){for(var e,n=1,s=arguments.length;nc.name===s);if(i.length!==1)throw new ih(`Type not found: ${JSON.stringify(t)}`);return Ei.typeDefLayout(i[0],e,n)}else if("array"in t.type){let s=t.type.array[0],i=t.type.array[1],c=Ei.fieldLayout({name:void 0,type:s},e);return Ye.array(c,i,n)}else throw new Error(`Not yet implemented: ${t}`)}}}static typeDefLayout(t,e=[],n){if(t.type.kind==="struct"){const s=t.type.fields.map(i=>Ei.fieldLayout(i,e));return Ye.struct(s,n)}else if(t.type.kind==="enum"){let s=t.type.variants.map(i=>{const c=Nr(i.name);if(i.fields===void 0)return Ye.struct([],c);const l=i.fields.map((p,v)=>p.hasOwnProperty("name")?Ei.fieldLayout(p,e):Ei.fieldLayout({type:p,name:v.toString()},e));return Ye.struct(l,c)});return n!==void 0?Ye.rustEnum(s).replicate(n):Ye.rustEnum(s,n)}else throw new Error(`Unknown type kint: ${t}`)}}const N3="global";class Pd{constructor(t){this.idl=t,this.ixLayout=Pd.parseIxLayout(t);const e=new Map;t.instructions.forEach(n=>{const s=D3(N3,n.name);e.set(Ku.encode(s),{layout:this.ixLayout.get(n.name),name:n.name})}),this.sighashLayouts=e}encode(t,e){return this._encode(N3,t,e)}_encode(t,e,n){const s=yr.Buffer.alloc(1e3),i=Nr(e),c=this.ixLayout.get(i);if(!c)throw new Error(`Unknown method: ${i}`);const l=c.encode(n,s),p=s.slice(0,l);return yr.Buffer.concat([D3(t,e),p])}static parseIxLayout(t){const e=t.instructions.map(n=>{let s=n.args.map(c=>{var l,p;return Ei.fieldLayout(c,Array.from([...(l=t.accounts)!==null&&l!==void 0?l:[],...(p=t.types)!==null&&p!==void 0?p:[]]))});const i=Nr(n.name);return[i,Ye.struct(s,i)]});return new Map(e)}decode(t,e="hex"){typeof t=="string"&&(t=e==="hex"?yr.Buffer.from(t,"hex"):Ku.decode(t));let n=Ku.encode(t.slice(0,8)),s=t.slice(8);const i=this.sighashLayouts.get(n);return i?{data:i.layout.decode(s),name:i.name}:null}format(t,e){return cs.format(t,e,this.idl)}}class cs{static format(t,e,n){const s=n.instructions.filter(p=>t.name===p.name)[0];if(s===void 0)return console.error("Invalid instruction given"),null;const i=s.args.map(p=>({name:p.name,type:cs.formatIdlType(p.type),data:cs.formatIdlData(p,t.data[p.name],n.types)})),c=cs.flattenIdlAccounts(s.accounts),l=e.map((p,v)=>v`;if("option"in t)return`Option<${this.formatIdlType(t.option)}>`;if("defined"in t)return t.defined;if("array"in t)return`Array<${t.array[0]}; ${t.array[1]}>`;throw new Error(`Unknown IDL type: ${t}`)}static formatIdlData(t,e,n){if(typeof t.type=="string")return e.toString();if(t.type.hasOwnProperty("vec"))return"["+e.map(s=>this.formatIdlData({name:"",type:t.type.vec},s)).join(", ")+"]";if(t.type.hasOwnProperty("option"))return e===null?"null":this.formatIdlData({name:"",type:t.type.option},e,n);if(t.type.hasOwnProperty("defined")){if(n===void 0)throw new Error("User defined types not provided");const s=n.filter(i=>i.name===t.type.defined);if(s.length!==1)throw new Error(`Type not found: ${t.type.defined}`);return cs.formatIdlDataDefined(s[0],e,n)}return"unknown"}static formatIdlDataDefined(t,e,n){if(t.type.kind==="struct"){const s=t.type;return"{ "+Object.keys(e).map(c=>{const l=s.fields.filter(p=>p.name===c)[0];if(l===void 0)throw new Error("Unable to find type");return c+": "+cs.formatIdlData(l,e[c],n)}).join(", ")+" }"}else{if(t.type.variants.length===0)return"{}";if(t.type.variants[0].name){const s=t.type.variants,i=Object.keys(e)[0],c=e[i],l=Object.keys(c).map(v=>{var y;const E=c[v],M=(y=s[i])===null||y===void 0?void 0:y.filter(w=>w.name===v)[0];if(M===void 0)throw new Error("Unable to find variant");return v+": "+cs.formatIdlData(M,E,n)}).join(", "),p=Nr(i,{pascalCase:!0});return l.length===0?p:`${p} { ${l} }`}else return"Tuple formatting not yet implemented"}}static flattenIdlAccounts(t,e){return t.map(n=>{const s=eN(n.name);if(n.hasOwnProperty("accounts")){const i=e?`${e} > ${s}`:s;return cs.flattenIdlAccounts(n.accounts,i)}else return{...n,name:e?`${e} > ${s}`:s}}).flat()}}function eN(r){const t=r.replace(/([A-Z])/g," $1");return t.charAt(0).toUpperCase()+t.slice(1)}function D3(r,t){let e=tN(t),n=`${r}:${e}`;return yr.Buffer.from(od(n).slice(0,8))}function oy(r,t){if(t.type.kind==="enum"){const e=t.type.variants.map(n=>n.fields?n.fields.map(s=>typeof s=="object"&&"name"in s?Wu(r,s.type):Wu(r,s)).reduce((s,i)=>s+i,0):0);return Math.max(...e)+1}return t.type.fields.map(e=>Wu(r,e.type)).reduce((e,n)=>e+n,0)}function Wu(r,t){var e,n;switch(t){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"publicKey":return 32;default:if("vec"in t)return 1;if("option"in t)return 1+Wu(r,t.option);if("coption"in t)return 4+Wu(r,t.coption);if("defined"in t){const s=(n=(e=r.types)===null||e===void 0?void 0:e.filter(c=>c.name===t.defined))!==null&&n!==void 0?n:[];if(s.length!==1)throw new ih(`Type not found: ${JSON.stringify(t)}`);let i=s[0];return oy(r,i)}if("array"in t){let s=t.array[0],i=t.array[1];return Wu(r,s)*i}throw new Error(`Invalid type ${JSON.stringify(t)}`)}}const Sl=8;function uM(r){return Gt.Buffer.from(od(r).slice(0,Sl))}class qa{constructor(t){if(t.accounts===void 0){this.accountLayouts=new Map;return}const e=t.accounts.map(n=>[n.name,Ei.typeDefLayout(n,t.types)]);this.accountLayouts=new Map(e),this.idl=t}async encode(t,e){const n=yr.Buffer.alloc(1e3),s=this.accountLayouts.get(t);if(!s)throw new Error(`Unknown account: ${t}`);const i=s.encode(e,n);let c=n.slice(0,i),l=qa.accountDiscriminator(t);return yr.Buffer.concat([l,c])}decode(t,e){if(qa.accountDiscriminator(t).compare(e.slice(0,8)))throw new Error("Invalid account discriminator");return this.decodeUnchecked(t,e)}decodeAny(t){const e=t.slice(0,8),n=Array.from(this.accountLayouts.keys()).find(s=>qa.accountDiscriminator(s).equals(e));if(!n)throw new Error("Account descriminator not found");return this.decodeUnchecked(n,t)}decodeUnchecked(t,e){const n=e.subarray(Sl),s=this.accountLayouts.get(t);if(!s)throw new Error(`Unknown account: ${t}`);return s.decode(n)}memcmp(t,e){const n=qa.accountDiscriminator(t);return{offset:0,bytes:Ku.encode(e?yr.Buffer.concat([n,e]):n)}}size(t){var e;return Sl+((e=oy(this.idl,t))!==null&&e!==void 0?e:0)}static accountDiscriminator(t){const e=`account:${Nr(t,{pascalCase:!0,preserveConsecutiveUppercase:!0})}`;return uM(e)}}class fM{constructor(t){if(t.events===void 0){this.layouts=new Map;return}const e=t.events.map(n=>{let s={name:n.name,type:{kind:"struct",fields:n.fields.map(i=>({name:i.name,type:i.type}))}};return[n.name,Ei.typeDefLayout(s,t.types)]});this.layouts=new Map(e),this.discriminators=new Map(t.events===void 0?[]:t.events.map(n=>[Av(cM(n.name)),n.name]))}decode(t){let e;try{e=yr.Buffer.from(X7(t))}catch{return null}const n=Av(e.slice(0,8)),s=this.discriminators.get(n);if(s===void 0)return null;const i=this.layouts.get(s);if(!i)throw new Error(`Unknown event: ${s}`);return{data:i.decode(e.slice(8)),name:s}}}function cM(r){return uM(`event:${r}`)}class rN{constructor(t){if(t.types===void 0){this.typeLayouts=new Map;return}const e=t.types.map(n=>[n.name,Ei.typeDefLayout(n,t.types)]);this.typeLayouts=new Map(e),this.idl=t}encode(t,e){const n=yr.Buffer.alloc(1e3),s=this.typeLayouts.get(t);if(!s)throw new Error(`Unknown type: ${t}`);const i=s.encode(e,n);return n.slice(0,i)}decode(t,e){const n=this.typeLayouts.get(t);if(!n)throw new Error(`Unknown type: ${t}`);return n.decode(e)}}class sy{constructor(t){this.instruction=new Pd(t),this.accounts=new qa(t),this.events=new fM(t),this.types=new rN(t)}}var nN=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Gt.global<"u"?Gt.global:typeof self<"u"?self:{};function iN(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}class di{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}var Rd=di;function oN(r,t){return t.property?r+"["+t.property+"]":r}class Fa extends di{isCount(){throw new Error("ExternalLayout is abstract")}}class hM extends Fa{constructor(t,e,n){if(!(t instanceof di))throw new TypeError("layout must be a Layout");if(e===void 0)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof Cd||this.layout instanceof lM}decode(t,e){return e===void 0&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return n===void 0&&(n=0),this.layout.encode(t,e,n+this.offset)}}class Cd extends di{constructor(t,e){if(super(t,e),6i&&c instanceof di,!0)))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const i of t)if(0>i.span&&i.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let s=-1;try{s=t.reduce((i,c)=>i+c.getSpan(),0)}catch{}super(s,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;try{n=this.fields.reduce((s,i)=>{const c=i.getSpan(t,e);return e+=c,s+c},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e){e===void 0&&(e=0);const n=this.makeDestinationObject();for(const s of this.fields)if(s.property!==void 0&&(n[s.property]=s.decode(t,e)),e+=s.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){n===void 0&&(n=0);const s=n;let i=0,c=0;for(const l of this.fields){let p=l.span;if(c=0p&&(p=l.getSpan(e,n)))}i=n,n+=p}return i+c-s}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?e=-1:0<=e&&(e+=n.span)}}}class mM{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class z3 extends mM{constructor(t,e){if(!(t instanceof Fa&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class vM extends di{constructor(t,e,n){const s=t instanceof Cd||t instanceof lM;if(s)t=new z3(new hM(t));else if(t instanceof Fa&&t.isCount())t=new z3(t);else if(!(t instanceof mM))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof di))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&s&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=s,this.defaultLayout=e,this.registry={};let c=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(l){return c(l)},this.configGetSourceVariant=function(l){c=l.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){e===void 0&&(e=0);let n;const s=this.discriminator,i=s.decode(t,e);let c=this.registry[i];if(c===void 0){let l=0;c=this.defaultLayout,this.usesPrefixDiscriminator&&(l=s.layout.span),n=this.makeDestinationObject(),n[s.property]=i,n[c.property]=this.defaultLayout.decode(t,e+l)}else n=c.decode(t,e);return n}encode(t,e,n){n===void 0&&(n=0);const s=this.getSourceVariant(t);if(s===void 0){const i=this.discriminator,c=this.defaultLayout;let l=0;return this.usesPrefixDiscriminator&&(l=i.layout.span),i.encode(t[i.property],e,n),l+c.encode(t[c.property],e,n+l)}return s.encode(t,e,n)}addVariant(t,e,n){const s=new fN(this,t,e,n);return this.registry[t]=s,s}getVariant(t,e){let n=t;return Gt.Buffer.isBuffer(t)&&(e===void 0&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class fN extends di{constructor(t,e,n,s){if(!(t instanceof vM))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&s===void 0&&(s=n,n=null),n){if(!(n instanceof di))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof s!="string")throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,s),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(e===void 0&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let s=0;return this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+s):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){n===void 0&&(n=0);let s=0;if(this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=s;if(this.layout&&(this.layout.encode(t[this.property],e,n+s),i+=this.layout.getSpan(e,n+s),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}class cN extends di{constructor(t,e){if(!(t instanceof Fa&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;t instanceof Fa||(n=t),super(n,e),this.length=t}getSpan(t,e){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),n}decode(t,e){e===void 0&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let s=this.length;if(this.length instanceof Fa&&(s=t.length),!(Gt.Buffer.isBuffer(t)&&s===t.length))throw new TypeError(oN("Blob.encode",this)+" requires (length "+s+") Buffer as src");if(n+s>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,s,"hex"),this.length instanceof Fa&&this.length.encode(s,e,n),s}}var hN=(r,t,e)=>new hM(r,t,e),lN=r=>new Cd(1,r),bs=r=>new Cd(4,r),dN=r=>new sN(r),Cs=r=>new aN(r),mn=(r,t,e)=>new uN(r,t,e),gM=(r,t,e)=>new vM(r,t,e),Hh=(r,t)=>new cN(r,t);class pN{constructor(t){}encode(t,e){switch(Nr(t)){case"createAccount":return vN(e);case"assign":return gN(e);case"transfer":return yN(e);case"createAccountWithSeed":return bN(e);case"advanceNonceAccount":return xN(e);case"withdrawNonceAccount":return _N(e);case"initializeNonceAccount":return wN(e);case"authorizeNonceAccount":return MN(e);case"allocate":return EN(e);case"allocateWithSeed":return AN(e);case"assignWithSeed":return SN(e);case"transferWithSeed":return kN(e);default:throw new Error(`Invalid instruction: ${t}`)}}encodeState(t,e){throw new Error("System does not have state")}}class mN extends Rd{constructor(t){super(-1,t),this.property=t,this.layout=mn([bs("length"),bs("lengthPadding"),Hh(hN(bs(),-8),"chars")],this.property)}encode(t,e,n=0){if(t==null)return this.layout.span;const s={chars:Gt.Buffer.from(t,"utf8")};return this.layout.encode(s,e,n)}decode(t,e=0){return this.layout.decode(t,e).chars.toString()}getSpan(t,e=0){return bs().span+bs().span+new pg(new Uint8Array(t).slice(e,e+4),10,"le").toNumber()}}function Td(r){return new mN(r)}function Yi(r){return Hh(32,r)}function vN({lamports:r,space:t,owner:e}){return eo({createAccount:{lamports:r,space:t,owner:e.toBuffer()}})}function gN({owner:r}){return eo({assign:{owner:r.toBuffer()}})}function yN({lamports:r}){return eo({transfer:{lamports:r}})}function bN({base:r,seed:t,lamports:e,space:n,owner:s}){return eo({createAccountWithSeed:{base:r.toBuffer(),seed:t,lamports:e,space:n,owner:s.toBuffer()}},kn.getVariant(3).span+t.length)}function wN({authorized:r}){return eo({initializeNonceAccount:{authorized:r.toBuffer()}})}function xN({authorized:r}){return eo({advanceNonceAccount:{authorized:r.toBuffer()}})}function _N({lamports:r}){return eo({withdrawNonceAccount:{lamports:r}})}function MN({authorized:r}){return eo({authorizeNonceAccount:{authorized:r.toBuffer()}})}function EN({space:r}){return eo({allocate:{space:r}})}function AN({base:r,seed:t,space:e,owner:n}){return eo({allocateWithSeed:{base:r.toBuffer(),seed:t,space:e,owner:n.toBuffer()}},kn.getVariant(9).span+t.length)}function SN({base:r,seed:t,owner:e}){return eo({assignWithSeed:{base:r.toBuffer(),seed:t,owner:e.toBuffer()}},kn.getVariant(10).span+t.length)}function kN({lamports:r,seed:t,owner:e}){return eo({transferWithSeed:{lamports:r,seed:t,owner:e.toBuffer()}},kn.getVariant(11).span+t.length)}const kn=gM(bs("instruction"));kn.addVariant(0,mn([Cs("lamports"),Cs("space"),Yi("owner")]),"createAccount");kn.addVariant(1,mn([Yi("owner")]),"assign");kn.addVariant(2,mn([Cs("lamports")]),"transfer");kn.addVariant(3,mn([Yi("base"),Td("seed"),Cs("lamports"),Cs("space"),Yi("owner")]),"createAccountWithSeed");kn.addVariant(4,mn([Yi("authorized")]),"advanceNonceAccount");kn.addVariant(5,mn([Cs("lamports")]),"withdrawNonceAccount");kn.addVariant(6,mn([Yi("authorized")]),"initializeNonceAccount");kn.addVariant(7,mn([Yi("authorized")]),"authorizeNonceAccount");kn.addVariant(8,mn([Cs("space")]),"allocate");kn.addVariant(9,mn([Yi("base"),Td("seed"),Cs("space"),Yi("owner")]),"allocateWithSeed");kn.addVariant(10,mn([Yi("base"),Td("seed"),Yi("owner")]),"assignWithSeed");kn.addVariant(11,mn([Cs("lamports"),Td("seed"),Yi("owner")]),"transferWithSeed");function eo(r,t){const e=Gt.Buffer.alloc(t??IN),n=kn.encode(r,e);return t===void 0?e.slice(0,n):e}const IN=Math.max(...Object.values(kn.registry).map(r=>r.span));class BN{constructor(t){this.idl=t}async encode(t,e){switch(t){case"nonce":{const n=Gt.Buffer.alloc(Lb),s=yM.encode(e,n);return n.slice(0,s)}default:throw new Error(`Invalid account name: ${t}`)}}decode(t,e){return this.decodeUnchecked(t,e)}decodeUnchecked(t,e){switch(t){case"nonce":return PN(e);default:throw new Error(`Invalid account name: ${t}`)}}memcmp(t,e){switch(t){case"nonce":return{dataSize:Lb};default:throw new Error(`Invalid account name: ${t}`)}}size(t){var e;return(e=oy(this.idl,t))!==null&&e!==void 0?e:0}}function PN(r){return yM.decode(r)}class RN extends Rd{constructor(t,e,n,s){super(t.span,s),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}function q3(r){return new RN(Hh(32),t=>new Ne(t),t=>t.toBuffer(),r)}const yM=mn([bs("version"),bs("state"),q3("authorizedPubkey"),q3("nonce"),mn([dN("lamportsPerSignature")],"feeCalculator")]);class CN{constructor(t){}decode(t){throw new Error("System program does not have events")}}class TN{constructor(t){}encode(t,e){throw new Error("System does not have user-defined types")}decode(t,e){throw new Error("System does not have user-defined types")}}class bM{constructor(t){this.instruction=new pN(t),this.accounts=new BN(t),this.events=new CN(t),this.types=new TN(t)}}function LN(r){return new TextDecoder().decode(od(r))}var ON=Object.freeze({__proto__:null,hash:LN});function UN(r,t,e){const n=yr.Buffer.concat([r.toBuffer(),yr.Buffer.from(t),e.toBuffer()]);return new Ne(od(n))}function wM(r,...t){let e=[yr.Buffer.from([97,110,99,104,111,114])];t.forEach(s=>{e.push(s instanceof yr.Buffer?s:fi(s).toBuffer())});const[n]=Ne.findProgramAddressSync(e,fi(r));return n}var NN=Object.freeze({__proto__:null,createWithSeedSync:UN,associated:wM});const ay=new Ne("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),uy=new Ne("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");function DN({mint:r,owner:t}){return Ne.findProgramAddressSync([t.toBuffer(),ay.toBuffer(),r.toBuffer()],uy)[0]}var zN=Object.freeze({__proto__:null,TOKEN_PROGRAM_ID:ay,ASSOCIATED_PROGRAM_ID:uy,associatedAddress:DN}),Vv={exports:{}};(function(r,t){var e=typeof self<"u"?self:nN,n=function(){function i(){this.fetch=!1,this.DOMException=e.DOMException}return i.prototype=e,new i}();(function(i){(function(c){var l={searchParams:"URLSearchParams"in i,iterable:"Symbol"in i&&"iterator"in Symbol,blob:"FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in i,arrayBuffer:"ArrayBuffer"in i};function p(f){return f&&DataView.prototype.isPrototypeOf(f)}if(l.arrayBuffer)var v=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],y=ArrayBuffer.isView||function(f){return f&&v.indexOf(Object.prototype.toString.call(f))>-1};function E(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function M(f){return typeof f!="string"&&(f=String(f)),f}function w(f){var h={next:function(){var g=f.shift();return{done:g===void 0,value:g}}};return l.iterable&&(h[Symbol.iterator]=function(){return h}),h}function _(f){this.map={},f instanceof _?f.forEach(function(h,g){this.append(g,h)},this):Array.isArray(f)?f.forEach(function(h){this.append(h[0],h[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(h){this.append(h,f[h])},this)}_.prototype.append=function(f,h){f=E(f),h=M(h);var g=this.map[f];this.map[f]=g?g+", "+h:h},_.prototype.delete=function(f){delete this.map[E(f)]},_.prototype.get=function(f){return f=E(f),this.has(f)?this.map[f]:null},_.prototype.has=function(f){return this.map.hasOwnProperty(E(f))},_.prototype.set=function(f,h){this.map[E(f)]=M(h)},_.prototype.forEach=function(f,h){for(var g in this.map)this.map.hasOwnProperty(g)&&f.call(h,this.map[g],g,this)},_.prototype.keys=function(){var f=[];return this.forEach(function(h,g){f.push(g)}),w(f)},_.prototype.values=function(){var f=[];return this.forEach(function(h){f.push(h)}),w(f)},_.prototype.entries=function(){var f=[];return this.forEach(function(h,g){f.push([g,h])}),w(f)},l.iterable&&(_.prototype[Symbol.iterator]=_.prototype.entries);function k(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function B(f){return new Promise(function(h,g){f.onload=function(){h(f.result)},f.onerror=function(){g(f.error)}})}function P(f){var h=new FileReader,g=B(h);return h.readAsArrayBuffer(f),g}function R(f){var h=new FileReader,g=B(h);return h.readAsText(f),g}function T(f){for(var h=new Uint8Array(f),g=new Array(h.length),A=0;A-1?h:f}function nt(f,h){h=h||{};var g=h.body;if(f instanceof nt){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,h.headers||(this.headers=new _(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!g&&f._bodyInit!=null&&(g=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=h.credentials||this.credentials||"same-origin",(h.headers||!this.headers)&&(this.headers=new _(h.headers)),this.method=rt(h.method||this.method||"GET"),this.mode=h.mode||this.mode||null,this.signal=h.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&g)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(g)}nt.prototype.clone=function(){return new nt(this,{body:this._bodyInit})};function Z(f){var h=new FormData;return f.trim().split("&").forEach(function(g){if(g){var A=g.split("="),I=A.shift().replace(/\+/g," "),b=A.join("=").replace(/\+/g," ");h.append(decodeURIComponent(I),decodeURIComponent(b))}}),h}function x(f){var h=new _,g=f.replace(/\r?\n[\t ]+/g," ");return g.split(/\r?\n/).forEach(function(A){var I=A.split(":"),b=I.shift().trim();if(b){var u=I.join(":").trim();h.append(b,u)}}),h}j.call(nt.prototype);function d(f,h){h||(h={}),this.type="default",this.status=h.status===void 0?200:h.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in h?h.statusText:"OK",this.headers=new _(h.headers),this.url=h.url||"",this._initBody(f)}j.call(d.prototype),d.prototype.clone=function(){return new d(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new _(this.headers),url:this.url})},d.error=function(){var f=new d(null,{status:0,statusText:""});return f.type="error",f};var o=[301,302,303,307,308];d.redirect=function(f,h){if(o.indexOf(h)===-1)throw new RangeError("Invalid status code");return new d(null,{status:h,headers:{location:f}})},c.DOMException=i.DOMException;try{new c.DOMException}catch{c.DOMException=function(h,g){this.message=h,this.name=g;var A=Error(h);this.stack=A.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function a(f,h){return new Promise(function(g,A){var I=new nt(f,h);if(I.signal&&I.signal.aborted)return A(new c.DOMException("Aborted","AbortError"));var b=new XMLHttpRequest;function u(){b.abort()}b.onload=function(){var m={status:b.status,statusText:b.statusText,headers:x(b.getAllResponseHeaders()||"")};m.url="responseURL"in b?b.responseURL:m.headers.get("X-Request-URL");var L="response"in b?b.response:b.responseText;g(new d(L,m))},b.onerror=function(){A(new TypeError("Network request failed"))},b.ontimeout=function(){A(new TypeError("Network request failed"))},b.onabort=function(){A(new c.DOMException("Aborted","AbortError"))},b.open(I.method,I.url,!0),I.credentials==="include"?b.withCredentials=!0:I.credentials==="omit"&&(b.withCredentials=!1),"responseType"in b&&l.blob&&(b.responseType="blob"),I.headers.forEach(function(m,L){b.setRequestHeader(L,m)}),I.signal&&(I.signal.addEventListener("abort",u),b.onreadystatechange=function(){b.readyState===4&&I.signal.removeEventListener("abort",u)}),b.send(typeof I._bodyInit>"u"?null:I._bodyInit)})}return a.polyfill=!0,i.fetch||(i.fetch=a,i.Headers=_,i.Request=nt,i.Response=d),c.Headers=_,c.Request=nt,c.Response=d,c.fetch=a,Object.defineProperty(c,"__esModule",{value:!0}),c})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var s=n;t=s.fetch,t.default=s.fetch,t.fetch=s.fetch,t.Headers=s.Headers,t.Request=s.Request,t.Response=s.Response,r.exports=t})(Vv,Vv.exports);var qN=iN(Vv.exports);async function FN(r,t,e=5){const n=`https://api.apr.dev/api/v0/program/${t.toString()}/latest?limit=${e}`,[s,i]=await Promise.all([xM(r,t),qN(n)]),c=(await i.json()).filter(p=>!p.aborted&&p.state==="Built"&&p.verified==="Verified");if(c.length===0)return null;const l=c[0];return s.slot.toNumber()!==l.verified_slot?null:l}async function xM(r,t){const e=await r.getAccountInfo(t);if(e===null)throw new Error("program account not found");const{program:n}=Zv(e.data),s=await r.getAccountInfo(n.programdataAddress);if(s===null)throw new Error("program data account not found");const{programData:i}=Zv(s.data);return i}const jN=Ye.rustEnum([Ye.struct([],"uninitialized"),Ye.struct([Ye.option(Ye.publicKey(),"authorityAddress")],"buffer"),Ye.struct([Ye.publicKey("programdataAddress")],"program"),Ye.struct([Ye.u64("slot"),Ye.option(Ye.publicKey(),"upgradeAuthorityAddress")],"programData")],void 0,Ye.u32());function Zv(r){return jN.decode(r)}var $N=Object.freeze({__proto__:null,verifiedBuild:FN,fetchData:xM,decodeUpgradeableLoaderState:Zv}),KN=Object.freeze({__proto__:null,sha256:ON,rpc:$U,publicKey:NN,bytes:kU,token:zN,features:WU,registry:$N});function HN(r){return"accounts"in r}async function VN(r){const t=(await Ne.findProgramAddress([],r))[0];return await Ne.createWithSeed(t,ZN(),r)}function ZN(){return"anchor:idl"}const WN=Ye.struct([Ye.publicKey("authority"),Ye.vecU8("data")]);function GN(r){return WN.decode(r)}function Vh(r,t){var e,n;let s={};const i=r.args?r.args.length:0;if(t.length>i){if(t.length!==i+1)throw new Error(`provided too many arguments ${t} to instruction ${r==null?void 0:r.name} expecting: ${(n=(e=r.args)===null||e===void 0?void 0:e.map(c=>c.name))!==null&&n!==void 0?n:[]}`);s=t.pop()}return[t,s]}class kl{static build(t,e,n){if(t.name==="_inner")throw new ih("the _inner name is reserved");const s=(...i)=>{const[c,l]=Vh(t,[...i]);Jg(t.accounts,l.accounts),YN(t,...i);const p=s.accounts(l.accounts);return l.remainingAccounts!==void 0&&p.push(...l.remainingAccounts),ny("debug-logs")&&console.log("Outgoing account metas:",p),new kh({keys:p,programId:n,data:e(t.name,tM(t,...c))})};return s.accounts=i=>kl.accountsArray(i,t.accounts,n,t.name),s}static accountsArray(t,e,n,s){return t?e.map(i=>{if(("accounts"in i?i.accounts:void 0)!==void 0){const l=t[i.name];return kl.accountsArray(l,i.accounts,n,s).flat()}else{const l=i;let p;try{p=fi(t[i.name])}catch{throw new Error(`Wrong input type for account "${i.name}" in the instruction accounts object${s!==void 0?' for instruction "'+s+'"':""}. Expected PublicKey or string.`)}const v=l.isOptional&&p.equals(n),y=l.isMut&&!v,E=l.isSigner&&!v;return{pubkey:p,isWritable:y,isSigner:E}}}).flat():[]}}function YN(r,...t){}class XN{static build(t,e){return(...s)=>{var i,c,l;const[,p]=Vh(t,[...s]),v=new sd;if(p.preInstructions&&p.instructions)throw new Error("instructions is deprecated, use preInstructions");return(i=p.preInstructions)===null||i===void 0||i.forEach(y=>v.add(y)),(c=p.instructions)===null||c===void 0||c.forEach(y=>v.add(y)),v.add(e(...s)),(l=p.postInstructions)===null||l===void 0||l.forEach(y=>v.add(y)),v}}}class JN{static build(t,e,n,s){return async(...c)=>{var l;const p=e(...c),[,v]=Vh(t,[...c]);if(s.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");try{return await s.sendAndConfirm(p,(l=v.signers)!==null&&l!==void 0?l:[],v.options)}catch(y){throw iy(y,n)}}}}class QN{static build(t,e,n,s){var i;const c={};return(i=t.accounts)===null||i===void 0||i.forEach(l=>{const p=Nr(l.name);c[p]=new _M(t,l,n,s,e)}),c}}class _M{get size(){return this._size}get programId(){return this._programId}get provider(){return this._provider}get coder(){return this._coder}get idlAccount(){return this._idlAccount}constructor(t,e,n,s,i){this._idlAccount=e,this._programId=n,this._provider=s??nh(),this._coder=i??new sy(t),this._size=this._coder.accounts.size(e)}async fetchNullable(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);return n}async fetchNullableAndContext(t,e){const n=await this.getAccountInfoAndContext(t,e),{value:s,context:i}=n;return{data:s&&s.data.length!==0?this._coder.accounts.decode(this._idlAccount.name,s.data):null,context:i}}async fetch(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);if(n===null)throw new Error(`Account does not exist or has no data ${t.toString()}`);return n}async fetchAndContext(t,e){const{data:n,context:s}=await this.fetchNullableAndContext(t,e);if(n===null)throw new Error(`Account does not exist ${t.toString()}`);return{data:n,context:s}}async fetchMultiple(t,e){return(await this.fetchMultipleAndContext(t,e)).map(s=>s?s.data:null)}async fetchMultipleAndContext(t,e){return(await ry(this._provider.connection,t.map(s=>fi(s)),e)).map(s=>{if(s==null)return null;const{account:i,context:c}=s;return{data:this._coder.accounts.decode(this._idlAccount.name,i.data),context:c}})}async all(t){const e=this.coder.accounts.memcmp(this._idlAccount.name,t instanceof Gt.Buffer?t:void 0),n=[];return(e==null?void 0:e.offset)!=null&&(e==null?void 0:e.bytes)!=null&&n.push({memcmp:{offset:e.offset,bytes:e.bytes}}),(e==null?void 0:e.dataSize)!=null&&n.push({dataSize:e.dataSize}),(await this._provider.connection.getProgramAccounts(this._programId,{commitment:this._provider.connection.commitment,filters:[...n,...Array.isArray(t)?t:[]]})).map(({pubkey:i,account:c})=>({publicKey:i,account:this._coder.accounts.decode(this._idlAccount.name,c.data)}))}subscribe(t,e){const n=fc.get(t.toString());if(n)return n.ee;const s=new Xk;t=fi(t);const i=this._provider.connection.onAccountChange(t,c=>{const l=this._coder.accounts.decode(this._idlAccount.name,c.data);s.emit("change",l)},e);return fc.set(t.toString(),{ee:s,listener:i}),s}async unsubscribe(t){let e=fc.get(t.toString());if(!e){console.warn("Address is not subscribed");return}fc&&await this._provider.connection.removeAccountChangeListener(e.listener).then(()=>{fc.delete(t.toString())}).catch(console.error)}async createInstruction(t,e){const n=this.size;if(this._provider.publicKey===void 0)throw new Error("This function requires the Provider interface implementor to have a 'publicKey' field.");return id.createAccount({fromPubkey:this._provider.publicKey,newAccountPubkey:t.publicKey,space:e??n,lamports:await this._provider.connection.getMinimumBalanceForRentExemption(e??n),programId:this._programId})}async associated(...t){const e=await this.associatedAddress(...t);return await this.fetch(e)}async associatedAddress(...t){return await wM(this._programId,...t)}async getAccountInfo(t,e){return await this._provider.connection.getAccountInfo(fi(t),e)}async getAccountInfoAndContext(t,e){return await this._provider.connection.getAccountInfoAndContext(fi(t),e)}}const fc=new Map,Wv="Program log: ",MM="Program data: ",tD=Wv.length,eD=MM.length;class EM{constructor(t,e,n){this._programId=t,this._provider=e,this._eventParser=new fy(t,n),this._eventCallbacks=new Map,this._eventListeners=new Map,this._listenerIdCount=0}addEventListener(t,e){var n;let s=this._listenerIdCount;return this._listenerIdCount+=1,this._eventListeners.has(t)||this._eventListeners.set(t,[]),this._eventListeners.set(t,((n=this._eventListeners.get(t))!==null&&n!==void 0?n:[]).concat(s)),this._eventCallbacks.set(s,[t,e]),this._onLogsSubscriptionId!==void 0||(this._onLogsSubscriptionId=this._provider.connection.onLogs(this._programId,(i,c)=>{if(!i.err)for(const l of this._eventParser.parseLogs(i.logs)){const p=this._eventListeners.get(l.name);p&&p.forEach(v=>{const y=this._eventCallbacks.get(v);if(y){const[,E]=y;E(l.data,c.slot,i.signature)}})}})),s}async removeEventListener(t){const e=this._eventCallbacks.get(t);if(!e)throw new Error(`Event listener ${t} doesn't exist!`);const[n]=e;let s=this._eventListeners.get(n);if(!s)throw new Error(`Event listeners don't exist for ${n}!`);if(this._eventCallbacks.delete(t),s=s.filter(i=>i!==t),this._eventListeners.set(n,s),s.length===0&&this._eventListeners.delete(n),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 fy{constructor(t,e){this.coder=e,this.programId=t}*parseLogs(t,e=!1){const n=new nD(t),s=new rD;let i=n.next();for(;i!==null;){let[c,l,p]=this.handleLog(s,i,e);c&&(yield c),l&&s.push(l),p&&s.pop(),i=n.next()}}handleLog(t,e,n){return t.stack.length>0&&t.program()===this.programId.toString()?this.handleProgramLog(e,n):[null,...this.handleSystemLog(e)]}handleProgramLog(t,e){if(t.startsWith(Wv)||t.startsWith(MM)){const n=t.startsWith(Wv)?t.slice(tD):t.slice(eD),s=this.coder.events.decode(n);if(e&&s===null)throw new Error(`Unable to decode event ${n}`);return[s,null,!1]}else return[null,...this.handleSystemLog(t)]}handleSystemLog(t){const e=t.split(":")[0];return e.match(/^Program (.*) success/g)!==null?[null,!0]:e.startsWith(`Program ${this.programId.toString()} invoke`)?[this.programId.toString(),!1]:e.includes("invoke")?["cpi",!1]:[null,!1]}}class rD{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(t){this.stack.push(t)}pop(){if(!this.stack.length)throw new Error("Expected the stack to have elements");this.stack.pop()}}class nD{constructor(t){this.logs=t}next(){if(this.logs.length===0)return null;let t=this.logs[0];return this.logs=this.logs.slice(1),t}}class iD{static build(t,e,n,s,i,c,l){return async(...v)=>{var y;const E=e(...v),[,M]=Vh(t,[...v]);let w;if(s.simulate===void 0)throw new Error("This function requires 'Provider.simulate' to be implemented.");try{w=await s.simulate(E,M.signers,(y=M.options)===null||y===void 0?void 0:y.commitment)}catch(B){throw iy(B,n)}if(w===void 0)throw new Error("Unable to simulate transaction");const _=w.logs;if(!_)throw new Error("Simulated logs not found");const k=[];if(l.events){let B=new fy(c,i);for(const P of B.parseLogs(_))k.push(P)}return{events:k,raw:_}}}}function Jp(r){return new AM(Hh(8),t=>cy.fromBuffer(t),t=>t.toBuffer(),r)}function x0(r){return new AM(Hh(32),t=>new Ne(t),t=>t.toBuffer(),r)}function Qp(r,t){return new oD(r,t)}class AM extends Rd{constructor(t,e,n,s){super(t.span,s),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}class oD extends Rd{constructor(t,e){super(-1,e),this.layout=t,this.discriminator=bs()}encode(t,e,n=0){return t==null?this.layout.span+this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+4)+4)}decode(t,e=0){const n=this.discriminator.decode(t,e);if(n===0)return null;if(n===1)return this.layout.decode(t,e+4);throw new Error("Invalid coption "+this.layout.property)}getSpan(t,e=0){return this.layout.getSpan(t,e+4)+4}}class cy extends pg{toBuffer(){const t=super.toArray().reverse(),e=Gt.Buffer.from(t);if(e.length===8)return e;if(e.length>=8)throw new Error("u64 too large");const n=Gt.Buffer.alloc(8);return e.copy(n),n}static fromBuffer(t){if(t.length!==8)throw new Error(`Invalid buffer length: ${t.length}`);return new cy([...t].reverse().map(e=>`00${e.toString(16)}`.slice(-2)).join(""),16)}}const sD=mn([x0("mint"),x0("owner"),Jp("amount"),Qp(x0(),"delegate"),(r=>{const t=gM(lN("discriminator"),null,r);return t.addVariant(0,mn([]),"uninitialized"),t.addVariant(1,mn([]),"initialized"),t.addVariant(2,mn([]),"frozen"),t})("state"),Qp(Jp(),"isNative"),Jp("delegatedAmount"),Qp(x0(),"closeAuthority")]);function aD(r){return sD.decode(r)}class sh{constructor(t,e,n,s,i,c,l,p){this._accounts=e,this._provider=n,this._programId=s,this._idlIx=i,this._idlTypes=l,this._customResolver=p,this._args=t,this._accountStore=new uD(n,c,this._programId)}args(t){this._args=t}async resolve(){for(await this.resolveConst(this._idlIx.accounts),this._resolveEventCpi(this._idlIx.accounts);await this.resolvePdas(this._idlIx.accounts)+await this.resolveRelations(this._idlIx.accounts)+await this.resolveCustom()>0;);}async resolveCustom(){if(this._customResolver){const{accounts:t,resolved:e}=await this._customResolver({args:this._args,accounts:this._accounts,provider:this._provider,programId:this._programId,idlIx:this._idlIx});return this._accounts=t,e}return 0}resolveOptionalsHelper(t,e){const n={};for(const s of e){const i=s.name,c=t[i];c!==void 0&&(kM(c)?HN(s)?n[i]=this.resolveOptionalsHelper(c,s.accounts):n[i]=IM(c,!0):c!==null?n[i]=fi(c):s.isOptional&&(n[i]=this._programId))}return n}resolveOptionals(t){Object.assign(this._accounts,this.resolveOptionalsHelper(t,this._idlIx.accounts))}get(t){const e=t.reduce((n,s)=>n&&n[s],this._accounts);if(e&&e.toBase58)return e}set(t,e){let n=this._accounts;t.forEach((s,i)=>{i==t.length-1&&(n[s]=e),n[s]=n[s]||{},n=n[s]})}async resolveConst(t,e=[]){for(let n=0;n0&&!this.get([...e,p])&&await this.autoPopulatePda(l,e)&&(n+=1)}return n}async resolveRelations(t,e=[]){let n=0;for(let s=0;s!this.get([...e,Nr(M)]));if(n+=E.length,E.length>0){const M=await this._accountStore.fetchAccount({publicKey:y});await Promise.all(E.map(async w=>{const _=Nr(w);return this.set([...e,_],M[_]),M[_]}))}}}return n}async autoPopulatePda(t,e=[]){if(!t.pda||!t.pda.seeds)throw new Error("Must have seeds");const n=await Promise.all(t.pda.seeds.map(c=>this.toBuffer(c,e)));if(n.some(c=>typeof c>"u"))return;const s=await this.parseProgramId(t,e);if(!s)return;const[i]=await Ne.findProgramAddress(n,s);this.set([...e,Nr(t.name)],i)}async parseProgramId(t,e=[]){var n;if(!(!((n=t.pda)===null||n===void 0)&&n.programId))return this._programId;switch(t.pda.programId.kind){case"const":return new Ne(this.toBufferConst(t.pda.programId.value));case"arg":return this.argValue(t.pda.programId);case"account":return await this.accountValue(t.pda.programId,e);default:throw new Error(`Unexpected program seed kind: ${t.pda.programId.kind}`)}}async toBuffer(t,e=[]){switch(t.kind){case"const":return this.toBufferConst(t);case"arg":return await this.toBufferArg(t);case"account":return await this.toBufferAccount(t,e);default:throw new Error(`Unexpected seed kind: ${t.kind}`)}}getType(t,e=[]){if(e.length>0&&t.defined){const n=this._idlTypes.find(c=>c.name===t.defined);if(!n)throw new Error(`Cannot find type ${t.defined}`);const i=n.type.fields.find(c=>c.name===e[0]);return this.getType(i.type,e.slice(1))}return t}toBufferConst(t){return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),t.value)}async toBufferArg(t){const e=this.argValue(t);if(!(typeof e>"u"))return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),e)}argValue(t){const e=t.path.split("."),n=Nr(e[0]),s=this._idlIx.args.findIndex(i=>i.name===n);if(s===-1)throw new Error(`Unable to find argument for seed: ${n}`);return e.slice(1).reduce((i,c)=>(i||{})[c],this._args[s])}async toBufferAccount(t,e=[]){const n=await this.accountValue(t,e);if(n)return this.toBufferValue(t.type,n)}async accountValue(t,e=[]){const n=t.path.split("."),s=n[0],i=this.get([...e,Nr(s)]);if(i===null)throw new Error("fieldPubkey is null");if(n.length===1)return i;const c=await this._accountStore.fetchAccount({publicKey:i,name:t.account});return this.parseAccountValue(c,n.slice(1))}parseAccountValue(t,e){let n;for(;e.length>0;)n=t[Nr(e[0])],e=e.slice(1);return n}toBufferValue(t,e){switch(t){case"u8":return Gt.Buffer.from([e]);case"u16":let n=Gt.Buffer.alloc(2);return n.writeUInt16LE(e),n;case"u32":let s=Gt.Buffer.alloc(4);return s.writeUInt32LE(e),s;case"u64":let i=Gt.Buffer.alloc(8);return i.writeBigUInt64LE(BigInt(e)),i;case"string":return Gt.Buffer.from(X9(e));case"publicKey":return e.toBuffer();default:if(t.array)return Gt.Buffer.from(e);throw new Error(`Unexpected seed type: ${t}`)}}}sh.CONST_ACCOUNTS={associatedTokenProgram:uy,rent:Gk,systemProgram:id.programId,tokenProgram:ay,clock:Yk};class uD{constructor(t,e,n){this._provider=t,this._programId=n,this._cache=new Map,this._idls={},this._idls[n.toBase58()]=e}async ensureIdl(t){if(!this._idls[t.toBase58()]){const e=await su.fetchIdl(t,this._provider);if(e){const n=new su(e,t,this._provider);this._idls[t.toBase58()]=n.account}}return this._idls[t.toBase58()]}async fetchAccount({publicKey:t,name:e,programId:n=this._programId}){const s=t.toString();if(!this._cache.has(s))if(e==="TokenAccount"){const i=await this._provider.connection.getAccountInfo(t);if(i===null)throw new Error(`invalid account info for ${s}`);const c=aD(i.data);this._cache.set(s,c)}else if(e){const i=await this.ensureIdl(n);if(i){const c=i[Nr(e)];if(c){const l=await c.fetch(t);this._cache.set(s,l)}}}else{const i=await this._provider.connection.getAccountInfo(t);if(i===null)throw new Error(`invalid account info for ${s}`);const c=i.data,l=await this.ensureIdl(i.owner);if(l){const p=Object.values(l)[0];if(!p)throw new Error("No accounts for this program");const v=p.coder.accounts.decodeAny(c);this._cache.set(s,v)}}return this._cache.get(s)}}class SM{static build(t,e,n,s,i,c,l,p,v,y,E){return(...M)=>new fD(M,s,i,c,l,p,t,e,n,v,y,E)}}function kM(r){return typeof r=="object"&&r!==null&&!("_bn"in r)}function IM(r,t){const e={};for(const n in r){const s=r[n];if(s===null){if(t)throw new Error("Failed to resolve optionals due to IDL type mismatch with input accounts!");continue}e[n]=kM(s)?IM(s,!0):fi(s)}return e}class fD{constructor(t,e,n,s,i,c,l,p,v,y,E,M){this._ixFn=e,this._txFn=n,this._rpcFn=s,this._simulateFn=i,this._viewFn=c,this._programId=p,this._accounts={},this._remainingAccounts=[],this._signers=[],this._preInstructions=[],this._postInstructions=[],this._autoResolveAccounts=!0,this._args=t,this._accountsResolver=new sh(t,this._accounts,l,p,v,y,E,M)}args(t){this._args=t,this._accountsResolver.args(t)}async pubkeys(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._accounts}accounts(t){return this._autoResolveAccounts=!0,this._accountsResolver.resolveOptionals(t),this}accountsStrict(t){return this._autoResolveAccounts=!1,this._accountsResolver.resolveOptionals(t),this}signers(t){return this._signers=this._signers.concat(t),this}remainingAccounts(t){return this._remainingAccounts=this._remainingAccounts.concat(t),this}preInstructions(t){return this._preInstructions=this._preInstructions.concat(t),this}postInstructions(t){return this._postInstructions=this._postInstructions.concat(t),this}async rpc(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._rpcFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async rpcAndKeys(t){return{pubkeys:await this.pubkeys(),signature:await this.rpc(t)}}async view(t){if(this._autoResolveAccounts&&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:t})}async simulate(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._simulateFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async instruction(){return this._autoResolveAccounts&&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:await this._signers}}async transaction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._txFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}}class cD{static build(t,e,n,s){const i=e.accounts.find(p=>p.isMut),c=!!e.returns;return i||!c?void 0:async(...p)=>{var v,y;let E=await n(...p);const M=`Program return: ${t} `;let w=E.raw.find(P=>P.startsWith(M));if(!w)throw new Error("View expected return log");let _=J9(w.slice(M.length)),k=e.returns;if(!k)throw new Error("View expected return type");return Ei.fieldLayout({type:k},Array.from([...(v=s.accounts)!==null&&v!==void 0?v:[],...(y=s.types)!==null&&y!==void 0?y:[]])).decode(_)}}}class hD{static build(t,e,n,s,i){const c={},l={},p={},v={},y={},E={},M=Q9(t),w=t.accounts?QN.build(t,e,n,s):{};return t.instructions.forEach(_=>{const k=kl.build(_,(Y,rt)=>e.instruction.encode(Y,rt),n),B=XN.build(_,k),P=JN.build(_,B,M,s),R=iD.build(_,B,M,s,e,n,t),T=cD.build(n,_,R,t),U=SM.build(s,n,_,k,B,P,R,T,w,t.types||[],i&&i(_)),j=Nr(_.name);l[j]=k,p[j]=B,c[j]=P,v[j]=R,y[j]=U,T&&(E[j]=T)}),[c,l,p,w,v,y,E]}}class su{get programId(){return this._programId}get idl(){return this._idl}get coder(){return this._coder}get provider(){return this._provider}constructor(t,e,n,s,i){e=fi(e),n||(n=nh()),this._idl=t,this._provider=n,this._programId=e,this._coder=s??new sy(t),this._events=new EM(this._programId,n,this._coder);const[c,l,p,v,y,E,M]=hD.build(t,this._coder,e,n,i??(()=>{}));this.rpc=c,this.instruction=l,this.transaction=p,this.account=v,this.simulate=y,this.methods=E,this.views=M}static async at(t,e){const n=fi(t),s=await su.fetchIdl(n,e);if(!s)throw new Error(`IDL not found for program: ${t.toString()}`);return new su(s,n,e)}static async fetchIdl(t,e){e=e??nh();const n=fi(t),s=await VN(n),i=await e.connection.getAccountInfo(s);if(!i)return null;let c=GN(i.data.slice(8));const l=gU(c.data);return JSON.parse(Y9(l))}addEventListener(t,e){return this._events.addEventListener(t,e)}async removeEventListener(t){return await this._events.removeEventListener(t)}}const lD=new Ne("11111111111111111111111111111111");function dD(r){return new su(BM,lD,r,pD())}function pD(){return new bM(BM)}const BM={version:"0.1.0",name:"system_program",instructions:[{name:"createAccount",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!0}],args:[{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assign",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"owner",type:"publicKey"}]},{name:"transfer",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"}]},{name:"createAccountWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"advanceNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"withdrawNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"to",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"lamports",type:"u64"}]},{name:"initializeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!0},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"authorized",type:"publicKey"}]},{name:"authorizeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"allocate",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"space",type:"u64"}]},{name:"allocateWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assignWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]},{name:"transferWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]}],accounts:[{name:"nonce",type:{kind:"struct",fields:[{name:"version",type:"u32"},{name:"state",type:"u32"},{name:"authorizedPubkey",type:"publicKey"},{name:"nonce",type:"publicKey"},{name:"feeCalculator",type:{defined:"FeeCalculator"}}]}}],types:[{name:"FeeCalculator",type:{kind:"struct",fields:[{name:"lamportsPerSignature",type:"u64"}]}}]};class mD{static system(t){return dD(t)}}const vD=Object.freeze(Object.defineProperty({__proto__:null,AccountClient:_M,AnchorError:Zu,AnchorProvider:oM,BN:pg,BorshAccountsCoder:qa,BorshCoder:sy,BorshEventCoder:fM,BorshInstructionCoder:Pd,DISCRIMINATOR_SIZE:Sl,EventManager:EM,EventParser:fy,IdlError:ih,LangErrorCode:ze,LangErrorMessage:aM,MethodsBuilderFactory:SM,Native:mD,Program:su,ProgramError:oh,ProgramErrorStack:qf,SystemCoder:bM,eventDiscriminator:cM,getProvider:nh,parseIdlErrors:Q9,setProvider:HU,splitArgsAndCtx:Vh,toInstruction:tM,translateAddress:fi,translateError:iy,utils:KN,validateAccounts:Jg,web3:G7},Symbol.toStringTag,{value:"Module"})),PM=W7(vD);var cc={},hc={},F3;function gD(){if(F3)return hc;F3=1,Object.defineProperty(hc,"__esModule",{value:!0}),hc.PythOracleEventCoder=void 0;var r=function(){function t(){}return t.prototype.decode=function(e){throw new Error("Pyth oracle program does not have events")},t}();return hc.PythOracleEventCoder=r,hc}var lc={},j3;function yD(){if(j3)return lc;j3=1;var r=Re&&Re.__awaiter||function(n,s,i,c){function l(p){return p instanceof i?p:new i(function(v){v(p)})}return new(i||(i=Promise))(function(p,v){function y(w){try{M(c.next(w))}catch(_){v(_)}}function E(w){try{M(c.throw(w))}catch(_){v(_)}}function M(w){w.done?p(w.value):l(w.value).then(y,E)}M((c=c.apply(n,s||[])).next())})},t=Re&&Re.__generator||function(n,s){var i={label:0,sent:function(){if(p[0]&1)throw p[1];return p[1]},trys:[],ops:[]},c,l,p,v;return v={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(v[Symbol.iterator]=function(){return this}),v;function y(M){return function(w){return E([M,w])}}function E(M){if(c)throw new TypeError("Generator is already executing.");for(;i;)try{if(c=1,l&&(p=M[0]&2?l.return:M[0]?l.throw||((p=l.return)&&p.call(l),0):l.next)&&!(p=p.call(l,M[1])).done)return p;switch(l=0,p&&(M=[M[0]&2,p.value]),M[0]){case 0:case 1:p=M;break;case 4:return i.label++,{value:M[1],done:!1};case 5:i.label++,l=M[1],M=[0];continue;case 7:M=i.ops.pop(),i.trys.pop();continue;default:if(p=i.trys,!(p=p.length>0&&p[p.length-1])&&(M[0]===6||M[0]===2)){i=0;continue}if(M[0]===3&&(!p||M[1]>p[0]&&M[1]y)throw new Error("The metadata is too long");var rt=k.subarray(0,T);return c.Buffer.concat([R,rt])}else{var nt=P.encode(_,k),rt=k.subarray(0,nt);return c.Buffer.concat([R,rt])}},M.parseIxLayout=function(w){var _=w.instructions.map(function(k){var B=k.args.map(function(R){var T,U;return v.IdlCoder.fieldLayout(R,Array.from(n(n([],(T=w.accounts)!==null&&T!==void 0?T:[]),(U=w.types)!==null&&U!==void 0?U:[])))}),P=l.default(k.name);return[P,p.struct(B,P)]});return new Map(_)},M.prototype.decode=function(w,_){_===void 0&&(_="hex"),typeof w=="string"&&(w=_==="hex"?c.Buffer.from(w,"hex"):c.Buffer.from(i.default.decode(w)));var k=i.default.encode(w.subarray(0,this.discriminatorLength)),B=w.subarray(this.discriminatorLength),P=this.discriminatorLayouts.get(k);if(!P)return null;if(P.name==="updProduct"||P.name==="addProduct"){for(var R={},T=0;Tr.MAX_SLOT_DIFFERENCE&&(mt=s.Unknown);var jt,dt;mt===s.Trading&&(jt=yt.price,dt=yt.confidence);for(var ct=[],Tt=240;ct.length=n;)l-=n,e[p]=c>>l&i,p+=1}),s)l>0&&(e[p]=c<=t)throw new Error("Excessive padding: ".concat(l," (max ").concat(t-1," allowed)"));if(c%(1<8||t<1)throw new RangeError("Invalid bits per element; 1 to 8 expected");return RM(r,8,e,t,!0),e}function TD(r,t,e){if(t>8||t<1)throw new RangeError("Invalid bits per element; 1 to 8 expected");return RM(r,t,e,8,!1),e}var wo={};Object.defineProperty(wo,"__esModule",{value:!0});wo.CHECKSUM_LENGTH=void 0;wo.createChecksum=ND;wo.decode=UM;wo.decodeWithPrefix=zD;wo.detectCase=qD;wo.encode=DD;wo.expandPrefix=OM;wo.verifyChecksum=UD;var CM=Ff,Gv="qpzry9x8gf2tvdw0s3jn54khce6mua7l",TM=734539939,J3=33,Q3=126,Yv=6;wo.CHECKSUM_LENGTH=Yv;var LD=function(){for(var r=new Map,t=0;t>25,s=(t&33554431)<<5^e;return OD.reduce(function(i,c,l){return n>>l&1?i^c:i},s)},1)}function OM(r,t){for(var e=0;e>5,t[e+r.length+1]=n&31}t[r.length]=0}function UD(r){switch(LM(r)){case 1:return"bech32";case TM:return"bech32m";default:return}}function ND(r,t){var e;switch(t){case"bech32":e=1;break;case"bech32m":e=TM;break;default:throw Error("Invalid encoding value: ".concat(t,"; expected bech32 or bech32m"))}for(var n=LM(r)^e,s=0;s>i&31}}function DD(r){return r.reduce(function(t,e){return t+Gv[e]},"")}function UM(r,t){for(var e=t||(0,CM.createBitArray)(r.length),n=0;n1&&arguments[1]!==void 0?arguments[1]:"message",e=!1,n=!1,s=0;sQ3)throw new TypeError("Invalid char in ".concat(t,": ").concat(i,"; ")+"should be in ASCII range ".concat(J3,"-").concat(Q3));n=n||i>=65&&i<=90,e=e||i>=97&&i<=122}if(e&&n)throw new TypeError("Mixed-case ".concat(t));return n?"upper":e?"lower":null}Object.defineProperty(Ls,"__esModule",{value:!0});Ls.BitcoinAddress=void 0;Ls.decode=KD;Ls.decodeTo5BitArray=my;Ls.encode=$D;Ls.encode5BitArray=py;Ls.from5BitArray=dy;Ls.to5BitArray=ly;var ah=Ff,$i=wo;function FD(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}function t5(r,t){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:"bech32",s=2*r.length+1+t.length+$i.CHECKSUM_LENGTH;if(s-r.length>Il)throw new Error("Message to be produced is too long (max ".concat(Il," supported)"));var i=(e=(0,$i.detectCase)(r,"prefix"))!==null&&e!==void 0?e:"lower",c=(0,ah.createBitArray)(s);(0,$i.expandPrefix)(r.toLowerCase(),c.subarray(0,2*r.length+1));var l=c.subarray(2*r.length+1,c.length-$i.CHECKSUM_LENGTH);l.set(t),(0,$i.createChecksum)(c,n);var p=(0,$i.encode)(c.subarray(2*r.length+1));return i==="upper"&&(p=p.toUpperCase()),"".concat(r,"1").concat(p)}function $D(r,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"bech32";return py(r,ly(t),e)}function my(r){if(r.length>Il)throw new TypeError("Message too long; max ".concat(Il," expected"));(0,$i.detectCase)(r);var t=r.toLowerCase(),e=t.lastIndexOf("1");if(e<0)throw new Error('No separator char ("1") found');if(e>r.length-$i.CHECKSUM_LENGTH-1)throw new Error("Data part of the message too short (at least ".concat($i.CHECKSUM_LENGTH," chars expected)"));var n=t.substring(0,e),s=(0,$i.decodeWithPrefix)(n,t.substring(e+1)),i=(0,$i.verifyChecksum)(s);if(i===void 0)throw new Error("Invalid checksum");return{prefix:n,encoding:i,data:s.subarray(2*n.length+1,s.length-$i.CHECKSUM_LENGTH)}}function KD(r){var t=my(r),e=t.prefix,n=t.encoding,s=t.data;return{prefix:e,encoding:n,data:dy(s)}}var HD=function(){function r(t,e,n){if(FD(this,r),t!=="bc"&&t!=="tb")throw new Error('Invalid human-readable prefix, "bc" or "tb" expected');if(e<0||e>16)throw new RangeError("Invalid scriptVersion, value in range [0, 16] expected");if(n.length<2||n.length>40)throw new RangeError("Invalid script length: expected 2 to 40 bytes");if(e===0&&n.length!==20&&n.length!==32)throw new Error("Invalid v0 script length: expected 20 or 32 bytes");this.prefix=t,this.scriptVersion=e,this.data=n}return jD(r,[{key:"type",value:function(){if(this.scriptVersion===0)switch(this.data.length){case 20:return"p2wpkh";case 32:return"p2wsh";default:return}}},{key:"encode",value:function(){var e=Math.ceil(this.data.length*8/5),n=(0,ah.createBitArray)(e+1);n[0]=this.scriptVersion,ly(this.data,n.subarray(1));var s=this.scriptVersion===0?"bech32":"bech32m";return py(this.prefix,n,s)}}],[{key:"decode",value:function(e){var n=my(e),s=n.prefix,i=n.data,c=n.encoding;if(s!=="bc"&&s!=="tb")throw new Error('Invalid human-readable prefix, "bc" or "tb" expected');var l=i[0];if(l===0&&c!=="bech32")throw Error("Unexpected encoding ".concat(c," used for version 0 script"));if(l>0&&c!=="bech32m")throw Error("Unexpected encoding ".concat(c," used for version ").concat(l," script"));return new this(s,l,dy(i.subarray(1)))}}]),r}();Ls.BitcoinAddress=HD;var VD={exports:{}};(function(r){(function(t){var e=function($){var G,H=new Float64Array(16);if($)for(G=0;G<$.length;G++)H[G]=$[G];return H},n=function(){throw new Error("no PRNG")},s=new Uint8Array(16),i=new Uint8Array(32);i[0]=9;var c=e(),l=e([1]),p=e([56129,1]),v=e([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),y=e([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),E=e([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),M=e([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),w=e([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function _($,G,H,N){$[G]=H>>24&255,$[G+1]=H>>16&255,$[G+2]=H>>8&255,$[G+3]=H&255,$[G+4]=N>>24&255,$[G+5]=N>>16&255,$[G+6]=N>>8&255,$[G+7]=N&255}function k($,G,H,N,V){var tt,lt=0;for(tt=0;tt>>8)-1}function B($,G,H,N){return k($,G,H,N,16)}function P($,G,H,N){return k($,G,H,N,32)}function R($,G,H,N){for(var V=N[0]&255|(N[1]&255)<<8|(N[2]&255)<<16|(N[3]&255)<<24,tt=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,lt=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,at=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,ht=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,zt=N[4]&255|(N[5]&255)<<8|(N[6]&255)<<16|(N[7]&255)<<24,Zt=G[0]&255|(G[1]&255)<<8|(G[2]&255)<<16|(G[3]&255)<<24,ye=G[4]&255|(G[5]&255)<<8|(G[6]&255)<<16|(G[7]&255)<<24,Yt=G[8]&255|(G[9]&255)<<8|(G[10]&255)<<16|(G[11]&255)<<24,pe=G[12]&255|(G[13]&255)<<8|(G[14]&255)<<16|(G[15]&255)<<24,ve=N[8]&255|(N[9]&255)<<8|(N[10]&255)<<16|(N[11]&255)<<24,ge=H[16]&255|(H[17]&255)<<8|(H[18]&255)<<16|(H[19]&255)<<24,ie=H[20]&255|(H[21]&255)<<8|(H[22]&255)<<16|(H[23]&255)<<24,ue=H[24]&255|(H[25]&255)<<8|(H[26]&255)<<16|(H[27]&255)<<24,fe=H[28]&255|(H[29]&255)<<8|(H[30]&255)<<16|(H[31]&255)<<24,ce=N[12]&255|(N[13]&255)<<8|(N[14]&255)<<16|(N[15]&255)<<24,$t=V,oe=tt,Jt=lt,le=at,ae=ht,ne=zt,Ot=Zt,Nt=ye,he=Yt,ee=pe,re=ve,me=ge,Fe=ie,We=ue,Xe=fe,Ge=ce,bt,ir=0;ir<20;ir+=2)bt=$t+Fe|0,ae^=bt<<7|bt>>>32-7,bt=ae+$t|0,he^=bt<<9|bt>>>32-9,bt=he+ae|0,Fe^=bt<<13|bt>>>32-13,bt=Fe+he|0,$t^=bt<<18|bt>>>32-18,bt=ne+oe|0,ee^=bt<<7|bt>>>32-7,bt=ee+ne|0,We^=bt<<9|bt>>>32-9,bt=We+ee|0,oe^=bt<<13|bt>>>32-13,bt=oe+We|0,ne^=bt<<18|bt>>>32-18,bt=re+Ot|0,Xe^=bt<<7|bt>>>32-7,bt=Xe+re|0,Jt^=bt<<9|bt>>>32-9,bt=Jt+Xe|0,Ot^=bt<<13|bt>>>32-13,bt=Ot+Jt|0,re^=bt<<18|bt>>>32-18,bt=Ge+me|0,le^=bt<<7|bt>>>32-7,bt=le+Ge|0,Nt^=bt<<9|bt>>>32-9,bt=Nt+le|0,me^=bt<<13|bt>>>32-13,bt=me+Nt|0,Ge^=bt<<18|bt>>>32-18,bt=$t+le|0,oe^=bt<<7|bt>>>32-7,bt=oe+$t|0,Jt^=bt<<9|bt>>>32-9,bt=Jt+oe|0,le^=bt<<13|bt>>>32-13,bt=le+Jt|0,$t^=bt<<18|bt>>>32-18,bt=ne+ae|0,Ot^=bt<<7|bt>>>32-7,bt=Ot+ne|0,Nt^=bt<<9|bt>>>32-9,bt=Nt+Ot|0,ae^=bt<<13|bt>>>32-13,bt=ae+Nt|0,ne^=bt<<18|bt>>>32-18,bt=re+ee|0,me^=bt<<7|bt>>>32-7,bt=me+re|0,he^=bt<<9|bt>>>32-9,bt=he+me|0,ee^=bt<<13|bt>>>32-13,bt=ee+he|0,re^=bt<<18|bt>>>32-18,bt=Ge+Xe|0,Fe^=bt<<7|bt>>>32-7,bt=Fe+Ge|0,We^=bt<<9|bt>>>32-9,bt=We+Fe|0,Xe^=bt<<13|bt>>>32-13,bt=Xe+We|0,Ge^=bt<<18|bt>>>32-18;$t=$t+V|0,oe=oe+tt|0,Jt=Jt+lt|0,le=le+at|0,ae=ae+ht|0,ne=ne+zt|0,Ot=Ot+Zt|0,Nt=Nt+ye|0,he=he+Yt|0,ee=ee+pe|0,re=re+ve|0,me=me+ge|0,Fe=Fe+ie|0,We=We+ue|0,Xe=Xe+fe|0,Ge=Ge+ce|0,$[0]=$t>>>0&255,$[1]=$t>>>8&255,$[2]=$t>>>16&255,$[3]=$t>>>24&255,$[4]=oe>>>0&255,$[5]=oe>>>8&255,$[6]=oe>>>16&255,$[7]=oe>>>24&255,$[8]=Jt>>>0&255,$[9]=Jt>>>8&255,$[10]=Jt>>>16&255,$[11]=Jt>>>24&255,$[12]=le>>>0&255,$[13]=le>>>8&255,$[14]=le>>>16&255,$[15]=le>>>24&255,$[16]=ae>>>0&255,$[17]=ae>>>8&255,$[18]=ae>>>16&255,$[19]=ae>>>24&255,$[20]=ne>>>0&255,$[21]=ne>>>8&255,$[22]=ne>>>16&255,$[23]=ne>>>24&255,$[24]=Ot>>>0&255,$[25]=Ot>>>8&255,$[26]=Ot>>>16&255,$[27]=Ot>>>24&255,$[28]=Nt>>>0&255,$[29]=Nt>>>8&255,$[30]=Nt>>>16&255,$[31]=Nt>>>24&255,$[32]=he>>>0&255,$[33]=he>>>8&255,$[34]=he>>>16&255,$[35]=he>>>24&255,$[36]=ee>>>0&255,$[37]=ee>>>8&255,$[38]=ee>>>16&255,$[39]=ee>>>24&255,$[40]=re>>>0&255,$[41]=re>>>8&255,$[42]=re>>>16&255,$[43]=re>>>24&255,$[44]=me>>>0&255,$[45]=me>>>8&255,$[46]=me>>>16&255,$[47]=me>>>24&255,$[48]=Fe>>>0&255,$[49]=Fe>>>8&255,$[50]=Fe>>>16&255,$[51]=Fe>>>24&255,$[52]=We>>>0&255,$[53]=We>>>8&255,$[54]=We>>>16&255,$[55]=We>>>24&255,$[56]=Xe>>>0&255,$[57]=Xe>>>8&255,$[58]=Xe>>>16&255,$[59]=Xe>>>24&255,$[60]=Ge>>>0&255,$[61]=Ge>>>8&255,$[62]=Ge>>>16&255,$[63]=Ge>>>24&255}function T($,G,H,N){for(var V=N[0]&255|(N[1]&255)<<8|(N[2]&255)<<16|(N[3]&255)<<24,tt=H[0]&255|(H[1]&255)<<8|(H[2]&255)<<16|(H[3]&255)<<24,lt=H[4]&255|(H[5]&255)<<8|(H[6]&255)<<16|(H[7]&255)<<24,at=H[8]&255|(H[9]&255)<<8|(H[10]&255)<<16|(H[11]&255)<<24,ht=H[12]&255|(H[13]&255)<<8|(H[14]&255)<<16|(H[15]&255)<<24,zt=N[4]&255|(N[5]&255)<<8|(N[6]&255)<<16|(N[7]&255)<<24,Zt=G[0]&255|(G[1]&255)<<8|(G[2]&255)<<16|(G[3]&255)<<24,ye=G[4]&255|(G[5]&255)<<8|(G[6]&255)<<16|(G[7]&255)<<24,Yt=G[8]&255|(G[9]&255)<<8|(G[10]&255)<<16|(G[11]&255)<<24,pe=G[12]&255|(G[13]&255)<<8|(G[14]&255)<<16|(G[15]&255)<<24,ve=N[8]&255|(N[9]&255)<<8|(N[10]&255)<<16|(N[11]&255)<<24,ge=H[16]&255|(H[17]&255)<<8|(H[18]&255)<<16|(H[19]&255)<<24,ie=H[20]&255|(H[21]&255)<<8|(H[22]&255)<<16|(H[23]&255)<<24,ue=H[24]&255|(H[25]&255)<<8|(H[26]&255)<<16|(H[27]&255)<<24,fe=H[28]&255|(H[29]&255)<<8|(H[30]&255)<<16|(H[31]&255)<<24,ce=N[12]&255|(N[13]&255)<<8|(N[14]&255)<<16|(N[15]&255)<<24,$t=V,oe=tt,Jt=lt,le=at,ae=ht,ne=zt,Ot=Zt,Nt=ye,he=Yt,ee=pe,re=ve,me=ge,Fe=ie,We=ue,Xe=fe,Ge=ce,bt,ir=0;ir<20;ir+=2)bt=$t+Fe|0,ae^=bt<<7|bt>>>32-7,bt=ae+$t|0,he^=bt<<9|bt>>>32-9,bt=he+ae|0,Fe^=bt<<13|bt>>>32-13,bt=Fe+he|0,$t^=bt<<18|bt>>>32-18,bt=ne+oe|0,ee^=bt<<7|bt>>>32-7,bt=ee+ne|0,We^=bt<<9|bt>>>32-9,bt=We+ee|0,oe^=bt<<13|bt>>>32-13,bt=oe+We|0,ne^=bt<<18|bt>>>32-18,bt=re+Ot|0,Xe^=bt<<7|bt>>>32-7,bt=Xe+re|0,Jt^=bt<<9|bt>>>32-9,bt=Jt+Xe|0,Ot^=bt<<13|bt>>>32-13,bt=Ot+Jt|0,re^=bt<<18|bt>>>32-18,bt=Ge+me|0,le^=bt<<7|bt>>>32-7,bt=le+Ge|0,Nt^=bt<<9|bt>>>32-9,bt=Nt+le|0,me^=bt<<13|bt>>>32-13,bt=me+Nt|0,Ge^=bt<<18|bt>>>32-18,bt=$t+le|0,oe^=bt<<7|bt>>>32-7,bt=oe+$t|0,Jt^=bt<<9|bt>>>32-9,bt=Jt+oe|0,le^=bt<<13|bt>>>32-13,bt=le+Jt|0,$t^=bt<<18|bt>>>32-18,bt=ne+ae|0,Ot^=bt<<7|bt>>>32-7,bt=Ot+ne|0,Nt^=bt<<9|bt>>>32-9,bt=Nt+Ot|0,ae^=bt<<13|bt>>>32-13,bt=ae+Nt|0,ne^=bt<<18|bt>>>32-18,bt=re+ee|0,me^=bt<<7|bt>>>32-7,bt=me+re|0,he^=bt<<9|bt>>>32-9,bt=he+me|0,ee^=bt<<13|bt>>>32-13,bt=ee+he|0,re^=bt<<18|bt>>>32-18,bt=Ge+Xe|0,Fe^=bt<<7|bt>>>32-7,bt=Fe+Ge|0,We^=bt<<9|bt>>>32-9,bt=We+Fe|0,Xe^=bt<<13|bt>>>32-13,bt=Xe+We|0,Ge^=bt<<18|bt>>>32-18;$[0]=$t>>>0&255,$[1]=$t>>>8&255,$[2]=$t>>>16&255,$[3]=$t>>>24&255,$[4]=ne>>>0&255,$[5]=ne>>>8&255,$[6]=ne>>>16&255,$[7]=ne>>>24&255,$[8]=re>>>0&255,$[9]=re>>>8&255,$[10]=re>>>16&255,$[11]=re>>>24&255,$[12]=Ge>>>0&255,$[13]=Ge>>>8&255,$[14]=Ge>>>16&255,$[15]=Ge>>>24&255,$[16]=Ot>>>0&255,$[17]=Ot>>>8&255,$[18]=Ot>>>16&255,$[19]=Ot>>>24&255,$[20]=Nt>>>0&255,$[21]=Nt>>>8&255,$[22]=Nt>>>16&255,$[23]=Nt>>>24&255,$[24]=he>>>0&255,$[25]=he>>>8&255,$[26]=he>>>16&255,$[27]=he>>>24&255,$[28]=ee>>>0&255,$[29]=ee>>>8&255,$[30]=ee>>>16&255,$[31]=ee>>>24&255}function U($,G,H,N){R($,G,H,N)}function j($,G,H,N){T($,G,H,N)}var Y=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function rt($,G,H,N,V,tt,lt){var at=new Uint8Array(16),ht=new Uint8Array(64),zt,Zt;for(Zt=0;Zt<16;Zt++)at[Zt]=0;for(Zt=0;Zt<8;Zt++)at[Zt]=tt[Zt];for(;V>=64;){for(U(ht,at,lt,Y),Zt=0;Zt<64;Zt++)$[G+Zt]=H[N+Zt]^ht[Zt];for(zt=1,Zt=8;Zt<16;Zt++)zt=zt+(at[Zt]&255)|0,at[Zt]=zt&255,zt>>>=8;V-=64,G+=64,N+=64}if(V>0)for(U(ht,at,lt,Y),Zt=0;Zt=64;){for(U(lt,tt,V,Y),ht=0;ht<64;ht++)$[G+ht]=lt[ht];for(at=1,ht=8;ht<16;ht++)at=at+(tt[ht]&255)|0,tt[ht]=at&255,at>>>=8;H-=64,G+=64}if(H>0)for(U(lt,tt,V,Y),ht=0;ht>>13|H<<3)&8191,N=$[4]&255|($[5]&255)<<8,this.r[2]=(H>>>10|N<<6)&7939,V=$[6]&255|($[7]&255)<<8,this.r[3]=(N>>>7|V<<9)&8191,tt=$[8]&255|($[9]&255)<<8,this.r[4]=(V>>>4|tt<<12)&255,this.r[5]=tt>>>1&8190,lt=$[10]&255|($[11]&255)<<8,this.r[6]=(tt>>>14|lt<<2)&8191,at=$[12]&255|($[13]&255)<<8,this.r[7]=(lt>>>11|at<<5)&8065,ht=$[14]&255|($[15]&255)<<8,this.r[8]=(at>>>8|ht<<8)&8191,this.r[9]=ht>>>5&127,this.pad[0]=$[16]&255|($[17]&255)<<8,this.pad[1]=$[18]&255|($[19]&255)<<8,this.pad[2]=$[20]&255|($[21]&255)<<8,this.pad[3]=$[22]&255|($[23]&255)<<8,this.pad[4]=$[24]&255|($[25]&255)<<8,this.pad[5]=$[26]&255|($[27]&255)<<8,this.pad[6]=$[28]&255|($[29]&255)<<8,this.pad[7]=$[30]&255|($[31]&255)<<8};d.prototype.blocks=function($,G,H){for(var N=this.fin?0:2048,V,tt,lt,at,ht,zt,Zt,ye,Yt,pe,ve,ge,ie,ue,fe,ce,$t,oe,Jt,le=this.h[0],ae=this.h[1],ne=this.h[2],Ot=this.h[3],Nt=this.h[4],he=this.h[5],ee=this.h[6],re=this.h[7],me=this.h[8],Fe=this.h[9],We=this.r[0],Xe=this.r[1],Ge=this.r[2],bt=this.r[3],ir=this.r[4],mr=this.r[5],vr=this.r[6],Qe=this.r[7],dr=this.r[8],pr=this.r[9];H>=16;)V=$[G+0]&255|($[G+1]&255)<<8,le+=V&8191,tt=$[G+2]&255|($[G+3]&255)<<8,ae+=(V>>>13|tt<<3)&8191,lt=$[G+4]&255|($[G+5]&255)<<8,ne+=(tt>>>10|lt<<6)&8191,at=$[G+6]&255|($[G+7]&255)<<8,Ot+=(lt>>>7|at<<9)&8191,ht=$[G+8]&255|($[G+9]&255)<<8,Nt+=(at>>>4|ht<<12)&8191,he+=ht>>>1&8191,zt=$[G+10]&255|($[G+11]&255)<<8,ee+=(ht>>>14|zt<<2)&8191,Zt=$[G+12]&255|($[G+13]&255)<<8,re+=(zt>>>11|Zt<<5)&8191,ye=$[G+14]&255|($[G+15]&255)<<8,me+=(Zt>>>8|ye<<8)&8191,Fe+=ye>>>5|N,Yt=0,pe=Yt,pe+=le*We,pe+=ae*(5*pr),pe+=ne*(5*dr),pe+=Ot*(5*Qe),pe+=Nt*(5*vr),Yt=pe>>>13,pe&=8191,pe+=he*(5*mr),pe+=ee*(5*ir),pe+=re*(5*bt),pe+=me*(5*Ge),pe+=Fe*(5*Xe),Yt+=pe>>>13,pe&=8191,ve=Yt,ve+=le*Xe,ve+=ae*We,ve+=ne*(5*pr),ve+=Ot*(5*dr),ve+=Nt*(5*Qe),Yt=ve>>>13,ve&=8191,ve+=he*(5*vr),ve+=ee*(5*mr),ve+=re*(5*ir),ve+=me*(5*bt),ve+=Fe*(5*Ge),Yt+=ve>>>13,ve&=8191,ge=Yt,ge+=le*Ge,ge+=ae*Xe,ge+=ne*We,ge+=Ot*(5*pr),ge+=Nt*(5*dr),Yt=ge>>>13,ge&=8191,ge+=he*(5*Qe),ge+=ee*(5*vr),ge+=re*(5*mr),ge+=me*(5*ir),ge+=Fe*(5*bt),Yt+=ge>>>13,ge&=8191,ie=Yt,ie+=le*bt,ie+=ae*Ge,ie+=ne*Xe,ie+=Ot*We,ie+=Nt*(5*pr),Yt=ie>>>13,ie&=8191,ie+=he*(5*dr),ie+=ee*(5*Qe),ie+=re*(5*vr),ie+=me*(5*mr),ie+=Fe*(5*ir),Yt+=ie>>>13,ie&=8191,ue=Yt,ue+=le*ir,ue+=ae*bt,ue+=ne*Ge,ue+=Ot*Xe,ue+=Nt*We,Yt=ue>>>13,ue&=8191,ue+=he*(5*pr),ue+=ee*(5*dr),ue+=re*(5*Qe),ue+=me*(5*vr),ue+=Fe*(5*mr),Yt+=ue>>>13,ue&=8191,fe=Yt,fe+=le*mr,fe+=ae*ir,fe+=ne*bt,fe+=Ot*Ge,fe+=Nt*Xe,Yt=fe>>>13,fe&=8191,fe+=he*We,fe+=ee*(5*pr),fe+=re*(5*dr),fe+=me*(5*Qe),fe+=Fe*(5*vr),Yt+=fe>>>13,fe&=8191,ce=Yt,ce+=le*vr,ce+=ae*mr,ce+=ne*ir,ce+=Ot*bt,ce+=Nt*Ge,Yt=ce>>>13,ce&=8191,ce+=he*Xe,ce+=ee*We,ce+=re*(5*pr),ce+=me*(5*dr),ce+=Fe*(5*Qe),Yt+=ce>>>13,ce&=8191,$t=Yt,$t+=le*Qe,$t+=ae*vr,$t+=ne*mr,$t+=Ot*ir,$t+=Nt*bt,Yt=$t>>>13,$t&=8191,$t+=he*Ge,$t+=ee*Xe,$t+=re*We,$t+=me*(5*pr),$t+=Fe*(5*dr),Yt+=$t>>>13,$t&=8191,oe=Yt,oe+=le*dr,oe+=ae*Qe,oe+=ne*vr,oe+=Ot*mr,oe+=Nt*ir,Yt=oe>>>13,oe&=8191,oe+=he*bt,oe+=ee*Ge,oe+=re*Xe,oe+=me*We,oe+=Fe*(5*pr),Yt+=oe>>>13,oe&=8191,Jt=Yt,Jt+=le*pr,Jt+=ae*dr,Jt+=ne*Qe,Jt+=Ot*vr,Jt+=Nt*mr,Yt=Jt>>>13,Jt&=8191,Jt+=he*ir,Jt+=ee*bt,Jt+=re*Ge,Jt+=me*Xe,Jt+=Fe*We,Yt+=Jt>>>13,Jt&=8191,Yt=(Yt<<2)+Yt|0,Yt=Yt+pe|0,pe=Yt&8191,Yt=Yt>>>13,ve+=Yt,le=pe,ae=ve,ne=ge,Ot=ie,Nt=ue,he=fe,ee=ce,re=$t,me=oe,Fe=Jt,G+=16,H-=16;this.h[0]=le,this.h[1]=ae,this.h[2]=ne,this.h[3]=Ot,this.h[4]=Nt,this.h[5]=he,this.h[6]=ee,this.h[7]=re,this.h[8]=me,this.h[9]=Fe},d.prototype.finish=function($,G){var H=new Uint16Array(10),N,V,tt,lt;if(this.leftover){for(lt=this.leftover,this.buffer[lt++]=1;lt<16;lt++)this.buffer[lt]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(N=this.h[1]>>>13,this.h[1]&=8191,lt=2;lt<10;lt++)this.h[lt]+=N,N=this.h[lt]>>>13,this.h[lt]&=8191;for(this.h[0]+=N*5,N=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=N,N=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=N,H[0]=this.h[0]+5,N=H[0]>>>13,H[0]&=8191,lt=1;lt<10;lt++)H[lt]=this.h[lt]+N,N=H[lt]>>>13,H[lt]&=8191;for(H[9]-=8192,V=(N^1)-1,lt=0;lt<10;lt++)H[lt]&=V;for(V=~V,lt=0;lt<10;lt++)this.h[lt]=this.h[lt]&V|H[lt];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,tt=this.h[0]+this.pad[0],this.h[0]=tt&65535,lt=1;lt<8;lt++)tt=(this.h[lt]+this.pad[lt]|0)+(tt>>>16)|0,this.h[lt]=tt&65535;$[G+0]=this.h[0]>>>0&255,$[G+1]=this.h[0]>>>8&255,$[G+2]=this.h[1]>>>0&255,$[G+3]=this.h[1]>>>8&255,$[G+4]=this.h[2]>>>0&255,$[G+5]=this.h[2]>>>8&255,$[G+6]=this.h[3]>>>0&255,$[G+7]=this.h[3]>>>8&255,$[G+8]=this.h[4]>>>0&255,$[G+9]=this.h[4]>>>8&255,$[G+10]=this.h[5]>>>0&255,$[G+11]=this.h[5]>>>8&255,$[G+12]=this.h[6]>>>0&255,$[G+13]=this.h[6]>>>8&255,$[G+14]=this.h[7]>>>0&255,$[G+15]=this.h[7]>>>8&255},d.prototype.update=function($,G,H){var N,V;if(this.leftover){for(V=16-this.leftover,V>H&&(V=H),N=0;N=16&&(V=H-H%16,this.blocks($,G,V),G+=V,H-=V),H){for(N=0;N>16&1),tt[H-1]&=65535;tt[15]=lt[15]-32767-(tt[14]>>16&1),V=tt[15]>>16&1,tt[14]&=65535,I(lt,tt,1-V)}for(H=0;H<16;H++)$[2*H]=lt[H]&255,$[2*H+1]=lt[H]>>8}function u($,G){var H=new Uint8Array(32),N=new Uint8Array(32);return b(H,$),b(N,G),P(H,0,N,0)}function m($){var G=new Uint8Array(32);return b(G,$),G[0]&1}function L($,G){var H;for(H=0;H<16;H++)$[H]=G[2*H]+(G[2*H+1]<<8);$[15]&=32767}function q($,G,H){for(var N=0;N<16;N++)$[N]=G[N]+H[N]}function z($,G,H){for(var N=0;N<16;N++)$[N]=G[N]-H[N]}function W($,G,H){var N,V,tt=0,lt=0,at=0,ht=0,zt=0,Zt=0,ye=0,Yt=0,pe=0,ve=0,ge=0,ie=0,ue=0,fe=0,ce=0,$t=0,oe=0,Jt=0,le=0,ae=0,ne=0,Ot=0,Nt=0,he=0,ee=0,re=0,me=0,Fe=0,We=0,Xe=0,Ge=0,bt=H[0],ir=H[1],mr=H[2],vr=H[3],Qe=H[4],dr=H[5],pr=H[6],on=H[7],Br=H[8],Gr=H[9],Yr=H[10],Xr=H[11],hn=H[12],zn=H[13],qn=H[14],Fn=H[15];N=G[0],tt+=N*bt,lt+=N*ir,at+=N*mr,ht+=N*vr,zt+=N*Qe,Zt+=N*dr,ye+=N*pr,Yt+=N*on,pe+=N*Br,ve+=N*Gr,ge+=N*Yr,ie+=N*Xr,ue+=N*hn,fe+=N*zn,ce+=N*qn,$t+=N*Fn,N=G[1],lt+=N*bt,at+=N*ir,ht+=N*mr,zt+=N*vr,Zt+=N*Qe,ye+=N*dr,Yt+=N*pr,pe+=N*on,ve+=N*Br,ge+=N*Gr,ie+=N*Yr,ue+=N*Xr,fe+=N*hn,ce+=N*zn,$t+=N*qn,oe+=N*Fn,N=G[2],at+=N*bt,ht+=N*ir,zt+=N*mr,Zt+=N*vr,ye+=N*Qe,Yt+=N*dr,pe+=N*pr,ve+=N*on,ge+=N*Br,ie+=N*Gr,ue+=N*Yr,fe+=N*Xr,ce+=N*hn,$t+=N*zn,oe+=N*qn,Jt+=N*Fn,N=G[3],ht+=N*bt,zt+=N*ir,Zt+=N*mr,ye+=N*vr,Yt+=N*Qe,pe+=N*dr,ve+=N*pr,ge+=N*on,ie+=N*Br,ue+=N*Gr,fe+=N*Yr,ce+=N*Xr,$t+=N*hn,oe+=N*zn,Jt+=N*qn,le+=N*Fn,N=G[4],zt+=N*bt,Zt+=N*ir,ye+=N*mr,Yt+=N*vr,pe+=N*Qe,ve+=N*dr,ge+=N*pr,ie+=N*on,ue+=N*Br,fe+=N*Gr,ce+=N*Yr,$t+=N*Xr,oe+=N*hn,Jt+=N*zn,le+=N*qn,ae+=N*Fn,N=G[5],Zt+=N*bt,ye+=N*ir,Yt+=N*mr,pe+=N*vr,ve+=N*Qe,ge+=N*dr,ie+=N*pr,ue+=N*on,fe+=N*Br,ce+=N*Gr,$t+=N*Yr,oe+=N*Xr,Jt+=N*hn,le+=N*zn,ae+=N*qn,ne+=N*Fn,N=G[6],ye+=N*bt,Yt+=N*ir,pe+=N*mr,ve+=N*vr,ge+=N*Qe,ie+=N*dr,ue+=N*pr,fe+=N*on,ce+=N*Br,$t+=N*Gr,oe+=N*Yr,Jt+=N*Xr,le+=N*hn,ae+=N*zn,ne+=N*qn,Ot+=N*Fn,N=G[7],Yt+=N*bt,pe+=N*ir,ve+=N*mr,ge+=N*vr,ie+=N*Qe,ue+=N*dr,fe+=N*pr,ce+=N*on,$t+=N*Br,oe+=N*Gr,Jt+=N*Yr,le+=N*Xr,ae+=N*hn,ne+=N*zn,Ot+=N*qn,Nt+=N*Fn,N=G[8],pe+=N*bt,ve+=N*ir,ge+=N*mr,ie+=N*vr,ue+=N*Qe,fe+=N*dr,ce+=N*pr,$t+=N*on,oe+=N*Br,Jt+=N*Gr,le+=N*Yr,ae+=N*Xr,ne+=N*hn,Ot+=N*zn,Nt+=N*qn,he+=N*Fn,N=G[9],ve+=N*bt,ge+=N*ir,ie+=N*mr,ue+=N*vr,fe+=N*Qe,ce+=N*dr,$t+=N*pr,oe+=N*on,Jt+=N*Br,le+=N*Gr,ae+=N*Yr,ne+=N*Xr,Ot+=N*hn,Nt+=N*zn,he+=N*qn,ee+=N*Fn,N=G[10],ge+=N*bt,ie+=N*ir,ue+=N*mr,fe+=N*vr,ce+=N*Qe,$t+=N*dr,oe+=N*pr,Jt+=N*on,le+=N*Br,ae+=N*Gr,ne+=N*Yr,Ot+=N*Xr,Nt+=N*hn,he+=N*zn,ee+=N*qn,re+=N*Fn,N=G[11],ie+=N*bt,ue+=N*ir,fe+=N*mr,ce+=N*vr,$t+=N*Qe,oe+=N*dr,Jt+=N*pr,le+=N*on,ae+=N*Br,ne+=N*Gr,Ot+=N*Yr,Nt+=N*Xr,he+=N*hn,ee+=N*zn,re+=N*qn,me+=N*Fn,N=G[12],ue+=N*bt,fe+=N*ir,ce+=N*mr,$t+=N*vr,oe+=N*Qe,Jt+=N*dr,le+=N*pr,ae+=N*on,ne+=N*Br,Ot+=N*Gr,Nt+=N*Yr,he+=N*Xr,ee+=N*hn,re+=N*zn,me+=N*qn,Fe+=N*Fn,N=G[13],fe+=N*bt,ce+=N*ir,$t+=N*mr,oe+=N*vr,Jt+=N*Qe,le+=N*dr,ae+=N*pr,ne+=N*on,Ot+=N*Br,Nt+=N*Gr,he+=N*Yr,ee+=N*Xr,re+=N*hn,me+=N*zn,Fe+=N*qn,We+=N*Fn,N=G[14],ce+=N*bt,$t+=N*ir,oe+=N*mr,Jt+=N*vr,le+=N*Qe,ae+=N*dr,ne+=N*pr,Ot+=N*on,Nt+=N*Br,he+=N*Gr,ee+=N*Yr,re+=N*Xr,me+=N*hn,Fe+=N*zn,We+=N*qn,Xe+=N*Fn,N=G[15],$t+=N*bt,oe+=N*ir,Jt+=N*mr,le+=N*vr,ae+=N*Qe,ne+=N*dr,Ot+=N*pr,Nt+=N*on,he+=N*Br,ee+=N*Gr,re+=N*Yr,me+=N*Xr,Fe+=N*hn,We+=N*zn,Xe+=N*qn,Ge+=N*Fn,tt+=38*oe,lt+=38*Jt,at+=38*le,ht+=38*ae,zt+=38*ne,Zt+=38*Ot,ye+=38*Nt,Yt+=38*he,pe+=38*ee,ve+=38*re,ge+=38*me,ie+=38*Fe,ue+=38*We,fe+=38*Xe,ce+=38*Ge,V=1,N=tt+V+65535,V=Math.floor(N/65536),tt=N-V*65536,N=lt+V+65535,V=Math.floor(N/65536),lt=N-V*65536,N=at+V+65535,V=Math.floor(N/65536),at=N-V*65536,N=ht+V+65535,V=Math.floor(N/65536),ht=N-V*65536,N=zt+V+65535,V=Math.floor(N/65536),zt=N-V*65536,N=Zt+V+65535,V=Math.floor(N/65536),Zt=N-V*65536,N=ye+V+65535,V=Math.floor(N/65536),ye=N-V*65536,N=Yt+V+65535,V=Math.floor(N/65536),Yt=N-V*65536,N=pe+V+65535,V=Math.floor(N/65536),pe=N-V*65536,N=ve+V+65535,V=Math.floor(N/65536),ve=N-V*65536,N=ge+V+65535,V=Math.floor(N/65536),ge=N-V*65536,N=ie+V+65535,V=Math.floor(N/65536),ie=N-V*65536,N=ue+V+65535,V=Math.floor(N/65536),ue=N-V*65536,N=fe+V+65535,V=Math.floor(N/65536),fe=N-V*65536,N=ce+V+65535,V=Math.floor(N/65536),ce=N-V*65536,N=$t+V+65535,V=Math.floor(N/65536),$t=N-V*65536,tt+=V-1+37*(V-1),V=1,N=tt+V+65535,V=Math.floor(N/65536),tt=N-V*65536,N=lt+V+65535,V=Math.floor(N/65536),lt=N-V*65536,N=at+V+65535,V=Math.floor(N/65536),at=N-V*65536,N=ht+V+65535,V=Math.floor(N/65536),ht=N-V*65536,N=zt+V+65535,V=Math.floor(N/65536),zt=N-V*65536,N=Zt+V+65535,V=Math.floor(N/65536),Zt=N-V*65536,N=ye+V+65535,V=Math.floor(N/65536),ye=N-V*65536,N=Yt+V+65535,V=Math.floor(N/65536),Yt=N-V*65536,N=pe+V+65535,V=Math.floor(N/65536),pe=N-V*65536,N=ve+V+65535,V=Math.floor(N/65536),ve=N-V*65536,N=ge+V+65535,V=Math.floor(N/65536),ge=N-V*65536,N=ie+V+65535,V=Math.floor(N/65536),ie=N-V*65536,N=ue+V+65535,V=Math.floor(N/65536),ue=N-V*65536,N=fe+V+65535,V=Math.floor(N/65536),fe=N-V*65536,N=ce+V+65535,V=Math.floor(N/65536),ce=N-V*65536,N=$t+V+65535,V=Math.floor(N/65536),$t=N-V*65536,tt+=V-1+37*(V-1),$[0]=tt,$[1]=lt,$[2]=at,$[3]=ht,$[4]=zt,$[5]=Zt,$[6]=ye,$[7]=Yt,$[8]=pe,$[9]=ve,$[10]=ge,$[11]=ie,$[12]=ue,$[13]=fe,$[14]=ce,$[15]=$t}function ot($,G){W($,G,G)}function ut($,G){var H=e(),N;for(N=0;N<16;N++)H[N]=G[N];for(N=253;N>=0;N--)ot(H,H),N!==2&&N!==4&&W(H,H,G);for(N=0;N<16;N++)$[N]=H[N]}function Ct($,G){var H=e(),N;for(N=0;N<16;N++)H[N]=G[N];for(N=250;N>=0;N--)ot(H,H),N!==1&&W(H,H,G);for(N=0;N<16;N++)$[N]=H[N]}function yt($,G,H){var N=new Uint8Array(32),V=new Float64Array(80),tt,lt,at=e(),ht=e(),zt=e(),Zt=e(),ye=e(),Yt=e();for(lt=0;lt<31;lt++)N[lt]=G[lt];for(N[31]=G[31]&127|64,N[0]&=248,L(V,H),lt=0;lt<16;lt++)ht[lt]=V[lt],Zt[lt]=at[lt]=zt[lt]=0;for(at[0]=Zt[0]=1,lt=254;lt>=0;--lt)tt=N[lt>>>3]>>>(lt&7)&1,I(at,ht,tt),I(zt,Zt,tt),q(ye,at,zt),z(at,at,zt),q(zt,ht,Zt),z(ht,ht,Zt),ot(Zt,ye),ot(Yt,at),W(at,zt,at),W(zt,ht,ye),q(ye,at,zt),z(at,at,zt),ot(ht,at),z(zt,Zt,Yt),W(at,zt,p),q(at,at,Zt),W(zt,zt,at),W(at,Zt,Yt),W(Zt,ht,V),ot(ht,ye),I(at,ht,tt),I(zt,Zt,tt);for(lt=0;lt<16;lt++)V[lt+16]=at[lt],V[lt+32]=zt[lt],V[lt+48]=ht[lt],V[lt+64]=Zt[lt];var pe=V.subarray(32),ve=V.subarray(16);return ut(pe,pe),W(ve,ve,pe),b($,ve),0}function mt($,G){return yt($,G,i)}function jt($,G){return n(G,32),mt($,G)}function dt($,G,H){var N=new Uint8Array(32);return yt(N,H,G),j($,s,N,Y)}var ct=f,Tt=h;function kt($,G,H,N,V,tt){var lt=new Uint8Array(32);return dt(lt,V,tt),ct($,G,H,N,lt)}function S($,G,H,N,V,tt){var lt=new Uint8Array(32);return dt(lt,V,tt),Tt($,G,H,N,lt)}var C=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function O($,G,H,N){for(var V=new Int32Array(16),tt=new Int32Array(16),lt,at,ht,zt,Zt,ye,Yt,pe,ve,ge,ie,ue,fe,ce,$t,oe,Jt,le,ae,ne,Ot,Nt,he,ee,re,me,Fe=$[0],We=$[1],Xe=$[2],Ge=$[3],bt=$[4],ir=$[5],mr=$[6],vr=$[7],Qe=G[0],dr=G[1],pr=G[2],on=G[3],Br=G[4],Gr=G[5],Yr=G[6],Xr=G[7],hn=0;N>=128;){for(ae=0;ae<16;ae++)ne=8*ae+hn,V[ae]=H[ne+0]<<24|H[ne+1]<<16|H[ne+2]<<8|H[ne+3],tt[ae]=H[ne+4]<<24|H[ne+5]<<16|H[ne+6]<<8|H[ne+7];for(ae=0;ae<80;ae++)if(lt=Fe,at=We,ht=Xe,zt=Ge,Zt=bt,ye=ir,Yt=mr,pe=vr,ve=Qe,ge=dr,ie=pr,ue=on,fe=Br,ce=Gr,$t=Yr,oe=Xr,Ot=vr,Nt=Xr,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=(bt>>>14|Br<<32-14)^(bt>>>18|Br<<32-18)^(Br>>>41-32|bt<<32-(41-32)),Nt=(Br>>>14|bt<<32-14)^(Br>>>18|bt<<32-18)^(bt>>>41-32|Br<<32-(41-32)),he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,Ot=bt&ir^~bt&mr,Nt=Br&Gr^~Br&Yr,he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,Ot=C[ae*2],Nt=C[ae*2+1],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,Ot=V[ae%16],Nt=tt[ae%16],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,Jt=re&65535|me<<16,le=he&65535|ee<<16,Ot=Jt,Nt=le,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=(Fe>>>28|Qe<<32-28)^(Qe>>>34-32|Fe<<32-(34-32))^(Qe>>>39-32|Fe<<32-(39-32)),Nt=(Qe>>>28|Fe<<32-28)^(Fe>>>34-32|Qe<<32-(34-32))^(Fe>>>39-32|Qe<<32-(39-32)),he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,Ot=Fe&We^Fe&Xe^We&Xe,Nt=Qe&dr^Qe&pr^dr&pr,he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,pe=re&65535|me<<16,oe=he&65535|ee<<16,Ot=zt,Nt=ue,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=Jt,Nt=le,he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,zt=re&65535|me<<16,ue=he&65535|ee<<16,We=lt,Xe=at,Ge=ht,bt=zt,ir=Zt,mr=ye,vr=Yt,Fe=pe,dr=ve,pr=ge,on=ie,Br=ue,Gr=fe,Yr=ce,Xr=$t,Qe=oe,ae%16===15)for(ne=0;ne<16;ne++)Ot=V[ne],Nt=tt[ne],he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=V[(ne+9)%16],Nt=tt[(ne+9)%16],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,Jt=V[(ne+1)%16],le=tt[(ne+1)%16],Ot=(Jt>>>1|le<<32-1)^(Jt>>>8|le<<32-8)^Jt>>>7,Nt=(le>>>1|Jt<<32-1)^(le>>>8|Jt<<32-8)^(le>>>7|Jt<<32-7),he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,Jt=V[(ne+14)%16],le=tt[(ne+14)%16],Ot=(Jt>>>19|le<<32-19)^(le>>>61-32|Jt<<32-(61-32))^Jt>>>6,Nt=(le>>>19|Jt<<32-19)^(Jt>>>61-32|le<<32-(61-32))^(le>>>6|Jt<<32-6),he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,V[ne]=re&65535|me<<16,tt[ne]=he&65535|ee<<16;Ot=Fe,Nt=Qe,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=$[0],Nt=G[0],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,$[0]=Fe=re&65535|me<<16,G[0]=Qe=he&65535|ee<<16,Ot=We,Nt=dr,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=$[1],Nt=G[1],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,$[1]=We=re&65535|me<<16,G[1]=dr=he&65535|ee<<16,Ot=Xe,Nt=pr,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=$[2],Nt=G[2],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,$[2]=Xe=re&65535|me<<16,G[2]=pr=he&65535|ee<<16,Ot=Ge,Nt=on,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=$[3],Nt=G[3],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,$[3]=Ge=re&65535|me<<16,G[3]=on=he&65535|ee<<16,Ot=bt,Nt=Br,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=$[4],Nt=G[4],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,$[4]=bt=re&65535|me<<16,G[4]=Br=he&65535|ee<<16,Ot=ir,Nt=Gr,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=$[5],Nt=G[5],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,$[5]=ir=re&65535|me<<16,G[5]=Gr=he&65535|ee<<16,Ot=mr,Nt=Yr,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=$[6],Nt=G[6],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,$[6]=mr=re&65535|me<<16,G[6]=Yr=he&65535|ee<<16,Ot=vr,Nt=Xr,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=$[7],Nt=G[7],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,$[7]=vr=re&65535|me<<16,G[7]=Xr=he&65535|ee<<16,hn+=128,N-=128}return N}function F($,G,H){var N=new Int32Array(8),V=new Int32Array(8),tt=new Uint8Array(256),lt,at=H;for(N[0]=1779033703,N[1]=3144134277,N[2]=1013904242,N[3]=2773480762,N[4]=1359893119,N[5]=2600822924,N[6]=528734635,N[7]=1541459225,V[0]=4089235720,V[1]=2227873595,V[2]=4271175723,V[3]=1595750129,V[4]=2917565137,V[5]=725511199,V[6]=4215389547,V[7]=327033209,O(N,V,G,H),H%=128,lt=0;lt=0;--V)N=H[V/8|0]>>(V&7)&1,Q($,G,N),et(G,$),et($,$),Q($,G,N)}function It($,G){var H=[e(),e(),e(),e()];g(H[0],E),g(H[1],M),g(H[2],l),W(H[3],E,M),qt($,H,G)}function xt($,G,H){var N=new Uint8Array(64),V=[e(),e(),e(),e()],tt;for(H||n(G,32),F(N,G,32),N[0]&=248,N[31]&=127,N[31]|=64,It(V,N),it($,V),tt=0;tt<32;tt++)G[tt+32]=$[tt];return 0}var Qt=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Rt($,G){var H,N,V,tt;for(N=63;N>=32;--N){for(H=0,V=N-32,tt=N-12;V>4)*Qt[V],H=G[V]>>8,G[V]&=255;for(V=0;V<32;V++)G[V]-=H*Qt[V];for(N=0;N<32;N++)G[N+1]+=G[N]>>8,$[N]=G[N]&255}function Dt($){var G=new Float64Array(64),H;for(H=0;H<64;H++)G[H]=$[H];for(H=0;H<64;H++)$[H]=0;Rt($,G)}function Se($,G,H,N){var V=new Uint8Array(64),tt=new Uint8Array(64),lt=new Uint8Array(64),at,ht,zt=new Float64Array(64),Zt=[e(),e(),e(),e()];F(V,N,32),V[0]&=248,V[31]&=127,V[31]|=64;var ye=H+64;for(at=0;at>7&&z($[0],c,$[0]),W($[3],$[0],$[1]),0)}function Ut($,G,H,N){var V,tt=new Uint8Array(32),lt=new Uint8Array(64),at=[e(),e(),e(),e()],ht=[e(),e(),e(),e()];if(H<64||te(ht,N))return-1;for(V=0;V=0},t.sign.keyPair=function(){var $=new Uint8Array(Pt),G=new Uint8Array(wt);return xt($,G),{publicKey:$,secretKey:G}},t.sign.keyPair.fromSecretKey=function($){if(Bt($),$.length!==wt)throw new Error("bad secret key size");for(var G=new Uint8Array(Pt),H=0;H=0;)B++;if(_.substr(0,2)==="::"&&B--,_.substr(-2,2)==="::"&&B--,B>k)return null;for(U=k-B,T=":";U--;)T+="0:";return _=_.replace("::",T),_[0]===":"&&(_=_.slice(1)),_[_.length-1]===":"&&(_=_.slice(0,-1)),k=function(){const j=_.split(":"),Y=[];for(let rt=0;rt0;){if(T=B-P,T<0&&(T=0),_[R]>>T!==k[R]>>T)return!1;P-=B,R+=1}return!0}function E(_){if(i.test(_))return parseInt(_,16);if(_[0]==="0"&&!isNaN(parseInt(_[1],10))){if(s.test(_))return parseInt(_,8);throw new Error(`ipaddr: cannot parse ${_} as octal`)}return parseInt(_,10)}function M(_,k){for(;_.length=0;R-=1)if(T=this.octets[R],T in P){if(U=P[T],B&&U!==0)return null;U!==8&&(B=!0),k+=U}else return null;return 32-k},_.prototype.range=function(){return w.subnetMatch(this,this.SpecialRanges)},_.prototype.toByteArray=function(){return this.octets.slice(0)},_.prototype.toIPv4MappedAddress=function(){return w.IPv6.parse(`::ffff:${this.toString()}`)},_.prototype.toNormalizedString=function(){return this.toString()},_.prototype.toString=function(){return this.octets.join(".")},_}(),w.IPv4.broadcastAddressFromCIDR=function(_){try{const k=this.parseCIDR(_),B=k[0].toByteArray(),P=this.subnetMaskFromPrefixLength(k[1]).toByteArray(),R=[];let T=0;for(;T<4;)R.push(parseInt(B[T],10)|parseInt(P[T],10)^255),T++;return new this(R)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},w.IPv4.isIPv4=function(_){return this.parser(_)!==null},w.IPv4.isValid=function(_){try{return new this(this.parser(_)),!0}catch{return!1}},w.IPv4.isValidFourPartDecimal=function(_){return!!(w.IPv4.isValid(_)&&_.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},w.IPv4.networkAddressFromCIDR=function(_){let k,B,P,R,T;try{for(k=this.parseCIDR(_),P=k[0].toByteArray(),T=this.subnetMaskFromPrefixLength(k[1]).toByteArray(),R=[],B=0;B<4;)R.push(parseInt(P[B],10)&parseInt(T[B],10)),B++;return new this(R)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},w.IPv4.parse=function(_){const k=this.parser(_);if(k===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(k)},w.IPv4.parseCIDR=function(_){let k;if(k=_.match(/^(.+)\/(\d+)$/)){const B=parseInt(k[2]);if(B>=0&&B<=32){const P=[this.parse(k[1]),B];return Object.defineProperty(P,"toString",{value:function(){return this.join("/")}}),P}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},w.IPv4.parser=function(_){let k,B,P;if(k=_.match(n.fourOctet))return function(){const R=k.slice(1,6),T=[];for(let U=0;U4294967295||P<0)throw new Error("ipaddr: address outside defined range");return function(){const R=[];let T;for(T=0;T<=24;T+=8)R.push(P>>T&255);return R}().reverse()}else return(k=_.match(n.twoOctet))?function(){const R=k.slice(1,4),T=[];if(P=E(R[1]),P>16777215||P<0)throw new Error("ipaddr: address outside defined range");return T.push(E(R[0])),T.push(P>>16&255),T.push(P>>8&255),T.push(P&255),T}():(k=_.match(n.threeOctet))?function(){const R=k.slice(1,5),T=[];if(P=E(R[2]),P>65535||P<0)throw new Error("ipaddr: address outside defined range");return T.push(E(R[0])),T.push(E(R[1])),T.push(P>>8&255),T.push(P&255),T}():null},w.IPv4.subnetMaskFromPrefixLength=function(_){if(_=parseInt(_),_<0||_>32)throw new Error("ipaddr: invalid IPv4 prefix length");const k=[0,0,0,0];let B=0;const P=Math.floor(_/8);for(;B=0;U-=1)if(R=this.parts[U],R in P){if(T=P[R],B&&T!==0)return null;T!==16&&(B=!0),k+=T}else return null;return 128-k},_.prototype.range=function(){return w.subnetMatch(this,this.SpecialRanges)},_.prototype.toByteArray=function(){let k;const B=[],P=this.parts;for(let R=0;R>8),B.push(k&255);return B},_.prototype.toFixedLengthString=function(){const k=(function(){const P=[];for(let R=0;R>8,B&255,P>>8,P&255])},_.prototype.toNormalizedString=function(){const k=(function(){const P=[];for(let R=0;RR&&(P=T.index,R=T[0].length);return R<0?B:`${B.substring(0,P)}::${B.substring(P+R)}`},_.prototype.toString=function(){return this.toRFC5952String()},_}(),w.IPv6.broadcastAddressFromCIDR=function(_){try{const k=this.parseCIDR(_),B=k[0].toByteArray(),P=this.subnetMaskFromPrefixLength(k[1]).toByteArray(),R=[];let T=0;for(;T<16;)R.push(parseInt(B[T],10)|parseInt(P[T],10)^255),T++;return new this(R)}catch(k){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${k})`)}},w.IPv6.isIPv6=function(_){return this.parser(_)!==null},w.IPv6.isValid=function(_){if(typeof _=="string"&&_.indexOf(":")===-1)return!1;try{const k=this.parser(_);return new this(k.parts,k.zoneId),!0}catch{return!1}},w.IPv6.networkAddressFromCIDR=function(_){let k,B,P,R,T;try{for(k=this.parseCIDR(_),P=k[0].toByteArray(),T=this.subnetMaskFromPrefixLength(k[1]).toByteArray(),R=[],B=0;B<16;)R.push(parseInt(P[B],10)&parseInt(T[B],10)),B++;return new this(R)}catch(U){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${U})`)}},w.IPv6.parse=function(_){const k=this.parser(_);if(k.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(k.parts,k.zoneId)},w.IPv6.parseCIDR=function(_){let k,B,P;if((B=_.match(/^(.+)\/(\d+)$/))&&(k=parseInt(B[2]),k>=0&&k<=128))return P=[this.parse(B[1]),k],Object.defineProperty(P,"toString",{value:function(){return this.join("/")}}),P;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},w.IPv6.parser=function(_){let k,B,P,R,T,U;if(P=_.match(p.deprecatedTransitional))return this.parser(`::ffff:${P[1]}`);if(p.native.test(_))return v(_,8);if((P=_.match(p.transitional))&&(U=P[6]||"",k=v(P[1].slice(0,-1)+U,6),k.parts)){for(T=[parseInt(P[2]),parseInt(P[3]),parseInt(P[4]),parseInt(P[5])],B=0;B128)throw new Error("ipaddr: invalid IPv6 prefix length");const k=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let B=0;const P=Math.floor(_/8);for(;B{const t=YD+r,e=PT(yr.Buffer.from(t,"utf8")).slice(2);return yr.Buffer.from(e,"hex")},JD=(r,t,e)=>{const n=[r];t?n.push(t.toBuffer()):n.push(yr.Buffer.alloc(32)),e?n.push(e.toBuffer()):n.push(yr.Buffer.alloc(32));const[s]=Ne.findProgramAddressSync(n,GD);return s},Au=(r,t=DM)=>{let e=XD(r);return{pubkey:JD(e,void 0,t),hashed:e}},Jv=(r,t=!1)=>{r.endsWith(".sol")&&(r=r.slice(0,-4));const e=r.split(".");if(e.length===2){const n=yr.Buffer.from([t?1:0]).toString().concat(e[0]),{pubkey:s}=Au(e[1]);return{...Au(n,s),isSub:!0,parent:s}}if(e.length===3&&t){const{pubkey:n}=Au(e[2]),{pubkey:s}=Au("\0".concat(e[1]),n),i=yr.Buffer.from([1]).toString();return{...Au(i.concat(e[0]),s),isSub:!0,parent:n,isSubRecord:!0}}if(e.length>=3)throw new WD(Xv.InvalidInput);return{...Au(r,DM),isSub:!1,parent:void 0}};var hs;(function(r){r.IPFS="IPFS",r.ARWV="ARWV",r.SOL="SOL",r.ETH="ETH",r.BTC="BTC",r.LTC="LTC",r.DOGE="DOGE",r.Email="email",r.Url="url",r.Discord="discord",r.Github="github",r.Reddit="reddit",r.Twitter="twitter",r.Telegram="telegram",r.Pic="pic",r.SHDW="SHDW",r.POINT="POINT",r.BSC="BSC",r.Injective="INJ",r.Backpack="backpack",r.A="A",r.AAAA="AAAA",r.CNAME="CNAME",r.TXT="TXT",r.Background="background"})(hs||(hs={}));hs.SOL,hs.ETH,hs.BSC,hs.Injective,hs.A,hs.AAAA,hs.Background;new Ne("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29");var r5;(function(r){r.DegenPoet1="DegenPoet#1",r.Rgb0x001="rgb0x00#1"})(r5||(r5={}));new Ne("ART5dr4bDic2sQVZoFheEmUxwQq5VGSx9he7JxHcXNQD");new Ne("CSWvuDHXExVGEMR9kP8xYAHuNjXogeRck9Cnr312CC9g");const QD=["-","_"],tz=()=>{const r=Math.floor(2*Math.random());return QD[r]},zM=(r,t=4)=>{const e=[];for(let n=0;n{const e=t.map(s=>Jv(s).pubkey),n=await(r==null?void 0:r.getMultipleAccountsInfo(e));return n?t.map((s,i)=>{var c;return{domain:s,available:!((c=n[i])!=null&&c.data)}}):[]},ez=({connection:r,domain:t})=>Dg(async()=>{if(!t||!r)return[];const e=t.split(".");if(e.length===2){const n=e[1],s=Jv(t).pubkey,i=await(r==null?void 0:r.getAccountInfo(s)),c=zM(n,10),l=await Qv(r,c);if(i!=null&&i.data)return[{domain:t,available:!i.data},...l];{const p=Jv(n).pubkey,v=await(r==null?void 0:r.getAccountInfo(p));return[{domain:n,available:!(v!=null&&v.data)},...l]}}return Qv(r,[t])},[!!r,t]),rz=({connection:r,domain:t})=>Dg(async()=>{if(!t||t==="")return[];if(t.split(".").length===2)return[];const e=await(await fetch(`https://sns-api.bonfida.com/v2/suggestion/search/${t}`)).json();if(!e||e.length<5){if(!r)return[];const n=zM(t,10);return Qv(r,n)}return e.map(n=>({domain:n,available:!0}))},[t,!!r]),nz=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M16.56 3.06a3.092 3.092 0 0 0-.56.206c-.266.13-.398.244-1.17 1.008l-.87.86.184.343c1.138 2.12 2.165 3.161 4.24 4.3l.476.261.823-.822c.478-.477.879-.913.955-1.039.337-.556.438-1.178.288-1.772-.149-.588-.273-.758-1.342-1.838-1.043-1.054-1.36-1.307-1.816-1.448a2.668 2.668 0 0 0-1.208-.059M9.873 9.233c-3.16 3.169-3.114 3.117-3.29 3.667-.068.213-.583 3.732-.583 3.986C6 17.435 6.565 18 7.114 18c.254 0 3.773-.515 3.986-.583.55-.176.498-.13 3.667-3.29l2.986-2.979-.478-.274c-1.888-1.082-3.003-2.19-4.104-4.081l-.319-.547-2.979 2.987M3.394 19.601c-.284.15-.426.445-.376.779.035.236.278.518.497.579.201.056 16.769.056 16.97 0 .219-.061.462-.343.497-.579.051-.339-.094-.633-.384-.781-.153-.078-.272-.079-8.606-.077-8.276.001-8.455.003-8.598.079"})),qM=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",d:"M19.748 9.058a.75.75 0 0 0-1.496-.116l1.496.116Zm-1.464 9.249.748.057-.748-.057Zm-12.568 0-.748.057.748-.057Zm.032-9.365a.75.75 0 1 0-1.496.116l1.496-.116ZM20.67 7.674a.75.75 0 0 0 .658-1.348l-.658 1.348Zm-18-1.348a.75.75 0 1 0 .658 1.348L2.67 6.326ZM9.25 5a.75.75 0 0 0 1.5 0h-1.5Zm4 0a.75.75 0 0 0 1.5 0h-1.5Zm-2.5 6a.75.75 0 0 0-1.5 0h1.5Zm-1.5 6a.75.75 0 0 0 1.5 0h-1.5Zm5.5-6a.75.75 0 0 0-1.5 0h1.5Zm-1.5 6a.75.75 0 0 0 1.5 0h-1.5Zm5.002-8.058-.716 9.307 1.496.115.716-9.306-1.496-.116ZM14.296 21.25H9.704v1.5h4.592v-1.5Zm-7.832-3-.716-9.308-1.496.116.716 9.306 1.496-.115Zm3.24 3a3.25 3.25 0 0 1-3.24-3l-1.496.114a4.75 4.75 0 0 0 4.736 4.386v-1.5Zm7.832-3a3.25 3.25 0 0 1-3.24 3v1.5a4.75 4.75 0 0 0 4.736-4.386l-1.496-.115ZM12 5.75c3.204 0 6.18.71 8.671 1.924l.658-1.348C18.624 5.008 15.423 4.25 12 4.25v1.5ZM3.329 7.674C5.82 6.46 8.796 5.75 12 5.75v-1.5c-3.423 0-6.624.758-9.329 2.076l.658 1.348ZM10.75 5V4h-1.5v1h1.5Zm2.5-1v1h1.5V4h-1.5ZM12 2.75c.69 0 1.25.56 1.25 1.25h1.5A2.75 2.75 0 0 0 12 1.25v1.5ZM10.75 4c0-.69.56-1.25 1.25-1.25v-1.5A2.75 2.75 0 0 0 9.25 4h1.5Zm-1.5 7v6h1.5v-6h-1.5Zm4 0v6h1.5v-6h-1.5Z"})),FM=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{stroke:"currentColor",strokeLinejoin:"round",strokeWidth:1.5,d:"M22 7a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v10a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4V7Z"}),xe.createElement("path",{stroke:"currentColor",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 12a3 3 0 0 0-3-3H2v6h3a3 3 0 0 0 3-3Z"})),iz=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",d:"M2.587 9.25a.75.75 0 1 0 0 1.5v-1.5Zm18.826 1.5a.75.75 0 0 0 0-1.5v1.5ZM18.035 6v.75V6Zm3.882 4.808.735.15-.735-.15Zm-19.834 0 .735-.15-.735.15ZM5.965 6v-.75V6ZM7.6 22v-.75.75Zm-3.882-3.192.735-.15-.735.15ZM16.4 22v.75V22Zm3.882-3.192-.735-.15.735.15ZM8 13.25a.75.75 0 0 0 0 1.5v-1.5Zm8 1.5a.75.75 0 0 0 0-1.5v1.5Zm-7 2.5a.75.75 0 0 0 0 1.5v-1.5Zm6 1.5a.75.75 0 0 0 0-1.5v1.5ZM9.6 2.45a.75.75 0 1 0-1.2-.9l1.2.9Zm-4.2 3.1a.75.75 0 1 0 1.2.9l-1.2-.9Zm10.2-4a.75.75 0 1 0-1.2.9l1.2-.9Zm1.8 4.9a.75.75 0 1 0 1.2-.9l-1.2.9Zm-1 14.8H7.6v1.5h8.8v-1.5ZM4.453 18.658l-1.635-8-1.47.3 1.635 8 1.47-.3ZM5.965 6.75h12.07v-1.5H5.965v1.5Zm15.217 3.908-1.635 8 1.47.3 1.635-8-1.47-.3Zm-18.595.092h18.826v-1.5H2.587v1.5Zm15.448-4c2.028 0 3.56 1.883 3.147 3.908l1.47.3c.6-2.938-1.623-5.708-4.617-5.708v1.5ZM2.818 10.658C2.404 8.633 3.938 6.75 5.965 6.75v-1.5c-2.994 0-5.217 2.77-4.617 5.708l1.47-.3ZM7.6 21.25a3.222 3.222 0 0 1-3.147-2.592l-1.47.3c.45 2.203 2.375 3.792 4.617 3.792v-1.5Zm8.8 1.5c2.242 0 4.167-1.589 4.617-3.792l-1.47-.3A3.223 3.223 0 0 1 16.4 21.25v1.5Zm-8.4-8h8v-1.5H8v1.5Zm1 4h6v-1.5H9v1.5Zm-.6-17.2-3 4 1.2.9 3-4-1.2-.9Zm6 .9 3 4 1.2-.9-3-4-1.2.9Z"})),oz=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",d:"M5.469 12.414a.75.75 0 0 0-.938 1.172l.938-1.172Zm3.057 3.407-.468.586.468-.586Zm2.736-.224-.557-.501.557.501Zm8.296-8.095a.75.75 0 1 0-1.116-1.004l1.116 1.004ZM4.53 13.586l3.527 2.82.937-1.17-3.526-2.822-.938 1.172Zm7.289 2.513 7.738-8.597-1.116-1.004-7.737 8.598 1.115 1.003Zm-3.762.308a2.75 2.75 0 0 0 3.762-.308l-1.115-1.003a1.25 1.25 0 0 1-1.71.14l-.937 1.17Z"})),jM=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M11.12 2.039c-2.479.248-4.706 1.323-6.359 3.068a9.985 9.985 0 0 0-1.624 11.516 9.432 9.432 0 0 0 1.801 2.438c.992.99 2.1 1.728 3.334 2.217 3.362 1.332 7.041.802 9.928-1.433.437-.338 1.307-1.208 1.645-1.645C21.256 16.378 22 14.236 22 12c0-4.568-3.158-8.613-7.57-9.697-.984-.241-2.402-.355-3.31-.264m1.285 5.342c.08.051.188.162.24.246.091.146.095.184.095.88v.726l-.121.172c-.166.236-.346.334-.619.334s-.453-.098-.619-.334l-.121-.172v-.726c0-.691.005-.734.093-.876.233-.375.691-.484 1.052-.25m-.113 3.433c.155.065.375.305.417.457.017.06.031 1.201.031 2.536v2.426l-.121.172c-.166.237-.346.334-.619.334s-.453-.097-.619-.334l-.121-.172v-2.426c0-1.335.014-2.476.031-2.536.041-.147.259-.39.408-.455a.881.881 0 0 1 .593-.002"})),$M=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",d:"M16.773 8.288a.75.75 0 0 0-1.06-1.061l1.06 1.06Zm-9.546 7.424a.75.75 0 0 0 1.06 1.061l-1.06-1.06Zm8.485 1.06a.75.75 0 1 0 1.06-1.06l-1.06 1.06ZM8.288 7.228a.75.75 0 0 0-1.061 1.06l1.06-1.06Zm7.424 0-8.485 8.485 1.06 1.061 8.486-8.485-1.06-1.061Zm1.06 8.485L8.289 7.227l-1.061 1.06 8.485 8.486 1.06-1.06Z"})),sz=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",d:"m18.63 21.422.53-.53-.53.53Zm2.792-2.793.53-.53-.53.53Zm-1.392-2.452a.75.75 0 0 0-1.06 1.06l1.06-1.06Zm-2.792 2.793a.75.75 0 0 0-1.06 1.06l1.06-1.06ZM2.75 10.5a7.75 7.75 0 0 1 7.75-7.75v-1.5a9.25 9.25 0 0 0-9.25 9.25h1.5Zm7.75-7.75a7.75 7.75 0 0 1 7.75 7.75h1.5a9.25 9.25 0 0 0-9.25-9.25v1.5Zm7.75 7.75a7.75 7.75 0 0 1-7.75 7.75v1.5a9.25 9.25 0 0 0 9.25-9.25h-1.5Zm-7.75 7.75a7.75 7.75 0 0 1-7.75-7.75h-1.5a9.25 9.25 0 0 0 9.25 9.25v-1.5Zm10.391 2.641a1.224 1.224 0 0 1-1.731 0l-1.061 1.061a2.725 2.725 0 0 0 3.853 0l-1.06-1.06Zm0-1.731a1.224 1.224 0 0 1 0 1.731l1.061 1.061a2.725 2.725 0 0 0 0-3.853l-1.06 1.06Zm-1.921-1.922 1.921 1.922 1.061-1.061-1.922-1.922-1.06 1.06Zm.19 3.653-1.922-1.921-1.06 1.06 1.92 1.922 1.062-1.06Z"})),az=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",d:"M16.625 3.987a.75.75 0 1 0 .75-1.298l-.75 1.298Zm5.448 4.25a.75.75 0 1 0-1.405.526l1.405-.526ZM7.469 9.414a.75.75 0 1 0-.938 1.172l.938-1.172Zm3.057 3.407-.468.586.468-.586Zm2.736-.224-.557-.501.557.501Zm8.296-8.095a.75.75 0 1 0-1.116-1.004l1.116 1.004ZM21.25 12A9.25 9.25 0 0 1 12 21.25v1.5c5.937 0 10.75-4.813 10.75-10.75h-1.5ZM12 21.25A9.25 9.25 0 0 1 2.75 12h-1.5c0 5.937 4.813 10.75 10.75 10.75v-1.5ZM2.75 12A9.25 9.25 0 0 1 12 2.75v-1.5C6.063 1.25 1.25 6.063 1.25 12h1.5ZM12 2.75c1.686 0 3.265.45 4.625 1.237l.75-1.298A10.704 10.704 0 0 0 12 1.25v1.5Zm8.668 6.013A9.228 9.228 0 0 1 21.25 12h1.5c0-1.322-.24-2.59-.677-3.763l-1.405.526ZM6.53 10.586l3.527 2.82.937-1.17-3.526-2.822-.938 1.172Zm7.289 2.513 7.738-8.597-1.116-1.004-7.737 8.598 1.115 1.003Zm-3.762.308a2.75 2.75 0 0 0 3.762-.308l-1.115-1.003a1.25 1.25 0 0 1-1.71.14l-.937 1.17Z"})),uz=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m10 8-4 4m0 0 4 4m-4-4h12"})),fz=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("circle",{cx:12,cy:7,r:1,fill:"currentColor"}),xe.createElement("path",{fill:"currentColor",d:"M11 9.25a.75.75 0 0 0 0 1.5v-1.5Zm1 .75h.75a.75.75 0 0 0-.75-.75V10Zm-.75 7a.75.75 0 0 0 1.5 0h-1.5Zm10-5A9.25 9.25 0 0 1 12 21.25v1.5c5.937 0 10.75-4.813 10.75-10.75h-1.5ZM12 21.25A9.25 9.25 0 0 1 2.75 12h-1.5c0 5.937 4.813 10.75 10.75 10.75v-1.5ZM2.75 12A9.25 9.25 0 0 1 12 2.75v-1.5C6.063 1.25 1.25 6.063 1.25 12h1.5ZM12 2.75A9.25 9.25 0 0 1 21.25 12h1.5c0-5.937-4.813-10.75-10.75-10.75v1.5Zm-1 8h1v-1.5h-1v1.5Zm.25-.75v7h1.5v-7h-1.5Z"})),cz=r=>St.jsx("svg",{width:r.width||20,height:r.height||20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:St.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.29279 7.29302C5.48031 7.10555 5.73462 7.00023 5.99979 7.00023C6.26495 7.00023 6.51926 7.10555 6.70679 7.29302L9.99979 10.586L13.2928 7.29302C13.385 7.19751 13.4954 7.12133 13.6174 7.06892C13.7394 7.01651 13.8706 6.98892 14.0034 6.98777C14.1362 6.98662 14.2678 7.01192 14.3907 7.0622C14.5136 7.11248 14.6253 7.18673 14.7192 7.28062C14.8131 7.37452 14.8873 7.48617 14.9376 7.60907C14.9879 7.73196 15.0132 7.86364 15.012 7.99642C15.0109 8.1292 14.9833 8.26042 14.9309 8.38242C14.8785 8.50443 14.8023 8.61477 14.7068 8.70702L10.7068 12.707C10.5193 12.8945 10.265 12.9998 9.99979 12.9998C9.73462 12.9998 9.48031 12.8945 9.29279 12.707L5.29279 8.70702C5.10532 8.51949 5 8.26518 5 8.00002C5 7.73486 5.10532 7.48055 5.29279 7.29302Z",fill:"currentColor"})}),hz=r=>St.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",...r,children:St.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 4.5h-3A1.5 1.5 0 0 0 3 6v7.5A1.5 1.5 0 0 0 4.5 15H12a1.5 1.5 0 0 0 1.5-1.5v-3m-3-7.5H15m0 0v4.5M15 3l-7.5 7.5"})}),lz=r=>St.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...r,children:St.jsx("path",{fill:"currentColor",d:"M19.27 5.33C17.94 4.71 16.5 4.26 15 4a.09.09 0 0 0-.07.03c-.18.33-.39.76-.53 1.09a16.09 16.09 0 0 0-4.8 0c-.14-.34-.35-.76-.54-1.09-.01-.02-.04-.03-.07-.03-1.5.26-2.93.71-4.27 1.33-.01 0-.02.01-.03.02-2.72 4.07-3.47 8.03-3.1 11.95 0 .02.01.04.03.05 1.8 1.32 3.53 2.12 5.24 2.65.03.01.06 0 .07-.02.4-.55.76-1.13 1.07-1.74.02-.04 0-.08-.04-.09-.57-.22-1.11-.48-1.64-.78-.04-.02-.04-.08-.01-.11.11-.08.22-.17.33-.25.02-.02.05-.02.07-.01 3.44 1.57 7.15 1.57 10.55 0 .02-.01.05-.01.07.01.11.09.22.17.33.26.04.03.04.09-.01.11-.52.31-1.07.56-1.64.78-.04.01-.05.06-.04.09.32.61.68 1.19 1.07 1.74.03.01.06.02.09.01 1.72-.53 3.45-1.33 5.25-2.65.02-.01.03-.03.03-.05.44-4.53-.73-8.46-3.1-11.95-.01-.01-.02-.02-.04-.02ZM8.52 14.91c-1.03 0-1.89-.95-1.89-2.12 0-1.17.84-2.12 1.89-2.12 1.06 0 1.9.96 1.89 2.12 0 1.17-.84 2.12-1.89 2.12Zm6.97 0c-1.03 0-1.89-.95-1.89-2.12 0-1.17.84-2.12 1.89-2.12 1.06 0 1.9.96 1.89 2.12 0 1.17-.83 2.12-1.89 2.12Z"})}),dz=({type:r="text",value:t,className:e,errorMessage:n,...s}={})=>{const i=xe.useRef(null);return St.jsxs("div",{className:sn("flex-grow",r==="search"&&"relative"),children:[St.jsx("input",{...s,ref:i,value:t,className:sn("w-full h-full px-3 py-4 text-sm border border-opacity-25 rounded-xl border-field-border dark:border-interactive-border bg-background-secondary text-ellipsis",e,r==="search"&&"pr-8"),type:r==="search"?"text":r}),r==="search"&&t&&St.jsx("button",{type:"button",className:"absolute p-1 top-3 right-1","aria-label":"Clear",tabIndex:0,onClick:()=>{i.current&&(i.current.value="")},children:St.jsx($M,{width:24,height:24})}),n&&St.jsx("p",{className:"absolute top-[calc(100%+4px)] text-error font-medium tracking-widest pl-3 text-xs animate-[fade-in_300ms_ease-out]",children:n})]})};var Ld={};Object.defineProperty(Ld,"__esModule",{value:!0});Ld.arabic=void 0;var pz="ؠ-يٮ-ٯٱ-ەۮ-ۯۺ-ۿ",mz="ݐ-ݿ",vz="[".concat(pz).concat(mz,"]"),gz="[ً-ٰٟ]",yz="".concat(vz).concat(gz,"*");Ld.arabic=yz;var Od={};Object.defineProperty(Od,"__esModule",{value:!0});Od.bengali=void 0;var n5="[\\u{0980}-\\u{09FF}]",bz="[\\u{0980}-\\u{0983}\\u{09BC}-\\u{09D7}\\u{09E2}\\u{09E3}\\u{09FE}]",wz="\\u{09CD}",xz="".concat(n5,"(").concat(wz).concat(n5,"|").concat(bz,")*");Od.bengali=xz;var Ud={};Object.defineProperty(Ud,"__esModule",{value:!0});Ud.devanagari=void 0;var i5="[\\u{0900}-\\u{097F}]",_z="[\\u{0900}-\\u{0903}\\u{093A}-\\u{0957}\\u{0962}\\u{0963}]",Mz="\\u{094D}",Ez="".concat(i5,"(").concat(Mz).concat(i5,"|").concat(_z,")*");Ud.devanagari=Ez;var Nd={};Object.defineProperty(Nd,"__esModule",{value:!0});Nd.gujarati=void 0;var o5="[\\u{0A80}-\\u{0AFF}]",Az="[\\u{0A81}-\\u{0A83}\\u{0ABC}\\u{0ABE}-\\u{0ACD}\\u{0AE2}\\u{0AE3}\\u{0AFA}-\\u{0AFF}]",Sz="\\u{0ACD}",kz="".concat(o5,"(").concat(Sz).concat(o5,"|").concat(Az,")*");Nd.gujarati=kz;var Dd={};Object.defineProperty(Dd,"__esModule",{value:!0});Dd.hebrew=void 0;var Iz="[א-ת]",Bz="[֑-ׇֽֿׁׂׅׄ]",Pz="".concat(Iz).concat(Bz,"*");Dd.hebrew=Pz;var zd={};Object.defineProperty(zd,"__esModule",{value:!0});zd.japaneseKana=void 0;var Rz="[\\u{3041}-\\u{3096}\\u{309D}-\\u{309F}]",Cz="[\\u{30A0}-\\u{30FF}]",Tz="[\\u{3099}-\\u{309A}]",Lz="[\\u{309B}-\\u{309C}]",Oz="((".concat(Cz,"|").concat(Rz,")").concat(Tz,"?|").concat(Lz,")");zd.japaneseKana=Oz;var qd={};Object.defineProperty(qd,"__esModule",{value:!0});qd.kannada=void 0;var s5="[\\u{0C80}-\\u{0CFF}]",Uz="[\\u{0C81}-\\u{0C83}\\u{0CBC}\\u{0CBE}-\\u{0CCD}\\u{0CD5}\\u{0CD6}\\u{0CE2}\\u{0CE3}]",Nz="\\u{0CCD}",Dz="".concat(s5,"(").concat(Nz).concat(s5,"|").concat(Uz,")*");qd.kannada=Dz;var Fd={};Object.defineProperty(Fd,"__esModule",{value:!0});Fd.khmer=void 0;var a5="[\\u{1780}-\\u{17FF}]",zz="[\\u{17B6}-\\u{17D1}\\u{17D3}\\u{17DD}]",qz="\\u{17D2}",Fz="".concat(a5,"(").concat(qz).concat(a5,"|").concat(zz,")*");Fd.khmer=Fz;var jd={};Object.defineProperty(jd,"__esModule",{value:!0});jd.lao=void 0;var jz="[\\u{0E80}-\\u{0EFF}]",$z="[\\u{0EB1}\\u{0EB4}-\\u{0EBC}\\u{0EC8}-\\u{0ECD}]",Kz="".concat(jz).concat($z,"*");jd.lao=Kz;var $d={};Object.defineProperty($d,"__esModule",{value:!0});$d.malayalam=void 0;var u5="[\\u{0D00}-\\u{0D7F}]",Hz="[\\u{0D00}-\\u{0D03}\\u{0D3B}\\u{0D3C}\\u{0D3E}-\\u{0D4D}\\u{0D57}\\u{0D62}-\\u{0D63}]",Vz="\\u{0D4D}",Zz="".concat(u5,"(").concat(Vz).concat(u5,"|").concat(Hz,")*");$d.malayalam=Zz;var Kd={};Object.defineProperty(Kd,"__esModule",{value:!0});Kd.myanmar=void 0;var f5="[\\u{1000}-\\u{109F}]",Wz=["\\u{102B}-\\u{1038}","\\u{103A}-\\u{103E}","\\u{1056}-\\u{1059}","\\u{105E}-\\u{1060}","\\u{1062}-\\u{1064}","\\u{1067}-\\u{106D}","\\u{1071}-\\u{1074}","\\u{1082}-\\u{108D}","\\u{108F}","\\u{109A}-\\u{109D}"],Gz="[".concat(Wz.join(""),"]"),Yz="\\u{1039}",Xz="".concat(f5,"(").concat(Yz).concat(f5,"|").concat(Gz,")*");Kd.myanmar=Xz;var Hd={};Object.defineProperty(Hd,"__esModule",{value:!0});Hd.tamil=void 0;var Jz="[\\u{0B80}-\\u{0BFF}]",Qz="[\\u{0B82}-\\u{0B83}\\u{0BBE}-\\u{0BD7}\\u{0962}\\u{0963}]",tq="".concat(Jz).concat(Qz,"*");Hd.tamil=tq;var Vd={};Object.defineProperty(Vd,"__esModule",{value:!0});Vd.telugu=void 0;var c5="[\\u{0C00}-\\u{0C7F}]",eq="[\\u{0C00}-\\u{0C04}\\u{0C3E}-\\u{0C56}\\u{0C62}\\u{0C63}]",rq="\\u{0C4D}",nq="".concat(c5,"(").concat(rq).concat(c5,"|").concat(eq,")*");Vd.telugu=nq;var Zd={};Object.defineProperty(Zd,"__esModule",{value:!0});Zd.thai=void 0;var iq="[\\u0E00-\\u0E7F]",oq="[\\u0E31\\u0E33-\\u0E3A\\u0E47-\\u0E4E]",sq="".concat(iq).concat(oq,"*");Zd.thai=sq;var Wd={};Object.defineProperty(Wd,"__esModule",{value:!0});Wd.tibetan=void 0;var aq="[\\u{0F00}-\\u{0FFF}]",uq="[\\0F18\\0F19\\0F35\\0F37\\0F39\\0F3E\\0F3F\\u{0F71}-\\u{0F87}\\u{0F8D}-\\u{0FBC}\\u{0FC6}]",fq="".concat(aq).concat(uq,"*");Wd.tibetan=fq;var na={};Object.defineProperty(na,"__esModule",{value:!0});na.emojiVariation=na.keyCap=na.countryFlag=void 0;var cq="[\\u{1F1E6}-\\u{1F1FF}]{2}";na.countryFlag=cq;var hq="[0-9#\\*][\\u{FE0F}]?\\u{20E3}";na.keyCap=hq;var lq=["[\\u{2600}-\\u{26FF}]","[\\u{2700}-\\u{27BF}]","[\\u{1F300}-\\u{1F5FF}]","[\\u{1F600}-\\u{1F64F}]","[\\u{1F680}-\\u{1F6FF}]","[\\u{1F700}-\\u{1F77F}]","[\\u{1F900}-\\u{1F9FF}]"],h5="(".concat(lq.join("|"),")"),dq="\\u{200D}",pq="[\\u{FE0E}\\u{FE0F}]",mq="[\\u{1F3FB}-\\u{1F3FF}]",vq="".concat(h5,"(").concat(dq).concat(h5,"|").concat(mq,"|").concat(pq,")*");na.emojiVariation=vq;var gq=Ld,yq=Od,bq=Ud,wq=Nd,xq=Dd,_q=zd,Mq=qd,Eq=Fd,Aq=jd,Sq=$d,kq=Kd,Iq=Hd,Bq=Vd,Pq=Zd,Rq=Wd,tm=na,Cq=[tm.countryFlag,tm.keyCap,tm.emojiVariation,gq.arabic,yq.bengali,bq.devanagari,wq.gujarati,xq.hebrew,_q.japaneseKana,Mq.kannada,Eq.khmer,Aq.lao,Sq.malayalam,kq.myanmar,Iq.tamil,Bq.telugu,Pq.thai,Rq.tibetan,"."],Tq=new RegExp("(".concat(Cq.join("|"),")"),"gu");function Lq(r){return r.match(Tq)||[]}var Oq={splitGraphemes:Lq};const KM=(r,t=1)=>{switch(Oq.splitGraphemes(r).length){case 1:return 750*t;case 2:return 700*t;case 3:return 640*t;case 4:return 160*t;default:return 20*t}},Uq=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}),_0=(r,t)=>{const e=Uq.format(r);return t?e.replace("$",""):e},uh=[{decimals:6,tokenSymbol:"USDC",mintAddress:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",tokenName:"USD Coin",pythFeed:"Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD",icon:"https://raw.githubusercontent.com/trustwallet/assets/f3ffd0b9ae2165336279ce2f8db1981a55ce30f8/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"},{decimals:9,tokenSymbol:"SOL",mintAddress:"So11111111111111111111111111111111111111112",pythFeed:"H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG",tokenName:"Wrapped SOL",icon:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png"},{decimals:6,tokenSymbol:"FIDA",mintAddress:"EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",tokenName:"Bonfida Token",pythFeed:"ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF",icon:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp/logo.svg"},{decimals:6,tokenSymbol:"USDT",mintAddress:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",tokenName:"USDT",pythFeed:"3vxLXJqLqF3JG5TCbYycbKWRBbCJQLxQmBGCkyqEEefL",icon:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/D3KdBta3p53RV5FoahnJM5tP45h6Fd3AyFYgXTJvGCaK/logo.svg"},{decimals:9,tokenSymbol:"mSOL",mintAddress:"mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",tokenName:"mSOL",pythFeed:"E4v1BBgoso9s64TQvmyownAVJbhbEPGyzA3qn4n46qj9",icon:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So/logo.png"},{decimals:5,tokenSymbol:"BONK",mintAddress:"DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",tokenName:"BONK",pythFeed:"8ihFLu5FimgTQ1Unh4dVyEHUGodJ5gJQCrQf4KUVB9bN",icon:"https://solana.fm/api/image-proxy?imageUrl=https://arweave.net/hQiPZOsRZXGXBJd_82PhVdlM_hACsT_q6wqwf5cSY7I"},{decimals:8,tokenSymbol:"BAT",mintAddress:"EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz",tokenName:"BAT",pythFeed:"AbMTYZ82Xfv9PtTQ5e1fJXemXjzqEEFHP3oDLRTae6yz",icon:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz/logo.png"}],Nq=r=>{var t;return(t=uh.find(e=>e.tokenSymbol===r))==null?void 0:t.icon},M0="EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",HM=1232,Dq=(r,t,e="48tzUutUCPDohF4YqFpX9dHHS43V1bn9R45LHEFVhbtq")=>{const n=[];let s=[];for(const i of r)zq([...s,i],t,e)>HM?(n.push(s),s=[i]):s.push(i);return s.length>0&&n.push(s),n},zq=(r,t,e="48tzUutUCPDohF4YqFpX9dHHS43V1bn9R45LHEFVhbtq")=>{try{const n=new sd().add(...r);return n.recentBlockhash=e,n.feePayer=t,n.serialize({requireAllSignatures:!1,verifySignatures:!1}).length}catch{return HM+1}},qq=async(r,t,e,n)=>{let s=n;const i=[],c=await r.getBalance(e),l=await r.getAccountInfo(t);if(!l||!l.data){const v=wT(e,t,e,qg);i.push(v)}else{const v=await r.getTokenAccountBalance(t,"processed");if(c+parseInt(v.value.amount)[yT(r,t,t)];function jq(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var $q="ABAOAAAAAACwiAAAAYkHdvjtnH+IFkUYxx/v3vPe7uw8UkjsD43ChKICDQsT3iIJy4gSiZAjkn5JUFlaiFmjccT9ESkpGBGVIlQgWSkY/QDBoMgrQv0jRJDAfkCXhUmgRX23d4ebnndmd3Z3ZnfVeeDDzM7MPs8zv57Zd2+5hd1Ed4ClYAisBuuUsqLpMHgJjIBNFu1fBW8l1O8AO8Ee8Cn4HIyCg+CI0u4Y+AmMgVPgDOhuEHWBPjAZXAy2gjfA9kb73hlx+i7SK8AHYDf4BOwHB8AoOAyOguPgB/ArOKlcnwHdPe32/Uin9LTvvwTph0gv62nbubKnXT+nZ1z/DcjfFF8vQno7uEaxH923BGVXN9v5Zcgvj/VFPIT8Y/H1k0jXxPn1SEfARjBdab8V+TfB22CXUh5xd3OcZTH3g6di1LZJbLNs55q96M9n4J9Gm6hsfzQvcT8fbfy//TyUf8vG4Lses/5jcd2PSE/IcQan4/o/UXYadE0kaoJBMG1ivNbidNbETr1XoWyuplwyHFN0fFai/8/EY7BIKY/68EpCvwP+mc/m/2vNGnBhp1eZ51bCmgsEAoFAIBAIBAKBQKAO3Irfrg3lfc4qi/cXd+Kee5TfvAd6ieY0ie5D2cNx+eNInwZLmu33gWuRn4/8C3H9CNJNYEt8/TrS35HuSPktvRP1z0LPOvAceB4IsB5saIa6UBfqQl2oc123AjwBVjWrP7MCgcC5y/ue/56yqXv87+qcIU2Z+ny8tuHHpyxsvrDNITDXgqkDRJcPdJY/wMo24/oQmDqZaPHkdplAuhv8ApqDRDeCVj/OAvD9BUSX9qF8Qpt7lTxnZ7+5TmVtrGMM7XchP3sS0SNgGzg4yU5HIBAIBM5NfsO5QDgfjuM54STOw7/Az/F3QtfhfF4Qn9F/gxMouxm/WU7F9afBQuUM7+rtPF+jb0b6ese/I7sI+emadhEzUT5bqbsW+esNbSMWoG6hWo/8gOLPUqUu+v5rKEHX8oS6iEXQexd7XlmBe1aCNWAp6kSsYyjHc82Liv2Xkd/C/HkN1w/Geren+KryToa2PtlQg2c9zijGZnGJ9kaibzZh84jmmfx4TeYpK9H3usMKqxnDCWxsdLY/3ygy9h+l/LYbYHtuXw2/rfsSPo0a/Jrn6PvPrzL2+7CmfV88lkc9j+F7cRzYU4N48DF8uA3n/T7Fly9q4Jdvoth0uLf9LORC11hvO/0D6RnQfRa99+2Hr1NS/M26VvfEe2jaWTAOvG8zzgKf8zCrYL++qUEfbumeQAjTVnQp+QmW99gQpDoJ4+9uHZe5/l3OW/M8x6WUZaduUvUc5p13NTXlz3VpGbCVrGNe5zOnjvGlrDWY1IdWShuuQ9fWh6h+VSV1Wit1lvNhHFz1zeUYtCg5ntvOSStDW5cITRnF5RJ+rcasJHExztwu910tl6LzLYsvuvvzilB0mvSaxt/V+SY0EMurfkjbrTjfInf+FJGkNdzSlOukZaDo3snqs7RZpqj2Gx7sS52D5O79k+93W2W/T3NhQxe3VeF16pwn4eI8qev7Sl1s0PnPy5PalSV57Pp6XuDxrypR9wBR8nOCzm/eXuYp5d4s/lV1XvL+lG2b+2AaQ1nPr23Hrc7z0WT5qvZL0v7QtdX5zdu6HMei+gV1ri8et4XSVpCfdeB7fRWNRy79UP0RCT4Jyre/88bbKsQUawUrV69dxjd+nlXxbCKos79pz1BpOqucz0gEdZ5hMk+aa7Wdy/7xZ5Yqhc+nyHivrkyQ/reM7tziuFojfM7zxtq0505XYutvHrtVnzNl2ONrTGdPkLv9ZjNHOoShnCh5nLLYKOKfK4qK7bjx/gqyj9lFJc2Wz/HIqyMSYaGnqM8+xp6vB1/6feg22UmLFUno1rurvelz7yT1UVfORW3L7+d6fMcAXdzxIVK3TNNioZpSyj2242izpky6y5S0fpr6q5ZXJT7O1qrmQRVB+rkQ1Dk3vvYttyGoc+51/mUVkYLtXvTx7MCvbUnzW2czyR8pql4XUlbcN9l1pSfPfOl0JV2bylyKoM4959sHQfr9Vpbk2V8u4ry0ndcvH5I1xggP9qVem/PHZL+qeGLrc945tLnHtG/LEtdjr4urxMpM92X1RZDd+pLtsorUydeCaiuvbtdSpQ9l2M4SU01nvI1e35L3uS5Jlw8pe1ykCKo2JtrGK9O9ujOlimcD6Y9LEWQ+7019d2VDLVPrTCLrsvjsQ1TfJVJM12pZmm5b4Xptx6HM9SpFkP2c6drJa5/iSr+pD7r+CNLvATVfpST1RYog/fwKTdsyxLVNQfnWrkyziGltJK2hLLptzjHXIsh+/HytmyQfpPA5VNtzXWWLzbiVsc9sbWSJ7UWE69KNh6v9kya2c6TzMa0fwpD37TtvQ6wuiw9CA9cny33Mj2pLte9Kp6996HO/83HPQ5r+ov5mvU9Qte/fIrGJP7axPO/9eXX6kjLPKZNd17iyZdOHLP31JSbfXY6hC59c+ZZ136TZ9SFlj6cvmVkSrkSQn3NG5KBqEVSeH6Ji/vvnhFWjSlfFNDwzyMgqLvvKxXffbeASBWo+Zj4p2x6TfwE=",Kq="AAACAAAAAACAOAAAAbYBSf7t2S1IBEEYBuDVDZ7FYrQMNsFiu3hgEYOI0SCXRIUrB8JhEZtgs5gEg1GMFk02m82oGI02m+9xezCOczv/uwv3fvAwc/PzfXOzcdqzWdaBDdiGPdiHdjE+DS3RNDuCfsn8idQ/g3OH3BdwKf0e96/gumTfYcncLdzBPTzAo+RZ+f0Cr/AG7/AJX4738x1wtz9FO5PX/50n6UXMNdfg/0lERERERERERERERETpdedHBvDRql4nq0cXtW9af98qdRby0Vvp8K4W0V+C5Xw0t4J2bfjeBp3cnEu1brnnCTYNa7eKdz91XP7WO9Lb4GqRb7cY6xbtAdqeVOsY/QGcevw/tb6OT85YhvfKYEx9CMuxKsKnrs+eJtVInVvHJ0eVYVvTZk2siFVLOCjb61PTZX3MdVWEyP7fjzpmMxdzTyq2Ebue6x61nXRGnzndWpf1an7dXmGYE4Y1ptqqKsK1nu26Ju0ty+maV2Rpvk+qnDZjKUIobUiesdAQE/jmCTmHmsskpFZsVYbtmXRcaoSGUPomunW2derQhDPFjtT1Q/eb8vnm990fq35oHVt11bU9m89c7DNI8Qs=",vy=0,VM=-3;function fh(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function Hq(r,t){this.source=r,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=t,this.destLen=0,this.ltree=new fh,this.dtree=new fh}var ZM=new fh,WM=new fh,t2=new Uint8Array(30),e2=new Uint16Array(30),GM=new Uint8Array(30),YM=new Uint16Array(30),Vq=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),l5=new fh,Mo=new Uint8Array(320);function d5(r,t,e,n){var s,i;for(s=0;s>>=1,t}function Oo(r,t,e){if(!t)return e;for(;r.bitcount<24;)r.tag|=r.source[r.sourceIndex++]<>>16-t;return r.tag>>>=t,r.bitcount-=t,n+e}function r2(r,t){for(;r.bitcount<24;)r.tag|=r.source[r.sourceIndex++]<>>=1,++s,e+=t.table[s],n-=t.table[s];while(n>=0);return r.tag=i,r.bitcount-=s,t.trans[e+n]}function Wq(r,t,e){var n,s,i,c,l,p;for(n=Oo(r,5,257),s=Oo(r,5,1),i=Oo(r,4,4),c=0;c<19;++c)Mo[c]=0;for(c=0;c8;)r.sourceIndex--,r.bitcount-=8;if((t=256*(t=r.source[r.sourceIndex+1])+r.source[r.sourceIndex])!==(65535&~(256*r.source[r.sourceIndex+3]+r.source[r.sourceIndex+2])))return VM;for(r.sourceIndex+=4,e=t;e;--e)r.dest[r.destLen++]=r.source[r.sourceIndex++];return r.bitcount=0,vy}(function(r,t){var e;for(e=0;e<7;++e)r.table[e]=0;for(r.table[7]=24,r.table[8]=152,r.table[9]=112,e=0;e<24;++e)r.trans[e]=256+e;for(e=0;e<144;++e)r.trans[24+e]=e;for(e=0;e<8;++e)r.trans[168+e]=280+e;for(e=0;e<112;++e)r.trans[176+e]=144+e;for(e=0;e<5;++e)t.table[e]=0;for(t.table[5]=32,e=0;e<32;++e)t.trans[e]=e})(ZM,WM),d5(t2,e2,4,3),d5(GM,YM,2,1),t2[28]=0,e2[28]=258;var Yq=function(r,t){var e,n,s=new Hq(r,t);do{switch(e=Zq(s),Oo(s,2,0)){case 0:n=Gq(s);break;case 1:n=m5(s,ZM,WM);break;case 2:Wq(s,s.ltree,s.dtree),n=m5(s,s.ltree,s.dtree);break;default:n=VM}if(n!==vy)throw new Error("Data error")}while(!e);return s.destLen{let n=r[t];r[t]=r[e],r[e]=n};var Jq={swap32LE:r=>{Xq&&(t=>{const e=t.length;for(let n=0;n1114111?this.errorValue:t<55296||t>56319&&t<=65535?(e=(this.data[t>>5]<<2)+(31&t),this.data[e]):t<=65535?(e=(this.data[2048+(t-55296>>5)]<<2)+(31&t),this.data[e]):t>11)],e=this.data[e+(t>>5&63)],e=(e<<2)+(31&t),this.data[e]):this.data[this.data.length-4]}},XM={exports:{}};XM.exports=(b5=y5="3.7.5",w5=typeof atob=="function",x5=typeof btoa=="function",_a=typeof Gt.Buffer=="function",rm=typeof TextDecoder=="function"?new TextDecoder:void 0,nm=typeof TextEncoder=="function"?new TextEncoder:void 0,_5="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Su=Array.prototype.slice.call(_5),wm={},Su.forEach(function(r,t){return wm[r]=t}),gc=wm,M5=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,yn=String.fromCharCode.bind(String),im=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(r){return new Uint8Array(Array.prototype.slice.call(r,0))},om=function(r){return r.replace(/=/g,"").replace(/[+\/]/g,function(t){return t=="+"?"-":"_"})},sm=function(r){return r.replace(/[^A-Za-z0-9\+\/]/g,"")},am=function(r){for(var t,e,n,s,i="",c=r.length%3,l=0;l255||(n=r.charCodeAt(l++))>255||(s=r.charCodeAt(l++))>255)throw new TypeError("invalid character found");i+=Su[(t=e<<16|n<<8|s)>>18&63]+Su[t>>12&63]+Su[t>>6&63]+Su[63&t]}return c?i.slice(0,c-3)+"===".substring(c):i},E0=_a?function(r){return Gt.Buffer.from(r).toString("base64")}:function(r){for(var t=4096,e=[],n=0,s=r.length;n>>6)+yn(128|63&t):yn(224|t>>>12&15)+yn(128|t>>>6&63)+yn(128|63&t);var t=65536+1024*(r.charCodeAt(0)-55296)+(r.charCodeAt(1)-56320);return yn(240|t>>>18&7)+yn(128|t>>>12&63)+yn(128|t>>>6&63)+yn(128|63&t)},A5=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,fm=_a?function(r){return Gt.Buffer.from(r,"utf8").toString("base64")}:nm?function(r){return E0(nm.encode(r))}:function(r){return um(S5(r))},cm=function(r){return ku(r,!0)},k5=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,I5=function(r){switch(r.length){case 4:var t=((7&r.charCodeAt(0))<<18|(63&r.charCodeAt(1))<<12|(63&r.charCodeAt(2))<<6|63&r.charCodeAt(3))-65536;return yn(55296+(t>>>10))+yn(56320+(1023&t));case 3:return yn((15&r.charCodeAt(0))<<12|(63&r.charCodeAt(1))<<6|63&r.charCodeAt(2));default:return yn((31&r.charCodeAt(0))<<6|63&r.charCodeAt(1))}},hm=function(r){if(r=r.replace(/\s+/g,""),!M5.test(r))throw new TypeError("malformed base64.");r+="==".slice(2-(3&r.length));for(var t,e,n,s="",i=0;i>16&255):n===64?yn(t>>16&255,t>>8&255):yn(t>>16&255,t>>8&255,255&t);return s},dm=_a?function(r){return im(Gt.Buffer.from(r,"base64"))}:function(r){return im(lm(r).split("").map(function(t){return t.charCodeAt(0)}))},pm=function(r){return dm(mm(r))},P5=_a?function(r){return Gt.Buffer.from(r,"base64").toString("utf8")}:rm?function(r){return rm.decode(dm(r))}:function(r){return B5(lm(r))},mm=function(r){return sm(r.replace(/[-_]/g,function(t){return t=="-"?"+":"/"}))},gm=function(r){return{value:r,enumerable:!1,writable:!0,configurable:!0}},ym=function(){var r=function(t,e){return Object.defineProperty(String.prototype,t,gm(e))};r("fromBase64",function(){return vm(this)}),r("toBase64",function(t){return ku(this,t)}),r("toBase64URI",function(){return ku(this,!0)}),r("toBase64URL",function(){return ku(this,!0)}),r("toUint8Array",function(){return pm(this)})},bm=function(){var r=function(t,e){return Object.defineProperty(Uint8Array.prototype,t,gm(e))};r("toBase64",function(t){return A0(this,t)}),r("toBase64URI",function(){return A0(this,!0)}),r("toBase64URL",function(){return A0(this,!0)})},R5=function(){ym(),bm()},yc={version:y5,VERSION:b5,atob:lm=w5?function(r){return atob(sm(r))}:_a?function(r){return Gt.Buffer.from(r,"base64").toString("binary")}:hm,atobPolyfill:hm,btoa:um=x5?function(r){return btoa(r)}:_a?function(r){return Gt.Buffer.from(r,"binary").toString("base64")}:am,btoaPolyfill:am,fromBase64:vm=function(r){return P5(mm(r))},toBase64:ku=function(r,t){return t===void 0&&(t=!1),t?om(fm(r)):fm(r)},encode:ku,encodeURI:cm,encodeURL:cm,utob:S5=function(r){return r.replace(A5,E5)},btou:B5=function(r){return r.replace(k5,I5)},decode:vm,isValid:function(r){if(typeof r!="string")return!1;var t=r.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},fromUint8Array:A0=function(r,t){return t===void 0&&(t=!1),t?om(E0(r)):E0(r)},toUint8Array:pm,extendString:ym,extendUint8Array:bm,extendBuiltins:R5,Base64:{}},Object.keys(yc).forEach(function(r){return yc.Base64[r]=yc[r]}),yc);const Ar={Other:0,CR:1,LF:2,Control:4,Extend:8,ZWJ:16,Regional_Indicator:32,Prepend:64,SpacingMark:128,L:256,V:512,T:1024,LV:2048,LVT:4096,Extended_Pictographic:8192},eF=$q,rF=Kq,JM=tF,QM=XM.exports.Base64,nF=new JM(QM.toUint8Array(eF)),iF=new JM(QM.toUint8Array(rF));function un(r,t){return(r&t)!=0}const S0=0,xm=1,_m=2;function oF(r,t){const e=r.length;let n=0,s=S0;for(let i=t;i+165535?2:1,e.push(s)}for(let s=0;suF.has(r),tE=/a-z/,eE=/абвгдеёжзийклмнопрстуфхцчшщъыьэюя/,rE=/\u4e00-\u9fa5/,nE=/ぁ-んァ-ン/,ma=/0-9/,va=/\_\-/,iE=/\u1100-\u115E\u1161-\u11FF\u302E\u302F\u3131-\u3163\u3165-\u318E\u3200-\u321E\u3260-\u327E\uA960-\uA97C\uAC00-\uD158\uD160-\uD172\uD17B-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uFFA1-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/,oE=/\u0600-\u0604\u0606-\u060B\u060D-\u061A\u061D-\u061E\u0620-\u063F\u0641-\u064A\u0656-\u066F/,cF=new RegExp("^["+(tE.source+eE.source+rE.source+nE.source+iE.source+oE.source+ma.source+va.source)+"]+$"),Os=(r,t)=>r?!!t.test(r):!0,yy=r=>Os(r,cF),hF=r=>{const t=new RegExp("^["+tE.source+ma.source+va.source+"]+$");return Os(r,t)},lF=r=>{const t=new RegExp("^["+rE.source+ma.source+va.source+"]+$");return Os(r,t)},dF=r=>{const t=new RegExp("^["+nE.source+ma.source+va.source+"]+$");return Os(r,t)},pF=r=>{const t=new RegExp("^["+eE.source+ma.source+va.source+"]+$");return Os(r,t)},mF=r=>{const t=new RegExp("^["+ma.source+"]+$");return Os(r,t)},vF=r=>{const t=new RegExp("^["+va.source+"]+$");return Os(r,t)},gF=r=>{const t=new RegExp("^["+iE.source+ma.source+va.source+"]+$");return Os(r,t)},yF=r=>{const t=new RegExp("^["+oE.source+ma.source+va.source+"]+$");return Os(r,t)},bF=["🥷","🦣","🦬"],C5=r=>sF.has(r),sE=r=>{if(!r)return!1;if(C5(r))return!0;const t=gy(r);for(let e of t){if(bF.includes(e)||e.length===0||fF(e)||aF.has(e))return!1;if(!yy(e)&&!C5(e))return!1}return!0};var Co;(function(r){r[r.English=0]="English",r[r.Cyrillic=1]="Cyrillic",r[r.Chinese=2]="Chinese",r[r.Japanese=3]="Japanese",r[r.Emoji=4]="Emoji",r[r.Unauthorized=5]="Unauthorized",r[r.Korean=6]="Korean",r[r.Arabic=7]="Arabic"})(Co||(Co={}));const aE=r=>gy(r).length>1?Co.Unauthorized:hF(r)?Co.English:lF(r)?Co.Chinese:pF(r)?Co.Cyrillic:dF(r)?Co.Japanese:gF(r)?Co.Korean:yF(r)?Co.Arabic:Co.Unauthorized,wF=(r,t)=>{const e=gy(r);for(let n of e){const s=yy(n),i=sE(n);if((s||!i)&&!vF(n)&&!mF(n)&&t!==aE(n))return!1}return!0},xF=["","."],_F=({value:r,prev:t,onError:e})=>{if(xF.includes(r))return"";r.endsWith(".sol")&&(r=r.split(".sol")[0]);const n=r.toLowerCase().trim(),s=n.split(".");if(s.length>2)return e==null||e(),t;for(const c of s){const l=yy(c),p=sE(c);if(!l&&!p||!wF(c,aE(r[0]||"")))return e==null||e(),t}return n},uE=(r,t,e=5)=>r?r.length<=t?r:r.slice(0,t-e)+"..."+r.slice(-e):"",fE=({domain:r,available:t=!1,price:e,children:n})=>St.jsxs("div",{className:"flex flex-row items-center gap-4 px-4 py-3 shadow-domain dark:shadow-none rounded-xl bg-background-secondary min-h-[72px]",children:[St.jsxs("div",{className:"flex flex-col mr-auto",children:[St.jsx("span",{className:"text-base text-content-secondary font-primary",children:uE(`${r}.sol`,25,3)}),t&&St.jsxs("span",{className:"flex items-center gap-1 text-sm font-medium",children:[St.jsx("img",{className:"w-4 h-4",src:Nq("USDC"),alt:"$"}),e]})]}),n]}),T5=({domain:r,available:t=!1,price:e})=>{const{cart:n,addToCart:s,removeFromCart:i}=xe.useContext(Nh);e=e??KM(r);const c=!!n[r],[l,p]=xe.useState(c),v=y=>{p(!1),i(y)};return xe.useEffect(()=>{let y;return c&&!l&&(y=setTimeout(()=>{p(!0)},1500)),()=>clearTimeout(y)},[c,l]),St.jsxs(fE,{domain:r,available:t,price:e,children:[!t&&St.jsx("div",{className:"px-3 rounded-lg bg-accent bg-opacity-10",children:St.jsx("span",{className:"text-xs font-semibold leading-6 tracking-widest text-accent",children:"Registered"})}),t&&St.jsx("div",{className:sn("flex items-center flex-row justify-between min-w-[93px]",t?"gap-2":"gap-1"),children:St.jsx("button",{type:"button",className:sn("flex items-center gap-2 px-3 py-1 text-sm text-base-button-content rounded-lg font-primary bg-theme-primary",c&&l&&"bg-transparent text-theme-primary dark:text-theme-secondary"),tabIndex:0,onClick:()=>c?v(r):s({domain:r,storage:1e3,price:Number(e)}),children:c?St.jsx(St.Fragment,{children:l?St.jsxs(St.Fragment,{children:["Remove",St.jsx(qM,{width:24,height:24})]}):St.jsxs(St.Fragment,{children:["Added",St.jsx(oz,{width:24,height:24})]})}):St.jsxs(St.Fragment,{children:["Add to cart",St.jsx(iz,{width:20,height:20})]})})})]})},L5=()=>St.jsxs("div",{className:"flex flex-row items-center justify-between gap-4 px-4 py-3 shadow-domain dark:shadow-none rounded-xl bg-background-secondary h-[72px] animate-pulse",children:[St.jsx("div",{className:"w-[80px] h-4 rounded-full bg-background-skeleton"}),St.jsx("div",{className:"h-4 rounded-full w-[120px] bg-background-skeleton"})]}),n2=({className:r,children:t,size:e="full",disabled:n,...s})=>St.jsx("button",{type:"button",disabled:n,...s,tabIndex:0,className:sn("flex items-center gap-2 px-3 justify-center text-white font-primary bg-theme-primary",e==="full"&&"py-2.5 rounded-xl tracking-wide",e==="small"&&"text-sm py-1 rounded-lg",n&&"bg-theme-secondary",r),children:t}),O5=()=>St.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 69 20",className:"h-full",children:[St.jsx("path",{d:"m8.843.27-.124.001.005 4.563h.124L8.843.27ZM16.8 14.917l-3.71-2.271.062-.125 3.71 2.27-.063.126ZM.788 14.917l-.061-.125 3.709-2.271.062.125-3.71 2.27Z"}),St.jsx("path",{d:"M8.784 10.104c-.021 0-.042 0-.042-.02L4.415 7.478a.159.159 0 0 1-.041-.083c0-.042.02-.063.041-.084l4.327-2.604c.021-.02.062-.02.103 0l4.328 2.625c.02.021.04.063.04.084 0 .041-.02.062-.04.083l-4.328 2.604h-.061Zm-4.142-2.73 4.121 2.5 4.121-2.478-4.121-2.5-4.121 2.479Z"}),St.jsx("path",{d:"M8.784 15.292c-.021 0-.042 0-.042-.021l-4.327-2.584a.159.159 0 0 1-.041-.083V7.396c0-.042.02-.063.041-.083.02-.021.062-.021.103 0l4.327 2.604c.021.02.042.062.042.083v5.188c0 .041-.021.062-.042.083-.04.02-.061.02-.061.02Zm-4.225-2.75 4.122 2.479v-4.959l-4.122-2.5v4.98Z"}),St.jsx("path",{d:"M8.784 15.292c-.021 0-.042 0-.042-.021a.159.159 0 0 1-.04-.084V10c0-.042.02-.063.04-.083l4.328-2.604c.02-.021.062-.021.103 0 .02.02.04.062.04.083v5.229c0 .042-.02.063-.04.083l-4.328 2.584h-.061Zm.082-5.23v4.959l4.121-2.459v-5l-4.12 2.5Z"}),St.jsx("path",{d:"M8.784 20 .5 15V5l8.284-5 8.283 5v10l-8.283 5Zm-7.83-5.27 7.809 4.728 7.81-4.729V5.271L8.783.563.954 5.27v9.458Z"}),St.jsx("path",{d:"M8.763 10.292.623 5.354C.522 5.292.48 5.146.542 5.021c.062-.125.206-.146.31-.084L8.762 9.73l7.954-4.792c.103-.062.247-.02.31.084.06.125.02.27-.083.333l-8.181 4.938Z"}),St.jsx("path",{d:"M8.784 19.958c-.124 0-.227-.104-.227-.25V10c0-.125.103-.25.227-.25.123 0 .226.104.226.25v9.708c0 .146-.103.25-.226.25ZM30.4 12.125c0 1.5-1.154 2.438-3.01 2.438h-3.585V5.979h3.38c1.834 0 2.988.854 2.988 2.25a1.97 1.97 0 0 1-1.32 1.875c.949.271 1.546 1.063 1.546 2.021Zm-3.215-2.562c.886 0 1.422-.438 1.422-1.167 0-.688-.536-1.125-1.422-1.125H25.35v2.292h1.834Zm.165 3.708c.886 0 1.442-.458 1.442-1.208 0-.73-.577-1.209-1.525-1.209h-1.916v2.417h1.999ZM31.327 11.167c0-2.209 1.277-3.542 3.38-3.542 2.1 0 3.378 1.333 3.378 3.542 0 2.208-1.277 3.541-3.379 3.541-2.102 0-3.38-1.333-3.38-3.541Zm3.38 2.333c1.194 0 1.915-.896 1.915-2.333 0-1.459-.72-2.334-1.916-2.334-1.195 0-1.937.896-1.937 2.334 0 1.458.742 2.333 1.937 2.333ZM42.825 8.875c-.804 0-1.463.5-1.937 1.604v4.084h-1.463V7.77h1.401l.041 1c.557-.77 1.36-1.167 2.205-1.167 1.525 0 2.473 1.042 2.473 2.625v4.313h-1.443v-4.209c.021-.895-.494-1.458-1.277-1.458ZM49.09 14.563h-1.443V8.957H46.43V7.771h1.216v-.73c0-1.374.783-2.229 2.06-2.229h1.628V6h-1.133c-.804 0-1.113.25-1.113 1v.75h4.08v6.792h-1.442V8.958h-2.638v5.604ZM59.763 8.604V5.5h1.443v9.063h-1.381l-.041-.855c-.454.625-1.237 1-2.123 1-1.772 0-3.008-1.5-3.008-3.541 0-2.042 1.236-3.542 3.008-3.542.886 0 1.628.375 2.102.98ZM57.991 13.5c.824 0 1.463-.52 1.772-1.333v-2c-.288-.813-.948-1.334-1.772-1.334-1.133 0-1.916.98-1.916 2.334.02 1.354.783 2.333 1.916 2.333ZM67.078 13.646c-.453.708-1.236 1.062-2.184 1.062-1.298 0-2.164-.791-2.164-2 0-1.395 1.092-2.208 2.926-2.208h1.402v-.417c0-.854-.577-1.395-1.525-1.395-.907 0-1.505.479-1.566 1.25h-1.422c.103-1.438 1.277-2.334 3.05-2.334 1.792 0 2.905.938 2.905 2.542v4.396h-1.38l-.042-.896Zm-1.854-.104c.803 0 1.421-.438 1.834-1.188v-.791l-1.443.02c-.906 0-1.442.355-1.442 1.063 0 .52.35.896 1.05.896Z"})]});var Ke=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Gt.global<"u"?Gt.global:typeof self<"u"?self:{};function xo(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Zh(r){if(r.__esModule)return r;var t=r.default;if(typeof t=="function"){var e=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var s=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:function(){return r[n]}})}),e}for(var Ae={},i2={byteLength:function(r){var t=N5(r),e=t[0],n=t[1];return 3*(e+n)/4-n}},cE=i2.toByteArray=function(r){var t,e,n=N5(r),s=n[0],i=n[1],c=new MF(function(v,y,E){return 3*(y+E)/4-E}(0,s,i)),l=0,p=i>0?s-4:s;for(e=0;e>16&255,c[l++]=t>>8&255,c[l++]=255&t;return i===2&&(t=zi[r.charCodeAt(e)]<<2|zi[r.charCodeAt(e+1)]>>4,c[l++]=255&t),i===1&&(t=zi[r.charCodeAt(e)]<<10|zi[r.charCodeAt(e+1)]<<4|zi[r.charCodeAt(e+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t),c},o2=i2.fromByteArray=function(r){for(var t,e=r.length,n=e%3,s=[],i=16383,c=0,l=e-n;cl?l:c+i));return n===1?(t=r[e-1],s.push(No[t>>2]+No[t<<4&63]+"==")):n===2&&(t=(r[e-2]<<8)+r[e-1],s.push(No[t>>10]+No[t>>4&63]+No[t<<2&63]+"=")),s.join("")},No=[],zi=[],MF=typeof Uint8Array<"u"?Uint8Array:Array,U5="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Iu=0;Iu<64;++Iu)No[Iu]=U5[Iu],zi[U5.charCodeAt(Iu)]=Iu;function N5(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");return e===-1&&(e=t),[e,e===t?0:4-e%4]}function EF(r,t,e){for(var n,s,i=[],c=t;c>18&63]+No[s>>12&63]+No[s>>6&63]+No[63&s]);return i.join("")}zi["-".charCodeAt(0)]=62,zi["_".charCodeAt(0)]=63;var Mm={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */function Bl(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function by(r,...t){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(r.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${r.length}`)}function yf(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function hE(r,t){by(r);const e=t.outputLen;if(r.length>1,y=-7,E=e?s-1:0,M=e?-1:1,w=r[t+E];for(E+=M,i=w&(1<<-y)-1,w>>=-y,y+=l;y>0;i=256*i+r[t+E],E+=M,y-=8);for(c=i&(1<<-y)-1,i>>=-y,y+=n;y>0;c=256*c+r[t+E],E+=M,y-=8);if(i===0)i=1-v;else{if(i===p)return c?NaN:1/0*(w?-1:1);c+=Math.pow(2,n),i-=v}return(w?-1:1)*c*Math.pow(2,i-n)},Mm.write=function(r,t,e,n,s,i){var c,l,p,v=8*i-s-1,y=(1<>1,M=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:i-1,_=n?1:-1,k=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,c=y):(c=Math.floor(Math.log(t)/Math.LN2),t*(p=Math.pow(2,-c))<1&&(c--,p*=2),(t+=c+E>=1?M/p:M*Math.pow(2,1-E))*p>=2&&(c++,p/=2),c+E>=y?(l=0,c=y):c+E>=1?(l=(t*p-1)*Math.pow(2,s),c+=E):(l=t*Math.pow(2,E-1)*Math.pow(2,s),c=0));s>=8;r[e+w]=255&l,w+=_,l/=256,s-=8);for(c=c<0;r[e+w]=255&c,w+=_,c/=256,v-=8);r[e+w-_]|=128*k},function(r){const t=i2,e=Mm,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=c,r.SlowBuffer=function(S){return+S!=S&&(S=0),c.alloc(+S)},r.INSPECT_MAX_BYTES=50;const s=2147483647;function i(S){if(S>s)throw new RangeError('The value "'+S+'" is invalid for option "size"');const C=new Uint8Array(S);return Object.setPrototypeOf(C,c.prototype),C}function c(S,C,O){if(typeof S=="number"){if(typeof C=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return v(S)}return l(S,C,O)}function l(S,C,O){if(typeof S=="string")return function(Q,it){if(typeof it=="string"&&it!==""||(it="utf8"),!c.isEncoding(it))throw new TypeError("Unknown encoding: "+it);const qt=0|w(Q,it);let It=i(qt);const xt=It.write(Q,it);return xt!==qt&&(It=It.slice(0,xt)),It}(S,C);if(ArrayBuffer.isView(S))return function(Q){if(jt(Q,Uint8Array)){const it=new Uint8Array(Q);return E(it.buffer,it.byteOffset,it.byteLength)}return y(Q)}(S);if(S==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof S);if(jt(S,ArrayBuffer)||S&&jt(S.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(jt(S,SharedArrayBuffer)||S&&jt(S.buffer,SharedArrayBuffer)))return E(S,C,O);if(typeof S=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const F=S.valueOf&&S.valueOf();if(F!=null&&F!==S)return c.from(F,C,O);const et=function(Q){if(c.isBuffer(Q)){const it=0|M(Q.length),qt=i(it);return qt.length===0||Q.copy(qt,0,0,it),qt}if(Q.length!==void 0)return typeof Q.length!="number"||dt(Q.length)?i(0):y(Q);if(Q.type==="Buffer"&&Array.isArray(Q.data))return y(Q.data)}(S);if(et)return et;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof S[Symbol.toPrimitive]=="function")return c.from(S[Symbol.toPrimitive]("string"),C,O);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof S)}function p(S){if(typeof S!="number")throw new TypeError('"size" argument must be of type number');if(S<0)throw new RangeError('The value "'+S+'" is invalid for option "size"')}function v(S){return p(S),i(S<0?0:0|M(S))}function y(S){const C=S.length<0?0:0|M(S.length),O=i(C);for(let F=0;F=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|S}function w(S,C){if(c.isBuffer(S))return S.length;if(ArrayBuffer.isView(S)||jt(S,ArrayBuffer))return S.byteLength;if(typeof S!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof S);const O=S.length,F=arguments.length>2&&arguments[2]===!0;if(!F&&O===0)return 0;let et=!1;for(;;)switch(C){case"ascii":case"latin1":case"binary":return O;case"utf8":case"utf-8":return Ct(S).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*O;case"hex":return O>>>1;case"base64":return yt(S).length;default:if(et)return F?-1:Ct(S).length;C=(""+C).toLowerCase(),et=!0}}function _(S,C,O){let F=!1;if((C===void 0||C<0)&&(C=0),C>this.length||((O===void 0||O>this.length)&&(O=this.length),O<=0)||(O>>>=0)<=(C>>>=0))return"";for(S||(S="utf8");;)switch(S){case"hex":return o(this,C,O);case"utf8":case"utf-8":return nt(this,C,O);case"ascii":return x(this,C,O);case"latin1":case"binary":return d(this,C,O);case"base64":return rt(this,C,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a(this,C,O);default:if(F)throw new TypeError("Unknown encoding: "+S);S=(S+"").toLowerCase(),F=!0}}function k(S,C,O){const F=S[C];S[C]=S[O],S[O]=F}function B(S,C,O,F,et){if(S.length===0)return-1;if(typeof O=="string"?(F=O,O=0):O>2147483647?O=2147483647:O<-2147483648&&(O=-2147483648),dt(O=+O)&&(O=et?0:S.length-1),O<0&&(O=S.length+O),O>=S.length){if(et)return-1;O=S.length-1}else if(O<0){if(!et)return-1;O=0}if(typeof C=="string"&&(C=c.from(C,F)),c.isBuffer(C))return C.length===0?-1:P(S,C,O,F,et);if(typeof C=="number")return C&=255,typeof Uint8Array.prototype.indexOf=="function"?et?Uint8Array.prototype.indexOf.call(S,C,O):Uint8Array.prototype.lastIndexOf.call(S,C,O):P(S,[C],O,F,et);throw new TypeError("val must be string, number or Buffer")}function P(S,C,O,F,et){let Q,it=1,qt=S.length,It=C.length;if(F!==void 0&&((F=String(F).toLowerCase())==="ucs2"||F==="ucs-2"||F==="utf16le"||F==="utf-16le")){if(S.length<2||C.length<2)return-1;it=2,qt/=2,It/=2,O/=2}function xt(Qt,Rt){return it===1?Qt[Rt]:Qt.readUInt16BE(Rt*it)}if(et){let Qt=-1;for(Q=O;Qqt&&(O=qt-It),Q=O;Q>=0;Q--){let Qt=!0;for(let Rt=0;Rtet&&(F=et):F=et;const Q=C.length;let it;for(F>Q/2&&(F=Q/2),it=0;it>8,It=it%256,xt.push(It),xt.push(qt);return xt}(C,S.length-O),S,O,F)}function rt(S,C,O){return C===0&&O===S.length?t.fromByteArray(S):t.fromByteArray(S.slice(C,O))}function nt(S,C,O){O=Math.min(S.length,O);const F=[];let et=C;for(;et239?4:Q>223?3:Q>191?2:1;if(et+qt<=O){let It,xt,Qt,Rt;switch(qt){case 1:Q<128&&(it=Q);break;case 2:It=S[et+1],(192&It)==128&&(Rt=(31&Q)<<6|63&It,Rt>127&&(it=Rt));break;case 3:It=S[et+1],xt=S[et+2],(192&It)==128&&(192&xt)==128&&(Rt=(15&Q)<<12|(63&It)<<6|63&xt,Rt>2047&&(Rt<55296||Rt>57343)&&(it=Rt));break;case 4:It=S[et+1],xt=S[et+2],Qt=S[et+3],(192&It)==128&&(192&xt)==128&&(192&Qt)==128&&(Rt=(15&Q)<<18|(63&It)<<12|(63&xt)<<6|63&Qt,Rt>65535&&Rt<1114112&&(it=Rt))}}it===null?(it=65533,qt=1):it>65535&&(it-=65536,F.push(it>>>10&1023|55296),it=56320|1023&it),F.push(it),et+=qt}return function(Q){const it=Q.length;if(it<=Z)return String.fromCharCode.apply(String,Q);let qt="",It=0;for(;It"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."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(S,C,O){return l(S,C,O)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(S,C,O){return function(F,et,Q){return p(F),F<=0?i(F):et!==void 0?typeof Q=="string"?i(F).fill(et,Q):i(F).fill(et):i(F)}(S,C,O)},c.allocUnsafe=function(S){return v(S)},c.allocUnsafeSlow=function(S){return v(S)},c.isBuffer=function(S){return S!=null&&S._isBuffer===!0&&S!==c.prototype},c.compare=function(S,C){if(jt(S,Uint8Array)&&(S=c.from(S,S.offset,S.byteLength)),jt(C,Uint8Array)&&(C=c.from(C,C.offset,C.byteLength)),!c.isBuffer(S)||!c.isBuffer(C))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(S===C)return 0;let O=S.length,F=C.length;for(let et=0,Q=Math.min(O,F);etF.length?(c.isBuffer(Q)||(Q=c.from(Q)),Q.copy(F,et)):Uint8Array.prototype.set.call(F,Q,et);else{if(!c.isBuffer(Q))throw new TypeError('"list" argument must be an Array of Buffers');Q.copy(F,et)}et+=Q.length}return F},c.byteLength=w,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const S=this.length;if(S%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let C=0;CC&&(S+=" ... "),""},n&&(c.prototype[n]=c.prototype.inspect),c.prototype.compare=function(S,C,O,F,et){if(jt(S,Uint8Array)&&(S=c.from(S,S.offset,S.byteLength)),!c.isBuffer(S))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof S);if(C===void 0&&(C=0),O===void 0&&(O=S?S.length:0),F===void 0&&(F=0),et===void 0&&(et=this.length),C<0||O>S.length||F<0||et>this.length)throw new RangeError("out of range index");if(F>=et&&C>=O)return 0;if(F>=et)return-1;if(C>=O)return 1;if(this===S)return 0;let Q=(et>>>=0)-(F>>>=0),it=(O>>>=0)-(C>>>=0);const qt=Math.min(Q,it),It=this.slice(F,et),xt=S.slice(C,O);for(let Qt=0;Qt>>=0,isFinite(O)?(O>>>=0,F===void 0&&(F="utf8")):(F=O,O=void 0)}const et=this.length-C;if((O===void 0||O>et)&&(O=et),S.length>0&&(O<0||C<0)||C>this.length)throw new RangeError("Attempt to write outside buffer bounds");F||(F="utf8");let Q=!1;for(;;)switch(F){case"hex":return R(this,S,C,O);case"utf8":case"utf-8":return T(this,S,C,O);case"ascii":case"latin1":case"binary":return U(this,S,C,O);case"base64":return j(this,S,C,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Y(this,S,C,O);default:if(Q)throw new TypeError("Unknown encoding: "+F);F=(""+F).toLowerCase(),Q=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const Z=4096;function x(S,C,O){let F="";O=Math.min(S.length,O);for(let et=C;etF)&&(O=F);let et="";for(let Q=C;QO)throw new RangeError("Trying to access beyond buffer length")}function h(S,C,O,F,et,Q){if(!c.isBuffer(S))throw new TypeError('"buffer" argument must be a Buffer instance');if(C>et||CS.length)throw new RangeError("Index out of range")}function g(S,C,O,F,et){z(C,F,et,S,O,7);let Q=Number(C&BigInt(4294967295));S[O++]=Q,Q>>=8,S[O++]=Q,Q>>=8,S[O++]=Q,Q>>=8,S[O++]=Q;let it=Number(C>>BigInt(32)&BigInt(4294967295));return S[O++]=it,it>>=8,S[O++]=it,it>>=8,S[O++]=it,it>>=8,S[O++]=it,O}function A(S,C,O,F,et){z(C,F,et,S,O,7);let Q=Number(C&BigInt(4294967295));S[O+7]=Q,Q>>=8,S[O+6]=Q,Q>>=8,S[O+5]=Q,Q>>=8,S[O+4]=Q;let it=Number(C>>BigInt(32)&BigInt(4294967295));return S[O+3]=it,it>>=8,S[O+2]=it,it>>=8,S[O+1]=it,it>>=8,S[O]=it,O+8}function I(S,C,O,F,et,Q){if(O+F>S.length)throw new RangeError("Index out of range");if(O<0)throw new RangeError("Index out of range")}function b(S,C,O,F,et){return C=+C,O>>>=0,et||I(S,0,O,4),e.write(S,C,O,F,23,4),O+4}function u(S,C,O,F,et){return C=+C,O>>>=0,et||I(S,0,O,8),e.write(S,C,O,F,52,8),O+8}c.prototype.slice=function(S,C){const O=this.length;(S=~~S)<0?(S+=O)<0&&(S=0):S>O&&(S=O),(C=C===void 0?O:~~C)<0?(C+=O)<0&&(C=0):C>O&&(C=O),C>>=0,C>>>=0,O||f(S,C,this.length);let F=this[S],et=1,Q=0;for(;++Q>>=0,C>>>=0,O||f(S,C,this.length);let F=this[S+--C],et=1;for(;C>0&&(et*=256);)F+=this[S+--C]*et;return F},c.prototype.readUint8=c.prototype.readUInt8=function(S,C){return S>>>=0,C||f(S,1,this.length),this[S]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(S,C){return S>>>=0,C||f(S,2,this.length),this[S]|this[S+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(S,C){return S>>>=0,C||f(S,2,this.length),this[S]<<8|this[S+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(S,C){return S>>>=0,C||f(S,4,this.length),(this[S]|this[S+1]<<8|this[S+2]<<16)+16777216*this[S+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(S,C){return S>>>=0,C||f(S,4,this.length),16777216*this[S]+(this[S+1]<<16|this[S+2]<<8|this[S+3])},c.prototype.readBigUInt64LE=Tt(function(S){W(S>>>=0,"offset");const C=this[S],O=this[S+7];C!==void 0&&O!==void 0||ot(S,this.length-8);const F=C+256*this[++S]+65536*this[++S]+this[++S]*2**24,et=this[++S]+256*this[++S]+65536*this[++S]+O*2**24;return BigInt(F)+(BigInt(et)<>>=0,"offset");const C=this[S],O=this[S+7];C!==void 0&&O!==void 0||ot(S,this.length-8);const F=C*2**24+65536*this[++S]+256*this[++S]+this[++S],et=this[++S]*2**24+65536*this[++S]+256*this[++S]+O;return(BigInt(F)<>>=0,C>>>=0,O||f(S,C,this.length);let F=this[S],et=1,Q=0;for(;++Q=et&&(F-=Math.pow(2,8*C)),F},c.prototype.readIntBE=function(S,C,O){S>>>=0,C>>>=0,O||f(S,C,this.length);let F=C,et=1,Q=this[S+--F];for(;F>0&&(et*=256);)Q+=this[S+--F]*et;return et*=128,Q>=et&&(Q-=Math.pow(2,8*C)),Q},c.prototype.readInt8=function(S,C){return S>>>=0,C||f(S,1,this.length),128&this[S]?-1*(255-this[S]+1):this[S]},c.prototype.readInt16LE=function(S,C){S>>>=0,C||f(S,2,this.length);const O=this[S]|this[S+1]<<8;return 32768&O?4294901760|O:O},c.prototype.readInt16BE=function(S,C){S>>>=0,C||f(S,2,this.length);const O=this[S+1]|this[S]<<8;return 32768&O?4294901760|O:O},c.prototype.readInt32LE=function(S,C){return S>>>=0,C||f(S,4,this.length),this[S]|this[S+1]<<8|this[S+2]<<16|this[S+3]<<24},c.prototype.readInt32BE=function(S,C){return S>>>=0,C||f(S,4,this.length),this[S]<<24|this[S+1]<<16|this[S+2]<<8|this[S+3]},c.prototype.readBigInt64LE=Tt(function(S){W(S>>>=0,"offset");const C=this[S],O=this[S+7];C!==void 0&&O!==void 0||ot(S,this.length-8);const F=this[S+4]+256*this[S+5]+65536*this[S+6]+(O<<24);return(BigInt(F)<>>=0,"offset");const C=this[S],O=this[S+7];C!==void 0&&O!==void 0||ot(S,this.length-8);const F=(C<<24)+65536*this[++S]+256*this[++S]+this[++S];return(BigInt(F)<>>=0,C||f(S,4,this.length),e.read(this,S,!0,23,4)},c.prototype.readFloatBE=function(S,C){return S>>>=0,C||f(S,4,this.length),e.read(this,S,!1,23,4)},c.prototype.readDoubleLE=function(S,C){return S>>>=0,C||f(S,8,this.length),e.read(this,S,!0,52,8)},c.prototype.readDoubleBE=function(S,C){return S>>>=0,C||f(S,8,this.length),e.read(this,S,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(S,C,O,F){S=+S,C>>>=0,O>>>=0,!F&&h(this,S,C,O,Math.pow(2,8*O)-1,0);let et=1,Q=0;for(this[C]=255&S;++Q>>=0,O>>>=0,!F&&h(this,S,C,O,Math.pow(2,8*O)-1,0);let et=O-1,Q=1;for(this[C+et]=255&S;--et>=0&&(Q*=256);)this[C+et]=S/Q&255;return C+O},c.prototype.writeUint8=c.prototype.writeUInt8=function(S,C,O){return S=+S,C>>>=0,O||h(this,S,C,1,255,0),this[C]=255&S,C+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(S,C,O){return S=+S,C>>>=0,O||h(this,S,C,2,65535,0),this[C]=255&S,this[C+1]=S>>>8,C+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(S,C,O){return S=+S,C>>>=0,O||h(this,S,C,2,65535,0),this[C]=S>>>8,this[C+1]=255&S,C+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(S,C,O){return S=+S,C>>>=0,O||h(this,S,C,4,4294967295,0),this[C+3]=S>>>24,this[C+2]=S>>>16,this[C+1]=S>>>8,this[C]=255&S,C+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(S,C,O){return S=+S,C>>>=0,O||h(this,S,C,4,4294967295,0),this[C]=S>>>24,this[C+1]=S>>>16,this[C+2]=S>>>8,this[C+3]=255&S,C+4},c.prototype.writeBigUInt64LE=Tt(function(S,C=0){return g(this,S,C,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Tt(function(S,C=0){return A(this,S,C,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(S,C,O,F){if(S=+S,C>>>=0,!F){const qt=Math.pow(2,8*O-1);h(this,S,C,O,qt-1,-qt)}let et=0,Q=1,it=0;for(this[C]=255&S;++et>0)-it&255;return C+O},c.prototype.writeIntBE=function(S,C,O,F){if(S=+S,C>>>=0,!F){const qt=Math.pow(2,8*O-1);h(this,S,C,O,qt-1,-qt)}let et=O-1,Q=1,it=0;for(this[C+et]=255&S;--et>=0&&(Q*=256);)S<0&&it===0&&this[C+et+1]!==0&&(it=1),this[C+et]=(S/Q>>0)-it&255;return C+O},c.prototype.writeInt8=function(S,C,O){return S=+S,C>>>=0,O||h(this,S,C,1,127,-128),S<0&&(S=255+S+1),this[C]=255&S,C+1},c.prototype.writeInt16LE=function(S,C,O){return S=+S,C>>>=0,O||h(this,S,C,2,32767,-32768),this[C]=255&S,this[C+1]=S>>>8,C+2},c.prototype.writeInt16BE=function(S,C,O){return S=+S,C>>>=0,O||h(this,S,C,2,32767,-32768),this[C]=S>>>8,this[C+1]=255&S,C+2},c.prototype.writeInt32LE=function(S,C,O){return S=+S,C>>>=0,O||h(this,S,C,4,2147483647,-2147483648),this[C]=255&S,this[C+1]=S>>>8,this[C+2]=S>>>16,this[C+3]=S>>>24,C+4},c.prototype.writeInt32BE=function(S,C,O){return S=+S,C>>>=0,O||h(this,S,C,4,2147483647,-2147483648),S<0&&(S=4294967295+S+1),this[C]=S>>>24,this[C+1]=S>>>16,this[C+2]=S>>>8,this[C+3]=255&S,C+4},c.prototype.writeBigInt64LE=Tt(function(S,C=0){return g(this,S,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Tt(function(S,C=0){return A(this,S,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(S,C,O){return b(this,S,C,!0,O)},c.prototype.writeFloatBE=function(S,C,O){return b(this,S,C,!1,O)},c.prototype.writeDoubleLE=function(S,C,O){return u(this,S,C,!0,O)},c.prototype.writeDoubleBE=function(S,C,O){return u(this,S,C,!1,O)},c.prototype.copy=function(S,C,O,F){if(!c.isBuffer(S))throw new TypeError("argument should be a Buffer");if(O||(O=0),F||F===0||(F=this.length),C>=S.length&&(C=S.length),C||(C=0),F>0&&F=this.length)throw new RangeError("Index out of range");if(F<0)throw new RangeError("sourceEnd out of bounds");F>this.length&&(F=this.length),S.length-C>>=0,O=O===void 0?this.length:O>>>0,S||(S=0),typeof S=="number")for(et=C;et=F+4;O-=3)C=`_${S.slice(O-3,O)}${C}`;return`${S.slice(0,O)}${C}`}function z(S,C,O,F,et,Q){if(S>O||S3?C===0||C===BigInt(0)?`>= 0${it} and < 2${it} ** ${8*(Q+1)}${it}`:`>= -(2${it} ** ${8*(Q+1)-1}${it}) and < 2 ** ${8*(Q+1)-1}${it}`:`>= ${C}${it} and <= ${O}${it}`,new m.ERR_OUT_OF_RANGE("value",qt,S)}(function(it,qt,It){W(qt,"offset"),it[qt]!==void 0&&it[qt+It]!==void 0||ot(qt,it.length-(It+1))})(F,et,Q)}function W(S,C){if(typeof S!="number")throw new m.ERR_INVALID_ARG_TYPE(C,"number",S)}function ot(S,C,O){throw Math.floor(S)!==S?(W(S,O),new m.ERR_OUT_OF_RANGE(O||"offset","an integer",S)):C<0?new m.ERR_BUFFER_OUT_OF_BOUNDS:new m.ERR_OUT_OF_RANGE(O||"offset",`>= ${O?1:0} and <= ${C}`,S)}L("ERR_BUFFER_OUT_OF_BOUNDS",function(S){return S?`${S} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),L("ERR_INVALID_ARG_TYPE",function(S,C){return`The "${S}" argument must be of type number. Received type ${typeof C}`},TypeError),L("ERR_OUT_OF_RANGE",function(S,C,O){let F=`The value of "${S}" is out of range.`,et=O;return Number.isInteger(O)&&Math.abs(O)>2**32?et=q(String(O)):typeof O=="bigint"&&(et=String(O),(O>BigInt(2)**BigInt(32)||O<-(BigInt(2)**BigInt(32)))&&(et=q(et)),et+="n"),F+=` It must be ${C}. Received ${et}`,F},RangeError);const ut=/[^+/0-9A-Za-z-_]/g;function Ct(S,C){let O;C=C||1/0;const F=S.length;let et=null;const Q=[];for(let it=0;it55295&&O<57344){if(!et){if(O>56319){(C-=3)>-1&&Q.push(239,191,189);continue}if(it+1===F){(C-=3)>-1&&Q.push(239,191,189);continue}et=O;continue}if(O<56320){(C-=3)>-1&&Q.push(239,191,189),et=O;continue}O=65536+(et-55296<<10|O-56320)}else et&&(C-=3)>-1&&Q.push(239,191,189);if(et=null,O<128){if((C-=1)<0)break;Q.push(O)}else if(O<2048){if((C-=2)<0)break;Q.push(O>>6|192,63&O|128)}else if(O<65536){if((C-=3)<0)break;Q.push(O>>12|224,O>>6&63|128,63&O|128)}else{if(!(O<1114112))throw new Error("Invalid code point");if((C-=4)<0)break;Q.push(O>>18|240,O>>12&63|128,O>>6&63|128,63&O|128)}}return Q}function yt(S){return t.toByteArray(function(C){if((C=(C=C.split("=")[0]).trim().replace(ut,"")).length<2)return"";for(;C.length%4!=0;)C+="=";return C}(S))}function mt(S,C,O,F){let et;for(et=0;et=C.length||et>=S.length);++et)C[et+O]=S[et];return et}function jt(S,C){return S instanceof C||S!=null&&S.constructor!=null&&S.constructor.name!=null&&S.constructor.name===C.name}function dt(S){return S!=S}const ct=function(){const S="0123456789abcdef",C=new Array(256);for(let O=0;O<16;++O){const F=16*O;for(let et=0;et<16;++et)C[F+et]=S[O]+S[et]}return C}();function Tt(S){return typeof BigInt>"u"?kt:S}function kt(){throw new Error("BigInt not supported")}}(Ae);const Em=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,lE=r=>r instanceof Uint8Array,Am=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),Eo=(r,t)=>r<<32-t|r>>>t;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */if(new Uint8Array(new Uint32Array([287454020]).buffer)[0]!==68)throw new Error("Non little-endian hardware is not supported");function AF(r){if(typeof r!="string")throw new Error("utf8ToBytes expected string, got "+typeof r);return new Uint8Array(new TextEncoder().encode(r))}function Gd(r){if(typeof r=="string"&&(r=AF(r)),!lE(r))throw new Error("expected Uint8Array, got "+typeof r);return r}function SF(...r){const t=new Uint8Array(r.reduce((n,s)=>n+s.length,0));let e=0;return r.forEach(n=>{if(!lE(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}class wy{clone(){return this._cloneInto()}}function xy(r){const t=n=>r().update(Gd(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function dE(r=32){if(Em&&typeof Em.getRandomValues=="function")return Em.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}class pE extends wy{constructor(t,e,n,s){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Am(this.buffer)}update(t){yf(this);const{view:e,buffer:n,blockLen:s}=this,i=(t=Gd(t)).length;for(let c=0;cs-c&&(this.process(n,0),c=0);for(let E=c;E>k&B),R=Number(w&B),T=_?4:0,U=_?0:4;E.setUint32(M+T,P,_),E.setUint32(M+U,R,_)})(n,s-8,BigInt(8*this.length),i),this.process(n,0);const l=Am(t),p=this.outputLen;if(p%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const v=p/4,y=this.get();if(v>y.length)throw new Error("_sha2: outputLen bigger than state");for(let E=0;E>s2&k0)}:{h:0|Number(r>>s2&k0),l:0|Number(r&k0)}}function vE(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let s=0;sr<>>32-e,yE=(r,t,e)=>t<>>32-e,bE=(r,t,e)=>t<>>64-e,wE=(r,t,e)=>r<>>64-e,kF={fromBig:mE,split:vE,toBig:(r,t)=>BigInt(r>>>0)<>>0),shrSH:(r,t,e)=>r>>>e,shrSL:(r,t,e)=>r<<32-e|t>>>e,rotrSH:(r,t,e)=>r>>>e|t<<32-e,rotrSL:(r,t,e)=>r<<32-e|t>>>e,rotrBH:(r,t,e)=>r<<64-e|t>>>e-32,rotrBL:(r,t,e)=>r>>>e-32|t<<64-e,rotr32H:(r,t)=>t,rotr32L:(r,t)=>r,rotlSH:gE,rotlSL:yE,rotlBH:bE,rotlBL:wE,add:function(r,t,e,n){const s=(t>>>0)+(n>>>0);return{h:r+e+(s/2**32|0)|0,l:0|s}},add3L:(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),add3H:(r,t,e,n)=>t+e+n+(r/2**32|0)|0,add4L:(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),add4H:(r,t,e,n,s)=>t+e+n+s+(r/2**32|0)|0,add5H:(r,t,e,n,s,i)=>t+e+n+s+i+(r/2**32|0)|0,add5L:(r,t,e,n,s)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(s>>>0)};var tr=kF;const[IF,BF]=(()=>tr.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(r=>BigInt(r))))(),Ns=new Uint32Array(80),Ds=new Uint32Array(80);class PF extends pE{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:t,Al:e,Bh:n,Bl:s,Ch:i,Cl:c,Dh:l,Dl:p,Eh:v,El:y,Fh:E,Fl:M,Gh:w,Gl:_,Hh:k,Hl:B}=this;return[t,e,n,s,i,c,l,p,v,y,E,M,w,_,k,B]}set(t,e,n,s,i,c,l,p,v,y,E,M,w,_,k,B){this.Ah=0|t,this.Al=0|e,this.Bh=0|n,this.Bl=0|s,this.Ch=0|i,this.Cl=0|c,this.Dh=0|l,this.Dl=0|p,this.Eh=0|v,this.El=0|y,this.Fh=0|E,this.Fl=0|M,this.Gh=0|w,this.Gl=0|_,this.Hh=0|k,this.Hl=0|B}process(t,e){for(let T=0;T<16;T++,e+=4)Ns[T]=t.getUint32(e),Ds[T]=t.getUint32(e+=4);for(let T=16;T<80;T++){const U=0|Ns[T-15],j=0|Ds[T-15],Y=tr.rotrSH(U,j,1)^tr.rotrSH(U,j,8)^tr.shrSH(U,j,7),rt=tr.rotrSL(U,j,1)^tr.rotrSL(U,j,8)^tr.shrSL(U,j,7),nt=0|Ns[T-2],Z=0|Ds[T-2],x=tr.rotrSH(nt,Z,19)^tr.rotrBH(nt,Z,61)^tr.shrSH(nt,Z,6),d=tr.rotrSL(nt,Z,19)^tr.rotrBL(nt,Z,61)^tr.shrSL(nt,Z,6),o=tr.add4L(rt,d,Ds[T-7],Ds[T-16]),a=tr.add4H(o,Y,x,Ns[T-7],Ns[T-16]);Ns[T]=0|a,Ds[T]=0|o}let{Ah:n,Al:s,Bh:i,Bl:c,Ch:l,Cl:p,Dh:v,Dl:y,Eh:E,El:M,Fh:w,Fl:_,Gh:k,Gl:B,Hh:P,Hl:R}=this;for(let T=0;T<80;T++){const U=tr.rotrSH(E,M,14)^tr.rotrSH(E,M,18)^tr.rotrBH(E,M,41),j=tr.rotrSL(E,M,14)^tr.rotrSL(E,M,18)^tr.rotrBL(E,M,41),Y=E&w^~E&k,rt=M&_^~M&B,nt=tr.add5L(R,j,rt,BF[T],Ds[T]),Z=tr.add5H(nt,P,U,Y,IF[T],Ns[T]),x=0|nt,d=tr.rotrSH(n,s,28)^tr.rotrBH(n,s,34)^tr.rotrBH(n,s,39),o=tr.rotrSL(n,s,28)^tr.rotrBL(n,s,34)^tr.rotrBL(n,s,39),a=n&i^n&l^i&l,f=s&c^s&p^c&p;P=0|k,R=0|B,k=0|w,B=0|_,w=0|E,_=0|M,{h:E,l:M}=tr.add(0|v,0|y,0|Z,0|x),v=0|l,y=0|p,l=0|i,p=0|c,i=0|n,c=0|s;const h=tr.add3L(x,o,f);n=tr.add3H(h,Z,d,a),s=0|h}({h:n,l:s}=tr.add(0|this.Ah,0|this.Al,0|n,0|s)),{h:i,l:c}=tr.add(0|this.Bh,0|this.Bl,0|i,0|c),{h:l,l:p}=tr.add(0|this.Ch,0|this.Cl,0|l,0|p),{h:v,l:y}=tr.add(0|this.Dh,0|this.Dl,0|v,0|y),{h:E,l:M}=tr.add(0|this.Eh,0|this.El,0|E,0|M),{h:w,l:_}=tr.add(0|this.Fh,0|this.Fl,0|w,0|_),{h:k,l:B}=tr.add(0|this.Gh,0|this.Gl,0|k,0|B),{h:P,l:R}=tr.add(0|this.Hh,0|this.Hl,0|P,0|R),this.set(n,s,i,c,l,p,v,y,E,M,w,_,k,B,P,R)}roundClean(){Ns.fill(0),Ds.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 RF=xy(()=>new PF),D5=BigInt(0),al=BigInt(1),CF=BigInt(2),Yd=r=>r instanceof Uint8Array,TF=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function au(r){if(!Yd(r))throw new Error("Uint8Array expected");let t="";for(let e=0;en+s.length,0));let e=0;return r.forEach(n=>{if(!Yd(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}const My=r=>(CF<new Uint8Array(r),q5=r=>Uint8Array.from(r);function xE(r,t,e){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let n=Sm(r),s=Sm(r),i=0;const c=()=>{n.fill(1),s.fill(0),i=0},l=(...y)=>e(s,n,...y),p=(y=Sm())=>{s=l(q5([0]),y),n=l(),y.length!==0&&(s=l(q5([1]),y),n=l())},v=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let y=0;const E=[];for(;y{let M;for(c(),p(y);!(M=E(v()));)p();return c(),M}}const LF={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||r instanceof Uint8Array,isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function wf(r,t,e={}){const n=(s,i,c)=>{const l=LF[i];if(typeof l!="function")throw new Error(`Invalid validator "${i}", expected function`);const p=r[s];if(!(c&&p===void 0||l(p,r)))throw new Error(`Invalid param ${String(s)}=${p} (${typeof p}), expected ${i}`)};for(const[s,i]of Object.entries(t))n(s,i,!1);for(const[s,i]of Object.entries(e))n(s,i,!0);return r}var OF=Object.freeze({__proto__:null,bytesToHex:au,numberToHexUnpadded:z5,hexToNumber:_y,hexToBytes:bf,bytesToNumberBE:ja,bytesToNumberLE:Gu,numberToBytesBE:Yu,numberToBytesLE:ch,numberToVarBytesBE:function(r){return bf(z5(r))},ensureBytes:pn,concatBytes:uu,equalBytes:function(r,t){if(r.length!==t.length)return!1;for(let e=0;eD5;r>>=al,t+=1);return t},bitGet:function(r,t){return r>>BigInt(t)&al},bitSet:(r,t,e)=>r|(e?al:D5)<=Mn?e:t+e}function NF(r,t,e){if(e<=Mn||t 0");if(e===Vr)return Mn;let n=Vr;for(;t>Mn;)t&Vr&&(n=n*r%e),r=r*r%e,t>>=Vr;return n}function tn(r,t,e){let n=r;for(;t-- >Mn;)n*=n,n%=e;return n}function a2(r,t){if(r===Mn||t<=Mn)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=jr(r,t),n=t,s=Mn,i=Vr;for(;e!==Mn;){const c=n%e,l=s-i*(n/e);n=e,e=c,s=i,i=l}if(n!==Vr)throw new Error("invert: does not exist");return jr(s,t)}function DF(r){if(r%km===UF){const t=(r+Vr)/km;return function(e,n){const s=e.pow(n,t);if(!e.eql(e.sqr(s),n))throw new Error("Cannot find square root");return s}}if(r%j5===F5){const t=(r-F5)/j5;return function(e,n){const s=e.mul(n,Ma),i=e.pow(s,t),c=e.mul(n,i),l=e.mul(e.mul(c,Ma),i),p=e.mul(c,e.sub(l,e.ONE));if(!e.eql(e.sqr(p),n))throw new Error("Cannot find square root");return p}}return function(t){const e=(t-Vr)/Ma;let n,s,i;for(n=t-Vr,s=0;n%Ma===Mn;n/=Ma,s++);for(i=Ma;i 0, got ${r}`);const{nBitLength:s,nByteLength:i}=_E(r,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const c=DF(r),l=Object.freeze({ORDER:r,BITS:s,BYTES:i,MASK:My(s),ZERO:Mn,ONE:Vr,create:p=>jr(p,r),isValid:p=>{if(typeof p!="bigint")throw new Error("Invalid field element: expected bigint, got "+typeof p);return Mn<=p&&pp===Mn,isOdd:p=>(p&Vr)===Vr,neg:p=>jr(-p,r),eql:(p,v)=>p===v,sqr:p=>jr(p*p,r),add:(p,v)=>jr(p+v,r),sub:(p,v)=>jr(p-v,r),mul:(p,v)=>jr(p*v,r),pow:(p,v)=>function(y,E,M){if(M 0");if(M===Mn)return y.ONE;if(M===Vr)return E;let w=y.ONE,_=E;for(;M>Mn;)M&Vr&&(w=y.mul(w,_)),_=y.sqr(_),M>>=Vr;return w}(l,p,v),div:(p,v)=>jr(p*a2(v,r),r),sqrN:p=>p*p,addN:(p,v)=>p+v,subN:(p,v)=>p-v,mulN:(p,v)=>p*v,inv:p=>a2(p,r),sqrt:n.sqrt||(p=>c(l,p)),invertBatch:p=>function(v,y){const E=new Array(y.length),M=y.reduce((_,k,B)=>v.is0(k)?_:(E[B]=_,v.mul(_,k)),v.ONE),w=v.inv(M);return y.reduceRight((_,k,B)=>v.is0(k)?_:(E[B]=v.mul(_,E[B]),v.mul(_,k)),w),E}(l,p),cmov:(p,v,y)=>y?v:p,toBytes:p=>e?ch(p,i):Yu(p,i),fromBytes:p=>{if(p.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${p.length}`);return e?Gu(p):ja(p)}});return Object.freeze(l)}function EE(r){if(typeof r!="bigint")throw new Error("field order must be bigint");const t=r.toString(2).length;return Math.ceil(t/8)}function $5(r){const t=EE(r);return t+Math.ceil(t/2)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const qF=BigInt(0),Im=BigInt(1);function AE(r,t){const e=(s,i)=>{const c=i.negate();return s?c:i},n=s=>({windows:Math.ceil(t/s)+1,windowSize:2**(s-1)});return{constTimeNegate:e,unsafeLadder(s,i){let c=r.ZERO,l=s;for(;i>qF;)i&Im&&(c=c.add(l)),l=l.double(),i>>=Im;return c},precomputeWindow(s,i){const{windows:c,windowSize:l}=n(i),p=[];let v=s,y=v;for(let E=0;E>=w,B>p&&(B-=M,c+=Im);const P=k,R=k+Math.abs(B)-1,T=_%2!=0,U=B<0;B===0?y=y.add(e(T,i[P])):v=v.add(e(U,i[R]))}return{p:v,f:y}},wNAFCached(s,i,c,l){const p=s._WINDOW_SIZE||1;let v=i.get(s);return v||(v=this.precomputeWindow(s,p),p!==1&&i.set(s,l(v))),this.wNAF(p,v,c)}}}function Ey(r){return wf(r.Fp,zF.reduce((t,e)=>(t[e]="function",t),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),wf(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({..._E(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const no=BigInt(0),bi=BigInt(1),I0=BigInt(2),FF=BigInt(8),jF={zip215:!0};function $F(r){const t=function(f){const h=Ey(f);return wf(f,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...h})}(r),{Fp:e,n,prehash:s,hash:i,randomBytes:c,nByteLength:l,h:p}=t,v=I0<{try{return{isValid:!0,value:e.sqrt(f*e.inv(h))}}catch{return{isValid:!1,value:no}}}),M=t.adjustScalarBytes||(f=>f),w=t.domain||((f,h,g)=>{if(h.length||g)throw new Error("Contexts/pre-hash are not supported");return f}),_=f=>typeof f=="bigint"&&no_(f)&&_(h)&&ff===no||k(f,v);function P(f,h){if(k(f,h))return f;throw new Error(`Expected valid scalar < ${h}, got ${typeof f} ${f}`)}function R(f){return f===no?f:P(f,n)}const T=new Map;function U(f){if(!(f instanceof j))throw new Error("ExtendedPoint expected")}class j{constructor(h,g,A,I){if(this.ex=h,this.ey=g,this.ez=A,this.et=I,!B(h))throw new Error("x required");if(!B(g))throw new Error("y required");if(!B(A))throw new Error("z required");if(!B(I))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(h){if(h instanceof j)throw new Error("extended point not allowed");const{x:g,y:A}=h||{};if(!B(g)||!B(A))throw new Error("invalid affine point");return new j(g,A,bi,y(g*A))}static normalizeZ(h){const g=e.invertBatch(h.map(A=>A.ez));return h.map((A,I)=>A.toAffine(g[I])).map(j.fromAffine)}_setWindowSize(h){this._WINDOW_SIZE=h,T.delete(this)}assertValidity(){const{a:h,d:g}=t;if(this.is0())throw new Error("bad point: ZERO");const{ex:A,ey:I,ez:b,et:u}=this,m=y(A*A),L=y(I*I),q=y(b*b),z=y(q*q),W=y(m*h);if(y(q*y(W+L))!==y(z+y(g*y(m*L))))throw new Error("bad point: equation left != right (1)");if(y(A*I)!==y(b*u))throw new Error("bad point: equation left != right (2)")}equals(h){U(h);const{ex:g,ey:A,ez:I}=this,{ex:b,ey:u,ez:m}=h,L=y(g*m),q=y(b*I),z=y(A*m),W=y(u*I);return L===q&&z===W}is0(){return this.equals(j.ZERO)}negate(){return new j(y(-this.ex),this.ey,this.ez,y(-this.et))}double(){const{a:h}=t,{ex:g,ey:A,ez:I}=this,b=y(g*g),u=y(A*A),m=y(I0*y(I*I)),L=y(h*b),q=g+A,z=y(y(q*q)-b-u),W=L+u,ot=W-m,ut=L-u,Ct=y(z*ot),yt=y(W*ut),mt=y(z*ut),jt=y(ot*W);return new j(Ct,yt,jt,mt)}add(h){U(h);const{a:g,d:A}=t,{ex:I,ey:b,ez:u,et:m}=this,{ex:L,ey:q,ez:z,et:W}=h;if(g===BigInt(-1)){const O=y((b-I)*(q+L)),F=y((b+I)*(q-L)),et=y(F-O);if(et===no)return this.double();const Q=y(u*I0*W),it=y(m*I0*z),qt=it+Q,It=F+O,xt=it-Q,Qt=y(qt*et),Rt=y(It*xt),Dt=y(qt*xt),Se=y(et*It);return new j(Qt,Rt,Se,Dt)}const ot=y(I*L),ut=y(b*q),Ct=y(m*A*W),yt=y(u*z),mt=y((I+b)*(L+q)-ot-ut),jt=yt-Ct,dt=yt+Ct,ct=y(ut-g*ot),Tt=y(mt*jt),kt=y(dt*ct),S=y(mt*ct),C=y(jt*dt);return new j(Tt,kt,C,S)}subtract(h){return this.add(h.negate())}wNAF(h){return nt.wNAFCached(this,T,h,j.normalizeZ)}multiply(h){const{p:g,f:A}=this.wNAF(P(h,n));return j.normalizeZ([g,A])[0]}multiplyUnsafe(h){let g=R(h);return g===no?rt:this.equals(rt)||g===bi?this:this.equals(Y)?this.wNAF(g).p:nt.unsafeLadder(this,g)}isSmallOrder(){return this.multiplyUnsafe(p).is0()}isTorsionFree(){return nt.unsafeLadder(this,n).is0()}toAffine(h){const{ex:g,ey:A,ez:I}=this,b=this.is0();h==null&&(h=b?FF:e.inv(I));const u=y(g*h),m=y(A*h),L=y(I*h);if(b)return{x:no,y:bi};if(L!==bi)throw new Error("invZ was invalid");return{x:u,y:m}}clearCofactor(){const{h}=t;return h===bi?this:this.multiplyUnsafe(h)}static fromHex(h,g=!1){const{d:A,a:I}=t,b=e.BYTES,u=(h=pn("pointHex",h,b)).slice(),m=h[b-1];u[b-1]=-129&m;const L=Gu(u);L===no||P(L,g?v:e.ORDER);const q=y(L*L),z=y(q-bi),W=y(A*q-I);let{isValid:ot,value:ut}=E(z,W);if(!ot)throw new Error("Point.fromHex: invalid y coordinate");const Ct=(ut&bi)===bi,yt=(128&m)!=0;if(!g&&ut===no&&yt)throw new Error("Point.fromHex: x=0 and x_0=1");return yt!==Ct&&(ut=y(-ut)),j.fromAffine({x:ut,y:L})}static fromPrivateKey(h){return d(h).point}toRawBytes(){const{x:h,y:g}=this.toAffine(),A=ch(g,e.BYTES);return A[A.length-1]|=h&bi?128:0,A}toHex(){return au(this.toRawBytes())}}j.BASE=new j(t.Gx,t.Gy,bi,y(t.Gx*t.Gy)),j.ZERO=new j(no,bi,bi,no);const{BASE:Y,ZERO:rt}=j,nt=AE(j,8*l);function Z(f){return jr(f,n)}function x(f){return Z(Gu(f))}function d(f){const h=l;f=pn("private key",f,h);const g=pn("hashed private key",i(f),2*h),A=M(g.slice(0,h)),I=g.slice(h,2*h),b=x(A),u=Y.multiply(b),m=u.toRawBytes();return{head:A,prefix:I,scalar:b,point:u,pointBytes:m}}function o(f=new Uint8Array,...h){const g=uu(...h);return x(i(w(g,pn("context",f),!!s)))}const a=jF;return Y._setWindowSize(8),{CURVE:t,getPublicKey:function(f){return d(f).pointBytes},sign:function(f,h,g={}){f=pn("message",f),s&&(f=s(f));const{prefix:A,scalar:I,pointBytes:b}=d(h),u=o(g.context,A,f),m=Y.multiply(u).toRawBytes(),L=Z(u+o(g.context,m,b,f)*I);return R(L),pn("result",uu(m,ch(L,e.BYTES)),2*l)},verify:function(f,h,g,A=a){const{context:I,zip215:b}=A,u=e.BYTES;f=pn("signature",f,2*u),h=pn("message",h),s&&(h=s(h));const m=Gu(f.slice(u,2*u));let L,q,z;try{L=j.fromHex(g,b),q=j.fromHex(f.slice(0,u),b),z=Y.multiplyUnsafe(m)}catch{return!1}if(!b&&L.isSmallOrder())return!1;const W=o(I,q.toRawBytes(),L.toRawBytes(),h);return q.add(L.multiplyUnsafe(W)).subtract(z).clearCofactor().equals(j.ZERO)},ExtendedPoint:j,utils:{getExtendedPublicKey:d,randomPrivateKey:()=>c(e.BYTES),precompute:(f=8,h=j.BASE)=>(h._setWindowSize(f),h.multiply(BigInt(3)),h)}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const u2=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),K5=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const KF=BigInt(1),f2=BigInt(2),HF=BigInt(5),H5=BigInt(10),VF=BigInt(20),ZF=BigInt(40),V5=BigInt(80),ls=ME(u2,void 0,!0),WF={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:ls,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:RF,randomBytes:dE,adjustScalarBytes:function(r){return r[0]&=248,r[31]&=127,r[31]|=64,r},uvRatio:function(r,t){const e=u2,n=jr(t*t*t,e),s=function(M){const w=u2,_=M*M%w*M%w,k=tn(_,f2,w)*_%w,B=tn(k,KF,w)*M%w,P=tn(B,HF,w)*B%w,R=tn(P,H5,w)*P%w,T=tn(R,VF,w)*R%w,U=tn(T,ZF,w)*T%w,j=tn(U,V5,w)*U%w,Y=tn(j,V5,w)*U%w,rt=tn(Y,H5,w)*P%w;return{pow_p_5_8:tn(rt,f2,w)*M%w,b2:_}}(r*jr(n*n*t,e)).pow_p_5_8;let i=jr(r*n*s,e);const c=jr(t*i*i,e),l=i,p=jr(i*K5,e),v=c===r,y=c===jr(-r,e),E=c===jr(-r*K5,e);return v&&(i=l),(y||E)&&(i=p),(jr(i,e)&Vr)===Vr&&(i=jr(-i,e)),{isValid:v||y,value:i}}},jf=$F(WF),GF=(ls.ORDER+BigInt(3))/BigInt(8);ls.pow(f2,GF),ls.sqrt(ls.neg(ls.ONE)),ls.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(r,t){if(!r.isOdd)throw new Error("Field doesn't have isOdd");const e=r.sqrt(t);r.isOdd(e)&&r.neg(e)}(ls,ls.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var SE={exports:{}},kE=Zh(Object.freeze({__proto__:null,default:{}}));(function(r,t){function e(x,d){if(!x)throw new Error(d||"Assertion failed")}function n(x,d){x.super_=d;var o=function(){};o.prototype=d.prototype,x.prototype=new o,x.prototype.constructor=x}function s(x,d,o){if(s.isBN(x))return x;this.negative=0,this.words=null,this.length=0,this.red=null,x!==null&&(d!=="le"&&d!=="be"||(o=d,d=10),this._init(x||0,d||10,o||"be"))}var i;typeof r=="object"?r.exports=s:t.BN=s,s.BN=s,s.wordSize=26;try{i=typeof window<"u"&&window.Buffer!==void 0?window.Buffer:kE.Buffer}catch{}function c(x,d){var o=x.charCodeAt(d);return o>=48&&o<=57?o-48:o>=65&&o<=70?o-55:o>=97&&o<=102?o-87:void e(!1,"Invalid character in "+x)}function l(x,d,o){var a=c(x,o);return o-1>=d&&(a|=c(x,o-1)<<4),a}function p(x,d,o,a){for(var f=0,h=0,g=Math.min(x.length,o),A=d;A=49?I-49+10:I>=17?I-17+10:I,e(I>=0&&h0?x:d},s.min=function(x,d){return x.cmp(d)<0?x:d},s.prototype._init=function(x,d,o){if(typeof x=="number")return this._initNumber(x,d,o);if(typeof x=="object")return this._initArray(x,d,o);d==="hex"&&(d=16),e(d===(0|d)&&d>=2&&d<=36);var a=0;(x=x.toString().replace(/\s+/g,""))[0]==="-"&&(a++,this.negative=1),a=0;a-=3)h=x[a]|x[a-1]<<8|x[a-2]<<16,this.words[f]|=h<>>26-g&67108863,(g+=24)>=26&&(g-=26,f++);else if(o==="le")for(a=0,f=0;a>>26-g&67108863,(g+=24)>=26&&(g-=26,f++);return this._strip()},s.prototype._parseHex=function(x,d,o){this.length=Math.ceil((x.length-d)/6),this.words=new Array(this.length);for(var a=0;a=d;a-=2)f=l(x,d,a)<=18?(h-=18,g+=1,this.words[g]|=f>>>26):h+=8;else for(a=(x.length-d)%2==0?d+1:d;a=18?(h-=18,g+=1,this.words[g]|=f>>>26):h+=8;this._strip()},s.prototype._parseBase=function(x,d,o){this.words=[0],this.length=1;for(var a=0,f=1;f<=67108863;f*=d)a++;a--,f=f/d|0;for(var h=x.length-o,g=h%a,A=Math.min(h,h-g)+o,I=0,b=o;b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=y}catch{s.prototype.inspect=y}else s.prototype.inspect=y;function y(){return(this.red?""}var E=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],M=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],w=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function _(x,d,o){o.negative=d.negative^x.negative;var a=x.length+d.length|0;o.length=a,a=a-1|0;var f=0|x.words[0],h=0|d.words[0],g=f*h,A=67108863&g,I=g/67108864|0;o.words[0]=A;for(var b=1;b>>26,m=67108863&I,L=Math.min(b,d.length-1),q=Math.max(0,b-x.length+1);q<=L;q++){var z=b-q|0;u+=(g=(f=0|x.words[z])*(h=0|d.words[q])+m)/67108864|0,m=67108863&g}o.words[b]=0|m,I=0|u}return I!==0?o.words[b]=0|I:o.length--,o._strip()}s.prototype.toString=function(x,d){var o;if(d=0|d||1,(x=x||10)===16||x==="hex"){o="";for(var a=0,f=0,h=0;h>>24-a&16777215,(a+=2)>=26&&(a-=26,h--),o=f!==0||h!==this.length-1?E[6-A.length]+A+o:A+o}for(f!==0&&(o=f.toString(16)+o);o.length%d!=0;)o="0"+o;return this.negative!==0&&(o="-"+o),o}if(x===(0|x)&&x>=2&&x<=36){var I=M[x],b=w[x];o="";var u=this.clone();for(u.negative=0;!u.isZero();){var m=u.modrn(b).toString(x);o=(u=u.idivn(b)).isZero()?m+o:E[I-m.length]+m+o}for(this.isZero()&&(o="0"+o);o.length%d!=0;)o="0"+o;return this.negative!==0&&(o="-"+o),o}e(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var x=this.words[0];return this.length===2?x+=67108864*this.words[1]:this.length===3&&this.words[2]===1?x+=4503599627370496+67108864*this.words[1]:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-x:x},s.prototype.toJSON=function(){return this.toString(16,2)},i&&(s.prototype.toBuffer=function(x,d){return this.toArrayLike(i,x,d)}),s.prototype.toArray=function(x,d){return this.toArrayLike(Array,x,d)},s.prototype.toArrayLike=function(x,d,o){this._strip();var a=this.byteLength(),f=o||Math.max(1,a);e(a<=f,"byte array longer than desired length"),e(f>0,"Requested array length <= 0");var h=function(g,A){return g.allocUnsafe?g.allocUnsafe(A):new g(A)}(x,f);return this["_toArrayLike"+(d==="le"?"LE":"BE")](h,a),h},s.prototype._toArrayLikeLE=function(x,d){for(var o=0,a=0,f=0,h=0;f>8&255),o>16&255),h===6?(o>24&255),a=0,h=0):(a=g>>>24,h+=2)}if(o=0&&(x[o--]=g>>8&255),o>=0&&(x[o--]=g>>16&255),h===6?(o>=0&&(x[o--]=g>>24&255),a=0,h=0):(a=g>>>24,h+=2)}if(o>=0)for(x[o--]=a;o>=0;)x[o--]=0},Math.clz32?s.prototype._countBits=function(x){return 32-Math.clz32(x)}:s.prototype._countBits=function(x){var d=x,o=0;return d>=4096&&(o+=13,d>>>=13),d>=64&&(o+=7,d>>>=7),d>=8&&(o+=4,d>>>=4),d>=2&&(o+=2,d>>>=2),o+d},s.prototype._zeroBits=function(x){if(x===0)return 26;var d=x,o=0;return!(8191&d)&&(o+=13,d>>>=13),!(127&d)&&(o+=7,d>>>=7),!(15&d)&&(o+=4,d>>>=4),!(3&d)&&(o+=2,d>>>=2),!(1&d)&&o++,o},s.prototype.bitLength=function(){var x=this.words[this.length-1],d=this._countBits(x);return 26*(this.length-1)+d},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var x=0,d=0;dx.length?this.clone().ior(x):x.clone().ior(this)},s.prototype.uor=function(x){return this.length>x.length?this.clone().iuor(x):x.clone().iuor(this)},s.prototype.iuand=function(x){var d;d=this.length>x.length?x:this;for(var o=0;ox.length?this.clone().iand(x):x.clone().iand(this)},s.prototype.uand=function(x){return this.length>x.length?this.clone().iuand(x):x.clone().iuand(this)},s.prototype.iuxor=function(x){var d,o;this.length>x.length?(d=this,o=x):(d=x,o=this);for(var a=0;ax.length?this.clone().ixor(x):x.clone().ixor(this)},s.prototype.uxor=function(x){return this.length>x.length?this.clone().iuxor(x):x.clone().iuxor(this)},s.prototype.inotn=function(x){e(typeof x=="number"&&x>=0);var d=0|Math.ceil(x/26),o=x%26;this._expand(d),o>0&&d--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-o),this._strip()},s.prototype.notn=function(x){return this.clone().inotn(x)},s.prototype.setn=function(x,d){e(typeof x=="number"&&x>=0);var o=x/26|0,a=x%26;return this._expand(o+1),this.words[o]=d?this.words[o]|1<x.length?(o=this,a=x):(o=x,a=this);for(var f=0,h=0;h>>26;for(;f!==0&&h>>26;if(this.length=o.length,f!==0)this.words[this.length]=f,this.length++;else if(o!==this)for(;hx.length?this.clone().iadd(x):x.clone().iadd(this)},s.prototype.isub=function(x){if(x.negative!==0){x.negative=0;var d=this.iadd(x);return x.negative=1,d._normSign()}if(this.negative!==0)return this.negative=0,this.iadd(x),this.negative=1,this._normSign();var o,a,f=this.cmp(x);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;f>0?(o=this,a=x):(o=x,a=this);for(var h=0,g=0;g>26,this.words[g]=67108863&d;for(;h!==0&&g>26,this.words[g]=67108863&d;if(h===0&&g>>13,q=0|g[1],z=8191&q,W=q>>>13,ot=0|g[2],ut=8191&ot,Ct=ot>>>13,yt=0|g[3],mt=8191&yt,jt=yt>>>13,dt=0|g[4],ct=8191&dt,Tt=dt>>>13,kt=0|g[5],S=8191&kt,C=kt>>>13,O=0|g[6],F=8191&O,et=O>>>13,Q=0|g[7],it=8191&Q,qt=Q>>>13,It=0|g[8],xt=8191&It,Qt=It>>>13,Rt=0|g[9],Dt=8191&Rt,Se=Rt>>>13,te=0|A[0],Ut=8191&te,Te=te>>>13,J=0|A[1],X=8191&J,st=J>>>13,D=0|A[2],K=8191&D,gt=D>>>13,ft=0|A[3],pt=8191&ft,vt=ft>>>13,At=0|A[4],_t=8191&At,Wt=At>>>13,Pt=0|A[5],wt=8191&Pt,se=Pt>>>13,Lt=0|A[6],Et=8191&Lt,de=Lt>>>13,Bt=0|A[7],Mt=8191&Bt,$=Bt>>>13,G=0|A[8],H=8191&G,N=G>>>13,V=0|A[9],tt=8191&V,lt=V>>>13;o.negative=x.negative^d.negative,o.length=19;var at=(b+(a=Math.imul(m,Ut))|0)+((8191&(f=(f=Math.imul(m,Te))+Math.imul(L,Ut)|0))<<13)|0;b=((h=Math.imul(L,Te))+(f>>>13)|0)+(at>>>26)|0,at&=67108863,a=Math.imul(z,Ut),f=(f=Math.imul(z,Te))+Math.imul(W,Ut)|0,h=Math.imul(W,Te);var ht=(b+(a=a+Math.imul(m,X)|0)|0)+((8191&(f=(f=f+Math.imul(m,st)|0)+Math.imul(L,X)|0))<<13)|0;b=((h=h+Math.imul(L,st)|0)+(f>>>13)|0)+(ht>>>26)|0,ht&=67108863,a=Math.imul(ut,Ut),f=(f=Math.imul(ut,Te))+Math.imul(Ct,Ut)|0,h=Math.imul(Ct,Te),a=a+Math.imul(z,X)|0,f=(f=f+Math.imul(z,st)|0)+Math.imul(W,X)|0,h=h+Math.imul(W,st)|0;var zt=(b+(a=a+Math.imul(m,K)|0)|0)+((8191&(f=(f=f+Math.imul(m,gt)|0)+Math.imul(L,K)|0))<<13)|0;b=((h=h+Math.imul(L,gt)|0)+(f>>>13)|0)+(zt>>>26)|0,zt&=67108863,a=Math.imul(mt,Ut),f=(f=Math.imul(mt,Te))+Math.imul(jt,Ut)|0,h=Math.imul(jt,Te),a=a+Math.imul(ut,X)|0,f=(f=f+Math.imul(ut,st)|0)+Math.imul(Ct,X)|0,h=h+Math.imul(Ct,st)|0,a=a+Math.imul(z,K)|0,f=(f=f+Math.imul(z,gt)|0)+Math.imul(W,K)|0,h=h+Math.imul(W,gt)|0;var Zt=(b+(a=a+Math.imul(m,pt)|0)|0)+((8191&(f=(f=f+Math.imul(m,vt)|0)+Math.imul(L,pt)|0))<<13)|0;b=((h=h+Math.imul(L,vt)|0)+(f>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,a=Math.imul(ct,Ut),f=(f=Math.imul(ct,Te))+Math.imul(Tt,Ut)|0,h=Math.imul(Tt,Te),a=a+Math.imul(mt,X)|0,f=(f=f+Math.imul(mt,st)|0)+Math.imul(jt,X)|0,h=h+Math.imul(jt,st)|0,a=a+Math.imul(ut,K)|0,f=(f=f+Math.imul(ut,gt)|0)+Math.imul(Ct,K)|0,h=h+Math.imul(Ct,gt)|0,a=a+Math.imul(z,pt)|0,f=(f=f+Math.imul(z,vt)|0)+Math.imul(W,pt)|0,h=h+Math.imul(W,vt)|0;var ye=(b+(a=a+Math.imul(m,_t)|0)|0)+((8191&(f=(f=f+Math.imul(m,Wt)|0)+Math.imul(L,_t)|0))<<13)|0;b=((h=h+Math.imul(L,Wt)|0)+(f>>>13)|0)+(ye>>>26)|0,ye&=67108863,a=Math.imul(S,Ut),f=(f=Math.imul(S,Te))+Math.imul(C,Ut)|0,h=Math.imul(C,Te),a=a+Math.imul(ct,X)|0,f=(f=f+Math.imul(ct,st)|0)+Math.imul(Tt,X)|0,h=h+Math.imul(Tt,st)|0,a=a+Math.imul(mt,K)|0,f=(f=f+Math.imul(mt,gt)|0)+Math.imul(jt,K)|0,h=h+Math.imul(jt,gt)|0,a=a+Math.imul(ut,pt)|0,f=(f=f+Math.imul(ut,vt)|0)+Math.imul(Ct,pt)|0,h=h+Math.imul(Ct,vt)|0,a=a+Math.imul(z,_t)|0,f=(f=f+Math.imul(z,Wt)|0)+Math.imul(W,_t)|0,h=h+Math.imul(W,Wt)|0;var Yt=(b+(a=a+Math.imul(m,wt)|0)|0)+((8191&(f=(f=f+Math.imul(m,se)|0)+Math.imul(L,wt)|0))<<13)|0;b=((h=h+Math.imul(L,se)|0)+(f>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(F,Ut),f=(f=Math.imul(F,Te))+Math.imul(et,Ut)|0,h=Math.imul(et,Te),a=a+Math.imul(S,X)|0,f=(f=f+Math.imul(S,st)|0)+Math.imul(C,X)|0,h=h+Math.imul(C,st)|0,a=a+Math.imul(ct,K)|0,f=(f=f+Math.imul(ct,gt)|0)+Math.imul(Tt,K)|0,h=h+Math.imul(Tt,gt)|0,a=a+Math.imul(mt,pt)|0,f=(f=f+Math.imul(mt,vt)|0)+Math.imul(jt,pt)|0,h=h+Math.imul(jt,vt)|0,a=a+Math.imul(ut,_t)|0,f=(f=f+Math.imul(ut,Wt)|0)+Math.imul(Ct,_t)|0,h=h+Math.imul(Ct,Wt)|0,a=a+Math.imul(z,wt)|0,f=(f=f+Math.imul(z,se)|0)+Math.imul(W,wt)|0,h=h+Math.imul(W,se)|0;var pe=(b+(a=a+Math.imul(m,Et)|0)|0)+((8191&(f=(f=f+Math.imul(m,de)|0)+Math.imul(L,Et)|0))<<13)|0;b=((h=h+Math.imul(L,de)|0)+(f>>>13)|0)+(pe>>>26)|0,pe&=67108863,a=Math.imul(it,Ut),f=(f=Math.imul(it,Te))+Math.imul(qt,Ut)|0,h=Math.imul(qt,Te),a=a+Math.imul(F,X)|0,f=(f=f+Math.imul(F,st)|0)+Math.imul(et,X)|0,h=h+Math.imul(et,st)|0,a=a+Math.imul(S,K)|0,f=(f=f+Math.imul(S,gt)|0)+Math.imul(C,K)|0,h=h+Math.imul(C,gt)|0,a=a+Math.imul(ct,pt)|0,f=(f=f+Math.imul(ct,vt)|0)+Math.imul(Tt,pt)|0,h=h+Math.imul(Tt,vt)|0,a=a+Math.imul(mt,_t)|0,f=(f=f+Math.imul(mt,Wt)|0)+Math.imul(jt,_t)|0,h=h+Math.imul(jt,Wt)|0,a=a+Math.imul(ut,wt)|0,f=(f=f+Math.imul(ut,se)|0)+Math.imul(Ct,wt)|0,h=h+Math.imul(Ct,se)|0,a=a+Math.imul(z,Et)|0,f=(f=f+Math.imul(z,de)|0)+Math.imul(W,Et)|0,h=h+Math.imul(W,de)|0;var ve=(b+(a=a+Math.imul(m,Mt)|0)|0)+((8191&(f=(f=f+Math.imul(m,$)|0)+Math.imul(L,Mt)|0))<<13)|0;b=((h=h+Math.imul(L,$)|0)+(f>>>13)|0)+(ve>>>26)|0,ve&=67108863,a=Math.imul(xt,Ut),f=(f=Math.imul(xt,Te))+Math.imul(Qt,Ut)|0,h=Math.imul(Qt,Te),a=a+Math.imul(it,X)|0,f=(f=f+Math.imul(it,st)|0)+Math.imul(qt,X)|0,h=h+Math.imul(qt,st)|0,a=a+Math.imul(F,K)|0,f=(f=f+Math.imul(F,gt)|0)+Math.imul(et,K)|0,h=h+Math.imul(et,gt)|0,a=a+Math.imul(S,pt)|0,f=(f=f+Math.imul(S,vt)|0)+Math.imul(C,pt)|0,h=h+Math.imul(C,vt)|0,a=a+Math.imul(ct,_t)|0,f=(f=f+Math.imul(ct,Wt)|0)+Math.imul(Tt,_t)|0,h=h+Math.imul(Tt,Wt)|0,a=a+Math.imul(mt,wt)|0,f=(f=f+Math.imul(mt,se)|0)+Math.imul(jt,wt)|0,h=h+Math.imul(jt,se)|0,a=a+Math.imul(ut,Et)|0,f=(f=f+Math.imul(ut,de)|0)+Math.imul(Ct,Et)|0,h=h+Math.imul(Ct,de)|0,a=a+Math.imul(z,Mt)|0,f=(f=f+Math.imul(z,$)|0)+Math.imul(W,Mt)|0,h=h+Math.imul(W,$)|0;var ge=(b+(a=a+Math.imul(m,H)|0)|0)+((8191&(f=(f=f+Math.imul(m,N)|0)+Math.imul(L,H)|0))<<13)|0;b=((h=h+Math.imul(L,N)|0)+(f>>>13)|0)+(ge>>>26)|0,ge&=67108863,a=Math.imul(Dt,Ut),f=(f=Math.imul(Dt,Te))+Math.imul(Se,Ut)|0,h=Math.imul(Se,Te),a=a+Math.imul(xt,X)|0,f=(f=f+Math.imul(xt,st)|0)+Math.imul(Qt,X)|0,h=h+Math.imul(Qt,st)|0,a=a+Math.imul(it,K)|0,f=(f=f+Math.imul(it,gt)|0)+Math.imul(qt,K)|0,h=h+Math.imul(qt,gt)|0,a=a+Math.imul(F,pt)|0,f=(f=f+Math.imul(F,vt)|0)+Math.imul(et,pt)|0,h=h+Math.imul(et,vt)|0,a=a+Math.imul(S,_t)|0,f=(f=f+Math.imul(S,Wt)|0)+Math.imul(C,_t)|0,h=h+Math.imul(C,Wt)|0,a=a+Math.imul(ct,wt)|0,f=(f=f+Math.imul(ct,se)|0)+Math.imul(Tt,wt)|0,h=h+Math.imul(Tt,se)|0,a=a+Math.imul(mt,Et)|0,f=(f=f+Math.imul(mt,de)|0)+Math.imul(jt,Et)|0,h=h+Math.imul(jt,de)|0,a=a+Math.imul(ut,Mt)|0,f=(f=f+Math.imul(ut,$)|0)+Math.imul(Ct,Mt)|0,h=h+Math.imul(Ct,$)|0,a=a+Math.imul(z,H)|0,f=(f=f+Math.imul(z,N)|0)+Math.imul(W,H)|0,h=h+Math.imul(W,N)|0;var ie=(b+(a=a+Math.imul(m,tt)|0)|0)+((8191&(f=(f=f+Math.imul(m,lt)|0)+Math.imul(L,tt)|0))<<13)|0;b=((h=h+Math.imul(L,lt)|0)+(f>>>13)|0)+(ie>>>26)|0,ie&=67108863,a=Math.imul(Dt,X),f=(f=Math.imul(Dt,st))+Math.imul(Se,X)|0,h=Math.imul(Se,st),a=a+Math.imul(xt,K)|0,f=(f=f+Math.imul(xt,gt)|0)+Math.imul(Qt,K)|0,h=h+Math.imul(Qt,gt)|0,a=a+Math.imul(it,pt)|0,f=(f=f+Math.imul(it,vt)|0)+Math.imul(qt,pt)|0,h=h+Math.imul(qt,vt)|0,a=a+Math.imul(F,_t)|0,f=(f=f+Math.imul(F,Wt)|0)+Math.imul(et,_t)|0,h=h+Math.imul(et,Wt)|0,a=a+Math.imul(S,wt)|0,f=(f=f+Math.imul(S,se)|0)+Math.imul(C,wt)|0,h=h+Math.imul(C,se)|0,a=a+Math.imul(ct,Et)|0,f=(f=f+Math.imul(ct,de)|0)+Math.imul(Tt,Et)|0,h=h+Math.imul(Tt,de)|0,a=a+Math.imul(mt,Mt)|0,f=(f=f+Math.imul(mt,$)|0)+Math.imul(jt,Mt)|0,h=h+Math.imul(jt,$)|0,a=a+Math.imul(ut,H)|0,f=(f=f+Math.imul(ut,N)|0)+Math.imul(Ct,H)|0,h=h+Math.imul(Ct,N)|0;var ue=(b+(a=a+Math.imul(z,tt)|0)|0)+((8191&(f=(f=f+Math.imul(z,lt)|0)+Math.imul(W,tt)|0))<<13)|0;b=((h=h+Math.imul(W,lt)|0)+(f>>>13)|0)+(ue>>>26)|0,ue&=67108863,a=Math.imul(Dt,K),f=(f=Math.imul(Dt,gt))+Math.imul(Se,K)|0,h=Math.imul(Se,gt),a=a+Math.imul(xt,pt)|0,f=(f=f+Math.imul(xt,vt)|0)+Math.imul(Qt,pt)|0,h=h+Math.imul(Qt,vt)|0,a=a+Math.imul(it,_t)|0,f=(f=f+Math.imul(it,Wt)|0)+Math.imul(qt,_t)|0,h=h+Math.imul(qt,Wt)|0,a=a+Math.imul(F,wt)|0,f=(f=f+Math.imul(F,se)|0)+Math.imul(et,wt)|0,h=h+Math.imul(et,se)|0,a=a+Math.imul(S,Et)|0,f=(f=f+Math.imul(S,de)|0)+Math.imul(C,Et)|0,h=h+Math.imul(C,de)|0,a=a+Math.imul(ct,Mt)|0,f=(f=f+Math.imul(ct,$)|0)+Math.imul(Tt,Mt)|0,h=h+Math.imul(Tt,$)|0,a=a+Math.imul(mt,H)|0,f=(f=f+Math.imul(mt,N)|0)+Math.imul(jt,H)|0,h=h+Math.imul(jt,N)|0;var fe=(b+(a=a+Math.imul(ut,tt)|0)|0)+((8191&(f=(f=f+Math.imul(ut,lt)|0)+Math.imul(Ct,tt)|0))<<13)|0;b=((h=h+Math.imul(Ct,lt)|0)+(f>>>13)|0)+(fe>>>26)|0,fe&=67108863,a=Math.imul(Dt,pt),f=(f=Math.imul(Dt,vt))+Math.imul(Se,pt)|0,h=Math.imul(Se,vt),a=a+Math.imul(xt,_t)|0,f=(f=f+Math.imul(xt,Wt)|0)+Math.imul(Qt,_t)|0,h=h+Math.imul(Qt,Wt)|0,a=a+Math.imul(it,wt)|0,f=(f=f+Math.imul(it,se)|0)+Math.imul(qt,wt)|0,h=h+Math.imul(qt,se)|0,a=a+Math.imul(F,Et)|0,f=(f=f+Math.imul(F,de)|0)+Math.imul(et,Et)|0,h=h+Math.imul(et,de)|0,a=a+Math.imul(S,Mt)|0,f=(f=f+Math.imul(S,$)|0)+Math.imul(C,Mt)|0,h=h+Math.imul(C,$)|0,a=a+Math.imul(ct,H)|0,f=(f=f+Math.imul(ct,N)|0)+Math.imul(Tt,H)|0,h=h+Math.imul(Tt,N)|0;var ce=(b+(a=a+Math.imul(mt,tt)|0)|0)+((8191&(f=(f=f+Math.imul(mt,lt)|0)+Math.imul(jt,tt)|0))<<13)|0;b=((h=h+Math.imul(jt,lt)|0)+(f>>>13)|0)+(ce>>>26)|0,ce&=67108863,a=Math.imul(Dt,_t),f=(f=Math.imul(Dt,Wt))+Math.imul(Se,_t)|0,h=Math.imul(Se,Wt),a=a+Math.imul(xt,wt)|0,f=(f=f+Math.imul(xt,se)|0)+Math.imul(Qt,wt)|0,h=h+Math.imul(Qt,se)|0,a=a+Math.imul(it,Et)|0,f=(f=f+Math.imul(it,de)|0)+Math.imul(qt,Et)|0,h=h+Math.imul(qt,de)|0,a=a+Math.imul(F,Mt)|0,f=(f=f+Math.imul(F,$)|0)+Math.imul(et,Mt)|0,h=h+Math.imul(et,$)|0,a=a+Math.imul(S,H)|0,f=(f=f+Math.imul(S,N)|0)+Math.imul(C,H)|0,h=h+Math.imul(C,N)|0;var $t=(b+(a=a+Math.imul(ct,tt)|0)|0)+((8191&(f=(f=f+Math.imul(ct,lt)|0)+Math.imul(Tt,tt)|0))<<13)|0;b=((h=h+Math.imul(Tt,lt)|0)+(f>>>13)|0)+($t>>>26)|0,$t&=67108863,a=Math.imul(Dt,wt),f=(f=Math.imul(Dt,se))+Math.imul(Se,wt)|0,h=Math.imul(Se,se),a=a+Math.imul(xt,Et)|0,f=(f=f+Math.imul(xt,de)|0)+Math.imul(Qt,Et)|0,h=h+Math.imul(Qt,de)|0,a=a+Math.imul(it,Mt)|0,f=(f=f+Math.imul(it,$)|0)+Math.imul(qt,Mt)|0,h=h+Math.imul(qt,$)|0,a=a+Math.imul(F,H)|0,f=(f=f+Math.imul(F,N)|0)+Math.imul(et,H)|0,h=h+Math.imul(et,N)|0;var oe=(b+(a=a+Math.imul(S,tt)|0)|0)+((8191&(f=(f=f+Math.imul(S,lt)|0)+Math.imul(C,tt)|0))<<13)|0;b=((h=h+Math.imul(C,lt)|0)+(f>>>13)|0)+(oe>>>26)|0,oe&=67108863,a=Math.imul(Dt,Et),f=(f=Math.imul(Dt,de))+Math.imul(Se,Et)|0,h=Math.imul(Se,de),a=a+Math.imul(xt,Mt)|0,f=(f=f+Math.imul(xt,$)|0)+Math.imul(Qt,Mt)|0,h=h+Math.imul(Qt,$)|0,a=a+Math.imul(it,H)|0,f=(f=f+Math.imul(it,N)|0)+Math.imul(qt,H)|0,h=h+Math.imul(qt,N)|0;var Jt=(b+(a=a+Math.imul(F,tt)|0)|0)+((8191&(f=(f=f+Math.imul(F,lt)|0)+Math.imul(et,tt)|0))<<13)|0;b=((h=h+Math.imul(et,lt)|0)+(f>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(Dt,Mt),f=(f=Math.imul(Dt,$))+Math.imul(Se,Mt)|0,h=Math.imul(Se,$),a=a+Math.imul(xt,H)|0,f=(f=f+Math.imul(xt,N)|0)+Math.imul(Qt,H)|0,h=h+Math.imul(Qt,N)|0;var le=(b+(a=a+Math.imul(it,tt)|0)|0)+((8191&(f=(f=f+Math.imul(it,lt)|0)+Math.imul(qt,tt)|0))<<13)|0;b=((h=h+Math.imul(qt,lt)|0)+(f>>>13)|0)+(le>>>26)|0,le&=67108863,a=Math.imul(Dt,H),f=(f=Math.imul(Dt,N))+Math.imul(Se,H)|0,h=Math.imul(Se,N);var ae=(b+(a=a+Math.imul(xt,tt)|0)|0)+((8191&(f=(f=f+Math.imul(xt,lt)|0)+Math.imul(Qt,tt)|0))<<13)|0;b=((h=h+Math.imul(Qt,lt)|0)+(f>>>13)|0)+(ae>>>26)|0,ae&=67108863;var ne=(b+(a=Math.imul(Dt,tt))|0)+((8191&(f=(f=Math.imul(Dt,lt))+Math.imul(Se,tt)|0))<<13)|0;return b=((h=Math.imul(Se,lt))+(f>>>13)|0)+(ne>>>26)|0,ne&=67108863,I[0]=at,I[1]=ht,I[2]=zt,I[3]=Zt,I[4]=ye,I[5]=Yt,I[6]=pe,I[7]=ve,I[8]=ge,I[9]=ie,I[10]=ue,I[11]=fe,I[12]=ce,I[13]=$t,I[14]=oe,I[15]=Jt,I[16]=le,I[17]=ae,I[18]=ne,b!==0&&(I[19]=b,o.length++),o};function B(x,d,o){o.negative=d.negative^x.negative,o.length=x.length+d.length;for(var a=0,f=0,h=0;h>>26)|0)>>>26,g&=67108863}o.words[h]=A,a=g,g=f}return a!==0?o.words[h]=a:o.length--,o._strip()}function P(x,d,o){return B(x,d,o)}Math.imul||(k=_),s.prototype.mulTo=function(x,d){var o=this.length+x.length;return this.length===10&&x.length===10?k(this,x,d):o<63?_(this,x,d):o<1024?B(this,x,d):P(this,x,d)},s.prototype.mul=function(x){var d=new s(null);return d.words=new Array(this.length+x.length),this.mulTo(x,d)},s.prototype.mulf=function(x){var d=new s(null);return d.words=new Array(this.length+x.length),P(this,x,d)},s.prototype.imul=function(x){return this.clone().mulTo(x,this)},s.prototype.imuln=function(x){var d=x<0;d&&(x=-x),e(typeof x=="number"),e(x<67108864);for(var o=0,a=0;a>=26,o+=f/67108864|0,o+=h>>>26,this.words[a]=67108863&h}return o!==0&&(this.words[a]=o,this.length++),d?this.ineg():this},s.prototype.muln=function(x){return this.clone().imuln(x)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(x){var d=function(h){for(var g=new Array(h.bitLength()),A=0;A>>b&1}return g}(x);if(d.length===0)return new s(1);for(var o=this,a=0;a=0);var d,o=x%26,a=(x-o)/26,f=67108863>>>26-o<<26-o;if(o!==0){var h=0;for(d=0;d>>26-o}h&&(this.words[d]=h,this.length++)}if(a!==0){for(d=this.length-1;d>=0;d--)this.words[d+a]=this.words[d];for(d=0;d=0),a=d?(d-d%26)/26:0;var f=x%26,h=Math.min((x-f)/26,this.length),g=67108863^67108863>>>f<h)for(this.length-=h,I=0;I=0&&(b!==0||I>=a);I--){var u=0|this.words[I];this.words[I]=b<<26-f|u>>>f,b=u&g}return A&&b!==0&&(A.words[A.length++]=b),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(x,d,o){return e(this.negative===0),this.iushrn(x,d,o)},s.prototype.shln=function(x){return this.clone().ishln(x)},s.prototype.ushln=function(x){return this.clone().iushln(x)},s.prototype.shrn=function(x){return this.clone().ishrn(x)},s.prototype.ushrn=function(x){return this.clone().iushrn(x)},s.prototype.testn=function(x){e(typeof x=="number"&&x>=0);var d=x%26,o=(x-d)/26,a=1<=0);var d=x%26,o=(x-d)/26;if(e(this.negative===0,"imaskn works only with positive numbers"),this.length<=o)return this;if(d!==0&&o++,this.length=Math.min(o,this.length),d!==0){var a=67108863^67108863>>>d<=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},s.prototype.isubn=function(x){if(e(typeof x=="number"),e(x<67108864),x<0)return this.iaddn(-x);if(this.negative!==0)return this.negative=0,this.iaddn(x),this.negative=1,this;if(this.words[0]-=x,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d>26)-(A/67108864|0),this.words[a+o]=67108863&f}for(;a>26,this.words[a+o]=67108863&f;if(g===0)return this._strip();for(e(g===-1),g=0,a=0;a>26,this.words[a]=67108863&f;return this.negative=1,this._strip()},s.prototype._wordDiv=function(x,d){var o=(this.length,x.length),a=this.clone(),f=x,h=0|f.words[f.length-1];(o=26-this._countBits(h))!=0&&(f=f.ushln(o),a.iushln(o),h=0|f.words[f.length-1]);var g,A=a.length-f.length;if(d!=="mod"){(g=new s(null)).length=A+1,g.words=new Array(g.length);for(var I=0;I=0;u--){var m=67108864*(0|a.words[f.length+u])+(0|a.words[f.length+u-1]);for(m=Math.min(m/h|0,67108863),a._ishlnsubmul(f,m,u);a.negative!==0;)m--,a.negative=0,a._ishlnsubmul(f,1,u),a.isZero()||(a.negative^=1);g&&(g.words[u]=m)}return g&&g._strip(),a._strip(),d!=="div"&&o!==0&&a.iushrn(o),{div:g||null,mod:a}},s.prototype.divmod=function(x,d,o){return e(!x.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:this.negative!==0&&x.negative===0?(h=this.neg().divmod(x,d),d!=="mod"&&(a=h.div.neg()),d!=="div"&&(f=h.mod.neg(),o&&f.negative!==0&&f.iadd(x)),{div:a,mod:f}):this.negative===0&&x.negative!==0?(h=this.divmod(x.neg(),d),d!=="mod"&&(a=h.div.neg()),{div:a,mod:h.mod}):this.negative&x.negative?(h=this.neg().divmod(x.neg(),d),d!=="div"&&(f=h.mod.neg(),o&&f.negative!==0&&f.isub(x)),{div:h.div,mod:f}):x.length>this.length||this.cmp(x)<0?{div:new s(0),mod:this}:x.length===1?d==="div"?{div:this.divn(x.words[0]),mod:null}:d==="mod"?{div:null,mod:new s(this.modrn(x.words[0]))}:{div:this.divn(x.words[0]),mod:new s(this.modrn(x.words[0]))}:this._wordDiv(x,d);var a,f,h},s.prototype.div=function(x){return this.divmod(x,"div",!1).div},s.prototype.mod=function(x){return this.divmod(x,"mod",!1).mod},s.prototype.umod=function(x){return this.divmod(x,"mod",!0).mod},s.prototype.divRound=function(x){var d=this.divmod(x);if(d.mod.isZero())return d.div;var o=d.div.negative!==0?d.mod.isub(x):d.mod,a=x.ushrn(1),f=x.andln(1),h=o.cmp(a);return h<0||f===1&&h===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},s.prototype.modrn=function(x){var d=x<0;d&&(x=-x),e(x<=67108863);for(var o=(1<<26)%x,a=0,f=this.length-1;f>=0;f--)a=(o*a+(0|this.words[f]))%x;return d?-a:a},s.prototype.modn=function(x){return this.modrn(x)},s.prototype.idivn=function(x){var d=x<0;d&&(x=-x),e(x<=67108863);for(var o=0,a=this.length-1;a>=0;a--){var f=(0|this.words[a])+67108864*o;this.words[a]=f/x|0,o=f%x}return this._strip(),d?this.ineg():this},s.prototype.divn=function(x){return this.clone().idivn(x)},s.prototype.egcd=function(x){e(x.negative===0),e(!x.isZero());var d=this,o=x.clone();d=d.negative!==0?d.umod(x):d.clone();for(var a=new s(1),f=new s(0),h=new s(0),g=new s(1),A=0;d.isEven()&&o.isEven();)d.iushrn(1),o.iushrn(1),++A;for(var I=o.clone(),b=d.clone();!d.isZero();){for(var u=0,m=1;!(d.words[0]&m)&&u<26;++u,m<<=1);if(u>0)for(d.iushrn(u);u-- >0;)(a.isOdd()||f.isOdd())&&(a.iadd(I),f.isub(b)),a.iushrn(1),f.iushrn(1);for(var L=0,q=1;!(o.words[0]&q)&&L<26;++L,q<<=1);if(L>0)for(o.iushrn(L);L-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(I),g.isub(b)),h.iushrn(1),g.iushrn(1);d.cmp(o)>=0?(d.isub(o),a.isub(h),f.isub(g)):(o.isub(d),h.isub(a),g.isub(f))}return{a:h,b:g,gcd:o.iushln(A)}},s.prototype._invmp=function(x){e(x.negative===0),e(!x.isZero());var d=this,o=x.clone();d=d.negative!==0?d.umod(x):d.clone();for(var a,f=new s(1),h=new s(0),g=o.clone();d.cmpn(1)>0&&o.cmpn(1)>0;){for(var A=0,I=1;!(d.words[0]&I)&&A<26;++A,I<<=1);if(A>0)for(d.iushrn(A);A-- >0;)f.isOdd()&&f.iadd(g),f.iushrn(1);for(var b=0,u=1;!(o.words[0]&u)&&b<26;++b,u<<=1);if(b>0)for(o.iushrn(b);b-- >0;)h.isOdd()&&h.iadd(g),h.iushrn(1);d.cmp(o)>=0?(d.isub(o),f.isub(h)):(o.isub(d),h.isub(f))}return(a=d.cmpn(1)===0?f:h).cmpn(0)<0&&a.iadd(x),a},s.prototype.gcd=function(x){if(this.isZero())return x.abs();if(x.isZero())return this.abs();var d=this.clone(),o=x.clone();d.negative=0,o.negative=0;for(var a=0;d.isEven()&&o.isEven();a++)d.iushrn(1),o.iushrn(1);for(;;){for(;d.isEven();)d.iushrn(1);for(;o.isEven();)o.iushrn(1);var f=d.cmp(o);if(f<0){var h=d;d=o,o=h}else if(f===0||o.cmpn(1)===0)break;d.isub(o)}return o.iushln(a)},s.prototype.invm=function(x){return this.egcd(x).a.umod(x)},s.prototype.isEven=function(){return(1&this.words[0])==0},s.prototype.isOdd=function(){return(1&this.words[0])==1},s.prototype.andln=function(x){return this.words[0]&x},s.prototype.bincn=function(x){e(typeof x=="number");var d=x%26,o=(x-d)/26,a=1<>>26,g&=67108863,this.words[h]=g}return f!==0&&(this.words[h]=f,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(x){var d,o=x<0;if(this.negative!==0&&!o)return-1;if(this.negative===0&&o)return 1;if(this._strip(),this.length>1)d=1;else{o&&(x=-x),e(x<=67108863,"Number is too big");var a=0|this.words[0];d=a===x?0:ax.length)return 1;if(this.length=0;o--){var a=0|this.words[o],f=0|x.words[o];if(a!==f){af&&(d=1);break}}return d},s.prototype.gtn=function(x){return this.cmpn(x)===1},s.prototype.gt=function(x){return this.cmp(x)===1},s.prototype.gten=function(x){return this.cmpn(x)>=0},s.prototype.gte=function(x){return this.cmp(x)>=0},s.prototype.ltn=function(x){return this.cmpn(x)===-1},s.prototype.lt=function(x){return this.cmp(x)===-1},s.prototype.lten=function(x){return this.cmpn(x)<=0},s.prototype.lte=function(x){return this.cmp(x)<=0},s.prototype.eqn=function(x){return this.cmpn(x)===0},s.prototype.eq=function(x){return this.cmp(x)===0},s.red=function(x){return new nt(x)},s.prototype.toRed=function(x){return e(!this.red,"Already a number in reduction context"),e(this.negative===0,"red works only with positives"),x.convertTo(this)._forceRed(x)},s.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(x){return this.red=x,this},s.prototype.forceRed=function(x){return e(!this.red,"Already a number in reduction context"),this._forceRed(x)},s.prototype.redAdd=function(x){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,x)},s.prototype.redIAdd=function(x){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,x)},s.prototype.redSub=function(x){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,x)},s.prototype.redISub=function(x){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,x)},s.prototype.redShl=function(x){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,x)},s.prototype.redMul=function(x){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,x),this.red.mul(this,x)},s.prototype.redIMul=function(x){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,x),this.red.imul(this,x)},s.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(x){return e(this.red&&!x.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,x)};var R={k256:null,p224:null,p192:null,p25519:null};function T(x,d){this.name=x,this.p=new s(d,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function U(){T.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function j(){T.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function Y(){T.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function rt(){T.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function nt(x){if(typeof x=="string"){var d=s._prime(x);this.m=d.p,this.prime=d}else e(x.gtn(1),"modulus must be greater than 1"),this.m=x,this.prime=null}function Z(x){nt.call(this,x),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(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)}T.prototype._tmp=function(){var x=new s(null);return x.words=new Array(Math.ceil(this.n/13)),x},T.prototype.ireduce=function(x){var d,o=x;do this.split(o,this.tmp),d=(o=(o=this.imulK(o)).iadd(this.tmp)).bitLength();while(d>this.n);var a=d0?o.isub(this.p):o.strip!==void 0?o.strip():o._strip(),o},T.prototype.split=function(x,d){x.iushrn(this.n,0,d)},T.prototype.imulK=function(x){return x.imul(this.k)},n(U,T),U.prototype.split=function(x,d){for(var o=4194303,a=Math.min(x.length,9),f=0;f>>22,h=g}h>>>=22,x.words[f-10]=h,h===0&&x.length>10?x.length-=10:x.length-=9},U.prototype.imulK=function(x){x.words[x.length]=0,x.words[x.length+1]=0,x.length+=2;for(var d=0,o=0;o>>=26,x.words[o]=f,d=a}return d!==0&&(x.words[x.length++]=d),x},s._prime=function(x){if(R[x])return R[x];var d;if(x==="k256")d=new U;else if(x==="p224")d=new j;else if(x==="p192")d=new Y;else{if(x!=="p25519")throw new Error("Unknown prime "+x);d=new rt}return R[x]=d,d},nt.prototype._verify1=function(x){e(x.negative===0,"red works only with positives"),e(x.red,"red works only with red numbers")},nt.prototype._verify2=function(x,d){e((x.negative|d.negative)==0,"red works only with positives"),e(x.red&&x.red===d.red,"red works only with red numbers")},nt.prototype.imod=function(x){return this.prime?this.prime.ireduce(x)._forceRed(this):(v(x,x.umod(this.m)._forceRed(this)),x)},nt.prototype.neg=function(x){return x.isZero()?x.clone():this.m.sub(x)._forceRed(this)},nt.prototype.add=function(x,d){this._verify2(x,d);var o=x.add(d);return o.cmp(this.m)>=0&&o.isub(this.m),o._forceRed(this)},nt.prototype.iadd=function(x,d){this._verify2(x,d);var o=x.iadd(d);return o.cmp(this.m)>=0&&o.isub(this.m),o},nt.prototype.sub=function(x,d){this._verify2(x,d);var o=x.sub(d);return o.cmpn(0)<0&&o.iadd(this.m),o._forceRed(this)},nt.prototype.isub=function(x,d){this._verify2(x,d);var o=x.isub(d);return o.cmpn(0)<0&&o.iadd(this.m),o},nt.prototype.shl=function(x,d){return this._verify1(x),this.imod(x.ushln(d))},nt.prototype.imul=function(x,d){return this._verify2(x,d),this.imod(x.imul(d))},nt.prototype.mul=function(x,d){return this._verify2(x,d),this.imod(x.mul(d))},nt.prototype.isqr=function(x){return this.imul(x,x.clone())},nt.prototype.sqr=function(x){return this.mul(x,x)},nt.prototype.sqrt=function(x){if(x.isZero())return x.clone();var d=this.m.andln(3);if(e(d%2==1),d===3){var o=this.m.add(new s(1)).iushrn(2);return this.pow(x,o)}for(var a=this.m.subn(1),f=0;!a.isZero()&&a.andln(1)===0;)f++,a.iushrn(1);e(!a.isZero());var h=new s(1).toRed(this),g=h.redNeg(),A=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,A).cmp(g)!==0;)I.redIAdd(g);for(var b=this.pow(I,a),u=this.pow(x,a.addn(1).iushrn(1)),m=this.pow(x,a),L=f;m.cmp(h)!==0;){for(var q=m,z=0;q.cmp(h)!==0;z++)q=q.redSqr();e(z=0;a--){for(var I=d.words[a],b=A-1;b>=0;b--){var u=I>>b&1;f!==o[0]&&(f=this.sqr(f)),u!==0||h!==0?(h<<=1,h|=u,(++g==4||a===0&&b===0)&&(f=this.mul(f,o[h]),g=0,h=0)):g=0}A=26}return f},nt.prototype.convertTo=function(x){var d=x.umod(this.m);return d===x?d.clone():d},nt.prototype.convertFrom=function(x){var d=x.clone();return d.red=null,d},s.mont=function(x){return new Z(x)},n(Z,nt),Z.prototype.convertTo=function(x){return this.imod(x.ushln(this.shift))},Z.prototype.convertFrom=function(x){var d=this.imod(x.mul(this.rinv));return d.red=null,d},Z.prototype.imul=function(x,d){if(x.isZero()||d.isZero())return x.words[0]=0,x.length=1,x;var o=x.imul(d),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=o.isub(a).iushrn(this.shift),h=f;return f.cmp(this.m)>=0?h=f.isub(this.m):f.cmpn(0)<0&&(h=f.iadd(this.m)),h._forceRed(this)},Z.prototype.mul=function(x,d){if(x.isZero()||d.isZero())return new s(0)._forceRed(this);var o=x.mul(d),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=o.isub(a).iushrn(this.shift),h=f;return f.cmp(this.m)>=0?h=f.isub(this.m):f.cmpn(0)<0&&(h=f.iadd(this.m)),h._forceRed(this)},Z.prototype.invm=function(x){return this.imod(x._invmp(this.m).mul(this.r2))._forceRed(this)}})(SE,Ke);var Ay=SE.exports,hh=xo(Ay),c2={exports:{}};(function(r,t){var e=Ae,n=e.Buffer;function s(c,l){for(var p in c)l[p]=c[p]}function i(c,l,p){return n(c,l,p)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?r.exports=e:(s(e,t),t.Buffer=i),i.prototype=Object.create(n.prototype),s(n,i),i.from=function(c,l,p){if(typeof c=="number")throw new TypeError("Argument must not be a number");return n(c,l,p)},i.alloc=function(c,l,p){if(typeof c!="number")throw new TypeError("Argument must be a number");var v=n(c);return l!==void 0?typeof p=="string"?v.fill(l,p):v.fill(l):v.fill(0),v},i.allocUnsafe=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return n(c)},i.allocUnsafeSlow=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return e.SlowBuffer(c)}})(c2,c2.exports);var B0=c2.exports.Buffer,Sy=function(r){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),e=0;e>>0,B=new Uint8Array(k);E[M];){var P=t[E.charCodeAt(M)];if(P===255)return;for(var R=0,T=k-1;(P!==0||R<_)&&T!==-1;T--,R++)P+=c*B[T]>>>0,B[T]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");_=R,M++}for(var U=k-_;U!==k&&B[U]===0;)U++;var j=B0.allocUnsafe(w+(k-U));j.fill(0,0,w);for(var Y=w;U!==k;)j[Y++]=B[U++];return j}return{encode:function(E){if((Array.isArray(E)||E instanceof Uint8Array)&&(E=B0.from(E)),!B0.isBuffer(E))throw new TypeError("Expected Buffer");if(E.length===0)return"";for(var M=0,w=0,_=0,k=E.length;_!==k&&E[_]===0;)_++,M++;for(var B=(k-_)*v+1>>>0,P=new Uint8Array(B);_!==k;){for(var R=E[_],T=0,U=B-1;(R!==0||T>>0,P[U]=R%c>>>0,R=R/c>>>0;if(R!==0)throw new Error("Non-zero carry");w=T,_++}for(var j=B-w;j!==B&&P[j]===0;)j++;for(var Y=l.repeat(M);jr&t^~r&e,XF=(r,t,e)=>r&t^r&e^t&e,JF=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]),zs=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),qs=new Uint32Array(64);class QF extends pE{constructor(){super(64,32,8,!1),this.A=0|zs[0],this.B=0|zs[1],this.C=0|zs[2],this.D=0|zs[3],this.E=0|zs[4],this.F=0|zs[5],this.G=0|zs[6],this.H=0|zs[7]}get(){const{A:t,B:e,C:n,D:s,E:i,F:c,G:l,H:p}=this;return[t,e,n,s,i,c,l,p]}set(t,e,n,s,i,c,l,p){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|s,this.E=0|i,this.F=0|c,this.G=0|l,this.H=0|p}process(t,e){for(let E=0;E<16;E++,e+=4)qs[E]=t.getUint32(e,!1);for(let E=16;E<64;E++){const M=qs[E-15],w=qs[E-2],_=Eo(M,7)^Eo(M,18)^M>>>3,k=Eo(w,17)^Eo(w,19)^w>>>10;qs[E]=k+qs[E-7]+_+qs[E-16]|0}let{A:n,B:s,C:i,D:c,E:l,F:p,G:v,H:y}=this;for(let E=0;E<64;E++){const M=y+(Eo(l,6)^Eo(l,11)^Eo(l,25))+YF(l,p,v)+JF[E]+qs[E]|0,w=(Eo(n,2)^Eo(n,13)^Eo(n,22))+XF(n,s,i)|0;y=v,v=p,p=l,l=c+M|0,c=i,i=s,s=n,n=M+w|0}n=n+this.A|0,s=s+this.B|0,i=i+this.C|0,c=c+this.D|0,l=l+this.E|0,p=p+this.F|0,v=v+this.G|0,y=y+this.H|0,this.set(n,s,i,c,l,p,v,y)}roundClean(){qs.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const fu=xy(()=>new QF);var Ln={},tj=Sy("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function ws(r,t,e){return t<=r&&r<=e}function Pl(r){if(r===void 0)return{};if(r===Object(r))return r;throw TypeError("Could not convert argument to dictionary")}function h2(r){this.tokens=[].slice.call(r)}h2.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(r){if(Array.isArray(r))for(var t=r;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(r)},push:function(r){if(Array.isArray(r))for(var t=r;t.length;)this.tokens.push(t.shift());else this.tokens.push(r)}};var qu=-1;function Bm(r,t){if(r)throw TypeError("Decoder error");return t||65533}var Rl="utf-8";function Cl(r,t){if(!(this instanceof Cl))return new Cl(r,t);if((r=r!==void 0?String(r).toLowerCase():Rl)!==Rl)throw new Error("Encoding not supported. Only utf-8 is supported");t=Pl(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function Tl(r,t){if(!(this instanceof Tl))return new Tl(r,t);if((r=r!==void 0?String(r).toLowerCase():Rl)!==Rl)throw new Error("Encoding not supported. Only utf-8 is supported");t=Pl(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}function ej(r){var t=r.fatal,e=0,n=0,s=0,i=128,c=191;this.handler=function(l,p){if(p===-1&&s!==0)return s=0,Bm(t);if(p===-1)return qu;if(s===0){if(ws(p,0,127))return p;if(ws(p,194,223))s=1,e=p-192;else if(ws(p,224,239))p===224&&(i=160),p===237&&(c=159),s=2,e=p-224;else{if(!ws(p,240,244))return Bm(t);p===240&&(i=144),p===244&&(c=143),s=3,e=p-240}return e<<=6*s,null}if(!ws(p,i,c))return e=s=n=0,i=128,c=191,l.prepend(p),Bm(t);if(i=128,c=191,e+=p-128<<6*(s-(n+=1)),n!==s)return null;var v=e;return e=s=n=0,v}}function rj(r){r.fatal,this.handler=function(t,e){if(e===-1)return qu;if(ws(e,0,127))return e;var n,s;ws(e,128,2047)?(n=1,s=192):ws(e,2048,65535)?(n=2,s=224):ws(e,65536,1114111)&&(n=3,s=240);for(var i=[(e>>6*n)+s];n>0;){var c=e>>6*(n-1);i.push(128|63&c),n-=1}return i}}Cl.prototype={decode:function(r,t){var e;e=typeof r=="object"&&r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="object"&&"buffer"in r&&r.buffer instanceof ArrayBuffer?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(0),t=Pl(t),this._streaming||(this._decoder=new ej({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!t.stream;for(var n,s=new h2(e),i=[];!s.endOfStream()&&(n=this._decoder.handler(s,s.read()))!==qu;)n!==null&&(Array.isArray(n)?i.push.apply(i,n):i.push(n));if(!this._streaming){do{if((n=this._decoder.handler(s,s.read()))===qu)break;n!==null&&(Array.isArray(n)?i.push.apply(i,n):i.push(n))}while(!s.endOfStream());this._decoder=null}return i.length&&(["utf-8"].indexOf(this.encoding)===-1||this._ignoreBOM||this._BOMseen||(i[0]===65279?(this._BOMseen=!0,i.shift()):this._BOMseen=!0)),function(c){for(var l="",p=0;p>10),56320+(1023&v)))}return l}(i)}},Tl.prototype={encode:function(r,t){r=r?String(r):"",t=Pl(t),this._streaming||(this._encoder=new rj(this._options)),this._streaming=!!t.stream;for(var e,n=[],s=new h2(function(i){for(var c=String(i),l=c.length,p=0,v=[];p57343)v.push(y);else if(56320<=y&&y<=57343)v.push(65533);else if(55296<=y&&y<=56319)if(p===l-1)v.push(65533);else{var E=i.charCodeAt(p+1);if(56320<=E&&E<=57343){var M=1023&y,w=1023&E;v.push(65536+(M<<10)+w),p+=1}else v.push(65533)}p+=1}return v}(r));!s.endOfStream()&&(e=this._encoder.handler(s,s.read()))!==qu;)Array.isArray(e)?n.push.apply(n,e):n.push(e);if(!this._streaming){for(;(e=this._encoder.handler(s,s.read()))!==qu;)Array.isArray(e)?n.push.apply(n,e):n.push(e);this._encoder=null}return new Uint8Array(n)}};var nj=Zh(Object.freeze({__proto__:null,TextEncoder:Tl,TextDecoder:Cl})),ij=Ke&&Ke.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e),Object.defineProperty(r,n,{enumerable:!0,get:function(){return t[e]}})}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),oj=Ke&&Ke.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),Ao=Ke&&Ke.__decorate||function(r,t,e,n){var s,i=arguments.length,c=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(r,t,e,n);else for(var l=r.length-1;l>=0;l--)(s=r[l])&&(c=(i<3?s(c):i>3?s(t,e,c):s(t,e))||c);return i>3&&c&&Object.defineProperty(t,e,c),c},sj=Ke&&Ke.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.hasOwnProperty.call(r,e)&&ij(t,r,e);return oj(t,r),t},IE=Ke&&Ke.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Ln,"__esModule",{value:!0});var BE=Ln.deserializeUnchecked=TE=Ln.deserialize=ky=Ln.serialize=Ln.BinaryReader=Ln.BinaryWriter=Ln.BorshError=Ln.baseDecode=Ln.baseEncode=void 0;const Gs=IE(Ay),Z5=IE(tj),aj=sj(nj),uj=new(typeof TextDecoder!="function"?aj.TextDecoder:TextDecoder)("utf-8",{fatal:!0});Ln.baseEncode=function(r){return typeof r=="string"&&(r=Gt.Buffer.from(r,"utf8")),Z5.default.encode(Gt.Buffer.from(r))},Ln.baseDecode=function(r){return Gt.Buffer.from(Z5.default.decode(r))};const Pm=1024;class ri extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}Ln.BorshError=ri;class PE{constructor(){this.buf=Gt.Buffer.alloc(Pm),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Gt.Buffer.concat([this.buf,Gt.Buffer.alloc(Pm)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(Gt.Buffer.from(new Gs.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(Gt.Buffer.from(new Gs.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(Gt.Buffer.from(new Gs.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(Gt.Buffer.from(new Gs.default(t).toArray("le",64)))}writeBuffer(t){this.buf=Gt.Buffer.concat([Gt.Buffer.from(this.buf.subarray(0,this.length)),t,Gt.Buffer.alloc(Pm)]),this.length+=t.length}writeString(t){this.maybeResize();const e=Gt.Buffer.from(t,"utf8");this.writeU32(e.length),this.writeBuffer(e)}writeFixedArray(t){this.writeBuffer(Gt.Buffer.from(t))}writeArray(t,e){this.maybeResize(),this.writeU32(t.length);for(const n of t)this.maybeResize(),e(n)}toArray(){return this.buf.subarray(0,this.length)}}function So(r,t,e){const n=e.value;e.value=function(...s){try{return n.apply(this,s)}catch(i){if(i instanceof RangeError){const c=i.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(c)>=0)throw new ri("Reached the end of buffer when deserializing")}throw i}}}Ln.BinaryWriter=PE;class xi{constructor(t){this.buf=t,this.offset=0}readU8(){const t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){const t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){const t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){const t=this.readBuffer(8);return new Gs.default(t,"le")}readU128(){const t=this.readBuffer(16);return new Gs.default(t,"le")}readU256(){const t=this.readBuffer(32);return new Gs.default(t,"le")}readU512(){const t=this.readBuffer(64);return new Gs.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new ri(`Expected buffer length ${t} isn't within bounds`);const e=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,e}readString(){const t=this.readU32(),e=this.readBuffer(t);try{return uj.decode(e)}catch(n){throw new ri(`Error decoding UTF-8 string: ${n}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){const e=this.readU32(),n=Array();for(let s=0;s{Ra(r,t,i,n[0],s)});else if(n.kind!==void 0)switch(n.kind){case"option":e==null?s.writeU8(0):(s.writeU8(1),Ra(r,t,e,n.type,s));break;case"map":s.writeU32(e.size),e.forEach((i,c)=>{Ra(r,t,c,n.key,s),Ra(r,t,i,n.value,s)});break;default:throw new ri(`FieldType ${n} unrecognized`)}else CE(r,e,s)}catch(i){throw i instanceof ri&&i.addToFieldPath(t),i}}function CE(r,t,e){if(typeof t.borshSerialize=="function")return void t.borshSerialize(e);const n=r.get(t.constructor);if(!n)throw new ri(`Class ${t.constructor.name} is missing in schema`);if(n.kind==="struct")n.fields.map(([s,i])=>{Ra(r,s,t[s],i,e)});else{if(n.kind!=="enum")throw new ri(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`);{const s=t[n.field];for(let i=0;iCa(r,t,e[0],n))}if(e.kind==="option")return n.readU8()?Ca(r,t,e.type,n):void 0;if(e.kind==="map"){let s=new Map;const i=n.readU32();for(let c=0;c=n.values.length)throw new ri(`Enum index: ${s} is out of range`);const[i,c]=n.values[s];return new t({[i]:Ca(r,i,c,e)})}throw new ri(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`)}var TE=Ln.deserialize=function(r,t,e,n=xi){const s=new n(e),i=Iy(r,t,s);if(s.offsetthis.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function Py(r,t){return t.property?r+"["+t.property+"]":r}Ht.Layout=Pr,Ht.nameWithProperty=Py,Ht.bindConstructorLayout=function(r,t){if(typeof r!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(r,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Pr))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");r.layout_=t,t.boundConstructor_=r,t.makeDestinationObject=()=>new r,Object.defineProperty(r.prototype,"encode",{value(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(r,"decode",{value:(e,n)=>t.decode(e,n),writable:!0})};class oi extends Pr{isCount(){throw new Error("ExternalLayout is abstract")}}Ht.ExternalLayout=oi;class LE extends oi{constructor(t=1,e){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e=0){$f(t);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}Ht.GreedyCount=LE;class Ry extends oi{constructor(t,e=0,n){if(!(t instanceof Pr))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof Zi||this.layout instanceof ho}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,n=0){return this.layout.encode(t,e,n+this.offset)}}Ht.OffsetLayout=Ry;class Zi extends Pr{constructor(t,e){if(super(t,e),6c+s.encode(l,e,n+c),0);return this.count instanceof oi&&this.count.encode(t.length,e,n),i}}Ht.Sequence=$E;class KE extends Pr{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce((i,c)=>i&&c instanceof Pr,!0))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const i of t)if(0>i.span&&i.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let s=-1;try{s=t.reduce((i,c)=>i+c.getSpan(),0)}catch{}super(s,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce((s,i)=>{const c=i.getSpan(t,e);return e+=c,s+c},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e=0){$f(t);const n=this.makeDestinationObject();for(const s of this.fields)if(s.property!==void 0&&(n[s.property]=s.decode(t,e)),e+=s.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n=0){const s=n;let i=0,c=0;for(const l of this.fields){let p=l.span;if(c=0p&&(p=l.getSpan(e,n)))}i=n,n+=p}return i+c-s}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?e=-1:0<=e&&(e+=n.span)}}}Ht.Structure=KE;class Cy{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,n){throw new Error("UnionDiscriminator is abstract")}}Ht.UnionDiscriminator=Cy;class Ll extends Cy{constructor(t,e){if(!(t instanceof oi&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}Ht.UnionLayoutDiscriminator=Ll;class Ty extends Pr{constructor(t,e,n){let s;if(t instanceof Zi||t instanceof ho)s=new Ll(new Ry(t));else if(t instanceof oi&&t.isCount())s=new Ll(t);else{if(!(t instanceof Cy))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");s=t}if(e===void 0&&(e=null),!(e===null||e instanceof Pr))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&(t instanceof Zi||t instanceof ho)&&(i+=s.layout.span)),super(i,n),this.discriminator=s,this.usesPrefixDiscriminator=t instanceof Zi||t instanceof ho,this.defaultLayout=e,this.registry={};let c=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(l){return c(l)},this.configGetSourceVariant=function(l){c=l.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(n.property&&Object.prototype.hasOwnProperty.call(t,n.property))return n}throw new Error("unable to infer src variant")}decode(t,e=0){let n;const s=this.discriminator,i=s.decode(t,e),c=this.registry[i];if(c===void 0){const l=this.defaultLayout;let p=0;this.usesPrefixDiscriminator&&(p=s.layout.span),n=this.makeDestinationObject(),n[s.property]=i,n[l.property]=l.decode(t,e+p)}else n=c.decode(t,e);return n}encode(t,e,n=0){const s=this.getSourceVariant(t);if(s===void 0){const i=this.discriminator,c=this.defaultLayout;let l=0;return this.usesPrefixDiscriminator&&(l=i.layout.span),i.encode(t[i.property],e,n),l+c.encode(t[c.property],e,n+l)}return s.encode(t,e,n)}addVariant(t,e,n){const s=new HE(this,t,e,n);return this.registry[t]=s,s}getVariant(t,e=0){let n;return n=t instanceof Uint8Array?this.discriminator.decode(t,e):t,this.registry[n]}}Ht.Union=Ty;class HE extends Pr{constructor(t,e,n,s){if(!(t instanceof Ty))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&s===void 0&&(s=n,n=null),n){if(!(n instanceof Pr))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof s!="string")throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,s),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let s=0;return this.layout&&(s=this.layout.getSpan(t,e+n)),n+s}decode(t,e=0){const n=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let s=0;return this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+s):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n=0){let s=0;if(this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=s;if(this.layout&&(this.layout.encode(t[this.property],e,n+s),i+=this.layout.getSpan(e,n+s),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function Tu(r){return 0>r&&(r+=4294967296),r}Ht.VariantLayout=HE;class Ly extends Pr{constructor(t,e,n){if(!(t instanceof Zi||t instanceof ho))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof e=="string"&&n===void 0&&(n=e,e=!1),4=e)throw new TypeError("bits must be positive integer");const s=8*t.span,i=t.fields.reduce((c,l)=>c+l.bits,0);if(e+i>s)throw new Error("bits too long for span remainder ("+(s-i)+" of "+s+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(typeof t!="number"||!Number.isInteger(t)||t!==Tu(t&this.valueMask))throw new TypeError(Py("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=Tu(t<n&&(n=this.length.decode(t,e)),n}decode(t,e=0){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),_r(t).slice(e,e+n)}encode(t,e,n){let s=this.length;if(this.length instanceof oi&&(s=t.length),!(t instanceof Uint8Array&&s===t.length))throw new TypeError(Py("Blob.encode",this)+" requires (length "+s+") Uint8Array as src");if(n+s>e.length)throw new RangeError("encoding overruns Uint8Array");const i=_r(t);return _r(e).write(i.toString("hex"),n,s,"hex"),this.length instanceof oi&&this.length.encode(s,e,n),s}}Ht.Blob=ZE;class WE extends Pr{constructor(t){super(-1,t)}getSpan(t,e=0){$f(t);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");const c=_r(e);return s.copy(c,n),c[n+i]=0,i+1}}Ht.CString=WE;class GE extends Pr{constructor(t,e){if(typeof t=="string"&&e===void 0&&(e=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return $f(t),t.length-e}decode(t,e=0){const n=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return s.copy(_r(e),n),i}}Ht.UTF8=GE;class YE extends Pr{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,n){return 0}}Ht.Constant=YE,Ht.greedy=(r,t)=>new LE(r,t);var ia=Ht.offset=(r,t,e)=>new Ry(r,t,e),or=Ht.u8=r=>new Zi(1,r),ji=Ht.u16=r=>new Zi(2,r);Ht.u24=r=>new Zi(3,r);var Ce=Ht.u32=r=>new Zi(4,r);Ht.u40=r=>new Zi(5,r),Ht.u48=r=>new Zi(6,r);var Pn=Ht.nu64=r=>new OE(r);Ht.u16be=r=>new ho(2,r),Ht.u24be=r=>new ho(3,r),Ht.u32be=r=>new ho(4,r),Ht.u40be=r=>new ho(5,r),Ht.u48be=r=>new ho(6,r),Ht.nu64be=r=>new UE(r),Ht.s8=r=>new Ia(1,r),Ht.s16=r=>new Ia(2,r),Ht.s24=r=>new Ia(3,r),Ht.s32=r=>new Ia(4,r),Ht.s40=r=>new Ia(5,r),Ht.s48=r=>new Ia(6,r);var Ai=Ht.ns64=r=>new NE(r);Ht.s16be=r=>new Cu(2,r),Ht.s24be=r=>new Cu(3,r),Ht.s32be=r=>new Cu(4,r),Ht.s40be=r=>new Cu(5,r),Ht.s48be=r=>new Cu(6,r),Ht.ns64be=r=>new DE(r),Ht.f32=r=>new zE(r),Ht.f32be=r=>new qE(r),Ht.f64=r=>new FE(r),Ht.f64be=r=>new jE(r);var Ue=Ht.struct=(r,t,e)=>new KE(r,t,e);Ht.bits=(r,t,e)=>new Ly(r,t,e);var Nn=Ht.seq=(r,t,e)=>new $E(r,t,e);Ht.union=(r,t,e)=>new Ty(r,t,e),Ht.unionLayoutDiscriminator=(r,t)=>new Ll(r,t);var Tr=Ht.blob=(r,t)=>new ZE(r,t);Ht.cstr=r=>new WE(r),Ht.utf8=(r,t)=>new GE(r,t),Ht.constant=(r,t)=>new YE(r,t);var Wh={};Object.defineProperty(Wh,"__esModule",{value:!0});var XE=Wh.toBigIntLE=function(r){{const t=Gt.Buffer.from(r);t.reverse();const e=t.toString("hex");return e.length===0?BigInt(0):BigInt(`0x${e}`)}};Wh.toBigIntBE=function(r){{const t=r.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}};var Rm,Uy=Wh.toBufferLE=function(r,t){{const e=r.toString(16),n=Gt.Buffer.from(e.padStart(2*t,"0").slice(0,2*t),"hex");return n.reverse(),n}};Wh.toBufferBE=function(r,t){{const e=r.toString(16);return Gt.Buffer.from(e.padStart(2*t,"0").slice(0,2*t),"hex")}};class fj extends TypeError{constructor(t,e){let n;const{message:s,...i}=t,{path:c}=t;super(c.length===0?s:"At path: "+c.join(".")+" -- "+s),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var l;return(l=n)!=null?l:n=[t,...e()]}}}function oa(r){return typeof r=="object"&&r!=null}function vo(r){return typeof r=="string"?JSON.stringify(r):""+r}function cj(r,t,e,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:s,branch:i}=t,{type:c}=e,{refinement:l,message:p="Expected a value of type `"+c+"`"+(l?" with refinement `"+l+"`":"")+", but received: `"+vo(n)+"`"}=r;return{value:n,type:c,refinement:l,key:s[s.length-1],path:s,branch:i,...r,message:p}}function*W5(r,t,e,n){(function(s){return oa(s)&&typeof s[Symbol.iterator]=="function"})(r)||(r=[r]);for(const s of r){const i=cj(s,t,e,n);i&&(yield i)}}function*Ny(r,t,e={}){const{path:n=[],branch:s=[r],coerce:i=!1,mask:c=!1}=e,l={path:n,branch:s};if(i&&(r=t.coercer(r,l),c&&t.type!=="type"&&oa(t.schema)&&oa(r)&&!Array.isArray(r)))for(const v in r)t.schema[v]===void 0&&delete r[v];let p=!0;for(const v of t.validator(r,l))p=!1,yield[v,void 0];for(let[v,y,E]of t.entries(r,l)){const M=Ny(y,E,{path:v===void 0?n:[...n,v],branch:v===void 0?s:[...s,y],coerce:i,mask:c});for(const w of M)w[0]?(p=!1,yield[w[0],void 0]):i&&(y=w[1],v===void 0?r=y:r instanceof Map?r.set(v,y):r instanceof Set?r.add(y):oa(r)&&(r[v]=y))}if(p)for(const v of t.refiner(r,l))p=!1,yield[v,void 0];p&&(yield[void 0,r])}class ns{constructor(t){const{type:e,schema:n,validator:s,refiner:i,coercer:c=p=>p,entries:l=function*(){}}=t;this.type=e,this.schema=n,this.entries=l,this.coercer=c,this.validator=s?(p,v)=>W5(s(p,v),v,this,p):()=>[],this.refiner=i?(p,v)=>W5(i(p,v),v,this,p):()=>[]}assert(t){return JE(t,this)}create(t){return Ee(t,this)}is(t){return QE(t,this)}mask(t){return function(e,n){const s=lh(e,n,{coerce:!0,mask:!0});if(s[0])throw s[0];return s[1]}(t,this)}validate(t,e={}){return lh(t,this,e)}}function JE(r,t){const e=lh(r,t);if(e[0])throw e[0]}function Ee(r,t){const e=lh(r,t,{coerce:!0});if(e[0])throw e[0];return e[1]}function QE(r,t){return!lh(r,t)[0]}function lh(r,t,e={}){const n=Ny(r,t,e),s=function(i){const{done:c,value:l}=i.next();return c?void 0:l}(n);return s[0]?[new fj(s[0],function*(){for(const c of n)c[0]&&(yield c[0])}),void 0]:[void 0,s[1]]}function gu(r,t){return new ns({type:r,schema:null,validator:t})}function ke(r){return new ns({type:"array",schema:r,*entries(t){if(r&&Array.isArray(t))for(const[e,n]of t.entries())yield[e,n,r]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||"Expected an array value, but received: "+vo(t)})}function Qo(){return gu("boolean",r=>typeof r=="boolean")}function Dy(r){return gu("instance",t=>t instanceof r||"Expected a `"+r.name+"` instance, but received: "+vo(t))}function Zr(r){const t=vo(r),e=typeof r;return new ns({type:"literal",schema:e==="string"||e==="number"||e==="boolean"?r:null,validator:n=>n===r||"Expected the literal `"+t+"`, but received: "+vo(n)})}function Ie(r){return new ns({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function Ft(){return gu("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+vo(r))}function Ve(r){return new ns({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function tA(r,t){return new ns({type:"record",schema:null,*entries(e){if(oa(e))for(const n in e){const s=e[n];yield[n,n,r],yield[n,s,t]}},validator:e=>oa(e)||"Expected an object, but received: "+vo(e)})}function _e(){return gu("string",r=>typeof r=="string"||"Expected a string, but received: "+vo(r))}function zy(r){const t=gu("never",()=>!1);return new ns({type:"tuple",schema:null,*entries(e){if(Array.isArray(e)){const n=Math.max(r.length,e.length);for(let s=0;sArray.isArray(e)||"Expected an array, but received: "+vo(e)})}function we(r){const t=Object.keys(r);return new ns({type:"type",schema:r,*entries(e){if(oa(e))for(const n of t)yield[n,e[n],r[n]]},validator:e=>oa(e)||"Expected an object, but received: "+vo(e)})}function pi(r){const t=r.map(e=>e.type).join(" | ");return new ns({type:"union",schema:null,validator(e,n){const s=[];for(const i of r){const[...c]=Ny(e,i,n),[l]=c;if(!l[0])return[];for(const[p]of c)p&&s.push(p)}return["Expected the value to satisfy a union of `"+t+"`, but received: "+vo(e),...s]}})}function Gh(){return gu("unknown",()=>!0)}function Yh(r,t,e){return new ns({...r,coercer:(n,s)=>QE(n,t)?r.coercer(e(n,s),s):r.coercer(n,s)})}var hj=new Uint8Array(16);function G5(){if(!Rm&&!(Rm=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Rm(hj)}var lj=/^(?:[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 Ol(r){return typeof r=="string"&&lj.test(r)}for(var Y5,Cm,In=[],Tm=0;Tm<256;++Tm)In.push((Tm+256).toString(16).substr(1));function ul(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(In[r[t+0]]+In[r[t+1]]+In[r[t+2]]+In[r[t+3]]+"-"+In[r[t+4]]+In[r[t+5]]+"-"+In[r[t+6]]+In[r[t+7]]+"-"+In[r[t+8]]+In[r[t+9]]+"-"+In[r[t+10]]+In[r[t+11]]+In[r[t+12]]+In[r[t+13]]+In[r[t+14]]+In[r[t+15]]).toLowerCase();if(!Ol(e))throw TypeError("Stringified UUID is invalid");return e}var Lm=0,Om=0;function eA(r){if(!Ol(r))throw TypeError("Invalid UUID");var t,e=new Uint8Array(16);return e[0]=(t=parseInt(r.slice(0,8),16))>>>24,e[1]=t>>>16&255,e[2]=t>>>8&255,e[3]=255&t,e[4]=(t=parseInt(r.slice(9,13),16))>>>8,e[5]=255&t,e[6]=(t=parseInt(r.slice(14,18),16))>>>8,e[7]=255&t,e[8]=(t=parseInt(r.slice(19,23),16))>>>8,e[9]=255&t,e[10]=(t=parseInt(r.slice(24,36),16))/1099511627776&255,e[11]=t/4294967296&255,e[12]=t>>>24&255,e[13]=t>>>16&255,e[14]=t>>>8&255,e[15]=255&t,e}function rA(r,t,e){function n(s,i,c,l){if(typeof s=="string"&&(s=function(y){y=unescape(encodeURIComponent(y));for(var E=[],M=0;M>>9<<4)+1}function Ys(r,t){var e=(65535&r)+(65535&t);return(r>>16)+(t>>16)+(e>>16)<<16|65535&e}function Qd(r,t,e,n,s,i){return Ys((c=Ys(Ys(t,r),Ys(n,i)))<<(l=s)|c>>>32-l,e);var c,l}function Vn(r,t,e,n,s,i,c){return Qd(t&e|~t&n,r,t,s,i,c)}function Zn(r,t,e,n,s,i,c){return Qd(t&n|e&~n,r,t,s,i,c)}function Wn(r,t,e,n,s,i,c){return Qd(t^e^n,r,t,s,i,c)}function Gn(r,t,e,n,s,i,c){return Qd(e^(t|~n),r,t,s,i,c)}var dj=rA("v3",48,function(r){if(typeof r=="string"){var t=unescape(encodeURIComponent(r));r=new Uint8Array(t.length);for(var e=0;e>5]>>>l%32&255,v=parseInt(c.charAt(p>>>4&15)+c.charAt(15&p),16);s.push(v)}return s}(function(n,s){n[s>>5]|=128<>5]|=(255&n[c/8])<>>32-t}var vj=rA("v5",80,function(r){var t=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof r=="string"){var n=unescape(encodeURIComponent(r));r=[];for(var s=0;s>>0;T=R,R=P,P=Um(B,30)>>>0,B=k,k=Y}e[0]=e[0]+k>>>0,e[1]=e[1]+B>>>0,e[2]=e[2]+P>>>0,e[3]=e[3]+R>>>0,e[4]=e[4]+T>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,255&e[0],e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,255&e[1],e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,255&e[2],e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,255&e[3],e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,255&e[4]]}),gj=vj,yj=Object.freeze({__proto__:null,v1:function(r,t,e){var n=t&&e||0,s=t||new Array(16),i=(r=r||{}).node||Y5,c=r.clockseq!==void 0?r.clockseq:Cm;if(i==null||c==null){var l=r.random||(r.rng||G5)();i==null&&(i=Y5=[1|l[0],l[1],l[2],l[3],l[4],l[5]]),c==null&&(c=Cm=16383&(l[6]<<8|l[7]))}var p=r.msecs!==void 0?r.msecs:Date.now(),v=r.nsecs!==void 0?r.nsecs:Om+1,y=p-Lm+(v-Om)/1e4;if(y<0&&r.clockseq===void 0&&(c=c+1&16383),(y<0||p>Lm)&&r.nsecs===void 0&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Lm=p,Om=v,Cm=c;var E=(1e4*(268435455&(p+=122192928e5))+v)%4294967296;s[n++]=E>>>24&255,s[n++]=E>>>16&255,s[n++]=E>>>8&255,s[n++]=255&E;var M=p/4294967296*1e4&268435455;s[n++]=M>>>8&255,s[n++]=255&M,s[n++]=M>>>24&15|16,s[n++]=M>>>16&255,s[n++]=c>>>8|128,s[n++]=255&c;for(var w=0;w<6;++w)s[n+w]=i[w];return t||ul(s)},v3:pj,v4:function(r,t,e){var n=(r=r||{}).random||(r.rng||G5)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){e=e||0;for(var s=0;s<16;++s)t[e+s]=n[s];return t}return ul(n)},v5:gj,NIL:"00000000-0000-0000-0000-000000000000",version:function(r){if(!Ol(r))throw TypeError("Invalid UUID");return parseInt(r.substr(14,1),16)},validate:Ol,stringify:ul,parse:eA}),nA=Zh(yj);const bj=nA.v4;var wj=function(r,t,e,n){if(typeof r!="string")throw new TypeError(r+" must be a string");const s=typeof(n=n||{}).version=="number"?n.version:2;if(s!==1&&s!==2)throw new TypeError(s+" must be 1 or 2");const i={method:r};if(s===2&&(i.jsonrpc="2.0"),t){if(typeof t!="object"&&!Array.isArray(t))throw new TypeError(t+" must be an object, array or omitted");i.params=t}if(e===void 0){const c=typeof n.generator=="function"?n.generator:function(){return bj()};i.id=c(i,n)}else s===2&&e===null?n.notificationIdNull&&(i.id=null):i.id=e;return i};const xj=nA.v4,_j=wj,dh=function(r,t){if(!(this instanceof dh))return new dh(r,t);t||(t={}),this.options={reviver:t.reviver!==void 0?t.reviver:null,replacer:t.replacer!==void 0?t.replacer:null,generator:t.generator!==void 0?t.generator:function(){return xj()},version:t.version!==void 0?t.version:2,notificationIdNull:typeof t.notificationIdNull=="boolean"&&t.notificationIdNull},this.callServer=r};var Mj=dh;dh.prototype.request=function(r,t,e,n){const s=this;let i=null;const c=Array.isArray(r)&&typeof t=="function";if(this.options.version===1&&c)throw new TypeError("JSON-RPC 1.0 does not support batching");if(c||!c&&r&&typeof r=="object"&&typeof t=="function")n=t,i=r;else{typeof e=="function"&&(n=e,e=void 0);const p=typeof n=="function";try{i=_j(r,t,e,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(v){if(p)return n(v);throw v}if(!p)return i}let l;try{l=JSON.stringify(i,this.options.replacer)}catch(p){return n(p)}return this.callServer(l,function(p,v){s._parseResponse(p,v,n)}),i},dh.prototype._parseResponse=function(r,t,e){if(r)return void e(r);if(!t)return e();let n;try{n=JSON.parse(t,this.options.reviver)}catch(s){return e(s)}if(e.length===3){if(Array.isArray(n)){const s=function(c){return c.error!==void 0},i=function(c){return!s(c)};return e(null,n.filter(s),n.filter(i))}return e(null,n.error,n.result)}e(null,n)};var P0,Ej=xo(Mj),iA={},oA={exports:{}};(P0=oA).exports=function(r){return r&&r.__esModule?r:{default:r}},P0.exports.__esModule=!0,P0.exports.default=P0.exports;var J5,Q5,Nm,t4,sA=oA.exports,e4={exports:{}},r4={exports:{}};function Xh(){return J5||(J5=1,function(r){function t(e){return r.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},r.exports.__esModule=!0,r.exports.default=r.exports,t(e)}r.exports=t,r.exports.__esModule=!0,r.exports.default=r.exports}(r4)),r4.exports}function Aj(){if(t4)return Nm;t4=1;var r=(Q5||(Q5=1,function(t){var e=Xh().default;function n(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t.exports=n=function(){return i},t.exports.__esModule=!0,t.exports.default=t.exports;var s,i={},c=Object.prototype,l=c.hasOwnProperty,p=Object.defineProperty||function(u,m,L){u[m]=L.value},v=typeof Symbol=="function"?Symbol:{},y=v.iterator||"@@iterator",E=v.asyncIterator||"@@asyncIterator",M=v.toStringTag||"@@toStringTag";function w(u,m,L){return Object.defineProperty(u,m,{value:L,enumerable:!0,configurable:!0,writable:!0}),u[m]}try{w({},"")}catch{w=function(m,L,q){return m[L]=q}}function _(u,m,L,q){var z=m&&m.prototype instanceof j?m:j,W=Object.create(z.prototype),ot=new I(q||[]);return p(W,"_invoke",{value:f(u,L,ot)}),W}function k(u,m,L){try{return{type:"normal",arg:u.call(m,L)}}catch(q){return{type:"throw",arg:q}}}i.wrap=_;var B="suspendedStart",P="suspendedYield",R="executing",T="completed",U={};function j(){}function Y(){}function rt(){}var nt={};w(nt,y,function(){return this});var Z=Object.getPrototypeOf,x=Z&&Z(Z(b([])));x&&x!==c&&l.call(x,y)&&(nt=x);var d=rt.prototype=j.prototype=Object.create(nt);function o(u){["next","throw","return"].forEach(function(m){w(u,m,function(L){return this._invoke(m,L)})})}function a(u,m){function L(z,W,ot,ut){var Ct=k(u[z],u,W);if(Ct.type!=="throw"){var yt=Ct.arg,mt=yt.value;return mt&&e(mt)=="object"&&l.call(mt,"__await")?m.resolve(mt.__await).then(function(jt){L("next",jt,ot,ut)},function(jt){L("throw",jt,ot,ut)}):m.resolve(mt).then(function(jt){yt.value=jt,ot(yt)},function(jt){return L("throw",jt,ot,ut)})}ut(Ct.arg)}var q;p(this,"_invoke",{value:function(z,W){function ot(){return new m(function(ut,Ct){L(z,W,ut,Ct)})}return q=q?q.then(ot,ot):ot()}})}function f(u,m,L){var q=B;return function(z,W){if(q===R)throw new Error("Generator is already running");if(q===T){if(z==="throw")throw W;return{value:s,done:!0}}for(L.method=z,L.arg=W;;){var ot=L.delegate;if(ot){var ut=h(ot,L);if(ut){if(ut===U)continue;return ut}}if(L.method==="next")L.sent=L._sent=L.arg;else if(L.method==="throw"){if(q===B)throw q=T,L.arg;L.dispatchException(L.arg)}else L.method==="return"&&L.abrupt("return",L.arg);q=R;var Ct=k(u,m,L);if(Ct.type==="normal"){if(q=L.done?T:P,Ct.arg===U)continue;return{value:Ct.arg,done:L.done}}Ct.type==="throw"&&(q=T,L.method="throw",L.arg=Ct.arg)}}}function h(u,m){var L=m.method,q=u.iterator[L];if(q===s)return m.delegate=null,L==="throw"&&u.iterator.return&&(m.method="return",m.arg=s,h(u,m),m.method==="throw")||L!=="return"&&(m.method="throw",m.arg=new TypeError("The iterator does not provide a '"+L+"' method")),U;var z=k(q,u.iterator,m.arg);if(z.type==="throw")return m.method="throw",m.arg=z.arg,m.delegate=null,U;var W=z.arg;return W?W.done?(m[u.resultName]=W.value,m.next=u.nextLoc,m.method!=="return"&&(m.method="next",m.arg=s),m.delegate=null,U):W:(m.method="throw",m.arg=new TypeError("iterator result is not an object"),m.delegate=null,U)}function g(u){var m={tryLoc:u[0]};1 in u&&(m.catchLoc=u[1]),2 in u&&(m.finallyLoc=u[2],m.afterLoc=u[3]),this.tryEntries.push(m)}function A(u){var m=u.completion||{};m.type="normal",delete m.arg,u.completion=m}function I(u){this.tryEntries=[{tryLoc:"root"}],u.forEach(g,this),this.reset(!0)}function b(u){if(u||u===""){var m=u[y];if(m)return m.call(u);if(typeof u.next=="function")return u;if(!isNaN(u.length)){var L=-1,q=function z(){for(;++L=0;--q){var z=this.tryEntries[q],W=z.completion;if(z.tryLoc==="root")return L("end");if(z.tryLoc<=this.prev){var ot=l.call(z,"catchLoc"),ut=l.call(z,"finallyLoc");if(ot&&ut){if(this.prev=0;--L){var q=this.tryEntries[L];if(q.tryLoc<=this.prev&&l.call(q,"finallyLoc")&&this.prev=0;--m){var L=this.tryEntries[m];if(L.finallyLoc===u)return this.complete(L.completion,L.afterLoc),A(L),U}},catch:function(u){for(var m=this.tryEntries.length-1;m>=0;--m){var L=this.tryEntries[m];if(L.tryLoc===u){var q=L.completion;if(q.type==="throw"){var z=q.arg;A(L)}return z}}throw new Error("illegal catch attempt")},delegateYield:function(u,m,L){return this.delegate={iterator:b(u),resultName:m,nextLoc:L},this.method==="next"&&(this.arg=s),U}},i}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(e4)),e4.exports)();Nm=r;try{regeneratorRuntime=r}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}return Nm}var n4,i4={exports:{}},o4,s4={exports:{}};function aA(){return o4||(o4=1,function(r){r.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},r.exports.__esModule=!0,r.exports.default=r.exports}(s4)),s4.exports}var a4,u4,f4,c4={exports:{}},h4={exports:{}},l4={exports:{}};function Sj(){return a4||(a4=1,function(r){var t=Xh().default;r.exports=function(e,n){if(t(e)!=="object"||e===null)return e;var s=e[Symbol.toPrimitive];if(s!==void 0){var i=s.call(e,n||"default");if(t(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)},r.exports.__esModule=!0,r.exports.default=r.exports}(l4)),l4.exports}function kj(){return u4||(u4=1,function(r){var t=Xh().default,e=Sj();r.exports=function(n){var s=e(n,"string");return t(s)==="symbol"?s:String(s)},r.exports.__esModule=!0,r.exports.default=r.exports}(h4)),h4.exports}function uA(){return f4||(f4=1,function(r){var t=kj();function e(n,s){for(var i=0;i"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}}();return function(){var k,B=(0,v.default)(w);if(_){var P=(0,v.default)(this).constructor;k=Reflect.construct(B,arguments,P)}else k=B.apply(this,arguments);return(0,p.default)(this,k)}}var M=function(w){(0,l.default)(T,w);var _,k,B,P,R=E(T);function T(U){var j,Y=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"ws://localhost:8080",rt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},nt=arguments.length>3?arguments[3]:void 0;(0,i.default)(this,T);var Z=rt.autoconnect,x=Z===void 0||Z,d=rt.reconnect,o=d===void 0||d,a=rt.reconnect_interval,f=a===void 0?1e3:a,h=rt.max_reconnects,g=h===void 0?5:h,A=function(I,b){var u={};for(var m in I)Object.prototype.hasOwnProperty.call(I,m)&&b.indexOf(m)<0&&(u[m]=I[m]);if(I!=null&&typeof Object.getOwnPropertySymbols=="function"){var L=0;for(m=Object.getOwnPropertySymbols(I);LY.current_reconnects||Y.max_reconnects===0)&&(Y.reconnect_timer_id=setTimeout(function(){return Y._connect(U,j)},Y.reconnect_interval)))})}}]),T}(y.EventEmitter);r.default=M})(iA);var Pj=xo(iA),lA={};(function(r){var t=sA;Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(v,y){return new p(v,y)};var e=t(aA()),n=t(uA()),s=t(fA()),i=t(cA()),c=t(hA());function l(v){var y=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var E,M=(0,c.default)(v);if(y){var w=(0,c.default)(this).constructor;E=Reflect.construct(M,arguments,w)}else E=M.apply(this,arguments);return(0,i.default)(this,E)}}var p=function(v){(0,s.default)(E,v);var y=l(E);function E(M,w,_){var k;return(0,e.default)(this,E),(k=y.call(this)).socket=new window.WebSocket(M,_),k.socket.onopen=function(){return k.emit("open")},k.socket.onmessage=function(B){return k.emit("message",B.data)},k.socket.onerror=function(B){return k.emit("error",B)},k.socket.onclose=function(B){k.emit("close",B.code,B.reason)},k}return(0,n.default)(E,[{key:"send",value:function(M,w,_){var k=_||w;try{this.socket.send(M),k()}catch(B){k(B)}}},{key:"close",value:function(M,w){this.socket.close(M,w)}},{key:"addEventListener",value:function(M,w,_){this.socket.addEventListener(M,w,_)}}]),E}(qy().EventEmitter)})(lA);var Rj=xo(lA);const[dA,pA,mA]=[[],[],[]],Cj=BigInt(0),bc=BigInt(1),Tj=BigInt(2),Lj=BigInt(7),Oj=BigInt(256),Uj=BigInt(113);for(let r=0,t=bc,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],dA.push(2*(5*n+e)),pA.push((r+1)*(r+2)/2%64);let s=Cj;for(let i=0;i<7;i++)t=(t<>Lj)*Uj)%Oj,t&Tj&&(s^=bc<<(bc<e>32?bE(r,t,e):gE(r,t,e),S4=(r,t,e)=>e>32?wE(r,t,e):yE(r,t,e);class Fy extends wy{constructor(t,e,n,s=!1,i=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,Bl(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var c;this.state=new Uint8Array(200),this.state32=(c=this.state,new Uint32Array(c.buffer,c.byteOffset,Math.floor(c.byteLength/4)))}keccak(){(function(t,e=24){const n=new Uint32Array(10);for(let s=24-e;s<24;s++){for(let l=0;l<10;l++)n[l]=t[l]^t[l+10]^t[l+20]^t[l+30]^t[l+40];for(let l=0;l<10;l+=2){const p=(l+8)%10,v=(l+2)%10,y=n[v],E=n[v+1],M=A4(y,E,1)^n[p],w=S4(y,E,1)^n[p+1];for(let _=0;_<50;_+=10)t[l+_]^=M,t[l+_+1]^=w}let i=t[2],c=t[3];for(let l=0;l<24;l++){const p=pA[l],v=A4(i,c,p),y=S4(i,c,p),E=dA[l];i=t[E],c=t[E+1],t[E]=v,t[E+1]=y}for(let l=0;l<50;l+=10){for(let p=0;p<10;p++)n[p]=t[l+p];for(let p=0;p<10;p++)t[l+p]^=~n[(p+2)%10]&n[(p+4)%10]}t[0]^=Nj[s],t[1]^=Dj[s]}n.fill(0)})(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){yf(this);const{blockLen:e,state:n}=this,s=(t=Gd(t)).length;for(let i=0;i=n&&this.keccak();const c=Math.min(n-this.posOut,i-s);t.set(e.subarray(this.posOut,this.posOut+c),s),this.posOut+=c,s+=c}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Bl(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(hE(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:s,rounds:i,enableXOF:c}=this;return t||(t=new Fy(e,n,s,c,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=s,t.enableXOF=c,t.destroyed=this.destroyed,t}}const k4=((r,t,e)=>xy(()=>new Fy(t,r,e)))(1,136,32),{bytesToNumberBE:zj,hexToBytes:qj}=OF,$a={Err:class extends Error{constructor(r=""){super(r)}},_parseInt(r){const{Err:t}=$a;if(r.length<2||r[0]!==2)throw new t("Invalid signature integer tag");const e=r[1],n=r.subarray(2,e+2);if(!e||n.length!==e)throw new t("Invalid signature integer: wrong length");if(128&n[0])throw new t("Invalid signature integer: negative");if(n[0]===0&&!(128&n[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:zj(n),l:r.subarray(e+2)}},toSig(r){const{Err:t}=$a,e=typeof r=="string"?qj(r):r;if(!(e instanceof Uint8Array))throw new Error("ui8a expected");let n=e.length;if(n<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==n-2)throw new t("Invalid signature: incorrect length");const{d:s,l:i}=$a._parseInt(e.subarray(2)),{d:c,l}=$a._parseInt(i);if(l.length)throw new t("Invalid signature: left bytes after parsing");return{r:s,s:c}},hexFromSig(r){const t=v=>8&Number.parseInt(v[0],16)?"00"+v:v,e=v=>{const y=v.toString(16);return 1&y.length?`0${y}`:y},n=t(e(r.s)),s=t(e(r.r)),i=n.length/2,c=s.length/2,l=e(i),p=e(c);return`30${e(c+i+4)}02${p}${s}02${l}${n}`}},xs=BigInt(0),Fi=BigInt(1);BigInt(2);const I4=BigInt(3);function Fj(r){const t=function(_){const k=Ey(_);wf(k,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:B,Fp:P,a:R}=k;if(B){if(!P.eql(R,P.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof B!="object"||typeof B.beta!="bigint"||typeof B.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...k})}(r),{Fp:e}=t,n=t.toBytes||((_,k,B)=>{const P=k.toAffine();return uu(Uint8Array.from([4]),e.toBytes(P.x),e.toBytes(P.y))}),s=t.fromBytes||(_=>{const k=_.subarray(1);return{x:e.fromBytes(k.subarray(0,e.BYTES)),y:e.fromBytes(k.subarray(e.BYTES,2*e.BYTES))}});function i(_){const{a:k,b:B}=t,P=e.sqr(_),R=e.mul(P,_);return e.add(e.add(R,e.mul(_,k)),B)}if(!e.eql(e.sqr(t.Gy),i(t.Gx)))throw new Error("bad generator point: equation left != right");function c(_){return typeof _=="bigint"&&xs<_&&_e.eql(T,e.ZERO);return R(B)&&R(P)?E.ZERO:new E(B,P,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(k){const B=e.invertBatch(k.map(P=>P.pz));return k.map((P,R)=>P.toAffine(B[R])).map(E.fromAffine)}static fromHex(k){const B=E.fromAffine(s(pn("pointHex",k)));return B.assertValidity(),B}static fromPrivateKey(k){return E.BASE.multiply(p(k))}_setWindowSize(k){this._WINDOW_SIZE=k,v.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:k,y:B}=this.toAffine();if(!e.isValid(k)||!e.isValid(B))throw new Error("bad point: x or y not FE");const P=e.sqr(B),R=i(k);if(!e.eql(P,R))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:k}=this.toAffine();if(e.isOdd)return!e.isOdd(k);throw new Error("Field doesn't support isOdd")}equals(k){y(k);const{px:B,py:P,pz:R}=this,{px:T,py:U,pz:j}=k,Y=e.eql(e.mul(B,j),e.mul(T,R)),rt=e.eql(e.mul(P,j),e.mul(U,R));return Y&&rt}negate(){return new E(this.px,e.neg(this.py),this.pz)}double(){const{a:k,b:B}=t,P=e.mul(B,I4),{px:R,py:T,pz:U}=this;let j=e.ZERO,Y=e.ZERO,rt=e.ZERO,nt=e.mul(R,R),Z=e.mul(T,T),x=e.mul(U,U),d=e.mul(R,T);return d=e.add(d,d),rt=e.mul(R,U),rt=e.add(rt,rt),j=e.mul(k,rt),Y=e.mul(P,x),Y=e.add(j,Y),j=e.sub(Z,Y),Y=e.add(Z,Y),Y=e.mul(j,Y),j=e.mul(d,j),rt=e.mul(P,rt),x=e.mul(k,x),d=e.sub(nt,x),d=e.mul(k,d),d=e.add(d,rt),rt=e.add(nt,nt),nt=e.add(rt,nt),nt=e.add(nt,x),nt=e.mul(nt,d),Y=e.add(Y,nt),x=e.mul(T,U),x=e.add(x,x),nt=e.mul(x,d),j=e.sub(j,nt),rt=e.mul(x,Z),rt=e.add(rt,rt),rt=e.add(rt,rt),new E(j,Y,rt)}add(k){y(k);const{px:B,py:P,pz:R}=this,{px:T,py:U,pz:j}=k;let Y=e.ZERO,rt=e.ZERO,nt=e.ZERO;const Z=t.a,x=e.mul(t.b,I4);let d=e.mul(B,T),o=e.mul(P,U),a=e.mul(R,j),f=e.add(B,P),h=e.add(T,U);f=e.mul(f,h),h=e.add(d,o),f=e.sub(f,h),h=e.add(B,R);let g=e.add(T,j);return h=e.mul(h,g),g=e.add(d,a),h=e.sub(h,g),g=e.add(P,R),Y=e.add(U,j),g=e.mul(g,Y),Y=e.add(o,a),g=e.sub(g,Y),nt=e.mul(Z,h),Y=e.mul(x,a),nt=e.add(Y,nt),Y=e.sub(o,nt),nt=e.add(o,nt),rt=e.mul(Y,nt),o=e.add(d,d),o=e.add(o,d),a=e.mul(Z,a),h=e.mul(x,h),o=e.add(o,a),a=e.sub(d,a),a=e.mul(Z,a),h=e.add(h,a),d=e.mul(o,h),rt=e.add(rt,d),d=e.mul(g,h),Y=e.mul(f,Y),Y=e.sub(Y,d),d=e.mul(f,o),nt=e.mul(g,nt),nt=e.add(nt,d),new E(Y,rt,nt)}subtract(k){return this.add(k.negate())}is0(){return this.equals(E.ZERO)}wNAF(k){return w.wNAFCached(this,v,k,B=>{const P=e.invertBatch(B.map(R=>R.pz));return B.map((R,T)=>R.toAffine(P[T])).map(E.fromAffine)})}multiplyUnsafe(k){const B=E.ZERO;if(k===xs)return B;if(l(k),k===Fi)return this;const{endo:P}=t;if(!P)return w.unsafeLadder(this,k);let{k1neg:R,k1:T,k2neg:U,k2:j}=P.splitScalar(k),Y=B,rt=B,nt=this;for(;T>xs||j>xs;)T&Fi&&(Y=Y.add(nt)),j&Fi&&(rt=rt.add(nt)),nt=nt.double(),T>>=Fi,j>>=Fi;return R&&(Y=Y.negate()),U&&(rt=rt.negate()),rt=new E(e.mul(rt.px,P.beta),rt.py,rt.pz),Y.add(rt)}multiply(k){l(k);let B,P,R=k;const{endo:T}=t;if(T){const{k1neg:U,k1:j,k2neg:Y,k2:rt}=T.splitScalar(R);let{p:nt,f:Z}=this.wNAF(j),{p:x,f:d}=this.wNAF(rt);nt=w.constTimeNegate(U,nt),x=w.constTimeNegate(Y,x),x=new E(e.mul(x.px,T.beta),x.py,x.pz),B=nt.add(x),P=Z.add(d)}else{const{p:U,f:j}=this.wNAF(R);B=U,P=j}return E.normalizeZ([B,P])[0]}multiplyAndAddUnsafe(k,B,P){const R=E.BASE,T=(j,Y)=>Y!==xs&&Y!==Fi&&j.equals(R)?j.multiply(Y):j.multiplyUnsafe(Y),U=T(this,B).add(T(k,P));return U.is0()?void 0:U}toAffine(k){const{px:B,py:P,pz:R}=this,T=this.is0();k==null&&(k=T?e.ONE:e.inv(R));const U=e.mul(B,k),j=e.mul(P,k),Y=e.mul(R,k);if(T)return{x:e.ZERO,y:e.ZERO};if(!e.eql(Y,e.ONE))throw new Error("invZ was invalid");return{x:U,y:j}}isTorsionFree(){const{h:k,isTorsionFree:B}=t;if(k===Fi)return!0;if(B)return B(E,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:k,clearCofactor:B}=t;return k===Fi?this:B?B(E,this):this.multiplyUnsafe(t.h)}toRawBytes(k=!0){return this.assertValidity(),n(E,this,k)}toHex(k=!0){return au(this.toRawBytes(k))}}E.BASE=new E(t.Gx,t.Gy,e.ONE),E.ZERO=new E(e.ZERO,e.ONE,e.ZERO);const M=t.nBitLength,w=AE(E,t.endo?Math.ceil(M/2):M);return{CURVE:t,ProjectivePoint:E,normPrivateKeyToScalar:p,weierstrassEquation:i,isWithinCurveOrder:c}}function jj(r){const t=function(Z){const x=Ey(Z);return wf(x,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...x})}(r),{Fp:e,n}=t,s=e.BYTES+1,i=2*e.BYTES+1;function c(Z){return jr(Z,n)}function l(Z){return a2(Z,n)}const{ProjectivePoint:p,normPrivateKeyToScalar:v,weierstrassEquation:y,isWithinCurveOrder:E}=Fj({...t,toBytes(Z,x,d){const o=x.toAffine(),a=e.toBytes(o.x),f=uu;return d?f(Uint8Array.from([x.hasEvenY()?2:3]),a):f(Uint8Array.from([4]),a,e.toBytes(o.y))},fromBytes(Z){const x=Z.length,d=Z[0],o=Z.subarray(1);if(x!==s||d!==2&&d!==3){if(x===i&&d===4)return{x:e.fromBytes(o.subarray(0,e.BYTES)),y:e.fromBytes(o.subarray(e.BYTES,2*e.BYTES))};throw new Error(`Point of length ${x} was invalid. Expected ${s} compressed bytes or ${i} uncompressed bytes`)}{const f=ja(o);if(!(xs<(a=f)&&aau(Yu(Z,t.nByteLength));function w(Z){return Z>n>>Fi}const _=(Z,x,d)=>ja(Z.slice(x,d));class k{constructor(x,d,o){this.r=x,this.s=d,this.recovery=o,this.assertValidity()}static fromCompact(x){const d=t.nByteLength;return x=pn("compactSignature",x,2*d),new k(_(x,0,d),_(x,d,2*d))}static fromDER(x){const{r:d,s:o}=$a.toSig(pn("DER",x));return new k(d,o)}assertValidity(){if(!E(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!E(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(x){return new k(this.r,this.s,x)}recoverPublicKey(x){const{r:d,s:o,recovery:a}=this,f=T(pn("msgHash",x));if(a==null||![0,1,2,3].includes(a))throw new Error("recovery id invalid");const h=a===2||a===3?d+t.n:d;if(h>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");const g=1&a?"03":"02",A=p.fromHex(g+M(h)),I=l(h),b=c(-f*I),u=c(o*I),m=p.BASE.multiplyAndAddUnsafe(A,b,u);if(!m)throw new Error("point at infinify");return m.assertValidity(),m}hasHighS(){return w(this.s)}normalizeS(){return this.hasHighS()?new k(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return bf(this.toDERHex())}toDERHex(){return $a.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return bf(this.toCompactHex())}toCompactHex(){return M(this.r)+M(this.s)}}const B={isValidPrivateKey(Z){try{return v(Z),!0}catch{return!1}},normPrivateKeyToScalar:v,randomPrivateKey:()=>{const Z=$5(t.n);return function(x,d,o=!1){const a=x.length,f=EE(d),h=$5(d);if(a<16||a1024)throw new Error(`expected ${h}-1024 bytes of input, got ${a}`);const g=jr(o?ja(x):Gu(x),d-Vr)+Vr;return o?ch(g,f):Yu(g,f)}(t.randomBytes(Z),t.n)},precompute:(Z=8,x=p.BASE)=>(x._setWindowSize(Z),x.multiply(BigInt(3)),x)};function P(Z){const x=Z instanceof Uint8Array,d=typeof Z=="string",o=(x||d)&&Z.length;return x?o===s||o===i:d?o===2*s||o===2*i:Z instanceof p}const R=t.bits2int||function(Z){const x=ja(Z),d=8*Z.length-t.nBitLength;return d>0?x>>BigInt(d):x},T=t.bits2int_modN||function(Z){return c(R(Z))},U=My(t.nBitLength);function j(Z){if(typeof Z!="bigint")throw new Error("bigint expected");if(!(xs<=Z&&ZL in d))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:a}=t;let{lowS:f,prehash:h,extraEntropy:g}=d;f==null&&(f=!0),Z=pn("msgHash",Z),h&&(Z=pn("prehashed msgHash",o(Z)));const A=T(Z),I=v(x),b=[j(I),j(A)];if(g!=null){const L=g===!0?a(e.BYTES):g;b.push(pn("extraEntropy",L))}const u=uu(...b),m=A;return{seed:u,k2sig:function(L){const q=R(L);if(!E(q))return;const z=l(q),W=p.BASE.multiply(q).toAffine(),ot=c(W.x);if(ot===xs)return;const ut=c(z*c(m+ot*I));if(ut===xs)return;let Ct=(W.x===ot?0:2)|Number(W.y&Fi),yt=ut;return f&&w(ut)&&(yt=function(mt){return w(mt)?c(-mt):mt}(ut),Ct^=1),new k(ot,yt,Ct)}}}const rt={lowS:t.lowS,prehash:!1},nt={lowS:t.lowS,prehash:!1};return p.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(Z,x=!0){return p.fromPrivateKey(Z).toRawBytes(x)},getSharedSecret:function(Z,x,d=!0){if(P(Z))throw new Error("first arg must be private key");if(!P(x))throw new Error("second arg must be public key");return p.fromHex(x).multiply(v(Z)).toRawBytes(d)},sign:function(Z,x,d=rt){const{seed:o,k2sig:a}=Y(Z,x,d),f=t;return xE(f.hash.outputLen,f.nByteLength,f.hmac)(o,a)},verify:function(Z,x,d,o=nt){var W;const a=Z;if(x=pn("msgHash",x),d=pn("publicKey",d),"strict"in o)throw new Error("options.strict was renamed to lowS");const{lowS:f,prehash:h}=o;let g,A;try{if(typeof a=="string"||a instanceof Uint8Array)try{g=k.fromDER(a)}catch(ot){if(!(ot instanceof $a.Err))throw ot;g=k.fromCompact(a)}else{if(typeof a!="object"||typeof a.r!="bigint"||typeof a.s!="bigint")throw new Error("PARSE");{const{r:ot,s:ut}=a;g=new k(ot,ut)}}A=p.fromHex(d)}catch(ot){if(ot.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(f&&g.hasHighS())return!1;h&&(x=t.hash(x));const{r:I,s:b}=g,u=T(x),m=l(b),L=c(u*m),q=c(I*m),z=(W=p.BASE.multiplyAndAddUnsafe(A,L,q))==null?void 0:W.toAffine();return!!z&&c(z.x)===I},ProjectivePoint:p,Signature:k,utils:B}}BigInt(4);class vA extends wy{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(c){if(typeof c!="function"||typeof c.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Bl(c.outputLen),Bl(c.blockLen)}(t);const n=Gd(e);if(this.iHash=t.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 s=this.blockLen,i=new Uint8Array(s);i.set(n.length>s?t.create().update(n).digest():n);for(let c=0;cnew vA(r,t).update(e).digest();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function $j(r){return{hash:r,hmac:(t,...e)=>gA(r,t,SF(...e)),randomBytes:dE}}gA.create=(r,t)=>new vA(r,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const B4=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),P4=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Kj=BigInt(1),d2=BigInt(2),R4=(r,t)=>(r+t/d2)/t,p2=ME(B4,void 0,void 0,{sqrt:function(r){const t=B4,e=BigInt(3),n=BigInt(6),s=BigInt(11),i=BigInt(22),c=BigInt(23),l=BigInt(44),p=BigInt(88),v=r*r*r%t,y=v*v*r%t,E=tn(y,e,t)*y%t,M=tn(E,e,t)*y%t,w=tn(M,d2,t)*v%t,_=tn(w,s,t)*w%t,k=tn(_,i,t)*_%t,B=tn(k,l,t)*k%t,P=tn(B,p,t)*B%t,R=tn(P,l,t)*k%t,T=tn(R,e,t)*y%t,U=tn(T,c,t)*_%t,j=tn(U,n,t)*v%t,Y=tn(j,d2,t);if(!p2.eql(p2.sqr(Y),r))throw new Error("Cannot find square root");return Y}}),t1=function(r,t){const e=n=>jj({...r,...$j(n)});return Object.freeze({...e(t),create:e})}({a:BigInt(0),b:BigInt(7),Fp:p2,n:P4,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{const t=P4,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-Kj*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=e,c=BigInt("0x100000000000000000000000000000000"),l=R4(i*r,t),p=R4(-n*r,t);let v=jr(r-l*e-p*s,t),y=jr(-l*n-p*i,t);const E=v>c,M=y>c;if(E&&(v=t-v),M&&(y=t-y),v>c||y>c)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:E,k1:v,k2neg:M,k2:y}}}},fu);BigInt(0),t1.ProjectivePoint;const Hj=jf.utils.randomPrivateKey,C4=()=>{const r=jf.utils.randomPrivateKey(),t=Ul(r),e=new Uint8Array(64);return e.set(r),e.set(t,32),{publicKey:t,secretKey:e}},Ul=jf.getPublicKey;function T4(r){try{return jf.ExtendedPoint.fromHex(r),!0}catch{return!1}}const jy=(r,t)=>jf.sign(r,t.slice(0,32)),Vj=jf.verify,nr=r=>Ae.Buffer.isBuffer(r)?r:r instanceof Uint8Array?Ae.Buffer.from(r.buffer,r.byteOffset,r.byteLength):Ae.Buffer.from(r);class m2{constructor(t){Object.assign(this,t)}encode(){return Ae.Buffer.from(ky(zc,this))}static decode(t){return TE(zc,this,t)}static decodeUnchecked(t){return BE(zc,this,t)}}const zc=new Map;var L4;let yA;const Pi=32;let O4=1;yA=Symbol.toStringTag;class Xt extends m2{constructor(t){if(super({}),this._bn=void 0,function(e){return e._bn!==void 0}(t))this._bn=t._bn;else{if(typeof t=="string"){const e=Un.decode(t);if(e.length!=Pi)throw new Error("Invalid public key input");this._bn=new hh(e)}else this._bn=new hh(t);if(this._bn.byteLength()>Pi)throw new Error("Invalid public key input")}}static unique(){const t=new Xt(O4);return O4+=1,new Xt(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return Un.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(Ae.Buffer);if(t.length===Pi)return t;const e=Ae.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[yA](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,n){const s=Ae.Buffer.concat([t.toBuffer(),Ae.Buffer.from(e),n.toBuffer()]),i=fu(s);return new Xt(i)}static createProgramAddressSync(t,e){let n=Ae.Buffer.alloc(0);t.forEach(function(i){if(i.length>32)throw new TypeError("Max seed length exceeded");n=Ae.Buffer.concat([n,nr(i)])}),n=Ae.Buffer.concat([n,e.toBuffer(),Ae.Buffer.from("ProgramDerivedAddress")]);const s=fu(n);if(T4(s))throw new Error("Invalid seeds, address must fall off the curve");return new Xt(s)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n,s=255;for(;s!=0;){try{const i=t.concat(Ae.Buffer.from([s]));n=this.createProgramAddressSync(i,e)}catch(i){if(i instanceof TypeError)throw i;s--;continue}return[n,s]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return T4(new Xt(t).toBytes())}}L4=Xt,Xt.default=new L4("11111111111111111111111111111111"),zc.set(Xt,{kind:"struct",fields:[["_bn","u256"]]});const Zj=new Xt("BPFLoader1111111111111111111111111111111111"),Xu=1232,e1=127,xf=64;class v2 extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(v2.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class g2 extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(g2.prototype,"name",{value:"TransactionExpiredTimeoutError"});class Lu extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(Lu.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class ph{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const e of this.keySegments()){if(t256)throw new Error("Account index overflow encountered during compilation");const e=new Map;this.keySegments().flat().forEach((s,i)=>{e.set(s.toBase58(),i)});const n=s=>{const i=e.get(s.toBase58());if(i===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return i};return t.map(s=>({programIdIndex:n(s.programId),accountKeyIndexes:s.keys.map(i=>n(i.pubkey)),data:s.data}))}}const ar=(r="publicKey")=>Tr(32,r),Wj=(r="signature")=>Tr(64,r),Ka=(r="string")=>{const t=Ue([Ce("length"),Ce("lengthPadding"),Tr(ia(Ce(),-8),"chars")],r),e=t.decode.bind(t),n=t.encode.bind(t),s=t;return s.decode=(i,c)=>e(i,c).chars.toString(),s.encode=(i,c,l)=>{const p={chars:Ae.Buffer.from(i,"utf8")};return n(p,c,l)},s.alloc=i=>Ce().span+Ce().span+Ae.Buffer.from(i,"utf8").length,s};function bA(r,t){const e=s=>{if(s.span>=0)return s.span;if(typeof s.alloc=="function")return s.alloc(t[s.property]);if("count"in s&&"elementLayout"in s){const i=t[s.property];if(Array.isArray(i))return i.length*e(s.elementLayout)}else if("fields"in s)return bA({layout:s},t[s.property]);return 0};let n=0;return r.layout.fields.forEach(s=>{n+=e(s)}),n}function ii(r){let t=0,e=0;for(;;){let n=r.shift();if(t|=(127&n)<<7*e,e+=1,(128&n)==0)break}return t}function Si(r,t){let e=t;for(;;){let n=127&e;if(e>>=7,e==0){r.push(n);break}n|=128,r.push(n)}}function xr(r,t){if(!r)throw new Error(t||"Assertion failed")}class r1{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){const n=new Map,s=c=>{const l=c.toBase58();let p=n.get(l);return p===void 0&&(p={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(l,p)),p},i=s(e);i.isSigner=!0,i.isWritable=!0;for(const c of t){s(c.programId).isInvoked=!0;for(const l of c.keys){const p=s(l.pubkey);p.isSigner||(p.isSigner=l.isSigner),p.isWritable||(p.isWritable=l.isWritable)}}return new r1(e,n)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];xr(t.length<=256,"Max static account keys length exceeded");const e=t.filter(([,l])=>l.isSigner&&l.isWritable),n=t.filter(([,l])=>l.isSigner&&!l.isWritable),s=t.filter(([,l])=>!l.isSigner&&l.isWritable),i=t.filter(([,l])=>!l.isSigner&&!l.isWritable),c={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};{xr(e.length>0,"Expected at least one writable signer key");const[l]=e[0];xr(l===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[c,[...e.map(([l])=>new Xt(l)),...n.map(([l])=>new Xt(l)),...s.map(([l])=>new Xt(l)),...i.map(([l])=>new Xt(l))]]}extractTableLookup(t){const[e,n]=this.drainKeysFoundInLookupTable(t.state.addresses,c=>!c.isSigner&&!c.isInvoked&&c.isWritable),[s,i]=this.drainKeysFoundInLookupTable(t.state.addresses,c=>!c.isSigner&&!c.isInvoked&&!c.isWritable);if(e.length!==0||s.length!==0)return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:s},{writable:n,readonly:i}]}drainKeysFoundInLookupTable(t,e){const n=new Array,s=new Array;for(const[i,c]of this.keyMetaMap.entries())if(e(c)){const l=new Xt(i),p=t.findIndex(v=>v.equals(l));p>=0&&(xr(p<256,"Max lookup table index exceeded"),n.push(p),s.push(l),this.keyMetaMap.delete(i))}return[n,s]}}class po{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map(e=>new Xt(e)),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach(e=>this.indexToProgramIds.set(e.programIdIndex,this.accountKeys[e.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Un.decode(t.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new ph(this.staticAccountKeys)}static compile(t){const e=r1.compile(t.instructions,t.payerKey),[n,s]=e.getMessageComponents(),i=new ph(s).compileInstructions(t.instructions).map(c=>({programIdIndex:c.programIdIndex,accounts:c.accountKeyIndexes,data:Un.encode(c.data)}));return new po({header:n,accountKeys:s,recentBlockhash:t.recentBlockhash,instructions:i})}isAccountSigner(t){return t=this.header.numRequiredSignatures?t-e!this.isProgramId(e))}serialize(){const t=this.accountKeys.length;let e=[];Si(e,t);const n=this.instructions.map(E=>{const{accounts:M,programIdIndex:w}=E,_=Array.from(Un.decode(E.data));let k=[];Si(k,M.length);let B=[];return Si(B,_.length),{programIdIndex:w,keyIndicesCount:Ae.Buffer.from(k),keyIndices:M,dataLength:Ae.Buffer.from(B),data:_}});let s=[];Si(s,n.length);let i=Ae.Buffer.alloc(Xu);Ae.Buffer.from(s).copy(i);let c=s.length;n.forEach(E=>{const M=Ue([or("programIdIndex"),Tr(E.keyIndicesCount.length,"keyIndicesCount"),Nn(or("keyIndex"),E.keyIndices.length,"keyIndices"),Tr(E.dataLength.length,"dataLength"),Nn(or("userdatum"),E.data.length,"data")]).encode(E,i,c);c+=M}),i=i.slice(0,c);const l=Ue([Tr(1,"numRequiredSignatures"),Tr(1,"numReadonlySignedAccounts"),Tr(1,"numReadonlyUnsignedAccounts"),Tr(e.length,"keyCount"),Nn(ar("key"),t,"keys"),ar("recentBlockhash")]),p={numRequiredSignatures:Ae.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:Ae.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:Ae.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:Ae.Buffer.from(e),keys:this.accountKeys.map(E=>nr(E.toBytes())),recentBlockhash:Un.decode(this.recentBlockhash)};let v=Ae.Buffer.alloc(2048);const y=l.encode(p,v);return i.copy(v,y),v.slice(0,y+i.length)}static from(t){let e=[...t];const n=e.shift();if(n!==(n&e1))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const s=e.shift(),i=e.shift(),c=ii(e);let l=[];for(let M=0;M0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new ph(this.staticAccountKeys,e)}isAccountSigner(t){return t=n){const s=t-n,i=this.addressTableLookups.reduce((c,l)=>c+l.writableIndexes.length,0);return s=this.header.numRequiredSignatures?t-ei.key.equals(n.accountKey));if(!s)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(const i of n.writableIndexes){if(!(iv.toBytes()),recentBlockhash:Un.decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:e,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:s},l);return l.slice(0,p)}serializeInstructions(){let t=0;const e=new Uint8Array(Xu);for(const n of this.compiledInstructions){const s=Array();Si(s,n.accountKeyIndexes.length);const i=Array();Si(i,n.data.length),t+=Ue([or("programIdIndex"),Tr(s.length,"encodedAccountKeyIndexesLength"),Nn(or(),n.accountKeyIndexes.length,"accountKeyIndexes"),Tr(i.length,"encodedDataLength"),Tr(n.data.length,"data")]).encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(s),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(i),data:n.data},e,t)}return e.slice(0,t)}serializeAddressTableLookups(){let t=0;const e=new Uint8Array(Xu);for(const n of this.addressTableLookups){const s=Array();Si(s,n.writableIndexes.length);const i=Array();Si(i,n.readonlyIndexes.length),t+=Ue([ar("accountKey"),Tr(s.length,"encodedWritableIndexesLength"),Nn(or(),n.writableIndexes.length,"writableIndexes"),Tr(i.length,"encodedReadonlyIndexesLength"),Nn(or(),n.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(s),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:n.readonlyIndexes},e,t)}return e.slice(0,t)}static deserialize(t){let e=[...t];const n=e.shift(),s=n&e1;xr(n!==s,"Expected versioned message but received legacy message"),xr(s===0,`Expected versioned message with version 0 but found version ${s}`);const i={numRequiredSignatures:e.shift(),numReadonlySignedAccounts:e.shift(),numReadonlyUnsignedAccounts:e.shift()},c=[],l=ii(e);for(let w=0;w{const t=$y.deserializeMessageVersion(r);if(t==="legacy")return po.from(r);if(t===0)return cu.deserialize(r);throw new Error(`Transaction message version ${t} deserialization is not supported`)}};let ss=function(r){return r[r.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",r[r.PROCESSED=1]="PROCESSED",r[r.TIMED_OUT=2]="TIMED_OUT",r[r.NONCE_INVALID=3]="NONCE_INVALID",r}({});const Gj=Ae.Buffer.alloc(xf).fill(0);class kr{constructor(t){this.keys=void 0,this.programId=void 0,this.data=Ae.Buffer.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map(({pubkey:t,isSigner:e,isWritable:n})=>({pubkey:t.toJSON(),isSigner:e,isWritable:n})),programId:this.programId.toJSON(),data:[...this.data]}}}class wr{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){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,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:e,nonceInfo:n}=t;this.minNonceContextSlot=e,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:n}=t;this.recentBlockhash=e,this.lastValidBlockHeight=n}else{const{recentBlockhash:e,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=e}}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(t=>t.toJSON()),signers:this.signatures.map(({publicKey:t})=>t.toJSON())}}add(...t){if(t.length===0)throw new Error("No instructions");return t.forEach(e=>{"instructions"in e?this.instructions=this.instructions.concat(e.instructions):"data"in e&&"programId"in e&&"keys"in e?this.instructions.push(e):this.instructions.push(new kr(e))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let k=0;k{k.keys.forEach(P=>{i.push({...P})});const B=k.programId.toString();s.includes(B)||s.push(B)}),s.forEach(k=>{i.push({pubkey:new Xt(k),isSigner:!1,isWritable:!1})});const c=[];i.forEach(k=>{const B=k.pubkey.toString(),P=c.findIndex(R=>R.pubkey.toString()===B);P>-1?(c[P].isWritable=c[P].isWritable||k.isWritable,c[P].isSigner=c[P].isSigner||k.isSigner):c.push(k)}),c.sort(function(k,B){return k.isSigner!==B.isSigner?k.isSigner?-1:1:k.isWritable!==B.isWritable?k.isWritable?-1:1:k.pubkey.toBase58().localeCompare(B.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})});const l=c.findIndex(k=>k.pubkey.equals(n));if(l>-1){const[k]=c.splice(l,1);k.isSigner=!0,k.isWritable=!0,c.unshift(k)}else c.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const k of this.signatures){const B=c.findIndex(P=>P.pubkey.equals(k.publicKey));if(!(B>-1))throw new Error(`unknown signer: ${k.publicKey.toString()}`);c[B].isSigner||(c[B].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."))}let p=0,v=0,y=0;const E=[],M=[];c.forEach(({pubkey:k,isSigner:B,isWritable:P})=>{B?(E.push(k.toString()),p+=1,P||(v+=1)):(M.push(k.toString()),P||(y+=1))});const w=E.concat(M),_=e.map(k=>{const{data:B,programId:P}=k;return{programIdIndex:w.indexOf(P.toString()),accounts:k.keys.map(R=>w.indexOf(R.pubkey.toString())),data:Un.encode(B)}});return _.forEach(k=>{xr(k.programIdIndex>=0),k.accounts.forEach(B=>xr(B>=0))}),new po({header:{numRequiredSignatures:p,numReadonlySignedAccounts:v,numReadonlyUnsignedAccounts:y},accountKeys:w,recentBlockhash:t,instructions:_})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every((s,i)=>e[i].equals(s.publicKey))||(this.signatures=e.map(n=>({signature:null,publicKey:n}))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(t.length===0)throw new Error("No signers");const e=new Set;this.signatures=t.filter(n=>{const s=n.toString();return!e.has(s)&&(e.add(s),!0)}).map(n=>({signature:null,publicKey:n}))}sign(...t){if(t.length===0)throw new Error("No signers");const e=new Set,n=[];for(const i of t){const c=i.publicKey.toString();e.has(c)||(e.add(c),n.push(i))}this.signatures=n.map(i=>({signature:null,publicKey:i.publicKey}));const s=this._compile();this._partialSign(s,...n)}partialSign(...t){if(t.length===0)throw new Error("No signers");const e=new Set,n=[];for(const i of t){const c=i.publicKey.toString();e.has(c)||(e.add(c),n.push(i))}const s=this._compile();this._partialSign(s,...n)}_partialSign(t,...e){const n=t.serialize();e.forEach(s=>{const i=jy(n,s.secretKey);this._addSignature(s.publicKey,nr(i))})}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){xr(e.length===64);const n=this.signatures.findIndex(s=>t.equals(s.publicKey));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=Ae.Buffer.from(e)}verifySignatures(t){return this._verifySignatures(this.serializeMessage(),t===void 0||t)}_verifySignatures(t,e){for(const{signature:n,publicKey:s}of this.signatures)if(n===null){if(e)return!1}else if(!Vj(n,t,s.toBytes()))return!1;return!0}serialize(t){const{requireAllSignatures:e,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),s=this.serializeMessage();if(n&&!this._verifySignatures(s,e))throw new Error("Signature verification failed");return this._serialize(s)}_serialize(t){const{signatures:e}=this,n=[];Si(n,e.length);const s=n.length+64*e.length+t.length,i=Ae.Buffer.alloc(s);return xr(e.length<256),Ae.Buffer.from(n).copy(i,0),e.forEach(({signature:c},l)=>{c!==null&&(xr(c.length===64,"signature has invalid length"),Ae.Buffer.from(c).copy(i,n.length+64*l))}),t.copy(i,n.length+64*e.length),xr(i.length<=Xu,`Transaction too large: ${i.length} > 1232`),i}get keys(){return xr(this.instructions.length===1),this.instructions[0].keys.map(t=>t.pubkey)}get programId(){return xr(this.instructions.length===1),this.instructions[0].programId}get data(){return xr(this.instructions.length===1),this.instructions[0].data}static from(t){let e=[...t];const n=ii(e);let s=[];for(let i=0;i0&&(n.feePayer=t.accountKeys[0]),e.forEach((s,i)=>{const c={signature:s==Un.encode(Gj)?null:Un.decode(s),publicKey:t.accountKeys[i]};n.signatures.push(c)}),t.instructions.forEach(s=>{const i=s.accounts.map(c=>{const l=t.accountKeys[c];return{pubkey:l,isSigner:n.signatures.some(p=>p.publicKey.toString()===l.toString())||t.isAccountSigner(c),isWritable:t.isAccountWritable(c)}});n.instructions.push(new kr({keys:i,programId:t.accountKeys[s.programIdIndex],data:Un.decode(s.data)}))}),n._message=t,n._json=n.toJSON(),n}}class Ky{constructor(t){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=t.payerKey,this.instructions=t.instructions,this.recentBlockhash=t.recentBlockhash}static decompile(t,e){const{header:n,compiledInstructions:s,recentBlockhash:i}=t,{numRequiredSignatures:c,numReadonlySignedAccounts:l,numReadonlyUnsignedAccounts:p}=n,v=c-l;xr(v>0,"Message header is invalid");const y=t.staticAccountKeys.length-c-p;xr(y>=0,"Message header is invalid");const E=t.getAccountKeys(e),M=E.get(0);if(M===void 0)throw new Error("Failed to decompile message because no account keys were found");const w=[];for(const _ of s){const k=[];for(const P of _.accountKeyIndexes){const R=E.get(P);if(R===void 0)throw new Error(`Failed to find key for account key index ${P}`);let T;T=Pc.equals(s.publicKey));xr(i>=0,`Cannot sign with non signer key ${s.publicKey.toBase58()}`),this.signatures[i]=jy(e,s.secretKey)}}addSignature(t,e){xr(e.byteLength===64,"Signature must be 64 bytes long");const n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(s=>s.equals(t));xr(n>=0,`Can not add signature; \`${t.toBase58()}\` is not required to sign this transaction`),this.signatures[n]=e}}const co=new Xt("SysvarC1ock11111111111111111111111111111111"),Yj=new Xt("SysvarEpochSchedu1e111111111111111111111111"),Xj=new Xt("Sysvar1nstructions1111111111111111111111111"),fl=new Xt("SysvarRecentB1ockHashes11111111111111111111"),fa=new Xt("SysvarRent111111111111111111111111111111111"),Jj=new Xt("SysvarRewards111111111111111111111111111111"),Qj=new Xt("SysvarS1otHashes111111111111111111111111111"),t$=new Xt("SysvarS1otHistory11111111111111111111111111"),cl=new Xt("SysvarStakeHistory1111111111111111111111111");async function y2(r,t,e,n){const s=n&&{skipPreflight:n.skipPreflight,preflightCommitment:n.preflightCommitment||n.commitment,maxRetries:n.maxRetries,minContextSlot:n.minContextSlot},i=await r.sendTransaction(t,e,s);let c;if(t.recentBlockhash!=null&&t.lastValidBlockHeight!=null)c=(await r.confirmTransaction({abortSignal:n==null?void 0:n.abortSignal,signature:i,blockhash:t.recentBlockhash,lastValidBlockHeight:t.lastValidBlockHeight},n&&n.commitment)).value;else if(t.minNonceContextSlot!=null&&t.nonceInfo!=null){const{nonceInstruction:l}=t.nonceInfo,p=l.keys[0].pubkey;c=(await r.confirmTransaction({abortSignal:n==null?void 0:n.abortSignal,minContextSlot:t.minNonceContextSlot,nonceAccountPubkey:p,nonceValue:t.nonceInfo.nonce,signature:i},n&&n.commitment)).value}else(n==null?void 0:n.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."),c=(await r.confirmTransaction(i,n&&n.commitment)).value;if(c.err)throw new Error(`Transaction ${i} failed (${JSON.stringify(c)})`);return i}function Ba(r){return new Promise(t=>setTimeout(t,r))}function gr(r,t){const e=r.layout.span>=0?r.layout.span:bA(r,t),n=Ae.Buffer.alloc(e),s=Object.assign({instruction:r.index},t);return r.layout.encode(s,n),n}function Ir(r,t){let e;try{e=r.layout.decode(t)}catch(n){throw new Error("invalid instruction; "+n)}if(e.instruction!==r.index)throw new Error(`invalid instruction; instruction index mismatch ${e.instruction} != ${r.index}`);return e}const wA=Pn("lamportsPerSignature"),xA=Ue([Ce("version"),Ce("state"),ar("authorizedPubkey"),ar("nonce"),Ue([wA],"feeCalculator")]),mh=xA.span;class Nl{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){const e=xA.decode(nr(t),0);return new Nl({authorizedPubkey:new Xt(e.authorizedPubkey),nonce:new Xt(e.nonce).toString(),feeCalculator:e.feeCalculator})}}const _f=(Dm=8,r=>{const t=Tr(Dm,r),{encode:e,decode:n}=(i=>({decode:i.decode.bind(i),encode:i.encode.bind(i)}))(t),s=t;return s.decode=(i,c)=>{const l=n(i,c);return XE(Ae.Buffer.from(l))},s.encode=(i,c,l)=>{const p=Uy(i,Dm);return e(p,c,l)},s});var Dm;const Lr=Object.freeze({Create:{index:0,layout:Ue([Ce("instruction"),Ai("lamports"),Ai("space"),ar("programId")])},Assign:{index:1,layout:Ue([Ce("instruction"),ar("programId")])},Transfer:{index:2,layout:Ue([Ce("instruction"),_f("lamports")])},CreateWithSeed:{index:3,layout:Ue([Ce("instruction"),ar("base"),Ka("seed"),Ai("lamports"),Ai("space"),ar("programId")])},AdvanceNonceAccount:{index:4,layout:Ue([Ce("instruction")])},WithdrawNonceAccount:{index:5,layout:Ue([Ce("instruction"),Ai("lamports")])},InitializeNonceAccount:{index:6,layout:Ue([Ce("instruction"),ar("authorized")])},AuthorizeNonceAccount:{index:7,layout:Ue([Ce("instruction"),ar("authorized")])},Allocate:{index:8,layout:Ue([Ce("instruction"),Ai("space")])},AllocateWithSeed:{index:9,layout:Ue([Ce("instruction"),ar("base"),Ka("seed"),Ai("space"),ar("programId")])},AssignWithSeed:{index:10,layout:Ue([Ce("instruction"),ar("base"),Ka("seed"),ar("programId")])},TransferWithSeed:{index:11,layout:Ue([Ce("instruction"),_f("lamports"),Ka("seed"),ar("programId")])},UpgradeNonceAccount:{index:12,layout:Ue([Ce("instruction")])}});class an{constructor(){}static createAccount(t){const e=gr(Lr.Create,{lamports:t.lamports,space:t.space,programId:nr(t.programId.toBuffer())});return new kr({keys:[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:e})}static transfer(t){let e,n;return"basePubkey"in t?(e=gr(Lr.TransferWithSeed,{lamports:BigInt(t.lamports),seed:t.seed,programId:nr(t.programId.toBuffer())}),n=[{pubkey:t.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]):(e=gr(Lr.Transfer,{lamports:BigInt(t.lamports)}),n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]),new kr({keys:n,programId:this.programId,data:e})}static assign(t){let e,n;return"basePubkey"in t?(e=gr(Lr.AssignWithSeed,{base:nr(t.basePubkey.toBuffer()),seed:t.seed,programId:nr(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=gr(Lr.Assign,{programId:nr(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new kr({keys:n,programId:this.programId,data:e})}static createAccountWithSeed(t){const e=gr(Lr.CreateWithSeed,{base:nr(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:nr(t.programId.toBuffer())});let n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!1,isWritable:!0}];return t.basePubkey!=t.fromPubkey&&n.push({pubkey:t.basePubkey,isSigner:!0,isWritable:!1}),new kr({keys:n,programId:this.programId,data:e})}static createNonceAccount(t){const e=new wr;"basePubkey"in t&&"seed"in t?e.add(an.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:mh,programId:this.programId})):e.add(an.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:mh,programId:this.programId}));const n={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return e.add(this.nonceInitialize(n)),e}static nonceInitialize(t){const e=gr(Lr.InitializeNonceAccount,{authorized:nr(t.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:fl,isSigner:!1,isWritable:!1},{pubkey:fa,isSigner:!1,isWritable:!1}],programId:this.programId,data:e};return new kr(n)}static nonceAdvance(t){const e=gr(Lr.AdvanceNonceAccount),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:fl,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e};return new kr(n)}static nonceWithdraw(t){const e=gr(Lr.WithdrawNonceAccount,{lamports:t.lamports});return new kr({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:fl,isSigner:!1,isWritable:!1},{pubkey:fa,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static nonceAuthorize(t){const e=gr(Lr.AuthorizeNonceAccount,{authorized:nr(t.newAuthorizedPubkey.toBuffer())});return new kr({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static allocate(t){let e,n;return"basePubkey"in t?(e=gr(Lr.AllocateWithSeed,{base:nr(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:nr(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=gr(Lr.Allocate,{space:t.space}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new kr({keys:n,programId:this.programId,data:e})}}an.programId=new Xt("11111111111111111111111111111111");class Xa{constructor(){}static getMinNumSignatures(t){return 2*(Math.ceil(t/Xa.chunkSize)+1+1)}static async load(t,e,n,s,i){{const E=await t.getMinimumBalanceForRentExemption(i.length),M=await t.getAccountInfo(n.publicKey,"confirmed");let w=null;if(M!==null){if(M.executable)return console.error("Program load failed, account is already executable"),!1;M.data.length!==i.length&&(w=w||new wr,w.add(an.allocate({accountPubkey:n.publicKey,space:i.length}))),M.owner.equals(s)||(w=w||new wr,w.add(an.assign({accountPubkey:n.publicKey,programId:s}))),M.lamports0?E:1,space:i.length,programId:s}));w!==null&&await y2(t,w,[e,n],{commitment:"confirmed"})}const c=Ue([Ce("instruction"),Ce("offset"),Ce("bytesLength"),Ce("bytesLengthPadding"),Nn(or("byte"),ia(Ce(),-8),"bytes")]),l=Xa.chunkSize;let p=0,v=i,y=[];for(;v.length>0;){const E=v.slice(0,l),M=Ae.Buffer.alloc(l+16);c.encode({instruction:0,offset:p,bytes:E,bytesLength:0,bytesLengthPadding:0},M);const w=new wr().add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:s,data:M});y.push(y2(t,w,[e,n],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")&&await Ba(1e3/4),p+=l,v=v.slice(l)}await Promise.all(y);{const E=Ue([Ce("instruction")]),M=Ae.Buffer.alloc(E.span);E.encode({instruction:1},M);const w=new wr().add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:fa,isSigner:!1,isWritable:!1}],programId:s,data:M}),_="processed",k=await t.sendTransaction(w,[e,n],{preflightCommitment:_}),{context:B,value:P}=await t.confirmTransaction({signature:k,lastValidBlockHeight:w.lastValidBlockHeight,blockhash:w.recentBlockhash},_);if(P.err)throw new Error(`Transaction ${k} failed (${JSON.stringify(P)})`);for(;;){try{if(await t.getSlot({commitment:_})>B.slot)break}catch{}await new Promise(R=>setTimeout(R,Math.round(200)))}}return!0}}Xa.chunkSize=932;const e$=new Xt("BPFLoader2111111111111111111111111111111111");function r$(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var n$=Object.prototype.toString,i$=Object.keys||function(r){var t=[];for(var e in r)t.push(e);return t};function Oc(r,t){var e,n,s,i,c,l,p;if(r===!0)return"true";if(r===!1)return"false";switch(typeof r){case"object":if(r===null)return null;if(r.toJSON&&typeof r.toJSON=="function")return Oc(r.toJSON(),t);if((p=n$.call(r))==="[object Array]"){for(s="[",n=r.length-1,e=0;e-1&&(s+=Oc(r[e],!0)),s+"]"}if(p==="[object Object]"){for(n=(i=i$(r).sort()).length,s="",e=0;e1;)r/=2,t++;return t}class N4{constructor(t,e,n,s,i){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=e,this.warmup=n,this.firstNormalEpoch=s,this.firstNormalSlot=i}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t>1,n|=n>>2,n|=n>>4,n|=n>>8,n|=n>>16,1+(n|=n>>32))}(t+32+1))-zm(32)-1;return[e,t-(this.getSlotsInEpoch(e)-32)]}{const e=t-this.firstNormalSlot,n=Math.floor(e/this.slotsPerEpoch);return[this.firstNormalEpoch+n,e%this.slotsPerEpoch]}}getFirstSlotInEpoch(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}getSlotsInEpoch(t){return t{const i=Rj(s,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...e});return this.underlyingSocket="socket"in i?i.socket:i,i},t,e,n),this.underlyingSocket=void 0}call(...t){var n;const e=(n=this.underlyingSocket)==null?void 0:n.readyState;return e===1?super.call(...t):Promise.reject(new Error("Tried to call a JSON-RPC method `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}notify(...t){var n;const e=(n=this.underlyingSocket)==null?void 0:n.readyState;return e===1?super.notify(...t):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}}class qm{constructor(t){this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}isActive(){const t=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===t}static deserialize(t){const e=function(c,l){let p;try{p=c.layout.decode(l)}catch(v){throw new Error("invalid instruction; "+v)}if(p.typeIndex!==c.index)throw new Error(`invalid account data; account type mismatch ${p.typeIndex} != ${c.index}`);return p}(a$,t),n=t.length-56;xr(n>=0,"lookup table is invalid"),xr(n%32==0,"lookup table is invalid");const s=n/32,{addresses:i}=Ue([Nn(ar(),s,"addresses")]).decode(t.slice(56));return{deactivationSlot:e.deactivationSlot,lastExtendedSlot:e.lastExtendedSlot,lastExtendedSlotStartIndex:e.lastExtendedStartIndex,authority:e.authority.length!==0?new Xt(e.authority[0]):void 0,addresses:i.map(c=>new Xt(c))}}}const a$={index:1,layout:Ue([Ce("typeIndex"),_f("deactivationSlot"),Pn("lastExtendedSlot"),or("lastExtendedStartIndex"),or(),Nn(ar(),ia(or(),-1),"authority")])},u$=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i,cn=Yh(Dy(Xt),_e(),r=>new Xt(r)),_A=zy([_e(),Zr("base64")]),Vy=Yh(Dy(Ae.Buffer),_A,r=>Ae.Buffer.from(r[0],"base64"));function qr(r){let t,e;if(typeof r=="string")t=r;else if(r){const{commitment:n,...s}=r;t=n,e=s}return{commitment:t,config:e}}function MA(r){return pi([we({jsonrpc:Zr("2.0"),id:_e(),result:r}),we({jsonrpc:Zr("2.0"),id:_e(),error:we({code:Gh(),message:_e(),data:Ve(gu("any",()=>!0))})})])}const f$=MA(Gh());function rr(r){return Yh(MA(r),f$,t=>"error"in t?t:{...t,result:Ee(t.result,r)})}function rn(r){return rr(we({context:we({slot:Ft()}),value:r}))}function n1(r){return we({context:we({slot:Ft()}),value:r})}function Fm(r,t){return r===0?new cu({header:t.header,staticAccountKeys:t.accountKeys.map(e=>new Xt(e)),recentBlockhash:t.recentBlockhash,compiledInstructions:t.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:Un.decode(e.data)})),addressTableLookups:t.addressTableLookups}):new po(t)}const c$=we({foundation:Ft(),foundationTerm:Ft(),initial:Ft(),taper:Ft(),terminal:Ft()}),h$=rr(ke(Ie(we({epoch:Ft(),effectiveSlot:Ft(),amount:Ft(),postBalance:Ft(),commission:Ve(Ie(Ft()))})))),l$=ke(we({slot:Ft(),prioritizationFee:Ft()})),d$=we({total:Ft(),validator:Ft(),foundation:Ft(),epoch:Ft()}),p$=we({epoch:Ft(),slotIndex:Ft(),slotsInEpoch:Ft(),absoluteSlot:Ft(),blockHeight:Ve(Ft()),transactionCount:Ve(Ft())}),m$=we({slotsPerEpoch:Ft(),leaderScheduleSlotOffset:Ft(),warmup:Qo(),firstNormalEpoch:Ft(),firstNormalSlot:Ft()}),v$=tA(_e(),ke(Ft())),yu=Ie(pi([we({}),_e()])),g$=we({err:yu}),y$=Zr("receivedSignature"),b$=we({"solana-core":_e(),"feature-set":Ve(Ft())}),D4=rn(we({err:Ie(pi([we({}),_e()])),logs:Ie(ke(_e())),accounts:Ve(Ie(ke(Ie(we({executable:Qo(),owner:_e(),lamports:Ft(),data:ke(_e()),rentEpoch:Ve(Ft())}))))),unitsConsumed:Ve(Ft()),returnData:Ve(Ie(we({programId:_e(),data:zy([_e(),Zr("base64")])})))})),w$=rn(we({byIdentity:tA(_e(),ke(Ft())),range:we({firstSlot:Ft(),lastSlot:Ft()})})),x$=rr(c$),_$=rr(d$),M$=rr(l$),E$=rr(p$),A$=rr(m$),S$=rr(v$),k$=rr(Ft()),I$=rn(we({total:Ft(),circulating:Ft(),nonCirculating:Ft(),nonCirculatingAccounts:ke(cn)})),b2=we({amount:_e(),uiAmount:Ie(Ft()),decimals:Ft(),uiAmountString:Ve(_e())}),B$=rn(ke(we({address:cn,amount:_e(),uiAmount:Ie(Ft()),decimals:Ft(),uiAmountString:Ve(_e())}))),P$=rn(ke(we({pubkey:cn,account:we({executable:Qo(),owner:cn,lamports:Ft(),data:Vy,rentEpoch:Ft()})}))),w2=we({program:_e(),parsed:Gh(),space:Ft()}),R$=rn(ke(we({pubkey:cn,account:we({executable:Qo(),owner:cn,lamports:Ft(),data:w2,rentEpoch:Ft()})}))),C$=rn(ke(we({lamports:Ft(),address:cn}))),vh=we({executable:Qo(),owner:cn,lamports:Ft(),data:Vy,rentEpoch:Ft()}),T$=we({pubkey:cn,account:vh}),L$=Yh(pi([Dy(Ae.Buffer),w2]),pi([_A,w2]),r=>Array.isArray(r)?Ee(r,Vy):r),x2=we({executable:Qo(),owner:cn,lamports:Ft(),data:L$,rentEpoch:Ft()}),O$=we({pubkey:cn,account:x2}),U$=we({state:pi([Zr("active"),Zr("inactive"),Zr("activating"),Zr("deactivating")]),active:Ft(),inactive:Ft()}),N$=rr(ke(we({signature:_e(),slot:Ft(),err:yu,memo:Ie(_e()),blockTime:Ve(Ie(Ft()))}))),D$=rr(ke(we({signature:_e(),slot:Ft(),err:yu,memo:Ie(_e()),blockTime:Ve(Ie(Ft()))}))),z$=we({subscription:Ft(),result:n1(vh)}),q$=we({pubkey:cn,account:vh}),F$=we({subscription:Ft(),result:n1(q$)}),j$=we({parent:Ft(),slot:Ft(),root:Ft()}),$$=we({subscription:Ft(),result:j$}),K$=pi([we({type:pi([Zr("firstShredReceived"),Zr("completed"),Zr("optimisticConfirmation"),Zr("root")]),slot:Ft(),timestamp:Ft()}),we({type:Zr("createdBank"),parent:Ft(),slot:Ft(),timestamp:Ft()}),we({type:Zr("frozen"),slot:Ft(),timestamp:Ft(),stats:we({numTransactionEntries:Ft(),numSuccessfulTransactions:Ft(),numFailedTransactions:Ft(),maxTransactionsPerEntry:Ft()})}),we({type:Zr("dead"),slot:Ft(),timestamp:Ft(),err:_e()})]),H$=we({subscription:Ft(),result:K$}),V$=we({subscription:Ft(),result:n1(pi([g$,y$]))}),Z$=we({subscription:Ft(),result:Ft()}),W$=we({pubkey:_e(),gossip:Ie(_e()),tpu:Ie(_e()),rpc:Ie(_e()),version:Ie(_e())}),z4=we({votePubkey:_e(),nodePubkey:_e(),activatedStake:Ft(),epochVoteAccount:Qo(),epochCredits:ke(zy([Ft(),Ft(),Ft()])),commission:Ft(),lastVote:Ft(),rootSlot:Ie(Ft())}),G$=rr(we({current:ke(z4),delinquent:ke(z4)})),Y$=pi([Zr("processed"),Zr("confirmed"),Zr("finalized")]),X$=we({slot:Ft(),confirmations:Ie(Ft()),err:yu,confirmationStatus:Ve(Y$)}),J$=rn(ke(Ie(X$))),Q$=rr(Ft()),EA=we({accountKey:cn,writableIndexes:ke(Ft()),readonlyIndexes:ke(Ft())}),Zy=we({signatures:ke(_e()),message:we({accountKeys:ke(_e()),header:we({numRequiredSignatures:Ft(),numReadonlySignedAccounts:Ft(),numReadonlyUnsignedAccounts:Ft()}),instructions:ke(we({accounts:ke(Ft()),data:_e(),programIdIndex:Ft()})),recentBlockhash:_e(),addressTableLookups:Ve(ke(EA))})}),AA=we({pubkey:cn,signer:Qo(),writable:Qo(),source:Ve(pi([Zr("transaction"),Zr("lookupTable")]))}),SA=we({accountKeys:ke(AA),signatures:ke(_e())}),q4=we({parsed:Gh(),program:_e(),programId:cn}),F4=we({accounts:ke(cn),data:_e(),programId:cn}),kA=Yh(pi([F4,q4]),pi([we({parsed:Gh(),program:_e(),programId:_e()}),we({accounts:ke(_e()),data:_e(),programId:_e()})]),r=>Ee(r,"accounts"in r?F4:q4)),IA=we({signatures:ke(_e()),message:we({accountKeys:ke(AA),instructions:ke(kA),recentBlockhash:_e(),addressTableLookups:Ve(Ie(ke(EA)))})}),Dl=we({accountIndex:Ft(),mint:_e(),owner:Ve(_e()),uiTokenAmount:b2}),BA=we({writable:ke(cn),readonly:ke(cn)}),i1=we({err:yu,fee:Ft(),innerInstructions:Ve(Ie(ke(we({index:Ft(),instructions:ke(we({accounts:ke(Ft()),data:_e(),programIdIndex:Ft()}))})))),preBalances:ke(Ft()),postBalances:ke(Ft()),logMessages:Ve(Ie(ke(_e()))),preTokenBalances:Ve(Ie(ke(Dl))),postTokenBalances:Ve(Ie(ke(Dl))),loadedAddresses:Ve(BA),computeUnitsConsumed:Ve(Ft())}),Wy=we({err:yu,fee:Ft(),innerInstructions:Ve(Ie(ke(we({index:Ft(),instructions:ke(kA)})))),preBalances:ke(Ft()),postBalances:ke(Ft()),logMessages:Ve(Ie(ke(_e()))),preTokenBalances:Ve(Ie(ke(Dl))),postTokenBalances:Ve(Ie(ke(Dl))),loadedAddresses:Ve(BA),computeUnitsConsumed:Ve(Ft())}),Kf=pi([Zr(0),Zr("legacy")]),bu=we({pubkey:_e(),lamports:Ft(),postBalance:Ie(Ft()),rewardType:Ie(_e()),commission:Ve(Ie(Ft()))}),tK=rr(Ie(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:Ft(),transactions:ke(we({transaction:Zy,meta:Ie(i1),version:Ve(Kf)})),rewards:Ve(ke(bu)),blockTime:Ie(Ft()),blockHeight:Ie(Ft())}))),eK=rr(Ie(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:Ft(),rewards:Ve(ke(bu)),blockTime:Ie(Ft()),blockHeight:Ie(Ft())}))),rK=rr(Ie(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:Ft(),transactions:ke(we({transaction:SA,meta:Ie(i1),version:Ve(Kf)})),rewards:Ve(ke(bu)),blockTime:Ie(Ft()),blockHeight:Ie(Ft())}))),nK=rr(Ie(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:Ft(),transactions:ke(we({transaction:IA,meta:Ie(Wy),version:Ve(Kf)})),rewards:Ve(ke(bu)),blockTime:Ie(Ft()),blockHeight:Ie(Ft())}))),iK=rr(Ie(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:Ft(),transactions:ke(we({transaction:SA,meta:Ie(Wy),version:Ve(Kf)})),rewards:Ve(ke(bu)),blockTime:Ie(Ft()),blockHeight:Ie(Ft())}))),oK=rr(Ie(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:Ft(),rewards:Ve(ke(bu)),blockTime:Ie(Ft()),blockHeight:Ie(Ft())}))),sK=rr(Ie(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:Ft(),transactions:ke(we({transaction:Zy,meta:Ie(i1)})),rewards:Ve(ke(bu)),blockTime:Ie(Ft())}))),j4=rr(Ie(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:Ft(),signatures:ke(_e()),blockTime:Ie(Ft())}))),jm=rr(Ie(we({slot:Ft(),meta:i1,blockTime:Ve(Ie(Ft())),transaction:Zy,version:Ve(Kf)}))),R0=rr(Ie(we({slot:Ft(),transaction:IA,meta:Ie(Wy),blockTime:Ve(Ie(Ft())),version:Ve(Kf)}))),aK=rn(we({blockhash:_e(),feeCalculator:we({lamportsPerSignature:Ft()})})),uK=rn(we({blockhash:_e(),lastValidBlockHeight:Ft()})),fK=rn(Qo()),cK=rr(ke(we({slot:Ft(),numTransactions:Ft(),numSlots:Ft(),samplePeriodSecs:Ft()}))),hK=rn(Ie(we({feeCalculator:we({lamportsPerSignature:Ft()})}))),lK=rr(_e()),dK=rr(_e()),pK=we({err:yu,logs:ke(_e()),signature:_e()}),mK=we({result:n1(pK),subscription:Ft()}),vK={"solana-client":"js/0.0.0-development"};class Qu{constructor(t){this._keypair=void 0,this._keypair=t??C4()}static generate(){return new Qu(C4())}static fromSecretKey(t,e){if(t.byteLength!==64)throw new Error("bad secret key size");const n=t.slice(32,64);if(!e||!e.skipValidation){const s=t.slice(0,32),i=Ul(s);for(let c=0;c<32;c++)if(n[c]!==i[c])throw new Error("provided secretKey is invalid")}return new Qu({publicKey:n,secretKey:t})}static fromSeed(t){const e=Ul(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),new Qu({publicKey:e,secretKey:n})}get publicKey(){return new Xt(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}const _s=Object.freeze({CreateLookupTable:{index:0,layout:Ue([Ce("instruction"),_f("recentSlot"),or("bumpSeed")])},FreezeLookupTable:{index:1,layout:Ue([Ce("instruction")])},ExtendLookupTable:{index:2,layout:Ue([Ce("instruction"),_f(),Nn(ar(),ia(Ce(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Ue([Ce("instruction")])},CloseLookupTable:{index:4,layout:Ue([Ce("instruction")])}});class _2{constructor(){}static createLookupTable(t){const[e,n]=Xt.findProgramAddressSync([t.authority.toBuffer(),Uy(BigInt(t.recentSlot),8)],this.programId),s=gr(_s.CreateLookupTable,{recentSlot:BigInt(t.recentSlot),bumpSeed:n}),i=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:an.programId,isSigner:!1,isWritable:!1}];return[new kr({programId:this.programId,keys:i,data:s}),e]}static freezeLookupTable(t){const e=gr(_s.FreezeLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new kr({programId:this.programId,keys:n,data:e})}static extendLookupTable(t){const e=gr(_s.ExtendLookupTable,{addresses:t.addresses.map(s=>s.toBytes())}),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return t.payer&&n.push({pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:an.programId,isSigner:!1,isWritable:!1}),new kr({programId:this.programId,keys:n,data:e})}static deactivateLookupTable(t){const e=gr(_s.DeactivateLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new kr({programId:this.programId,keys:n,data:e})}static closeLookupTable(t){const e=gr(_s.CloseLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.recipient,isSigner:!1,isWritable:!0}];return new kr({programId:this.programId,keys:n,data:e})}}_2.programId=new Xt("AddressLookupTab1e1111111111111111111111111");const Do=Object.freeze({RequestUnits:{index:0,layout:Ue([or("instruction"),Ce("units"),Ce("additionalFee")])},RequestHeapFrame:{index:1,layout:Ue([or("instruction"),Ce("bytes")])},SetComputeUnitLimit:{index:2,layout:Ue([or("instruction"),Ce("units")])},SetComputeUnitPrice:{index:3,layout:Ue([or("instruction"),_f("microLamports")])}});class M2{constructor(){}static requestUnits(t){const e=gr(Do.RequestUnits,t);return new kr({keys:[],programId:this.programId,data:e})}static requestHeapFrame(t){const e=gr(Do.RequestHeapFrame,t);return new kr({keys:[],programId:this.programId,data:e})}static setComputeUnitLimit(t){const e=gr(Do.SetComputeUnitLimit,t);return new kr({keys:[],programId:this.programId,data:e})}static setComputeUnitPrice(t){const e=gr(Do.SetComputeUnitPrice,{microLamports:BigInt(t.microLamports)});return new kr({keys:[],programId:this.programId,data:e})}}M2.programId=new Xt("ComputeBudget111111111111111111111111111111");const $4=Ue([or("numSignatures"),or("padding"),ji("signatureOffset"),ji("signatureInstructionIndex"),ji("publicKeyOffset"),ji("publicKeyInstructionIndex"),ji("messageDataOffset"),ji("messageDataSize"),ji("messageInstructionIndex")]);class o1{constructor(){}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:s,instructionIndex:i}=t;xr(e.length===32,`Public Key must be 32 bytes but received ${e.length} bytes`),xr(s.length===64,`Signature must be 64 bytes but received ${s.length} bytes`);const c=$4.span,l=c+e.length,p=l+s.length,v=Ae.Buffer.alloc(p+n.length),y=i??65535;return $4.encode({numSignatures:1,padding:0,signatureOffset:l,signatureInstructionIndex:y,publicKeyOffset:c,publicKeyInstructionIndex:y,messageDataOffset:p,messageDataSize:n.length,messageInstructionIndex:y},v),v.fill(e,c),v.fill(s,l),v.fill(n,p),new kr({keys:[],programId:o1.programId,data:v})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:s}=t;xr(e.length===64,`Private key must be 64 bytes but received ${e.length} bytes`);try{const i=Qu.fromSecretKey(e),c=i.publicKey.toBytes(),l=jy(n,i.secretKey);return this.createInstructionWithPublicKey({publicKey:c,message:n,signature:l,instructionIndex:s})}catch(i){throw new Error(`Error creating instruction; ${i}`)}}}o1.programId=new Xt("Ed25519SigVerify111111111111111111111111111");t1.utils.isValidPrivateKey;const gK=t1.getPublicKey,$m=Ue([or("numSignatures"),ji("signatureOffset"),or("signatureInstructionIndex"),ji("ethAddressOffset"),or("ethAddressInstructionIndex"),ji("messageDataOffset"),ji("messageDataSize"),or("messageInstructionIndex"),Tr(20,"ethAddress"),Tr(64,"signature"),or("recoveryId")]);class tf{constructor(){}static publicKeyToEthAddress(t){xr(t.length===64,`Public key must be 64 bytes but received ${t.length} bytes`);try{return Ae.Buffer.from(k4(nr(t))).slice(-20)}catch(e){throw new Error(`Error constructing Ethereum address: ${e}`)}}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:s,recoveryId:i,instructionIndex:c}=t;return tf.createInstructionWithEthAddress({ethAddress:tf.publicKeyToEthAddress(e),message:n,signature:s,recoveryId:i,instructionIndex:c})}static createInstructionWithEthAddress(t){const{ethAddress:e,message:n,signature:s,recoveryId:i,instructionIndex:c=0}=t;let l;l=typeof e=="string"?e.startsWith("0x")?Ae.Buffer.from(e.substr(2),"hex"):Ae.Buffer.from(e,"hex"):e,xr(l.length===20,`Address must be 20 bytes but received ${l.length} bytes`);const p=12+l.length,v=p+s.length+1,y=Ae.Buffer.alloc($m.span+n.length);return $m.encode({numSignatures:1,signatureOffset:p,signatureInstructionIndex:c,ethAddressOffset:12,ethAddressInstructionIndex:c,messageDataOffset:v,messageDataSize:n.length,messageInstructionIndex:c,signature:nr(s),ethAddress:nr(l),recoveryId:i},y),y.fill(nr(n),$m.span),new kr({keys:[],programId:tf.programId,data:y})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:s}=t;xr(e.length===32,`Private key must be 32 bytes but received ${e.length} bytes`);try{const i=nr(e),c=gK(i,!1).slice(1),l=Ae.Buffer.from(k4(nr(n))),[p,v]=((y,E)=>{const M=t1.sign(y,E);return[M.toCompactRawBytes(),M.recovery]})(l,i);return this.createInstructionWithPublicKey({publicKey:c,message:n,signature:p,recoveryId:v,instructionIndex:s})}catch(i){throw new Error(`Error creating instruction; ${i}`)}}}var K4;tf.programId=new Xt("KeccakSecp256k11111111111111111111111111111");const PA=new Xt("StakeConfig11111111111111111111111111111111");class H4{constructor(t,e){this.staker=void 0,this.withdrawer=void 0,this.staker=t,this.withdrawer=e}}class gh{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}}K4=gh,gh.default=new K4(0,0,Xt.default);const xn=Object.freeze({Initialize:{index:0,layout:Ue([Ce("instruction"),((r="authorized")=>Ue([ar("staker"),ar("withdrawer")],r))(),((r="lockup")=>Ue([Ai("unixTimestamp"),Ai("epoch"),ar("custodian")],r))()])},Authorize:{index:1,layout:Ue([Ce("instruction"),ar("newAuthorized"),Ce("stakeAuthorizationType")])},Delegate:{index:2,layout:Ue([Ce("instruction")])},Split:{index:3,layout:Ue([Ce("instruction"),Ai("lamports")])},Withdraw:{index:4,layout:Ue([Ce("instruction"),Ai("lamports")])},Deactivate:{index:5,layout:Ue([Ce("instruction")])},Merge:{index:7,layout:Ue([Ce("instruction")])},AuthorizeWithSeed:{index:8,layout:Ue([Ce("instruction"),ar("newAuthorized"),Ce("stakeAuthorizationType"),Ka("authoritySeed"),ar("authorityOwner")])}}),yK=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class zl{constructor(){}static initialize(t){const{stakePubkey:e,authorized:n,lockup:s}=t,i=s||gh.default,c=gr(xn.Initialize,{authorized:{staker:nr(n.staker.toBuffer()),withdrawer:nr(n.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:nr(i.custodian.toBuffer())}}),l={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:fa,isSigner:!1,isWritable:!1}],programId:this.programId,data:c};return new kr(l)}static createAccountWithSeed(t){const e=new wr;e.add(an.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:s,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:s,lockup:i}))}static createAccount(t){const e=new wr;e.add(an.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:s,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:s,lockup:i}))}static delegate(t){const{stakePubkey:e,authorizedPubkey:n,votePubkey:s}=t,i=gr(xn.Delegate);return new wr().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!1,isWritable:!1},{pubkey:co,isSigner:!1,isWritable:!1},{pubkey:cl,isSigner:!1,isWritable:!1},{pubkey:PA,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(t){const{stakePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:s,stakeAuthorizationType:i,custodianPubkey:c}=t,l=gr(xn.Authorize,{newAuthorized:nr(s.toBuffer()),stakeAuthorizationType:i.index}),p=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:co,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return c&&p.push({pubkey:c,isSigner:!1,isWritable:!1}),new wr().add({keys:p,programId:this.programId,data:l})}static authorizeWithSeed(t){const{stakePubkey:e,authorityBase:n,authoritySeed:s,authorityOwner:i,newAuthorizedPubkey:c,stakeAuthorizationType:l,custodianPubkey:p}=t,v=gr(xn.AuthorizeWithSeed,{newAuthorized:nr(c.toBuffer()),stakeAuthorizationType:l.index,authoritySeed:s,authorityOwner:nr(i.toBuffer())}),y=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:co,isSigner:!1,isWritable:!1}];return p&&y.push({pubkey:p,isSigner:!1,isWritable:!1}),new wr().add({keys:y,programId:this.programId,data:v})}static splitInstruction(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:s,lamports:i}=t,c=gr(xn.Split,{lamports:i});return new kr({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:c})}static split(t){const e=new wr;return e.add(an.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}static splitWithSeed(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:s,basePubkey:i,seed:c,lamports:l}=t,p=new wr;return p.add(an.allocate({accountPubkey:s,basePubkey:i,seed:c,space:this.space,programId:this.programId})),p.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:s,lamports:l}))}static merge(t){const{stakePubkey:e,sourceStakePubKey:n,authorizedPubkey:s}=t,i=gr(xn.Merge);return new wr().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:co,isSigner:!1,isWritable:!1},{pubkey:cl,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(t){const{stakePubkey:e,authorizedPubkey:n,toPubkey:s,lamports:i,custodianPubkey:c}=t,l=gr(xn.Withdraw,{lamports:i}),p=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:co,isSigner:!1,isWritable:!1},{pubkey:cl,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return c&&p.push({pubkey:c,isSigner:!1,isWritable:!1}),new wr().add({keys:p,programId:this.programId,data:l})}static deactivate(t){const{stakePubkey:e,authorizedPubkey:n}=t,s=gr(xn.Deactivate);return new wr().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:co,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}}zl.programId=new Xt("Stake11111111111111111111111111111111111111"),zl.space=200;class V4{constructor(t,e,n,s){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=t,this.authorizedVoter=e,this.authorizedWithdrawer=n,this.commission=s}}const Ms=Object.freeze({InitializeAccount:{index:0,layout:Ue([Ce("instruction"),((r="voteInit")=>Ue([ar("nodePubkey"),ar("authorizedVoter"),ar("authorizedWithdrawer"),or("commission")],r))()])},Authorize:{index:1,layout:Ue([Ce("instruction"),ar("newAuthorized"),Ce("voteAuthorizationType")])},Withdraw:{index:3,layout:Ue([Ce("instruction"),Ai("lamports")])},AuthorizeWithSeed:{index:10,layout:Ue([Ce("instruction"),((r="voteAuthorizeWithSeedArgs")=>Ue([Ce("voteAuthorizationType"),ar("currentAuthorityDerivedKeyOwnerPubkey"),Ka("currentAuthorityDerivedKeySeed"),ar("newAuthorized")],r))()])}}),bK=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class Mf{constructor(){}static initializeAccount(t){const{votePubkey:e,nodePubkey:n,voteInit:s}=t,i=gr(Ms.InitializeAccount,{voteInit:{nodePubkey:nr(s.nodePubkey.toBuffer()),authorizedVoter:nr(s.authorizedVoter.toBuffer()),authorizedWithdrawer:nr(s.authorizedWithdrawer.toBuffer()),commission:s.commission}}),c={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:fa,isSigner:!1,isWritable:!1},{pubkey:co,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new kr(c)}static createAccount(t){const e=new wr;return e.add(an.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){const{votePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:s,voteAuthorizationType:i}=t,c=gr(Ms.Authorize,{newAuthorized:nr(s.toBuffer()),voteAuthorizationType:i.index}),l=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:co,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return new wr().add({keys:l,programId:this.programId,data:c})}static authorizeWithSeed(t){const{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:s,newAuthorizedPubkey:i,voteAuthorizationType:c,votePubkey:l}=t,p=gr(Ms.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:nr(n.toBuffer()),currentAuthorityDerivedKeySeed:s,newAuthorized:nr(i.toBuffer()),voteAuthorizationType:c.index}}),v=[{pubkey:l,isSigner:!1,isWritable:!0},{pubkey:co,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return new wr().add({keys:v,programId:this.programId,data:p})}static withdraw(t){const{votePubkey:e,authorizedWithdrawerPubkey:n,lamports:s,toPubkey:i}=t,c=gr(Ms.Withdraw,{lamports:s}),l=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return new wr().add({keys:l,programId:this.programId,data:c})}static safeWithdraw(t,e,n){if(t.lamports>e-n)throw new Error("Withdraw will leave vote account with insuffcient funds.");return Mf.withdraw(t)}}Mf.programId=new Xt("Vote111111111111111111111111111111111111111"),Mf.space=3731;const RA=new Xt("Va1idator1nfo111111111111111111111111111111"),wK=we({name:_e(),website:Ve(_e()),details:Ve(_e()),keybaseUsername:Ve(_e())});class Gy{constructor(t,e){this.key=void 0,this.info=void 0,this.key=t,this.info=e}static fromConfigData(t){let e=[...t];if(ii(e)!==2)return null;const n=[];for(let s=0;s<2;s++){const i=new Xt(e.slice(0,Pi));e=e.slice(Pi);const c=e.slice(0,1)[0]===1;e=e.slice(1),n.push({publicKey:i,isSigner:c})}if(n[0].publicKey.equals(RA)&&n[1].isSigner){const s=Ka().decode(Ae.Buffer.from(e)),i=JSON.parse(s);return JE(i,wK),new Gy(n[1].publicKey,i)}return null}}const xK=new Xt("Vote111111111111111111111111111111111111111"),_K=Ue([ar("nodePubkey"),ar("authorizedWithdrawer"),or("commission"),Pn(),Nn(Ue([Pn("slot"),Ce("confirmationCount")]),ia(Ce(),-8),"votes"),or("rootSlotValid"),Pn("rootSlot"),Pn(),Nn(Ue([Pn("epoch"),ar("authorizedVoter")]),ia(Ce(),-8),"authorizedVoters"),Ue([Nn(Ue([ar("authorizedPubkey"),Pn("epochOfLastAuthorizedSwitch"),Pn("targetEpoch")]),32,"buf"),Pn("idx"),or("isEmpty")],"priorVoters"),Pn(),Nn(Ue([Pn("epoch"),Pn("credits"),Pn("prevCredits")]),ia(Ce(),-8),"epochCredits"),Ue([Pn("slot"),Pn("timestamp")],"lastTimestamp")]);class Yy{constructor(t){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=t.nodePubkey,this.authorizedWithdrawer=t.authorizedWithdrawer,this.commission=t.commission,this.rootSlot=t.rootSlot,this.votes=t.votes,this.authorizedVoters=t.authorizedVoters,this.priorVoters=t.priorVoters,this.epochCredits=t.epochCredits,this.lastTimestamp=t.lastTimestamp}static fromAccountData(t){const e=_K.decode(nr(t),4);let n=e.rootSlot;return e.rootSlotValid||(n=null),new Yy({nodePubkey:new Xt(e.nodePubkey),authorizedWithdrawer:new Xt(e.authorizedWithdrawer),commission:e.commission,votes:e.votes,rootSlot:n,authorizedVoters:e.authorizedVoters.map(MK),priorVoters:EK(e.priorVoters),epochCredits:e.epochCredits,lastTimestamp:e.lastTimestamp})}}function MK({authorizedVoter:r,epoch:t}){return{epoch:t,authorizedVoter:new Xt(r)}}function Z4({authorizedPubkey:r,epochOfLastAuthorizedSwitch:t,targetEpoch:e}){return{authorizedPubkey:new Xt(r),epochOfLastAuthorizedSwitch:t,targetEpoch:e}}function EK({buf:r,idx:t,isEmpty:e}){return e?[]:[...r.slice(t+1).map(Z4),...r.slice(0,t).map(Z4)]}const W4={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/"}};var CA=Object.freeze({__proto__:null,Account:class{constructor(r){if(this._publicKey=void 0,this._secretKey=void 0,r){const t=nr(r);if(r.length!==64)throw new Error("bad secret key size");this._publicKey=t.slice(32,64),this._secretKey=t.slice(0,32)}else this._secretKey=nr(Hj()),this._publicKey=nr(Ul(this._secretKey))}get publicKey(){return new Xt(this._publicKey)}get secretKey(){return Ae.Buffer.concat([this._secretKey,this._publicKey],64)}},AddressLookupTableAccount:qm,AddressLookupTableInstruction:class{constructor(){}static decodeInstructionType(r){this.checkProgramId(r.programId);const t=Ce("instruction").decode(r.data);let e;for(const[n,s]of Object.entries(_s))if(s.index==t){e=n;break}if(!e)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return e}static decodeCreateLookupTable(r){this.checkProgramId(r.programId),this.checkKeysLength(r.keys,4);const{recentSlot:t}=Ir(_s.CreateLookupTable,r.data);return{authority:r.keys[1].pubkey,payer:r.keys[2].pubkey,recentSlot:Number(t)}}static decodeExtendLookupTable(r){if(this.checkProgramId(r.programId),r.keys.length<2)throw new Error(`invalid instruction; found ${r.keys.length} keys, expected at least 2`);const{addresses:t}=Ir(_s.ExtendLookupTable,r.data);return{lookupTable:r.keys[0].pubkey,authority:r.keys[1].pubkey,payer:r.keys.length>2?r.keys[2].pubkey:void 0,addresses:t.map(e=>new Xt(e))}}static decodeCloseLookupTable(r){return this.checkProgramId(r.programId),this.checkKeysLength(r.keys,3),{lookupTable:r.keys[0].pubkey,authority:r.keys[1].pubkey,recipient:r.keys[2].pubkey}}static decodeFreezeLookupTable(r){return this.checkProgramId(r.programId),this.checkKeysLength(r.keys,2),{lookupTable:r.keys[0].pubkey,authority:r.keys[1].pubkey}}static decodeDeactivateLookupTable(r){return this.checkProgramId(r.programId),this.checkKeysLength(r.keys,2),{lookupTable:r.keys[0].pubkey,authority:r.keys[1].pubkey}}static checkProgramId(r){if(!r.equals(_2.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}static checkKeysLength(r,t){if(r.length{const p={};return async v=>{const{commitment:y,config:E}=qr(v),M=this._buildArgs([],y,void 0,E),w=U4(M);return p[w]=p[w]??(async()=>{try{const _=Ee(await this._rpcRequest("getBlockHeight",M),rr(Ft()));if("error"in _)throw new De(_.error,"failed to get block height information");return _.result}finally{delete p[w]}})(),await p[w]}})(),t&&typeof t=="string"?this._commitment=t:t&&(this._commitment=t.commitment,this._confirmTransactionInitialTimeout=t.confirmTransactionInitialTimeout,e=t.wsEndpoint,n=t.httpHeaders,s=t.fetch,i=t.fetchMiddleware,c=t.disableRetryOnRateLimit,l=t.httpAgent),this._rpcEndpoint=function(p){if(/^https?:/.test(p)===!1)throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return p}(r),this._rpcWsEndpoint=e||function(p){const v=p.match(u$);if(v==null)throw TypeError(`Failed to validate endpoint URL \`${p}\``);const[y,E,M,w]=v,_=p.startsWith("https:")?"wss:":"ws:",k=M==null?null:parseInt(M.slice(1),10);return`${_}//${E}${k==null?"":`:${k+1}`}${w}`}(r),this._rpcClient=function(p,v,y,E,M,w){const _=y||o$;let k;return w!=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."),E&&(k=async(P,R)=>{const T=await new Promise((U,j)=>{try{E(P,R,(Y,rt)=>U([Y,rt]))}catch(Y){j(Y)}});return await _(...T)}),new Ej(async(P,R)=>{const T={method:"POST",body:P,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},v||{},vK)};try{let U,j=5,Y=500;for(;U=k?await k(p,T):await _(p,T),U.status===429&&M!==!0&&(j-=1,j!==0);)console.log(`Server responded with ${U.status} ${U.statusText}. Retrying after ${Y}ms delay...`),await Ba(Y),Y*=2;const rt=await U.text();U.ok?R(null,rt):R(new Error(`${U.status} ${U.statusText}: ${rt}`))}catch(U){U instanceof Error&&R(U)}},{})}(r,n,s,i,c,l),this._rpcRequest=function(p){return(v,y)=>new Promise((E,M)=>{p.request(v,y,(w,_)=>{w?M(w):E(_)})})}(this._rpcClient),this._rpcBatchRequest=function(p){return v=>new Promise((y,E)=>{v.length===0&&y([]);const M=v.map(w=>p.request(w.methodName,w.args));p.request(M,(w,_)=>{w?E(w):y(_)})})}(this._rpcClient),this._rpcWebSocket=new s$(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(r,t){const{commitment:e,config:n}=qr(t),s=this._buildArgs([r.toBase58()],e,void 0,n),i=Ee(await this._rpcRequest("getBalance",s),rn(Ft()));if("error"in i)throw new De(i.error,`failed to get balance for ${r.toBase58()}`);return i.result}async getBalance(r,t){return await this.getBalanceAndContext(r,t).then(e=>e.value).catch(e=>{throw new Error("failed to get balance of account "+r.toBase58()+": "+e)})}async getBlockTime(r){const t=Ee(await this._rpcRequest("getBlockTime",[r]),rr(Ie(Ft())));if("error"in t)throw new De(t.error,`failed to get block time for slot ${r}`);return t.result}async getMinimumLedgerSlot(){const r=Ee(await this._rpcRequest("minimumLedgerSlot",[]),rr(Ft()));if("error"in r)throw new De(r.error,"failed to get minimum ledger slot");return r.result}async getFirstAvailableBlock(){const r=Ee(await this._rpcRequest("getFirstAvailableBlock",[]),k$);if("error"in r)throw new De(r.error,"failed to get first available block");return r.result}async getSupply(r){let t={};t=typeof r=="string"?{commitment:r}:r?{...r,commitment:r&&r.commitment||this.commitment}:{commitment:this.commitment};const e=Ee(await this._rpcRequest("getSupply",[t]),I$);if("error"in e)throw new De(e.error,"failed to get supply");return e.result}async getTokenSupply(r,t){const e=this._buildArgs([r.toBase58()],t),n=Ee(await this._rpcRequest("getTokenSupply",e),rn(b2));if("error"in n)throw new De(n.error,"failed to get token supply");return n.result}async getTokenAccountBalance(r,t){const e=this._buildArgs([r.toBase58()],t),n=Ee(await this._rpcRequest("getTokenAccountBalance",e),rn(b2));if("error"in n)throw new De(n.error,"failed to get token account balance");return n.result}async getTokenAccountsByOwner(r,t,e){const{commitment:n,config:s}=qr(e);let i=[r.toBase58()];"mint"in t?i.push({mint:t.mint.toBase58()}):i.push({programId:t.programId.toBase58()});const c=this._buildArgs(i,n,"base64",s),l=Ee(await this._rpcRequest("getTokenAccountsByOwner",c),P$);if("error"in l)throw new De(l.error,`failed to get token accounts owned by account ${r.toBase58()}`);return l.result}async getParsedTokenAccountsByOwner(r,t,e){let n=[r.toBase58()];"mint"in t?n.push({mint:t.mint.toBase58()}):n.push({programId:t.programId.toBase58()});const s=this._buildArgs(n,e,"jsonParsed"),i=Ee(await this._rpcRequest("getTokenAccountsByOwner",s),R$);if("error"in i)throw new De(i.error,`failed to get token accounts owned by account ${r.toBase58()}`);return i.result}async getLargestAccounts(r){const t={...r,commitment:r&&r.commitment||this.commitment},e=t.filter||t.commitment?[t]:[],n=Ee(await this._rpcRequest("getLargestAccounts",e),C$);if("error"in n)throw new De(n.error,"failed to get largest accounts");return n.result}async getTokenLargestAccounts(r,t){const e=this._buildArgs([r.toBase58()],t),n=Ee(await this._rpcRequest("getTokenLargestAccounts",e),B$);if("error"in n)throw new De(n.error,"failed to get token largest accounts");return n.result}async getAccountInfoAndContext(r,t){const{commitment:e,config:n}=qr(t),s=this._buildArgs([r.toBase58()],e,"base64",n),i=Ee(await this._rpcRequest("getAccountInfo",s),rn(Ie(vh)));if("error"in i)throw new De(i.error,`failed to get info about account ${r.toBase58()}`);return i.result}async getParsedAccountInfo(r,t){const{commitment:e,config:n}=qr(t),s=this._buildArgs([r.toBase58()],e,"jsonParsed",n),i=Ee(await this._rpcRequest("getAccountInfo",s),rn(Ie(x2)));if("error"in i)throw new De(i.error,`failed to get info about account ${r.toBase58()}`);return i.result}async getAccountInfo(r,t){try{return(await this.getAccountInfoAndContext(r,t)).value}catch(e){throw new Error("failed to get info about account "+r.toBase58()+": "+e)}}async getMultipleParsedAccounts(r,t){const{commitment:e,config:n}=qr(t),s=r.map(l=>l.toBase58()),i=this._buildArgs([s],e,"jsonParsed",n),c=Ee(await this._rpcRequest("getMultipleAccounts",i),rn(ke(Ie(x2))));if("error"in c)throw new De(c.error,`failed to get info for accounts ${s}`);return c.result}async getMultipleAccountsInfoAndContext(r,t){const{commitment:e,config:n}=qr(t),s=r.map(l=>l.toBase58()),i=this._buildArgs([s],e,"base64",n),c=Ee(await this._rpcRequest("getMultipleAccounts",i),rn(ke(Ie(vh))));if("error"in c)throw new De(c.error,`failed to get info for accounts ${s}`);return c.result}async getMultipleAccountsInfo(r,t){return(await this.getMultipleAccountsInfoAndContext(r,t)).value}async getStakeActivation(r,t,e){const{commitment:n,config:s}=qr(t),i=this._buildArgs([r.toBase58()],n,void 0,{...s,epoch:e??(s==null?void 0:s.epoch)}),c=Ee(await this._rpcRequest("getStakeActivation",i),rr(U$));if("error"in c)throw new De(c.error,`failed to get Stake Activation ${r.toBase58()}`);return c.result}async getProgramAccounts(r,t){const{commitment:e,config:n}=qr(t),{encoding:s,...i}=n||{},c=this._buildArgs([r.toBase58()],e,s||"base64",i),l=await this._rpcRequest("getProgramAccounts",c),p=ke(T$),v=i.withContext===!0?Ee(l,rn(p)):Ee(l,rr(p));if("error"in v)throw new De(v.error,`failed to get accounts owned by program ${r.toBase58()}`);return v.result}async getParsedProgramAccounts(r,t){const{commitment:e,config:n}=qr(t),s=this._buildArgs([r.toBase58()],e,"jsonParsed",n),i=Ee(await this._rpcRequest("getProgramAccounts",s),rr(ke(O$)));if("error"in i)throw new De(i.error,`failed to get accounts owned by program ${r.toBase58()}`);return i.result}async confirmTransaction(r,t){var s;let e,n;if(typeof r=="string")e=r;else{const i=r;if((s=i.abortSignal)!=null&&s.aborted)return Promise.reject(i.abortSignal.reason);e=i.signature}try{n=Un.decode(e)}catch{throw new Error("signature must be base58 encoded: "+e)}return xr(n.length===64,"signature has invalid length"),typeof r=="string"?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:t||this.commitment,signature:e}):"lastValidBlockHeight"in r?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t||this.commitment,strategy:r}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:t||this.commitment,strategy:r})}getCancellationPromise(r){return new Promise((t,e)=>{r!=null&&(r.aborted?e(r.reason):r.addEventListener("abort",()=>{e(r.reason)}))})}getTransactionConfirmationPromise({commitment:r,signature:t}){let e,n,s=!1;const i=new Promise((c,l)=>{try{e=this.onSignature(t,(v,y)=>{e=void 0;const E={context:y,value:v};c({__type:ss.PROCESSED,response:E})},r);const p=new Promise(v=>{e==null?v():n=this._onSubscriptionStateChange(e,y=>{y==="subscribed"&&v()})});(async()=>{if(await p,s)return;const v=await this.getSignatureStatus(t);if(s||v==null)return;const{context:y,value:E}=v;if(E!=null)if(E!=null&&E.err)l(E.err);else{switch(r){case"confirmed":case"single":case"singleGossip":if(E.confirmationStatus==="processed")return;break;case"finalized":case"max":case"root":if(E.confirmationStatus==="processed"||E.confirmationStatus==="confirmed")return}s=!0,c({__type:ss.PROCESSED,response:{context:y,value:E}})}})()}catch(p){l(p)}});return{abortConfirmation:()=>{n&&(n(),n=void 0),e!=null&&(this.removeSignatureListener(e),e=void 0)},confirmationPromise:i}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:r,strategy:{abortSignal:t,lastValidBlockHeight:e,signature:n}}){let s=!1;const i=new Promise(y=>{const E=async()=>{try{return await this.getBlockHeight(r)}catch{return-1}};(async()=>{let M=await E();if(!s){for(;M<=e;)if(await Ba(1e3),s||(M=await E(),s))return;y({__type:ss.BLOCKHEIGHT_EXCEEDED})}})()}),{abortConfirmation:c,confirmationPromise:l}=this.getTransactionConfirmationPromise({commitment:r,signature:n}),p=this.getCancellationPromise(t);let v;try{const y=await Promise.race([p,l,i]);if(y.__type!==ss.PROCESSED)throw new v2(n);v=y.response}finally{s=!0,c()}return v}async confirmTransactionUsingDurableNonceStrategy({commitment:r,strategy:{abortSignal:t,minContextSlot:e,nonceAccountPubkey:n,nonceValue:s,signature:i}}){let c=!1;const l=new Promise(M=>{let w=s,_=null;const k=async()=>{try{const{context:B,value:P}=await this.getNonceAndContext(n,{commitment:r,minContextSlot:e});return _=B.slot,P==null?void 0:P.nonce}catch{return w}};(async()=>{if(w=await k(),!c)for(;;){if(s!==w)return void M({__type:ss.NONCE_INVALID,slotInWhichNonceDidAdvance:_});if(await Ba(2e3),c||(w=await k(),c))return}})()}),{abortConfirmation:p,confirmationPromise:v}=this.getTransactionConfirmationPromise({commitment:r,signature:i}),y=this.getCancellationPromise(t);let E;try{const M=await Promise.race([y,v,l]);if(M.__type===ss.PROCESSED)E=M.response;else{let w;for(;;){const _=await this.getSignatureStatus(i);if(_==null)break;if(!(_.context.slot<(M.slotInWhichNonceDidAdvance??e))){w=_;break}await Ba(400)}if(!(w!=null&&w.value))throw new Lu(i);{const _=r||"finalized",{confirmationStatus:k}=w.value;switch(_){case"processed":case"recent":if(k!=="processed"&&k!=="confirmed"&&k!=="finalized")throw new Lu(i);break;case"confirmed":case"single":case"singleGossip":if(k!=="confirmed"&&k!=="finalized")throw new Lu(i);break;case"finalized":case"max":case"root":if(k!=="finalized")throw new Lu(i)}E={context:w.context,value:{err:w.value.err}}}}}finally{c=!0,p()}return E}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:r,signature:t}){let e;const n=new Promise(l=>{let p=this._confirmTransactionInitialTimeout||6e4;switch(r){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":p=this._confirmTransactionInitialTimeout||3e4}e=setTimeout(()=>l({__type:ss.TIMED_OUT,timeoutMs:p}),p)}),{abortConfirmation:s,confirmationPromise:i}=this.getTransactionConfirmationPromise({commitment:r,signature:t});let c;try{const l=await Promise.race([i,n]);if(l.__type!==ss.PROCESSED)throw new g2(t,l.timeoutMs/1e3);c=l.response}finally{clearTimeout(e),s()}return c}async getClusterNodes(){const r=Ee(await this._rpcRequest("getClusterNodes",[]),rr(ke(W$)));if("error"in r)throw new De(r.error,"failed to get cluster nodes");return r.result}async getVoteAccounts(r){const t=this._buildArgs([],r),e=Ee(await this._rpcRequest("getVoteAccounts",t),G$);if("error"in e)throw new De(e.error,"failed to get vote accounts");return e.result}async getSlot(r){const{commitment:t,config:e}=qr(r),n=this._buildArgs([],t,void 0,e),s=Ee(await this._rpcRequest("getSlot",n),rr(Ft()));if("error"in s)throw new De(s.error,"failed to get slot");return s.result}async getSlotLeader(r){const{commitment:t,config:e}=qr(r),n=this._buildArgs([],t,void 0,e),s=Ee(await this._rpcRequest("getSlotLeader",n),rr(_e()));if("error"in s)throw new De(s.error,"failed to get slot leader");return s.result}async getSlotLeaders(r,t){const e=[r,t],n=Ee(await this._rpcRequest("getSlotLeaders",e),rr(ke(cn)));if("error"in n)throw new De(n.error,"failed to get slot leaders");return n.result}async getSignatureStatus(r,t){const{context:e,value:n}=await this.getSignatureStatuses([r],t);return xr(n.length===1),{context:e,value:n[0]}}async getSignatureStatuses(r,t){const e=[r];t&&e.push(t);const n=Ee(await this._rpcRequest("getSignatureStatuses",e),J$);if("error"in n)throw new De(n.error,"failed to get signature status");return n.result}async getTransactionCount(r){const{commitment:t,config:e}=qr(r),n=this._buildArgs([],t,void 0,e),s=Ee(await this._rpcRequest("getTransactionCount",n),rr(Ft()));if("error"in s)throw new De(s.error,"failed to get transaction count");return s.result}async getTotalSupply(r){return(await this.getSupply({commitment:r,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(r){const t=this._buildArgs([],r),e=Ee(await this._rpcRequest("getInflationGovernor",t),x$);if("error"in e)throw new De(e.error,"failed to get inflation");return e.result}async getInflationReward(r,t,e){const{commitment:n,config:s}=qr(e),i=this._buildArgs([r.map(l=>l.toBase58())],n,void 0,{...s,epoch:t??(s==null?void 0:s.epoch)}),c=Ee(await this._rpcRequest("getInflationReward",i),h$);if("error"in c)throw new De(c.error,"failed to get inflation reward");return c.result}async getInflationRate(){const r=Ee(await this._rpcRequest("getInflationRate",[]),_$);if("error"in r)throw new De(r.error,"failed to get inflation rate");return r.result}async getEpochInfo(r){const{commitment:t,config:e}=qr(r),n=this._buildArgs([],t,void 0,e),s=Ee(await this._rpcRequest("getEpochInfo",n),E$);if("error"in s)throw new De(s.error,"failed to get epoch info");return s.result}async getEpochSchedule(){const r=Ee(await this._rpcRequest("getEpochSchedule",[]),A$);if("error"in r)throw new De(r.error,"failed to get epoch schedule");const t=r.result;return new N4(t.slotsPerEpoch,t.leaderScheduleSlotOffset,t.warmup,t.firstNormalEpoch,t.firstNormalSlot)}async getLeaderSchedule(){const r=Ee(await this._rpcRequest("getLeaderSchedule",[]),S$);if("error"in r)throw new De(r.error,"failed to get leader schedule");return r.result}async getMinimumBalanceForRentExemption(r,t){const e=this._buildArgs([r],t),n=Ee(await this._rpcRequest("getMinimumBalanceForRentExemption",e),Q$);return"error"in n?(console.warn("Unable to fetch minimum balance for rent exemption"),0):n.result}async getRecentBlockhashAndContext(r){const t=this._buildArgs([],r),e=Ee(await this._rpcRequest("getRecentBlockhash",t),aK);if("error"in e)throw new De(e.error,"failed to get recent blockhash");return e.result}async getRecentPerformanceSamples(r){const t=Ee(await this._rpcRequest("getRecentPerformanceSamples",r?[r]:[]),cK);if("error"in t)throw new De(t.error,"failed to get recent performance samples");return t.result}async getFeeCalculatorForBlockhash(r,t){const e=this._buildArgs([r],t),n=Ee(await this._rpcRequest("getFeeCalculatorForBlockhash",e),hK);if("error"in n)throw new De(n.error,"failed to get fee calculator");const{context:s,value:i}=n.result;return{context:s,value:i!==null?i.feeCalculator:null}}async getFeeForMessage(r,t){const e=nr(r.serialize()).toString("base64"),n=this._buildArgs([e],t),s=Ee(await this._rpcRequest("getFeeForMessage",n),rn(Ie(Ft())));if("error"in s)throw new De(s.error,"failed to get fee for message");if(s.result===null)throw new Error("invalid blockhash");return s.result}async getRecentPrioritizationFees(r){var s;const t=(s=r==null?void 0:r.lockedWritableAccounts)==null?void 0:s.map(i=>i.toBase58()),e=t!=null&&t.length?[t]:[],n=Ee(await this._rpcRequest("getRecentPrioritizationFees",e),M$);if("error"in n)throw new De(n.error,"failed to get recent prioritization fees");return n.result}async getRecentBlockhash(r){try{return(await this.getRecentBlockhashAndContext(r)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhash(r){try{return(await this.getLatestBlockhashAndContext(r)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhashAndContext(r){const{commitment:t,config:e}=qr(r),n=this._buildArgs([],t,void 0,e),s=Ee(await this._rpcRequest("getLatestBlockhash",n),uK);if("error"in s)throw new De(s.error,"failed to get latest blockhash");return s.result}async isBlockhashValid(r,t){const{commitment:e,config:n}=qr(t),s=this._buildArgs([r],e,void 0,n),i=Ee(await this._rpcRequest("isBlockhashValid",s),fK);if("error"in i)throw new De(i.error,"failed to determine if the blockhash `"+r+"`is valid");return i.result}async getVersion(){const r=Ee(await this._rpcRequest("getVersion",[]),rr(b$));if("error"in r)throw new De(r.error,"failed to get version");return r.result}async getGenesisHash(){const r=Ee(await this._rpcRequest("getGenesisHash",[]),rr(_e()));if("error"in r)throw new De(r.error,"failed to get genesis hash");return r.result}async getBlock(r,t){const{commitment:e,config:n}=qr(t),s=this._buildArgsAtLeastConfirmed([r],e,void 0,n),i=await this._rpcRequest("getBlock",s);try{switch(n==null?void 0:n.transactionDetails){case"accounts":{const c=Ee(i,rK);if("error"in c)throw c.error;return c.result}case"none":{const c=Ee(i,eK);if("error"in c)throw c.error;return c.result}default:{const c=Ee(i,tK);if("error"in c)throw c.error;const{result:l}=c;return l?{...l,transactions:l.transactions.map(({transaction:p,meta:v,version:y})=>({meta:v,transaction:{...p,message:Fm(y,p.message)},version:y}))}:null}}}catch(c){throw new De(c,"failed to get confirmed block")}}async getParsedBlock(r,t){const{commitment:e,config:n}=qr(t),s=this._buildArgsAtLeastConfirmed([r],e,"jsonParsed",n),i=await this._rpcRequest("getBlock",s);try{switch(n==null?void 0:n.transactionDetails){case"accounts":{const c=Ee(i,iK);if("error"in c)throw c.error;return c.result}case"none":{const c=Ee(i,oK);if("error"in c)throw c.error;return c.result}default:{const c=Ee(i,nK);if("error"in c)throw c.error;return c.result}}}catch(c){throw new De(c,"failed to get block")}}async getBlockProduction(r){let t,e;if(typeof r=="string")e=r;else if(r){const{commitment:i,...c}=r;e=i,t=c}const n=this._buildArgs([],e,"base64",t),s=Ee(await this._rpcRequest("getBlockProduction",n),w$);if("error"in s)throw new De(s.error,"failed to get block production information");return s.result}async getTransaction(r,t){const{commitment:e,config:n}=qr(t),s=this._buildArgsAtLeastConfirmed([r],e,void 0,n),i=Ee(await this._rpcRequest("getTransaction",s),jm);if("error"in i)throw new De(i.error,"failed to get transaction");const c=i.result;return c&&{...c,transaction:{...c.transaction,message:Fm(c.version,c.transaction.message)}}}async getParsedTransaction(r,t){const{commitment:e,config:n}=qr(t),s=this._buildArgsAtLeastConfirmed([r],e,"jsonParsed",n),i=Ee(await this._rpcRequest("getTransaction",s),R0);if("error"in i)throw new De(i.error,"failed to get transaction");return i.result}async getParsedTransactions(r,t){const{commitment:e,config:n}=qr(t),s=r.map(i=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([i],e,"jsonParsed",n)}));return(await this._rpcBatchRequest(s)).map(i=>{const c=Ee(i,R0);if("error"in c)throw new De(c.error,"failed to get transactions");return c.result})}async getTransactions(r,t){const{commitment:e,config:n}=qr(t),s=r.map(i=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([i],e,void 0,n)}));return(await this._rpcBatchRequest(s)).map(i=>{const c=Ee(i,jm);if("error"in c)throw new De(c.error,"failed to get transactions");const l=c.result;return l&&{...l,transaction:{...l.transaction,message:Fm(l.version,l.transaction.message)}}})}async getConfirmedBlock(r,t){const e=this._buildArgsAtLeastConfirmed([r],t),n=Ee(await this._rpcRequest("getConfirmedBlock",e),sK);if("error"in n)throw new De(n.error,"failed to get confirmed block");const s=n.result;if(!s)throw new Error("Confirmed block "+r+" not found");const i={...s,transactions:s.transactions.map(({transaction:c,meta:l})=>{const p=new po(c.message);return{meta:l,transaction:{...c,message:p}}})};return{...i,transactions:i.transactions.map(({transaction:c,meta:l})=>({meta:l,transaction:wr.populate(c.message,c.signatures)}))}}async getBlocks(r,t,e){const n=this._buildArgsAtLeastConfirmed(t!==void 0?[r,t]:[r],e),s=Ee(await this._rpcRequest("getBlocks",n),rr(ke(Ft())));if("error"in s)throw new De(s.error,"failed to get blocks");return s.result}async getBlockSignatures(r,t){const e=this._buildArgsAtLeastConfirmed([r],t,void 0,{transactionDetails:"signatures",rewards:!1}),n=Ee(await this._rpcRequest("getBlock",e),j4);if("error"in n)throw new De(n.error,"failed to get block");const s=n.result;if(!s)throw new Error("Block "+r+" not found");return s}async getConfirmedBlockSignatures(r,t){const e=this._buildArgsAtLeastConfirmed([r],t,void 0,{transactionDetails:"signatures",rewards:!1}),n=Ee(await this._rpcRequest("getConfirmedBlock",e),j4);if("error"in n)throw new De(n.error,"failed to get confirmed block");const s=n.result;if(!s)throw new Error("Confirmed block "+r+" not found");return s}async getConfirmedTransaction(r,t){const e=this._buildArgsAtLeastConfirmed([r],t),n=Ee(await this._rpcRequest("getConfirmedTransaction",e),jm);if("error"in n)throw new De(n.error,"failed to get transaction");const s=n.result;if(!s)return s;const i=new po(s.transaction.message),c=s.transaction.signatures;return{...s,transaction:wr.populate(i,c)}}async getParsedConfirmedTransaction(r,t){const e=this._buildArgsAtLeastConfirmed([r],t,"jsonParsed"),n=Ee(await this._rpcRequest("getConfirmedTransaction",e),R0);if("error"in n)throw new De(n.error,"failed to get confirmed transaction");return n.result}async getParsedConfirmedTransactions(r,t){const e=r.map(n=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([n],t,"jsonParsed")}));return(await this._rpcBatchRequest(e)).map(n=>{const s=Ee(n,R0);if("error"in s)throw new De(s.error,"failed to get confirmed transactions");return s.result})}async getConfirmedSignaturesForAddress(r,t,e){let n={},s=await this.getFirstAvailableBlock();for(;!("until"in n)&&!(--t<=0||t0&&(n.until=c.signatures[c.signatures.length-1].toString())}catch(c){if(c instanceof Error&&c.message.includes("skipped"))continue;throw c}let i=await this.getSlot("finalized");for(;!("before"in n||++e>i);)try{const c=await this.getConfirmedBlockSignatures(e);c.signatures.length>0&&(n.before=c.signatures[c.signatures.length-1].toString())}catch(c){if(c instanceof Error&&c.message.includes("skipped"))continue;throw c}return(await this.getConfirmedSignaturesForAddress2(r,n)).map(c=>c.signature)}async getConfirmedSignaturesForAddress2(r,t,e){const n=this._buildArgsAtLeastConfirmed([r.toBase58()],e,void 0,t),s=Ee(await this._rpcRequest("getConfirmedSignaturesForAddress2",n),N$);if("error"in s)throw new De(s.error,"failed to get confirmed signatures for address");return s.result}async getSignaturesForAddress(r,t,e){const n=this._buildArgsAtLeastConfirmed([r.toBase58()],e,void 0,t),s=Ee(await this._rpcRequest("getSignaturesForAddress",n),D$);if("error"in s)throw new De(s.error,"failed to get signatures for address");return s.result}async getAddressLookupTable(r,t){const{context:e,value:n}=await this.getAccountInfoAndContext(r,t);let s=null;return n!==null&&(s=new qm({key:r,state:qm.deserialize(n.data)})),{context:e,value:s}}async getNonceAndContext(r,t){const{context:e,value:n}=await this.getAccountInfoAndContext(r,t);let s=null;return n!==null&&(s=Nl.fromAccountData(n.data)),{context:e,value:s}}async getNonce(r,t){return await this.getNonceAndContext(r,t).then(e=>e.value).catch(e=>{throw new Error("failed to get nonce for account "+r.toBase58()+": "+e)})}async requestAirdrop(r,t){const e=Ee(await this._rpcRequest("requestAirdrop",[r.toBase58(),t]),lK);if("error"in e)throw new De(e.error,`airdrop to ${r.toBase58()} failed`);return e.result}async _blockhashWithExpiryBlockHeight(r){if(!r){for(;this._pollingBlockhash;)await Ba(100);const t=Date.now()-this._blockhashInfo.lastFetch>=3e4;if(this._blockhashInfo.latestBlockhash!==null&&!t)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const r=Date.now(),t=this._blockhashInfo.latestBlockhash,e=t?t.blockhash:null;for(let n=0;n<50;n++){const s=await this.getLatestBlockhash("finalized");if(e!==s.blockhash)return this._blockhashInfo={latestBlockhash:s,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},s;await Ba(200)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-r}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(r){const{commitment:t,config:e}=qr(r),n=this._buildArgs([],t,"base64",e),s=Ee(await this._rpcRequest("getStakeMinimumDelegation",n),rn(Ft()));if("error"in s)throw new De(s.error,"failed to get stake minimum delegation");return s.result}async simulateTransaction(r,t,e){if("message"in r){const E=r.serialize(),M=Ae.Buffer.from(E).toString("base64");if(Array.isArray(t)||e!==void 0)throw new Error("Invalid arguments");const w=t||{};w.encoding="base64","commitment"in w||(w.commitment=this.commitment);const _=[M,w],k=Ee(await this._rpcRequest("simulateTransaction",_),D4);if("error"in k)throw new Error("failed to simulate transaction: "+k.error.message);return k.result}let n;if(r instanceof wr){let E=r;n=new wr,n.feePayer=E.feePayer,n.instructions=r.instructions,n.nonceInfo=E.nonceInfo,n.signatures=E.signatures}else n=wr.populate(r),n._message=n._json=void 0;if(t!==void 0&&!Array.isArray(t))throw new Error("Invalid arguments");const s=t;if(n.nonceInfo&&s)n.sign(...s);else{let E=this._disableBlockhashCaching;for(;;){const M=await this._blockhashWithExpiryBlockHeight(E);if(n.lastValidBlockHeight=M.lastValidBlockHeight,n.recentBlockhash=M.blockhash,!s)break;if(n.sign(...s),!n.signature)throw new Error("!signature");const w=n.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(w)&&!this._blockhashInfo.transactionSignatures.includes(w)){this._blockhashInfo.simulatedSignatures.push(w);break}E=!0}}const i=n._compile(),c=i.serialize(),l=n._serialize(c).toString("base64"),p={encoding:"base64",commitment:this.commitment};if(e){const E=(Array.isArray(e)?e:i.nonProgramIds()).map(M=>M.toBase58());p.accounts={encoding:"base64",addresses:E}}s&&(p.sigVerify=!0);const v=[l,p],y=Ee(await this._rpcRequest("simulateTransaction",v),D4);if("error"in y){let E;if("data"in y.error&&(E=y.error.data.logs,E&&Array.isArray(E))){const M=` - `,w=M+E.join(M);console.error(y.error.message,w)}throw new Ju("failed to simulate transaction: "+y.error.message,E)}return y.result}async sendTransaction(r,t,e){if("version"in r){if(t&&Array.isArray(t))throw new Error("Invalid arguments");const i=r.serialize();return await this.sendRawTransaction(i,t)}if(t===void 0||!Array.isArray(t))throw new Error("Invalid arguments");const n=t;if(r.nonceInfo)r.sign(...n);else{let i=this._disableBlockhashCaching;for(;;){const c=await this._blockhashWithExpiryBlockHeight(i);if(r.lastValidBlockHeight=c.lastValidBlockHeight,r.recentBlockhash=c.blockhash,r.sign(...n),!r.signature)throw new Error("!signature");const l=r.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(l)){this._blockhashInfo.transactionSignatures.push(l);break}i=!0}}const s=r.serialize();return await this.sendRawTransaction(s,e)}async sendRawTransaction(r,t){const e=nr(r).toString("base64");return await this.sendEncodedTransaction(e,t)}async sendEncodedTransaction(r,t){const e={encoding:"base64"},n=t&&t.skipPreflight,s=t&&t.preflightCommitment||this.commitment;t&&t.maxRetries!=null&&(e.maxRetries=t.maxRetries),t&&t.minContextSlot!=null&&(e.minContextSlot=t.minContextSlot),n&&(e.skipPreflight=n),s&&(e.preflightCommitment=s);const i=[r,e],c=Ee(await this._rpcRequest("sendTransaction",i),dK);if("error"in c){let l;throw"data"in c.error&&(l=c.error.data.logs),new Ju("failed to send transaction: "+c.error.message,l)}return c.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()},5e3),this._updateSubscriptions()}_wsOnError(r){this._rpcWebSocketConnected=!1,console.error("ws error:",r.message)}_wsOnClose(r){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),r!==1e3?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach(([t,e])=>{this._setSubscription(t,{...e,state:"pending"})})):this._updateSubscriptions()}_setSubscription(r,t){var n;const e=(n=this._subscriptionsByHash[r])==null?void 0:n.state;if(this._subscriptionsByHash[r]=t,e!==t.state){const s=this._subscriptionStateChangeCallbacksByHash[r];s&&s.forEach(i=>{try{i(t.state)}catch{}})}}_onSubscriptionStateChange(r,t){var s;const e=this._subscriptionHashByClientSubscriptionId[r];if(e==null)return()=>{};const n=(s=this._subscriptionStateChangeCallbacksByHash)[e]||(s[e]=new Set);return n.add(t),()=>{n.delete(t),n.size===0&&delete this._subscriptionStateChangeCallbacksByHash[e]}}async _updateSubscriptions(){if(Object.keys(this._subscriptionsByHash).length===0)return void(this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(e){e instanceof Error&&console.log(`Error when closing socket connection: ${e.message}`)}},500)));if(this._rpcWebSocketIdleTimeout!==null&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const r=this._rpcWebSocketGeneration,t=()=>r===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map(async e=>{const n=this._subscriptionsByHash[e];if(n!==void 0)switch(n.state){case"pending":case"unsubscribed":if(n.callbacks.size===0)return delete this._subscriptionsByHash[e],n.state==="unsubscribed"&&delete this._subscriptionCallbacksByServerSubscriptionId[n.serverSubscriptionId],void await this._updateSubscriptions();await(async()=>{const{args:s,method:i}=n;try{this._setSubscription(e,{...n,state:"subscribing"});const c=await this._rpcWebSocket.call(i,s);this._setSubscription(e,{...n,serverSubscriptionId:c,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[c]=n.callbacks,await this._updateSubscriptions()}catch(c){if(c instanceof Error&&console.error(`${i} error for argument`,s,c.message),!t())return;this._setSubscription(e,{...n,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":n.callbacks.size===0&&await(async()=>{const{serverSubscriptionId:s,unsubscribeMethod:i}=n;if(this._subscriptionsAutoDisposedByRpc.has(s))this._subscriptionsAutoDisposedByRpc.delete(s);else{this._setSubscription(e,{...n,state:"unsubscribing"}),this._setSubscription(e,{...n,state:"unsubscribing"});try{await this._rpcWebSocket.call(i,[s])}catch(c){return c instanceof Error&&console.error(`${i} error:`,c.message),t()?(this._setSubscription(e,{...n,state:"subscribed"}),void await this._updateSubscriptions()):void 0}}this._setSubscription(e,{...n,state:"unsubscribed"}),await this._updateSubscriptions()})()}}))}_handleServerNotification(r,t){const e=this._subscriptionCallbacksByServerSubscriptionId[r];e!==void 0&&e.forEach(n=>{try{n(...t)}catch(s){console.error(s)}})}_wsOnAccountNotification(r){const{result:t,subscription:e}=Ee(r,z$);this._handleServerNotification(e,[t.value,t.context])}_makeSubscription(r,t){const e=this._nextClientSubscriptionId++,n=U4([r.method,t],!0),s=this._subscriptionsByHash[n];return s===void 0?this._subscriptionsByHash[n]={...r,args:t,callbacks:new Set([r.callback]),state:"pending"}:s.callbacks.add(r.callback),this._subscriptionHashByClientSubscriptionId[e]=n,this._subscriptionDisposeFunctionsByClientSubscriptionId[e]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[e],delete this._subscriptionHashByClientSubscriptionId[e];const i=this._subscriptionsByHash[n];xr(i!==void 0,`Could not find a \`Subscription\` when tearing down client subscription #${e}`),i.callbacks.delete(r.callback),await this._updateSubscriptions()},this._updateSubscriptions(),e}onAccountChange(r,t,e){const n=this._buildArgs([r.toBase58()],e||this._commitment||"finalized","base64");return this._makeSubscription({callback:t,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},n)}async removeAccountChangeListener(r){await this._unsubscribeClientSubscription(r,"account change")}_wsOnProgramAccountNotification(r){const{result:t,subscription:e}=Ee(r,F$);this._handleServerNotification(e,[{accountId:t.value.pubkey,accountInfo:t.value.account},t.context])}onProgramAccountChange(r,t,e,n){const s=this._buildArgs([r.toBase58()],e||this._commitment||"finalized","base64",n?{filters:n}:void 0);return this._makeSubscription({callback:t,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},s)}async removeProgramAccountChangeListener(r){await this._unsubscribeClientSubscription(r,"program account change")}onLogs(r,t,e){const n=this._buildArgs([typeof r=="object"?{mentions:[r.toString()]}:r],e||this._commitment||"finalized");return this._makeSubscription({callback:t,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},n)}async removeOnLogsListener(r){await this._unsubscribeClientSubscription(r,"logs")}_wsOnLogsNotification(r){const{result:t,subscription:e}=Ee(r,mK);this._handleServerNotification(e,[t.value,t.context])}_wsOnSlotNotification(r){const{result:t,subscription:e}=Ee(r,$$);this._handleServerNotification(e,[t])}onSlotChange(r){return this._makeSubscription({callback:r,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(r){await this._unsubscribeClientSubscription(r,"slot change")}_wsOnSlotUpdatesNotification(r){const{result:t,subscription:e}=Ee(r,H$);this._handleServerNotification(e,[t])}onSlotUpdate(r){return this._makeSubscription({callback:r,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(r){await this._unsubscribeClientSubscription(r,"slot update")}async _unsubscribeClientSubscription(r,t){const e=this._subscriptionDisposeFunctionsByClientSubscriptionId[r];e?await e():console.warn(`Ignored unsubscribe request because an active subscription with id \`${r}\` for '${t}' events could not be found.`)}_buildArgs(r,t,e,n){const s=t||this._commitment;if(s||e||n){let i={};e&&(i.encoding=e),s&&(i.commitment=s),n&&(i=Object.assign(i,n)),r.push(i)}return r}_buildArgsAtLeastConfirmed(r,t,e,n){const s=t||this._commitment;if(s&&!["confirmed","finalized"].includes(s))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(r,t,e,n)}_wsOnSignatureNotification(r){const{result:t,subscription:e}=Ee(r,V$);t.value!=="receivedSignature"&&this._subscriptionsAutoDisposedByRpc.add(e),this._handleServerNotification(e,t.value==="receivedSignature"?[{type:"received"},t.context]:[{type:"status",result:t.value},t.context])}onSignature(r,t,e){const n=this._buildArgs([r],e||this._commitment||"finalized"),s=this._makeSubscription({callback:(i,c)=>{if(i.type==="status"){t(i.result,c);try{this.removeSignatureListener(s)}catch{}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},n);return s}onSignatureWithOptions(r,t,e){const{commitment:n,...s}={...e,commitment:e&&e.commitment||this._commitment||"finalized"},i=this._buildArgs([r],n,void 0,s),c=this._makeSubscription({callback:(l,p)=>{t(l,p);try{this.removeSignatureListener(c)}catch{}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return c}async removeSignatureListener(r){await this._unsubscribeClientSubscription(r,"signature result")}_wsOnRootNotification(r){const{result:t,subscription:e}=Ee(r,Z$);this._handleServerNotification(e,[t])}onRootChange(r){return this._makeSubscription({callback:r,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(r){await this._unsubscribeClientSubscription(r,"root change")}},Ed25519Program:o1,Enum:class extends m2{constructor(r){if(super(r),this.enum="",Object.keys(r).length!==1)throw new Error("Enum can only take single value");Object.keys(r).map(t=>{this.enum=t})}},EpochSchedule:N4,FeeCalculatorLayout:wA,Keypair:Qu,LAMPORTS_PER_SOL:1e9,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:_s,Loader:Xa,Lockup:gh,MAX_SEED_LENGTH:32,Message:po,MessageAccountKeys:ph,MessageV0:cu,NONCE_ACCOUNT_LENGTH:mh,NonceAccount:Nl,PACKET_DATA_SIZE:Xu,PUBLIC_KEY_LENGTH:Pi,PublicKey:Xt,SIGNATURE_LENGTH_IN_BYTES:xf,SOLANA_SCHEMA:zc,STAKE_CONFIG_ID:PA,STAKE_INSTRUCTION_LAYOUTS:xn,SYSTEM_INSTRUCTION_LAYOUTS:Lr,SYSVAR_CLOCK_PUBKEY:co,SYSVAR_EPOCH_SCHEDULE_PUBKEY:Yj,SYSVAR_INSTRUCTIONS_PUBKEY:Xj,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:fl,SYSVAR_RENT_PUBKEY:fa,SYSVAR_REWARDS_PUBKEY:Jj,SYSVAR_SLOT_HASHES_PUBKEY:Qj,SYSVAR_SLOT_HISTORY_PUBKEY:t$,SYSVAR_STAKE_HISTORY_PUBKEY:cl,Secp256k1Program:tf,SendTransactionError:Ju,SolanaJSONRPCError:De,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},StakeAuthorizationLayout:yK,StakeInstruction:class{constructor(){}static decodeInstructionType(r){this.checkProgramId(r.programId);const t=Ce("instruction").decode(r.data);let e;for(const[n,s]of Object.entries(xn))if(s.index==t){e=n;break}if(!e)throw new Error("Instruction type incorrect; not a StakeInstruction");return e}static decodeInitialize(r){this.checkProgramId(r.programId),this.checkKeyLength(r.keys,2);const{authorized:t,lockup:e}=Ir(xn.Initialize,r.data);return{stakePubkey:r.keys[0].pubkey,authorized:new H4(new Xt(t.staker),new Xt(t.withdrawer)),lockup:new gh(e.unixTimestamp,e.epoch,new Xt(e.custodian))}}static decodeDelegate(r){return this.checkProgramId(r.programId),this.checkKeyLength(r.keys,6),Ir(xn.Delegate,r.data),{stakePubkey:r.keys[0].pubkey,votePubkey:r.keys[1].pubkey,authorizedPubkey:r.keys[5].pubkey}}static decodeAuthorize(r){this.checkProgramId(r.programId),this.checkKeyLength(r.keys,3);const{newAuthorized:t,stakeAuthorizationType:e}=Ir(xn.Authorize,r.data),n={stakePubkey:r.keys[0].pubkey,authorizedPubkey:r.keys[2].pubkey,newAuthorizedPubkey:new Xt(t),stakeAuthorizationType:{index:e}};return r.keys.length>3&&(n.custodianPubkey=r.keys[3].pubkey),n}static decodeAuthorizeWithSeed(r){this.checkProgramId(r.programId),this.checkKeyLength(r.keys,2);const{newAuthorized:t,stakeAuthorizationType:e,authoritySeed:n,authorityOwner:s}=Ir(xn.AuthorizeWithSeed,r.data),i={stakePubkey:r.keys[0].pubkey,authorityBase:r.keys[1].pubkey,authoritySeed:n,authorityOwner:new Xt(s),newAuthorizedPubkey:new Xt(t),stakeAuthorizationType:{index:e}};return r.keys.length>3&&(i.custodianPubkey=r.keys[3].pubkey),i}static decodeSplit(r){this.checkProgramId(r.programId),this.checkKeyLength(r.keys,3);const{lamports:t}=Ir(xn.Split,r.data);return{stakePubkey:r.keys[0].pubkey,splitStakePubkey:r.keys[1].pubkey,authorizedPubkey:r.keys[2].pubkey,lamports:t}}static decodeMerge(r){return this.checkProgramId(r.programId),this.checkKeyLength(r.keys,3),Ir(xn.Merge,r.data),{stakePubkey:r.keys[0].pubkey,sourceStakePubKey:r.keys[1].pubkey,authorizedPubkey:r.keys[4].pubkey}}static decodeWithdraw(r){this.checkProgramId(r.programId),this.checkKeyLength(r.keys,5);const{lamports:t}=Ir(xn.Withdraw,r.data),e={stakePubkey:r.keys[0].pubkey,toPubkey:r.keys[1].pubkey,authorizedPubkey:r.keys[4].pubkey,lamports:t};return r.keys.length>5&&(e.custodianPubkey=r.keys[5].pubkey),e}static decodeDeactivate(r){return this.checkProgramId(r.programId),this.checkKeyLength(r.keys,3),Ir(xn.Deactivate,r.data),{stakePubkey:r.keys[0].pubkey,authorizedPubkey:r.keys[2].pubkey}}static checkProgramId(r){if(!r.equals(zl.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(r,t){if(r.length({decode:r.decode.bind(r),encode:r.encode.bind(r)}),hl=(r=>t=>{const e=Tr(r,t),{encode:n,decode:s}=Xy(e),i=e;return i.decode=(c,l)=>{const p=s(c,l);return XE(Gt.Buffer.from(p))},i.encode=(c,l,p)=>{const v=Uy(c,r);return n(v,l,p)},i})(8),TA=r=>{const t=or(r),{encode:e,decode:n}=Xy(t),s=t;return s.decode=(i,c)=>!!n(i,c),s.encode=(i,c,l)=>{const p=Number(i);return e(p,c,l)},s},Tn=r=>{const t=Tr(32,r),{encode:e,decode:n}=Xy(t),s=t;return s.decode=(i,c)=>{const l=n(i,c);return new Xt(l)},s.encode=(i,c,l)=>{const p=i.toBuffer();return e(p,c,l)},s};class AK extends Error{constructor(t){super(t)}}class SK extends AK{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var G4;(function(r){r[r.Uninitialized=0]="Uninitialized",r[r.Mint=1]="Mint",r[r.Account=2]="Account"})(G4||(G4={}));Ue([or("m"),or("n"),TA("isInitialized"),Tn("signer1"),Tn("signer2"),Tn("signer3"),Tn("signer4"),Tn("signer5"),Tn("signer6"),Tn("signer7"),Tn("signer8"),Tn("signer9"),Tn("signer10"),Tn("signer11")]).span;var Y4;(function(r){r[r.Uninitialized=0]="Uninitialized",r[r.Initialized=1]="Initialized",r[r.Frozen=2]="Frozen"})(Y4||(Y4={}));const kK=Ue([Tn("mint"),Tn("owner"),hl("amount"),Ce("delegateOption"),Tn("delegate"),or("state"),Ce("isNativeOption"),hl("isNative"),hl("delegatedAmount"),Ce("closeAuthorityOption"),Tn("closeAuthority")]);kK.span;const IK=Ue([Ce("mintAuthorityOption"),Tn("mintAuthority"),hl("supply"),or("decimals"),TA("isInitialized"),Ce("freezeAuthorityOption"),Tn("freezeAuthority")]);IK.span;function X4(r,t,e=!1,n=ql,s=E2){if(!e&&!Xt.isOnCurve(t.toBuffer()))throw new SK;const[i]=Xt.findProgramAddressSync([t.toBuffer(),n.toBuffer(),r.toBuffer()],s);return i}function BK(r,t,e,n,s=ql,i=E2){return function(c,l,p,v,y,E=ql,M=E2){const w=[{pubkey:c,isSigner:!0,isWritable:!0},{pubkey:l,isSigner:!1,isWritable:!0},{pubkey:p,isSigner:!1,isWritable:!1},{pubkey:v,isSigner:!1,isWritable:!1},{pubkey:an.programId,isSigner:!1,isWritable:!1},{pubkey:E,isSigner:!1,isWritable:!1}];return new kr({keys:w,programId:M,data:y})}(r,t,e,n,Gt.Buffer.alloc(0),s,i)}var Fl;(function(r){r.SymbolNotFound="SymbolNotFound",r.InvalidSubdomain="InvalidSubdomain",r.FavouriteDomainNotFound="FavouriteDomainNotFound",r.MissingParentOwner="MissingParentOwner",r.U32Overflow="U32Overflow",r.InvalidBufferLength="InvalidBufferLength",r.U64Overflow="U64Overflow",r.NoRecordData="NoRecordData",r.InvalidRecordData="InvalidRecordData",r.UnsupportedRecord="UnsupportedRecord",r.InvalidEvmAddress="InvalidEvmAddress",r.InvalidInjectiveAddress="InvalidInjectiveAddress",r.InvalidARecord="InvalidARecord",r.InvalidAAAARecord="InvalidAAAARecord",r.InvalidRecordInput="InvalidRecordInput",r.InvalidSignature="InvalidSignature",r.AccountDoesNotExist="AccountDoesNotExist",r.MultipleRegistries="MultipleRegistries",r.InvalidReverseTwitter="InvalidReverseTwitter",r.NoAccountData="NoAccountData",r.InvalidInput="InvalidInput",r.InvalidDomain="InvalidDomain",r.InvalidCustomBg="InvalidCustomBackground",r.UnsupportedSignature="UnsupportedSignature",r.RecordDoestNotSupportGuardianSig="RecordDoestNotSupportGuardianSig",r.RecordIsNotSigned="RecordIsNotSigned",r.UnsupportedSignatureType="UnsupportedSignatureType",r.InvalidSolRecordV2="InvalidSolRecordV2",r.MissingVerifier="MissingVerifier"})(Fl||(Fl={}));class jl extends Error{constructor(t,e){super(e),this.name="SNSError",this.type=t,Error.captureStackTrace&&Error.captureStackTrace(this,jl)}}class yh{constructor(t){this.tag=13,this.name=t.name,this.space=t.space,this.referrerIdxOpt=t.referrerIdxOpt}serialize(){return ky(yh.schema,this)}getInstruction(t,e,n,s,i,c,l,p,v,y,E,M,w,_,k,B,P){const R=Ae.Buffer.from(this.serialize());let T=[];return T.push({pubkey:e,isSigner:!1,isWritable:!1}),T.push({pubkey:n,isSigner:!1,isWritable:!1}),T.push({pubkey:s,isSigner:!1,isWritable:!0}),T.push({pubkey:i,isSigner:!1,isWritable:!0}),T.push({pubkey:c,isSigner:!1,isWritable:!1}),T.push({pubkey:l,isSigner:!1,isWritable:!1}),T.push({pubkey:p,isSigner:!0,isWritable:!0}),T.push({pubkey:v,isSigner:!1,isWritable:!0}),T.push({pubkey:y,isSigner:!1,isWritable:!1}),T.push({pubkey:E,isSigner:!1,isWritable:!1}),T.push({pubkey:M,isSigner:!1,isWritable:!1}),T.push({pubkey:w,isSigner:!1,isWritable:!0}),T.push({pubkey:_,isSigner:!1,isWritable:!1}),T.push({pubkey:k,isSigner:!1,isWritable:!1}),T.push({pubkey:B,isSigner:!1,isWritable:!1}),P&&T.push({pubkey:P,isSigner:!1,isWritable:!0}),new kr({keys:T,programId:t,data:R})}}yh.schema=new Map([[yh,{kind:"struct",fields:[["tag","u8"],["name","string"],["space","u32"],["referrerIdxOpt",{kind:"option",type:"u16"}]]}]]);new Xt("nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk");Ae.Buffer.from("tokenized_name");var J4;(function(r){r[r.Uninitialized=0]="Uninitialized",r[r.CentralState=1]="CentralState",r[r.ActiveRecord=2]="ActiveRecord",r[r.InactiveRecord=3]="InactiveRecord"})(J4||(J4={}));var LA={},ur={},Jh=OA;function OA(r,t){if(!r)throw new Error(t||"Assertion failed")}OA.equal=function(r,t,e){if(r!=t)throw new Error(e||"Assertion failed: "+r+" != "+t)};var A2={exports:{}};typeof Object.create=="function"?A2.exports=function(r,t){t&&(r.super_=t,r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:A2.exports=function(r,t){if(t){r.super_=t;var e=function(){};e.prototype=t.prototype,r.prototype=new e,r.prototype.constructor=r}};var PK=A2.exports,RK=Jh,CK=PK;function TK(r,t){return(64512&r.charCodeAt(t))==55296&&!(t<0||t+1>=r.length)&&(64512&r.charCodeAt(t+1))==56320}function Q4(r){return(r>>>24|r>>>8&65280|r<<8&16711680|(255&r)<<24)>>>0}function t8(r){return r.length===1?"0"+r:r}function e8(r){return r.length===7?"0"+r:r.length===6?"00"+r:r.length===5?"000"+r:r.length===4?"0000"+r:r.length===3?"00000"+r:r.length===2?"000000"+r:r.length===1?"0000000"+r:r}ur.inherits=CK,ur.toArray=function(r,t){if(Array.isArray(r))return r.slice();if(!r)return[];var e=[];if(typeof r=="string")if(t){if(t==="hex")for((r=r.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(r="0"+r),s=0;s>6|192,e[n++]=63&i|128):TK(r,s)?(i=65536+((1023&i)<<10)+(1023&r.charCodeAt(++s)),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128)}else for(s=0;s>>0}return i},ur.split32=function(r,t){for(var e=new Array(4*r.length),n=0,s=0;n>>24,e[s+1]=i>>>16&255,e[s+2]=i>>>8&255,e[s+3]=255&i):(e[s+3]=i>>>24,e[s+2]=i>>>16&255,e[s+1]=i>>>8&255,e[s]=255&i)}return e},ur.rotr32=function(r,t){return r>>>t|r<<32-t},ur.rotl32=function(r,t){return r<>>32-t},ur.sum32=function(r,t){return r+t>>>0},ur.sum32_3=function(r,t,e){return r+t+e>>>0},ur.sum32_4=function(r,t,e,n){return r+t+e+n>>>0},ur.sum32_5=function(r,t,e,n,s){return r+t+e+n+s>>>0},ur.sum64=function(r,t,e,n){var s=r[t],i=n+r[t+1]>>>0,c=(i>>0,r[t+1]=i},ur.sum64_hi=function(r,t,e,n){return(t+n>>>0>>0},ur.sum64_lo=function(r,t,e,n){return t+n>>>0},ur.sum64_4_hi=function(r,t,e,n,s,i,c,l){var p=0,v=t;return p+=(v=v+n>>>0)>>0)>>0)>>0},ur.sum64_4_lo=function(r,t,e,n,s,i,c,l){return t+n+i+l>>>0},ur.sum64_5_hi=function(r,t,e,n,s,i,c,l,p,v){var y=0,E=t;return y+=(E=E+n>>>0)>>0)>>0)>>0)>>0},ur.sum64_5_lo=function(r,t,e,n,s,i,c,l,p,v){return t+n+i+l+v>>>0},ur.rotr64_hi=function(r,t,e){return(t<<32-e|r>>>e)>>>0},ur.rotr64_lo=function(r,t,e){return(r<<32-e|t>>>e)>>>0},ur.shr64_hi=function(r,t,e){return r>>>e},ur.shr64_lo=function(r,t,e){return(r<<32-e|t>>>e)>>>0};var Hf={},r8=ur,LK=Jh;function C0(){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}Hf.BlockHash=C0,C0.prototype.update=function(r,t){if(r=r8.toArray(r,t),this.pending?this.pending=this.pending.concat(r):this.pending=r,this.pendingTotal+=r.length,this.pending.length>=this._delta8){var e=(r=this.pending).length%this._delta8;this.pending=r.slice(r.length-e,r.length),this.pending.length===0&&(this.pending=null),r=r8.join32(r,0,r.length-e,this.endian);for(var n=0;n>>24&255,n[s++]=r>>>16&255,n[s++]=r>>>8&255,n[s++]=255&r}else for(n[s++]=255&r,n[s++]=r>>>8&255,n[s++]=r>>>16&255,n[s++]=r>>>24&255,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,i=8;i>>3},To.g1_256=function(r){return ko(r,17)^ko(r,19)^r>>>10};var Ef=ur,OK=Hf,UK=To,Km=Ef.rotl32,wc=Ef.sum32,NK=Ef.sum32_5,DK=UK.ft_1,UA=OK.BlockHash,zK=[1518500249,1859775393,2400959708,3395469782];function zo(){if(!(this instanceof zo))return new zo;UA.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Ef.inherits(zo,UA);var qK=zo;zo.blockSize=512,zo.outSize=160,zo.hmacStrength=80,zo.padLength=64,zo.prototype._update=function(r,t){for(var e=this.W,n=0;n<16;n++)e[n]=r[t+n];for(;nthis.blockSize&&(r=new this.Hash().update(r).digest()),kH(r.length<=this.blockSize);for(var t=r.length;t{try{if("test".normalize(t)!=="test")throw new Error("bad normalize")}catch{r.push(t)}}),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}();var I2,uo;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(I2||(I2={})),function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED",r.ACTION_REJECTED="ACTION_REJECTED"}(uo||(uo={}));const d8="0123456789abcdef";class Qr{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const n=t.toLowerCase();ll[n]==null&&this.throwArgumentError("invalid log level name","logLevel",t),h8>ll[n]||console.log.apply(console,e)}debug(...t){this._log(Qr.levels.DEBUG,t)}info(...t){this._log(Qr.levels.INFO,t)}warn(...t){this._log(Qr.levels.WARNING,t)}makeError(t,e,n){if(c8)return this.makeError("censored error",e,{});e||(e=Qr.errors.UNKNOWN_ERROR),n||(n={});const s=[];Object.keys(n).forEach(p=>{const v=n[p];try{if(v instanceof Uint8Array){let y="";for(let E=0;E>4],y+=d8[15&v[E]];s.push(p+"=Uint8Array(0x"+y+")")}else s.push(p+"="+JSON.stringify(v))}catch{s.push(p+"="+JSON.stringify(n[p].toString()))}}),s.push(`code=${e}`),s.push(`version=${this.version}`);const i=t;let c="";switch(e){case uo.NUMERIC_FAULT:{c="NUMERIC_FAULT";const p=t;switch(p){case"overflow":case"underflow":case"division-by-zero":c+="-"+p;break;case"negative-power":case"negative-width":c+="-unsupported";break;case"unbound-bitwise-result":c+="-unbound-result"}break}case uo.CALL_EXCEPTION:case uo.INSUFFICIENT_FUNDS:case uo.MISSING_NEW:case uo.NONCE_EXPIRED:case uo.REPLACEMENT_UNDERPRICED:case uo.TRANSACTION_REPLACED:case uo.UNPREDICTABLE_GAS_LIMIT:c=e}c&&(t+=" [ See: https://links.ethers.org/v5-errors-"+c+" ]"),s.length&&(t+=" ("+s.join(", ")+")");const l=new Error(t);return l.reason=i,l.code=e,Object.keys(n).forEach(function(p){l[p]=n[p]}),l}throwError(t,e,n){throw this.makeError(t,e,n)}throwArgumentError(t,e,n){return this.throwError(t,Qr.errors.INVALID_ARGUMENT,{argument:e,value:n})}assert(t,e,n,s){t||this.throwError(e,n,s)}assertArgument(t,e,n,s){t||this.throwArgumentError(e,n,s)}checkNormalize(t){l8&&this.throwError("platform missing String.prototype.normalize",Qr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:l8})}checkSafeUint53(t,e){typeof t=="number"&&(e==null&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Qr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Qr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,n){n=n?": "+n:"",te&&this.throwError("too many arguments"+n,Qr.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&t!=null||this.throwError("missing new",Qr.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Qr.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&t!=null||this.throwError("missing new",Qr.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return Zm||(Zm=new Qr("logger/5.7.0")),Zm}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Qr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),f8){if(!t)return;this.globalLogger().throwError("error censorship permanent",Qr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}c8=!!t,f8=!!e}static setLogLevel(t){const e=ll[t.toLowerCase()];e!=null?h8=e:Qr.globalLogger().warn("invalid log level - "+t)}static from(t){return new Qr(t)}}Qr.errors=uo,Qr.levels=I2;const Wm=new Qr("bytes/5.7.0");function dl(r){return r.slice||(r.slice=function(){const t=Array.prototype.slice.call(arguments);return dl(new Uint8Array(Array.prototype.slice.apply(r,t)))}),r}function p8(r){return typeof r=="number"&&r==r&&r%1==0}function PH(r,t){if(t||(t={}),typeof r=="number"){Wm.checkSafeUint53(r,"invalid arrayify value");const e=[];for(;r;)e.unshift(255&r),r=parseInt(String(r/256));return e.length===0&&e.push(0),dl(new Uint8Array(e))}if(t.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),function(e){return!!e.toHexString}(r)&&(r=r.toHexString()),function(e,n){return!(typeof e!="string"||!e.match(/^0x[0-9A-Fa-f]*$/)||n&&e.length!==2+2*n)}(r)){let e=r.substring(2);e.length%2&&(t.hexPad==="left"?e="0"+e:t.hexPad==="right"?e+="0":Wm.throwArgumentError("hex data is odd-length","value",r));const n=[];for(let s=0;s=256)return!1}return!0}(r)?dl(new Uint8Array(r)):Wm.throwArgumentError("invalid arrayify value","value",r)}function RH(r){return"0x"+BH.sha256().update(PH(r)).digest("hex")}const ZA=new Xt("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),CH="SPL Name Service",m8=new Xt("58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx"),L0=new Xt("jCebN34bUfdeUYJT13J1yG16XWQpt5PDx6Mse9GUqhR");new Xt("ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF");new Xt("AUoZ3YAhV3b2rZeEH93UMZHXUZcTramBvb4d9YEVySkc");new Xt("33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z");new Xt("FvPH7PrVrLGKPfqaf3xJodFTjZriqrAXXLTVWEorTFBi");new Xt("4YcexoW3r78zz16J2aqmukBLRwGq6rAvWzJpkYAXqebv");new Xt("DmSyHDSM9eSLyvoLsPvDr5fRRFZ7Bfr3h3ULvWpgQaq7");const TH=new Xt("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),WA=[new Xt("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1"),new Xt("DM1jJCkZZEwY5tmWbgvKRxsDFzXCdbfrYCCH1CtwguEs"),new Xt("ADCp4QXFajHrhy4f43pD6GJFtQLkdBY2mjS9DfCk7tNW"),new Xt("2XTgjw8yi1E3Etgj4CUyRD7Zk49gynH2U9gA5N2MY4NP"),new Xt("5oDWj8vr3vbcq9JZTtwXqrkCMZggMsDzNietvbr1BNfe"),new Xt("8kJqxAbqbPLGLMgB6FhLcnw2SiUEavx2aEGM3WQGhtJF"),new Xt("HemvJzwxvVpWBjPETpaseAH395WAxb2G73MeUfjVkK1u")],LH=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","USDC"],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB","USDT"],["So11111111111111111111111111111111111111112","SOL"],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp","FIDA"],["FeGn77dhg1KXRRFeSwwMiykZnZPw5JXW6naf2aQgZDQf","ETH"],["7i5KKsX2weiTkry7jA4ZwSuXGhs5eJBEjY8vVxR4pfRx","GMT"],["AFbX8oGjGpmVFywbVouvhQSRmiW2aR1mohfahi4Y2AdB","GST"],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So","MSOL"],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263","BONK"],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz","BAT"],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3","PYTH"]]),OH=new Xt("AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J"),UH=new Xt("GcWEQ9K78FV7LEHteFVciYApERk5YvQuFDQPk1yYJVXi");new Xt("BPeXUQDqGbzxeK1LJby6ugvCBuo7kRSEUkjD726mUVsz");new Xt("72aLKvXeV4aansAQtxKymeXDevT5ed6sCuz9iN62ugPT");new Xt("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");var v8={},B2=Zh(CA),rf={};Object.defineProperty(rf,"__esModule",{value:!0}),rf.readBigUInt64LE=rf.readBigInt64LE=void 0;var NH=function(){return new Error("Attempt to access memory outside buffer bounds")},DH=function(r,t,e){return new Error('The "'+r+'" argument must be of type '+t+". Received "+e)},g8=function(r,t,e){return new Error('The value of "'+r+" is out of range. It must be "+t+". Received "+e)};function P2(r,t){if(typeof r!="number")throw DH(t,"number",r)}function y8(r,t){throw Math.floor(r)!==r?(P2(r,"offset"),g8("offset","an integer",r)):t<0?NH():g8("offset",">= 0 and <= "+t,r)}rf.readBigInt64LE=function(r,t){t===void 0&&(t=0),P2(t,"offset");var e=r[t],n=r[t+7];e!==void 0&&n!==void 0||y8(t,r.length-8);var s=r[t+4]+r[t+5]*Math.pow(2,8)+r[t+6]*Math.pow(2,16)+(n<<24);return(BigInt(s)<0&&v[v.length-1])||k[0]!==6&&k[0]!==2)){E=0;continue}if(k[0]===3&&(!v||k[1]>v[0]&&k[1]0&&p[p.length-1])||_[0]!==6&&_[0]!==2)){y=0;continue}if(_[0]===3&&(!p||_[1]>p[0]&&_[1]{if(typeof v!="string"&&!Array.isArray(v))throw new TypeError("Expected the input to be `string | string[]`");if(y={pascalCase:!1,preserveConsecutiveUppercase:!1,...y},v=Array.isArray(v)?v.map(w=>w.trim()).filter(w=>w.length).join("-"):v.trim(),v.length===0)return"";const E=y.locale===!1?w=>w.toLowerCase():w=>w.toLocaleLowerCase(y.locale),M=y.locale===!1?w=>w.toUpperCase():w=>w.toLocaleUpperCase(y.locale);return v.length===1?y.pascalCase?M(v):E(v):(v!==E(v)&&(v=((w,_,k)=>{let B=!1,P=!1,R=!1;for(let T=0;T(e.lastIndex=0,w.replace(e,k=>_(k))))(v,E):E(v),y.pascalCase&&(v=M(v.charAt(0))+v.slice(1)),((w,_)=>(c.lastIndex=0,l.lastIndex=0,w.replace(c,(k,B)=>_(B)).replace(l,k=>_(k))))(v,M))};return O0.exports=p,O0.exports.default=p,O0.exports}var Dr=xo(R2()),Ze={},Pe={};class Rr{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function Jy(r,t){return t.property?r+"["+t.property+"]":r}Pe.Layout=Rr,Pe.nameWithProperty=Jy,Pe.bindConstructorLayout=function(r,t){if(typeof r!="function")throw new TypeError("Class must be constructor");if(r.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Rr))throw new TypeError("layout must be a Layout");if(t.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");r.layout_=t,t.boundConstructor_=r,t.makeDestinationObject=()=>new r,Object.defineProperty(r.prototype,"encode",{value:function(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(r,"decode",{value:function(e,n){return t.decode(e,n)},writable:!0})};class si extends Rr{isCount(){throw new Error("ExternalLayout is abstract")}}class A8 extends si{constructor(t,e){if(t===void 0&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e){e===void 0&&(e=0);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}class C2 extends si{constructor(t,e,n){if(!(t instanceof Rr))throw new TypeError("layout must be a Layout");if(e===void 0)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof Uo||this.layout instanceof gs}decode(t,e){return e===void 0&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return n===void 0&&(n=0),this.layout.encode(t,e,n+this.offset)}}class Uo extends Rr{constructor(t,e){if(super(t,e),6c+s.encode(l,e,n+c),0);return this.count instanceof si&&this.count.encode(t.length,e,n),i}}class R8 extends Rr{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce((i,c)=>i&&c instanceof Rr,!0))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const i of t)if(0>i.span&&i.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let s=-1;try{s=t.reduce((i,c)=>i+c.getSpan(),0)}catch{}super(s,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;try{n=this.fields.reduce((s,i)=>{const c=i.getSpan(t,e);return e+=c,s+c},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e){e===void 0&&(e=0);const n=this.makeDestinationObject();for(const s of this.fields)if(s.property!==void 0&&(n[s.property]=s.decode(t,e)),e+=s.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){n===void 0&&(n=0);const s=n;let i=0,c=0;for(const l of this.fields){let p=l.span;if(c=0p&&(p=l.getSpan(e,n)))}i=n,n+=p}return i+c-s}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?e=-1:0<=e&&(e+=n.span)}}}class Qy{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class $l extends Qy{constructor(t,e){if(!(t instanceof si&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class L2 extends Rr{constructor(t,e,n){const s=t instanceof Uo||t instanceof gs;if(s)t=new $l(new C2(t));else if(t instanceof si&&t.isCount())t=new $l(t);else if(!(t instanceof Qy))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof Rr))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&s&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=s,this.defaultLayout=e,this.registry={};let c=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(l){return c(l)},this.configGetSourceVariant=function(l){c=l.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){let n;e===void 0&&(e=0);const s=this.discriminator,i=s.decode(t,e);let c=this.registry[i];if(c===void 0){let l=0;c=this.defaultLayout,this.usesPrefixDiscriminator&&(l=s.layout.span),n=this.makeDestinationObject(),n[s.property]=i,n[c.property]=this.defaultLayout.decode(t,e+l)}else n=c.decode(t,e);return n}encode(t,e,n){n===void 0&&(n=0);const s=this.getSourceVariant(t);if(s===void 0){const i=this.discriminator,c=this.defaultLayout;let l=0;return this.usesPrefixDiscriminator&&(l=i.layout.span),i.encode(t[i.property],e,n),l+c.encode(t[c.property],e,n+l)}return s.encode(t,e,n)}addVariant(t,e,n){const s=new GA(this,t,e,n);return this.registry[t]=s,s}getVariant(t,e){let n=t;return Gt.Buffer.isBuffer(t)&&(e===void 0&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class GA extends Rr{constructor(t,e,n,s){if(!(t instanceof L2))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&s===void 0&&(s=n,n=null),n){if(!(n instanceof Rr))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof s!="string")throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,s),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(e===void 0&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let s=0;return this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+s):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){n===void 0&&(n=0);let s=0;if(this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=s;if(this.layout&&(this.layout.encode(t[this.property],e,n+s),i+=this.layout.getSpan(e,n+s),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function Uu(r){return 0>r&&(r+=4294967296),r}class O2 extends Rr{constructor(t,e,n){if(!(t instanceof Uo||t instanceof gs))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof e=="string"&&n===void 0&&(n=e,e=void 0),4=e)throw new TypeError("bits must be positive integer");const s=8*t.span,i=t.fields.reduce((c,l)=>c+l.bits,0);if(e+i>s)throw new Error("bits too long for span remainder ("+(s-i)+" of "+s+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(!Number.isInteger(t)||t!==Uu(t&this.valueMask))throw new TypeError(Jy("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=Uu(t<n&&(n=this.length.decode(t,e)),n}decode(t,e){e===void 0&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let s=this.length;if(this.length instanceof si&&(s=t.length),!Gt.Buffer.isBuffer(t)||s!==t.length)throw new TypeError(Jy("Blob.encode",this)+" requires (length "+s+") Buffer as src");if(n+s>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,s,"hex"),this.length instanceof si&&this.length.encode(s,e,n),s}}class T8 extends Rr{constructor(t){super(-1,t)}getSpan(t,e){if(!Gt.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");e===void 0&&(e=0);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");return s.copy(e,n),e[n+i]=0,i+1}}class L8 extends Rr{constructor(t,e){if(typeof t=="string"&&e===void 0&&(e=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e){if(!Gt.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");return e===void 0&&(e=0),t.length-e}decode(t,e,n){e===void 0&&(e=0);let s=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return s.copy(e,n),i}}class O8 extends Rr{constructor(t,e){super(0,e),this.value=t}decode(t,e,n){return this.value}encode(t,e,n){return 0}}Pe.ExternalLayout=si,Pe.GreedyCount=A8,Pe.OffsetLayout=C2,Pe.UInt=Uo,Pe.UIntBE=gs,Pe.Int=Aa,Pe.IntBE=Bu,Pe.Float=S8,Pe.FloatBE=k8,Pe.Double=I8,Pe.DoubleBE=B8,Pe.Sequence=P8,Pe.Structure=R8,Pe.UnionDiscriminator=Qy,Pe.UnionLayoutDiscriminator=$l,Pe.Union=L2,Pe.VariantLayout=GA,Pe.BitStructure=O2,Pe.BitField=qc,Pe.Boolean=YA,Pe.Blob=C8,Pe.CString=T8,Pe.UTF8=L8,Pe.Constant=O8,Pe.greedy=(r,t)=>new A8(r,t),Pe.offset=(r,t,e)=>new C2(r,t,e),Pe.u8=r=>new Uo(1,r),Pe.u16=r=>new Uo(2,r),Pe.u24=r=>new Uo(3,r),Pe.u32=r=>new Uo(4,r),Pe.u40=r=>new Uo(5,r),Pe.u48=r=>new Uo(6,r),Pe.nu64=r=>new FH(r),Pe.u16be=r=>new gs(2,r),Pe.u24be=r=>new gs(3,r),Pe.u32be=r=>new gs(4,r),Pe.u40be=r=>new gs(5,r),Pe.u48be=r=>new gs(6,r),Pe.nu64be=r=>new jH(r),Pe.s8=r=>new Aa(1,r),Pe.s16=r=>new Aa(2,r),Pe.s24=r=>new Aa(3,r),Pe.s32=r=>new Aa(4,r),Pe.s40=r=>new Aa(5,r),Pe.s48=r=>new Aa(6,r),Pe.ns64=r=>new $H(r),Pe.s16be=r=>new Bu(2,r),Pe.s24be=r=>new Bu(3,r),Pe.s32be=r=>new Bu(4,r),Pe.s40be=r=>new Bu(5,r),Pe.s48be=r=>new Bu(6,r),Pe.ns64be=r=>new KH(r),Pe.f32=r=>new S8(r),Pe.f32be=r=>new k8(r),Pe.f64=r=>new I8(r),Pe.f64be=r=>new B8(r),Pe.struct=(r,t,e)=>new R8(r,t,e),Pe.bits=(r,t,e)=>new O2(r,t,e),Pe.seq=(r,t,e)=>new P8(r,t,e),Pe.union=(r,t,e)=>new L2(r,t,e),Pe.unionLayoutDiscriminator=(r,t)=>new $l(r,t),Pe.blob=(r,t)=>new C8(r,t),Pe.cstr=r=>new T8(r),Pe.utf8=(r,t)=>new L8(r,t),Pe.const=(r,t)=>new O8(r,t),function(r){var t=Ke&&Ke.__importDefault||function(_){return _&&_.__esModule?_:{default:_}};Object.defineProperty(r,"__esModule",{value:!0}),r.map=r.array=r.rustEnum=r.str=r.vecU8=r.tagged=r.vec=r.bool=r.option=r.publicKey=r.i256=r.u256=r.i128=r.u128=r.i64=r.u64=r.struct=r.f64=r.f32=r.i32=r.u32=r.i16=r.u16=r.i8=r.u8=void 0;const e=Pe,n=B2,s=t(Ay);var i=Pe;Object.defineProperty(r,"u8",{enumerable:!0,get:function(){return i.u8}}),Object.defineProperty(r,"i8",{enumerable:!0,get:function(){return i.s8}}),Object.defineProperty(r,"u16",{enumerable:!0,get:function(){return i.u16}}),Object.defineProperty(r,"i16",{enumerable:!0,get:function(){return i.s16}}),Object.defineProperty(r,"u32",{enumerable:!0,get:function(){return i.u32}}),Object.defineProperty(r,"i32",{enumerable:!0,get:function(){return i.s32}}),Object.defineProperty(r,"f32",{enumerable:!0,get:function(){return i.f32}}),Object.defineProperty(r,"f64",{enumerable:!0,get:function(){return i.f64}}),Object.defineProperty(r,"struct",{enumerable:!0,get:function(){return i.struct}});class c extends e.Layout{constructor(k,B,P){super(k,P),this.blob=(0,e.blob)(k),this.signed=B}decode(k,B=0){const P=new s.default(this.blob.decode(k,B),10,"le");return this.signed?P.fromTwos(8*this.span).clone():P}encode(k,B,P=0){return this.signed&&(k=k.toTwos(8*this.span)),this.blob.encode(k.toArrayLike(Gt.Buffer,"le",this.span),B,P)}}function l(_){return new c(8,!1,_)}r.u64=l,r.i64=function(_){return new c(8,!0,_)},r.u128=function(_){return new c(16,!1,_)},r.i128=function(_){return new c(16,!0,_)},r.u256=function(_){return new c(32,!1,_)},r.i256=function(_){return new c(32,!0,_)};class p extends e.Layout{constructor(k,B,P,R){super(k.span,R),this.layout=k,this.decoder=B,this.encoder=P}decode(k,B){return this.decoder(this.layout.decode(k,B))}encode(k,B,P){return this.layout.encode(this.encoder(k),B,P)}getSpan(k,B){return this.layout.getSpan(k,B)}}r.publicKey=function(_){return new p((0,e.blob)(32),k=>new n.PublicKey(k),k=>k.toBuffer(),_)};class v extends e.Layout{constructor(k,B){super(-1,B),this.layout=k,this.discriminator=(0,e.u8)()}encode(k,B,P=0){return k==null?this.discriminator.encode(0,B,P):(this.discriminator.encode(1,B,P),this.layout.encode(k,B,P+1)+1)}decode(k,B=0){const P=this.discriminator.decode(k,B);if(P===0)return null;if(P===1)return this.layout.decode(k,B+1);throw new Error("Invalid option "+this.property)}getSpan(k,B=0){const P=this.discriminator.decode(k,B);if(P===0)return 1;if(P===1)return this.layout.getSpan(k,B+1)+1;throw new Error("Invalid option "+this.property)}}function y(_){if(_===0)return!1;if(_===1)return!0;throw new Error("Invalid bool: "+_)}function E(_){return _?1:0}function M(_){const k=(0,e.u32)("length"),B=(0,e.struct)([k,(0,e.blob)((0,e.offset)(k,-k.span),"data")]);return new p(B,({data:P})=>P,P=>({data:P}),_)}r.option=function(_,k){return new v(_,k)},r.bool=function(_){return new p((0,e.u8)(),y,E,_)},r.vec=function(_,k){const B=(0,e.u32)("length"),P=(0,e.struct)([B,(0,e.seq)(_,(0,e.offset)(B,-B.span),"values")]);return new p(P,({values:R})=>R,R=>({values:R}),k)},r.tagged=function(_,k,B){const P=(0,e.struct)([l("tag"),k.replicate("data")]);return new p(P,function({tag:R,data:T}){if(!R.eq(_))throw new Error("Invalid tag, expected: "+_.toString("hex")+", got: "+R.toString("hex"));return T},R=>({tag:_,data:R}),B)},r.vecU8=M,r.str=function(_){return new p(M(),k=>k.toString("utf-8"),k=>Gt.Buffer.from(k,"utf-8"),_)},r.rustEnum=function(_,k,B){const P=(0,e.union)(B??(0,e.u8)(),k);return _.forEach((R,T)=>P.addVariant(T,R,R.property)),P},r.array=function(_,k,B){const P=(0,e.struct)([(0,e.seq)(_,k,"values")]);return new p(P,({values:R})=>R,R=>({values:R}),B)};class w extends e.Layout{constructor(k,B,P){super(k.span+B.span,P),this.keyLayout=k,this.valueLayout=B}decode(k,B){return B=B||0,[this.keyLayout.decode(k,B),this.valueLayout.decode(k,B+this.keyLayout.getSpan(k,B))]}encode(k,B,P){P=P||0;const R=this.keyLayout.encode(k[0],B,P);return R+this.valueLayout.encode(k[1],B,P+R)}getSpan(k,B){return this.keyLayout.getSpan(k,B)+this.valueLayout.getSpan(k,B)}}r.map=function(_,k,B){const P=(0,e.u32)("length"),R=(0,e.struct)([P,(0,e.seq)(new w(_,k),(0,e.offset)(P,-P.span),"values")]);return new p(R,({values:T})=>new Map(T),T=>({values:Array.from(T.entries())}),B)}}(Ze);function Zf(r){let t=r.length;for(;--t>=0;)r[t]=0}const HH=30,VH=new Array(576);Zf(VH);const ZH=new Array(60);Zf(ZH);const WH=new Array(512);Zf(WH);const GH=new Array(256);Zf(GH);const YH=new Array(29);Zf(YH);const XH=new Array(HH);Zf(XH);var U2=(r,t,e,n)=>{let s=65535&r|0,i=r>>>16&65535|0,c=0;for(;e!==0;){c=e>2e3?2e3:e,e-=c;do s=s+t[n++]|0,i=i+s|0;while(--c);s%=65521,i%=65521}return s|i<<16|0};const JH=new Uint32Array((()=>{let r,t=[];for(var e=0;e<256;e++){r=e;for(var n=0;n<8;n++)r=1&r?3988292384^r>>>1:r>>>1;t[e]=r}return t})());var Io=(r,t,e,n)=>{const s=JH,i=n+e;r^=-1;for(let c=n;c>>8^s[255&(r^t[c])];return-1^r},N2={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"},tb={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 QH=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);var XA={assign:function(r){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(const n in e)QH(e,n)&&(r[n]=e[n])}}return r},flattenChunks:r=>{let t=0;for(let n=0,s=r.length;n=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;bh[254]=bh[254]=1;var D2={string2buf:r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let t,e,n,s,i,c=r.length,l=0;for(s=0;s>>6,t[i++]=128|63&e):e<65536?(t[i++]=224|e>>>12,t[i++]=128|e>>>6&63,t[i++]=128|63&e):(t[i++]=240|e>>>18,t[i++]=128|e>>>12&63,t[i++]=128|e>>>6&63,t[i++]=128|63&e);return t},buf2string:(r,t)=>{const e=t||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,t));let n,s;const i=new Array(2*e);for(s=0,n=0;n4)i[s++]=65533,n+=l-1;else{for(c&=l===2?31:l===3?15:7;l>1&&n1?i[s++]=65533:c<65536?i[s++]=c:(c-=65536,i[s++]=55296|c>>10&1023,i[s++]=56320|1023&c)}}return((c,l)=>{if(l<65534&&c.subarray&&JA)return String.fromCharCode.apply(null,c.length===l?c:c.subarray(0,l));let p="";for(let v=0;v{(t=t||r.length)>r.length&&(t=r.length);let e=t-1;for(;e>=0&&(192&r[e])==128;)e--;return e<0||e===0?t:e+bh[r[e]]>t?e:t}},tV=function(){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};const U0=16209;var eV=function(r,t){let e,n,s,i,c,l,p,v,y,E,M,w,_,k,B,P,R,T,U,j,Y,rt,nt,Z;const x=r.state;e=r.next_in,nt=r.input,n=e+(r.avail_in-5),s=r.next_out,Z=r.output,i=s-(t-r.avail_out),c=s+(r.avail_out-257),l=x.dmax,p=x.wsize,v=x.whave,y=x.wnext,E=x.window,M=x.hold,w=x.bits,_=x.lencode,k=x.distcode,B=(1<>>24,M>>>=T,w-=T,T=R>>>16&255,T===0)Z[s++]=65535&R;else{if(!(16&T)){if(!(64&T)){R=_[(65535&R)+(M&(1<>>=T,w-=T),w<15&&(M+=nt[e++]<>>24,M>>>=T,w-=T,T=R>>>16&255,!(16&T)){if(!(64&T)){R=k[(65535&R)+(M&(1<l){r.msg="invalid distance too far back",x.mode=U0;break t}if(M>>>=T,w-=T,T=s-i,j>T){if(T=j-T,T>v&&x.sane){r.msg="invalid distance too far back",x.mode=U0;break t}if(Y=0,rt=E,y===0){if(Y+=p-T,T2;)Z[s++]=rt[Y++],Z[s++]=rt[Y++],Z[s++]=rt[Y++],U-=3;U&&(Z[s++]=rt[Y++],U>1&&(Z[s++]=rt[Y++]))}else{Y=s-j;do Z[s++]=Z[Y++],Z[s++]=Z[Y++],Z[s++]=Z[Y++],U-=3;while(U>2);U&&(Z[s++]=Z[Y++],U>1&&(Z[s++]=Z[Y++]))}break}}break}}while(e>3,e-=U,w-=U<<3,M&=(1<{const p=l.bits;let v,y,E,M,w,_,k=0,B=0,P=0,R=0,T=0,U=0,j=0,Y=0,rt=0,nt=0,Z=null;const x=new Uint16Array(16),d=new Uint16Array(16);let o,a,f,h=null;for(k=0;k<=N0;k++)x[k]=0;for(B=0;B=1&&x[R]===0;R--);if(T>R&&(T=R),R===0)return s[i++]=20971520,s[i++]=20971520,l.bits=1,0;for(P=1;P0&&(r===0||R!==1))return-1;for(d[1]=0,k=1;k852||r===2&&rt>592)return 1;for(;;){o=k-j,c[B]+1<_?(a=0,f=c[B]):c[B]>=_?(a=h[c[B]-_],f=Z[c[B]-_]):(a=96,f=0),v=1<>j)+y]=o<<24|a<<16|f|0;while(y!==0);for(v=1<>=1;if(v!==0?(nt&=v-1,nt+=v):nt=0,B++,--x[k]==0){if(k===R)break;k=t[e+c[B]]}if(k>T&&(nt&M)!==E){for(j===0&&(j=T),w+=P,U=k-j,Y=1<852||r===2&&rt>592)return 1;E=nt&M,s[E]=T<<24|U<<16|w-i|0}}return nt!==0&&(s[w+nt]=k-j<<24|64<<16|0),l.bits=T,0};const{Z_FINISH:U8,Z_BLOCK:sV,Z_TREES:D0,Z_OK:hu,Z_STREAM_END:aV,Z_NEED_DICT:uV,Z_STREAM_ERROR:Xi,Z_DATA_ERROR:QA,Z_MEM_ERROR:tS,Z_BUF_ERROR:fV,Z_DEFLATED:N8}=tb,u1=16180,Kl=16190,as=16191,Gm=16192,Ym=16194,z0=16199,q0=16200,Xm=16206,Fr=16209,D8=r=>(r>>>24&255)+(r>>>8&65280)+((65280&r)<<8)+((255&r)<<24);function cV(){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 wu=r=>{if(!r)return 1;const t=r.state;return!t||t.strm!==r||t.mode16211?1:0},eS=r=>{if(wu(r))return Xi;const t=r.state;return r.total_in=r.total_out=t.total=0,r.msg="",t.wrap&&(r.adler=1&t.wrap),t.mode=u1,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,hu},rS=r=>{if(wu(r))return Xi;const t=r.state;return t.wsize=0,t.whave=0,t.wnext=0,eS(r)},nS=(r,t)=>{let e;if(wu(r))return Xi;const n=r.state;return t<0?(e=0,t=-t):(e=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Xi:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=e,n.wbits=t,rS(r))},z8=(r,t)=>{if(!r)return Xi;const e=new cV;r.state=e,e.strm=r,e.window=null,e.mode=u1;const n=nS(r,t);return n!==hu&&(r.state=null),n};let Jm,Qm,q8=!0;const hV=r=>{if(q8){Jm=new Int32Array(512),Qm=new Int32Array(32);let t=0;for(;t<144;)r.lens[t++]=8;for(;t<256;)r.lens[t++]=9;for(;t<280;)r.lens[t++]=7;for(;t<288;)r.lens[t++]=8;for(Fc(1,r.lens,0,288,Jm,0,r.work,{bits:9}),t=0;t<32;)r.lens[t++]=5;Fc(2,r.lens,0,32,Qm,0,r.work,{bits:5}),q8=!1}r.lencode=Jm,r.lenbits=9,r.distcode=Qm,r.distbits=5},iS=(r,t,e,n)=>{let s;const i=r.state;return i.window===null&&(i.wsize=1<=i.wsize?(i.window.set(t.subarray(e-i.wsize,e),0),i.wnext=0,i.whave=i.wsize):(s=i.wsize-i.wnext,s>n&&(s=n),i.window.set(t.subarray(e-n,e-n+s),i.wnext),(n-=s)?(i.window.set(t.subarray(e-n,e),0),i.wnext=n,i.whave=i.wsize):(i.wnext+=s,i.wnext===i.wsize&&(i.wnext=0),i.whave{let e,n,s,i,c,l,p,v,y,E,M,w,_,k,B,P,R,T,U,j,Y,rt,nt=0;const Z=new Uint8Array(4);let x,d;const o=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(wu(r)||!r.output||!r.input&&r.avail_in!==0)return Xi;e=r.state,e.mode===as&&(e.mode=Gm),c=r.next_out,s=r.output,p=r.avail_out,i=r.next_in,n=r.input,l=r.avail_in,v=e.hold,y=e.bits,E=l,M=p,rt=hu;t:for(;;)switch(e.mode){case u1:if(e.wrap===0){e.mode=Gm;break}for(;y<16;){if(l===0)break t;l--,v+=n[i++]<>>8&255,e.check=Io(e.check,Z,2,0),v=0,y=0,e.mode=16181;break}if(e.head&&(e.head.done=!1),!(1&e.wrap)||(((255&v)<<8)+(v>>8))%31){r.msg="incorrect header check",e.mode=Fr;break}if((15&v)!==N8){r.msg="unknown compression method",e.mode=Fr;break}if(v>>>=4,y-=4,Y=8+(15&v),e.wbits===0&&(e.wbits=Y),Y>15||Y>e.wbits){r.msg="invalid window size",e.mode=Fr;break}e.dmax=1<>8&1),512&e.flags&&4&e.wrap&&(Z[0]=255&v,Z[1]=v>>>8&255,e.check=Io(e.check,Z,2,0)),v=0,y=0,e.mode=16182;case 16182:for(;y<32;){if(l===0)break t;l--,v+=n[i++]<>>8&255,Z[2]=v>>>16&255,Z[3]=v>>>24&255,e.check=Io(e.check,Z,4,0)),v=0,y=0,e.mode=16183;case 16183:for(;y<16;){if(l===0)break t;l--,v+=n[i++]<>8),512&e.flags&&4&e.wrap&&(Z[0]=255&v,Z[1]=v>>>8&255,e.check=Io(e.check,Z,2,0)),v=0,y=0,e.mode=16184;case 16184:if(1024&e.flags){for(;y<16;){if(l===0)break t;l--,v+=n[i++]<>>8&255,e.check=Io(e.check,Z,2,0)),v=0,y=0}else e.head&&(e.head.extra=null);e.mode=16185;case 16185:if(1024&e.flags&&(w=e.length,w>l&&(w=l),w&&(e.head&&(Y=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(n.subarray(i,i+w),Y)),512&e.flags&&4&e.wrap&&(e.check=Io(e.check,n,w,i)),l-=w,i+=w,e.length-=w),e.length))break t;e.length=0,e.mode=16186;case 16186:if(2048&e.flags){if(l===0)break t;w=0;do Y=n[i+w++],e.head&&Y&&e.length<65536&&(e.head.name+=String.fromCharCode(Y));while(Y&&w>9&1,e.head.done=!0),r.adler=e.check=0,e.mode=as;break;case 16189:for(;y<32;){if(l===0)break t;l--,v+=n[i++]<>>=7&y,y-=7&y,e.mode=Xm;break}for(;y<3;){if(l===0)break t;l--,v+=n[i++]<>>=1,y-=1,3&v){case 0:e.mode=16193;break;case 1:if(hV(e),e.mode=z0,t===D0){v>>>=2,y-=2;break t}break;case 2:e.mode=16196;break;case 3:r.msg="invalid block type",e.mode=Fr}v>>>=2,y-=2;break;case 16193:for(v>>>=7&y,y-=7&y;y<32;){if(l===0)break t;l--,v+=n[i++]<>>16^65535)){r.msg="invalid stored block lengths",e.mode=Fr;break}if(e.length=65535&v,v=0,y=0,e.mode=Ym,t===D0)break t;case Ym:e.mode=16195;case 16195:if(w=e.length,w){if(w>l&&(w=l),w>p&&(w=p),w===0)break t;s.set(n.subarray(i,i+w),c),l-=w,i+=w,p-=w,c+=w,e.length-=w;break}e.mode=as;break;case 16196:for(;y<14;){if(l===0)break t;l--,v+=n[i++]<>>=5,y-=5,e.ndist=1+(31&v),v>>>=5,y-=5,e.ncode=4+(15&v),v>>>=4,y-=4,e.nlen>286||e.ndist>30){r.msg="too many length or distance symbols",e.mode=Fr;break}e.have=0,e.mode=16197;case 16197:for(;e.have>>=3,y-=3}for(;e.have<19;)e.lens[o[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,x={bits:e.lenbits},rt=Fc(0,e.lens,0,19,e.lencode,0,e.work,x),e.lenbits=x.bits,rt){r.msg="invalid code lengths set",e.mode=Fr;break}e.have=0,e.mode=16198;case 16198:for(;e.have>>24,P=nt>>>16&255,R=65535&nt,!(B<=y);){if(l===0)break t;l--,v+=n[i++]<>>=B,y-=B,e.lens[e.have++]=R;else{if(R===16){for(d=B+2;y>>=B,y-=B,e.have===0){r.msg="invalid bit length repeat",e.mode=Fr;break}Y=e.lens[e.have-1],w=3+(3&v),v>>>=2,y-=2}else if(R===17){for(d=B+3;y>>=B,y-=B,Y=0,w=3+(7&v),v>>>=3,y-=3}else{for(d=B+7;y>>=B,y-=B,Y=0,w=11+(127&v),v>>>=7,y-=7}if(e.have+w>e.nlen+e.ndist){r.msg="invalid bit length repeat",e.mode=Fr;break}for(;w--;)e.lens[e.have++]=Y}}if(e.mode===Fr)break;if(e.lens[256]===0){r.msg="invalid code -- missing end-of-block",e.mode=Fr;break}if(e.lenbits=9,x={bits:e.lenbits},rt=Fc(1,e.lens,0,e.nlen,e.lencode,0,e.work,x),e.lenbits=x.bits,rt){r.msg="invalid literal/lengths set",e.mode=Fr;break}if(e.distbits=6,e.distcode=e.distdyn,x={bits:e.distbits},rt=Fc(2,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,x),e.distbits=x.bits,rt){r.msg="invalid distances set",e.mode=Fr;break}if(e.mode=z0,t===D0)break t;case z0:e.mode=q0;case q0:if(l>=6&&p>=258){r.next_out=c,r.avail_out=p,r.next_in=i,r.avail_in=l,e.hold=v,e.bits=y,eV(r,M),c=r.next_out,s=r.output,p=r.avail_out,i=r.next_in,n=r.input,l=r.avail_in,v=e.hold,y=e.bits,e.mode===as&&(e.back=-1);break}for(e.back=0;nt=e.lencode[v&(1<>>24,P=nt>>>16&255,R=65535&nt,!(B<=y);){if(l===0)break t;l--,v+=n[i++]<>T)],B=nt>>>24,P=nt>>>16&255,R=65535&nt,!(T+B<=y);){if(l===0)break t;l--,v+=n[i++]<>>=T,y-=T,e.back+=T}if(v>>>=B,y-=B,e.back+=B,e.length=R,P===0){e.mode=16205;break}if(32&P){e.back=-1,e.mode=as;break}if(64&P){r.msg="invalid literal/length code",e.mode=Fr;break}e.extra=15&P,e.mode=16201;case 16201:if(e.extra){for(d=e.extra;y>>=e.extra,y-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=16202;case 16202:for(;nt=e.distcode[v&(1<>>24,P=nt>>>16&255,R=65535&nt,!(B<=y);){if(l===0)break t;l--,v+=n[i++]<>T)],B=nt>>>24,P=nt>>>16&255,R=65535&nt,!(T+B<=y);){if(l===0)break t;l--,v+=n[i++]<>>=T,y-=T,e.back+=T}if(v>>>=B,y-=B,e.back+=B,64&P){r.msg="invalid distance code",e.mode=Fr;break}e.offset=R,e.extra=15&P,e.mode=16203;case 16203:if(e.extra){for(d=e.extra;y>>=e.extra,y-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){r.msg="invalid distance too far back",e.mode=Fr;break}e.mode=16204;case 16204:if(p===0)break t;if(w=M-p,e.offset>w){if(w=e.offset-w,w>e.whave&&e.sane){r.msg="invalid distance too far back",e.mode=Fr;break}w>e.wnext?(w-=e.wnext,_=e.wsize-w):_=e.wnext-w,w>e.length&&(w=e.length),k=e.window}else k=s,_=c-e.offset,w=e.length;w>p&&(w=p),p-=w,e.length-=w;do s[c++]=k[_++];while(--w);e.length===0&&(e.mode=q0);break;case 16205:if(p===0)break t;s[c++]=e.length,p--,e.mode=q0;break;case Xm:if(e.wrap){for(;y<32;){if(l===0)break t;l--,v|=n[i++]<{if(wu(r))return Xi;let t=r.state;return t.window&&(t.window=null),r.state=null,hu},pV=(r,t)=>{if(wu(r))return Xi;const e=r.state;return 2&e.wrap?(e.head=t,t.done=!1,hu):Xi},mV=(r,t)=>{const e=t.length;let n,s,i;return wu(r)?Xi:(n=r.state,n.wrap!==0&&n.mode!==Kl?Xi:n.mode===Kl&&(s=1,s=U2(s,t,e,0),s!==n.check)?QA:(i=iS(r,t,e,e),i?(n.mode=16210,tS):(n.havedict=1,hu)))},ys={inflateReset:rS,inflateReset2:nS,inflateResetKeep:eS,inflateInit:r=>z8(r,15),inflateInit2:z8,inflate:lV,inflateEnd:dV,inflateGetHeader:pV,inflateSetDictionary:mV,inflateInfo:"pako inflate (from Nodeca project)"},vV=function(){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};const oS=Object.prototype.toString,{Z_NO_FLUSH:gV,Z_FINISH:yV,Z_OK:jc,Z_STREAM_END:tv,Z_NEED_DICT:ev,Z_STREAM_ERROR:bV,Z_DATA_ERROR:F8,Z_MEM_ERROR:wV}=tb;function $c(r){this.options=XA.assign({chunkSize:65536,windowBits:15,to:""},r||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||r&&r.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new tV,this.strm.avail_out=0;let e=ys.inflateInit2(this.strm,t.windowBits);if(e!==jc)throw new Error(N2[e]);if(this.header=new vV,ys.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=D2.string2buf(t.dictionary):oS.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=ys.inflateSetDictionary(this.strm,t.dictionary),e!==jc)))throw new Error(N2[e])}function rv(r,t){const e=new $c(t);if(e.push(r),e.err)throw e.msg||N2[e.err];return e.result}$c.prototype.push=function(r,t){const e=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let i,c,l;if(this.ended)return!1;for(c=t===~~t?t:t===!0?yV:gV,oS.call(r)==="[object ArrayBuffer]"?e.input=new Uint8Array(r):e.input=r,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),i=ys.inflate(e,c),i===ev&&s&&(i=ys.inflateSetDictionary(e,s),i===jc?i=ys.inflate(e,c):i===F8&&(i=ev));e.avail_in>0&&i===tv&&e.state.wrap>0&&r[e.next_in]!==0;)ys.inflateReset(e),i=ys.inflate(e,c);switch(i){case bV:case F8:case ev:case wV:return this.onEnd(i),this.ended=!0,!1}if(l=e.avail_out,e.next_out&&(e.avail_out===0||i===tv))if(this.options.to==="string"){let p=D2.utf8border(e.output,e.next_out),v=e.next_out-p,y=D2.buf2string(e.output,p);e.next_out=v,e.avail_out=n-v,v&&e.output.set(e.output.subarray(p,p+v),0),this.onData(y)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(i!==jc||l!==0){if(i===tv)return i=ys.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(e.avail_in===0)break}}return!0},$c.prototype.onData=function(r){this.chunks.push(r)},$c.prototype.onEnd=function(r){r===jc&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=XA.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};var xV={Inflate:$c,inflate:rv,inflateRaw:function(r,t){return(t=t||{}).raw=!0,rv(r,t)},ungzip:rv,constants:tb};const{Inflate:LG,inflate:_V,inflateRaw:OG,ungzip:UG}=xV;var MV=_V,EV=xo(qy());const Ec=r=>"version"in r;var AV=Object.freeze({__proto__:null,encode:function(r){return r.reduce((t,e)=>t+e.toString(16).padStart(2,"0"),"0x")},decode:function(r){r.indexOf("0x")===0&&(r=r.substr(2)),r.length%2==1&&(r="0"+r);let t=r.match(/.{2}/g);return t===null?Ae.Buffer.from([]):Ae.Buffer.from(t.map(e=>parseInt(e,16)))}});function sS(r){return new TextDecoder("utf-8").decode(r)}function aS(r){return new TextEncoder().encode(r)}var SV=Object.freeze({__proto__:null,decode:sS,encode:aS});function z2(r){return nf.encode(r)}var kV=Object.freeze({__proto__:null,encode:z2,decode:function(r){return nf.decode(r)}});function uS(r){return Ae.Buffer.from(cE(r))}var IV=Object.freeze({__proto__:null,encode:function(r){return o2(r)},decode:uS}),BV=Object.freeze({__proto__:null,hex:AV,utf8:SV,bs58:kV,base64:IV});function fS(r){const t=new Map;return r.errors&&r.errors.forEach(e=>{var n;let s=(n=e.msg)!==null&&n!==void 0?n:e.name;t.set(e.code,s)}),t}function cS(r,...t){if(r.args.length!=t.length)throw new Error("Invalid argument length");const e={};let n=0;return r.args.forEach(s=>{e[s.name]=t[n],n+=1}),e}function eb(r,t={}){r.forEach(e=>{if("accounts"in e)eb(e.accounts,t[e.name]);else if(t[e.name]===void 0)throw new Error(`Invalid arguments: ${e.name} not provided.`)})}function ci(r){return r instanceof Xt?r:new Xt(r)}class PV extends TypeError{constructor(t,e){let n;const{message:s,...i}=t,{path:c}=t;super(c.length===0?s:"At path: "+c.join(".")+" -- "+s),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,i),this.name=this.constructor.name,this.failures=()=>{var l;return(l=n)!=null?l:n=[t,...e()]}}}function of(r){return typeof r=="object"&&r!=null}function ca(r){return typeof r=="string"?JSON.stringify(r):""+r}function RV(r,t,e,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:s,branch:i}=t,{type:c}=e,{refinement:l,message:p="Expected a value of type `"+c+"`"+(l?" with refinement `"+l+"`":"")+", but received: `"+ca(n)+"`"}=r;return{value:n,type:c,refinement:l,key:s[s.length-1],path:s,branch:i,...r,message:p}}function*j8(r,t,e,n){(function(s){return of(s)&&typeof s[Symbol.iterator]=="function"})(r)||(r=[r]);for(const s of r){const i=RV(s,t,e,n);i&&(yield i)}}function*rb(r,t,e){e===void 0&&(e={});const{path:n=[],branch:s=[r],coerce:i=!1,mask:c=!1}=e,l={path:n,branch:s};if(i&&(r=t.coercer(r,l),c&&t.type!=="type"&&of(t.schema)&&of(r)&&!Array.isArray(r)))for(const v in r)t.schema[v]===void 0&&delete r[v];let p=!0;for(const v of t.validator(r,l))p=!1,yield[v,void 0];for(let[v,y,E]of t.entries(r,l)){const M=rb(y,E,{path:v===void 0?n:[...n,v],branch:v===void 0?s:[...s,y],coerce:i,mask:c});for(const w of M)w[0]?(p=!1,yield[w[0],void 0]):i&&(y=w[1],v===void 0?r=y:r instanceof Map?r.set(v,y):r instanceof Set?r.add(y):of(r)&&(r[v]=y))}if(p)for(const v of t.refiner(r,l))p=!1,yield[v,void 0];p&&(yield[void 0,r])}class ga{constructor(t){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:e,schema:n,validator:s,refiner:i,coercer:c=p=>p,entries:l=function*(){}}=t;this.type=e,this.schema=n,this.entries=l,this.coercer=c,this.validator=s?(p,v)=>j8(s(p,v),v,this,p):()=>[],this.refiner=i?(p,v)=>j8(i(p,v),v,this,p):()=>[]}assert(t){return function(e,n){const s=Kc(e,n);if(s[0])throw s[0]}(t,this)}create(t){return nb(t,this)}is(t){return hS(t,this)}mask(t){return function(e,n){const s=Kc(e,n,{coerce:!0,mask:!0});if(s[0])throw s[0];return s[1]}(t,this)}validate(t,e){return e===void 0&&(e={}),Kc(t,this,e)}}function nb(r,t){const e=Kc(r,t,{coerce:!0});if(e[0])throw e[0];return e[1]}function hS(r,t){return!Kc(r,t)[0]}function Kc(r,t,e){e===void 0&&(e={});const n=rb(r,t,e),s=function(i){const{done:c,value:l}=i.next();return c?void 0:l}(n);return s[0]?[new PV(s[0],function*(){for(const c of n)c[0]&&(yield c[0])}),void 0]:[void 0,s[1]]}function Qh(r,t){return new ga({type:r,schema:null,validator:t})}function nv(r){return new ga({type:"array",schema:r,*entries(t){if(r&&Array.isArray(t))for(const[e,n]of t.entries())yield[e,n,r]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||"Expected an array value, but received: "+ca(t)})}function $8(r){const t=ca(r),e=typeof r;return new ga({type:"literal",schema:e==="string"||e==="number"||e==="boolean"?r:null,validator:n=>n===r||"Expected the literal `"+t+"`, but received: "+ca(n)})}function F0(r){return new ga({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function j0(){return Qh("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+ca(r))}function pl(r){return new ga({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function Ha(){return Qh("string",r=>typeof r=="string"||"Expected a string, but received: "+ca(r))}function Zs(r){const t=Object.keys(r);return new ga({type:"type",schema:r,*entries(e){if(of(e))for(const n of t)yield[n,e[n],r[n]]},validator:e=>of(e)||"Expected an object, but received: "+ca(e)})}function lS(r){const t=r.map(e=>e.type).join(" | ");return new ga({type:"union",schema:null,coercer(e,n){return(r.find(i=>{const[c]=i.validate(e,{coerce:!0});return!c})||ib()).coercer(e,n)},validator(e,n){const s=[];for(const i of r){const[...c]=rb(e,i,n),[l]=c;if(!l[0])return[];for(const[p]of c)p&&s.push(p)}return["Expected the value to satisfy a union of `"+t+"`, but received: "+ca(e),...s]}})}function ib(){return Qh("unknown",()=>!0)}const K8=99;async function q2(r,t,e){if(t.length<=K8)return await H8(r,t,e);{const n=function(s,i){return Array.apply(0,new Array(Math.ceil(s.length/i))).map((c,l)=>s.slice(l*i,(l+1)*i))}(t,K8);return(await Promise.all(n.map(s=>H8(r,s,e)))).flat()}}async function H8(r,t,e){const n=e??r.commitment,{value:s,context:i}=await r.getMultipleAccountsInfoAndContext(t,n);return s.map((c,l)=>c===null?null:{publicKey:t[l],account:c,context:i})}async function dS(r,t,e,n,s){var i;e&&e.length>0&&t.sign(...e);const c=t._compile(),l=c.serialize(),p=t._serialize(l).toString("base64"),v={encoding:"base64",commitment:n??r.commitment};if(s){const M=(Array.isArray(s)?s:c.nonProgramIds()).map(w=>w.toBase58());v.accounts={encoding:"base64",addresses:M}}e&&(v.sigVerify=!0);const y=[p,v],E=nb(await r._rpcRequest("simulateTransaction",y),LV);if("error"in E){let M;if("data"in E.error&&(M=(i=E.error.data)===null||i===void 0?void 0:i.logs,M&&Array.isArray(M))){const w=` - `,_=w+M.join(w);console.error(E.error.message,_)}throw new Ju("failed to simulate transaction: "+E.error.message,M)}return E.result}function CV(r){return function(t,e,n){return new ga({...t,coercer:(s,i)=>hS(s,e)?t.coercer(n(s,i),i):t.coercer(s,i)})}(pS(r),TV,t=>"error"in t?t:{...t,result:nb(t.result,r)})}const TV=pS(ib());function pS(r){return lS([Zs({jsonrpc:$8("2.0"),id:Ha(),result:r}),Zs({jsonrpc:$8("2.0"),id:Ha(),error:Zs({code:ib(),message:Ha(),data:pl(Qh("any",()=>!0))})})])}const LV=(V8=Zs({err:F0(lS([Zs({}),Ha()])),logs:F0(nv(Ha())),accounts:pl(F0(nv(F0(Zs({executable:Qh("boolean",r=>typeof r=="boolean"),owner:Ha(),lamports:j0(),data:nv(Ha()),rentEpoch:pl(j0())}))))),unitsConsumed:pl(j0())}),CV(Zs({context:Zs({slot:j0()}),value:V8})));var V8,OV=Object.freeze({__proto__:null,invoke:async function(r,t,e,n){r=ci(r),n||(n=wh());const s=new wr;if(s.add(new kr({programId:r,keys:t??[],data:e})),n.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");return await n.sendAndConfirm(s,[])},getMultipleAccounts:async function(r,t,e){return(await q2(r,t,e)).map(n=>n?{publicKey:n.publicKey,account:n.account}:null)},getMultipleAccountsAndContext:q2,simulateTransaction:dS});class mS{constructor(t,e,n){this.connection=t,this.wallet=e,this.opts=n,this.publicKey=e==null?void 0:e.publicKey}static defaultOptions(){return{preflightCommitment:"processed",commitment:"processed"}}static local(t,e){throw new Error("Provider local is not available on browser.")}static env(){throw new Error("Provider env is not available on browser.")}async sendAndConfirm(t,e,n){var s,i,c,l;if(n===void 0&&(n=this.opts),Ec(t))e&&t.sign(e);else if(t.feePayer=(s=t.feePayer)!==null&&s!==void 0?s:this.wallet.publicKey,t.recentBlockhash=(await this.connection.getLatestBlockhash(n.preflightCommitment)).blockhash,e)for(const v of e)t.partialSign(v);const p=(t=await this.wallet.signTransaction(t)).serialize();try{return await Z8(this.connection,p,n)}catch(v){if(v instanceof F2){const y=z2(Ec(t)?((i=t.signatures)===null||i===void 0?void 0:i[0])||new Uint8Array:(c=t.signature)!==null&&c!==void 0?c:new Uint8Array),E=await this.connection.getTransaction(y,{commitment:"confirmed"});if(E){const M=(l=E.meta)===null||l===void 0?void 0:l.logMessages;throw M?new Ju(v.message,M):v}throw v}throw v}}async sendAll(t,e){var n,s,i;e===void 0&&(e=this.opts);const c=(await this.connection.getLatestBlockhash(e.preflightCommitment)).blockhash;let l=t.map(y=>{var E,M;if(Ec(y.tx)){let w=y.tx;return y.signers&&w.sign(y.signers),w}{let w=y.tx,_=(E=y.signers)!==null&&E!==void 0?E:[];return w.feePayer=(M=w.feePayer)!==null&&M!==void 0?M:this.wallet.publicKey,w.recentBlockhash=c,_.forEach(k=>{w.partialSign(k)}),w}});const p=await this.wallet.signAllTransactions(l),v=[];for(let y=0;yv.startsWith("Program log: AnchorError"));if(e===-1)return null;const n=t[e],s=[n];let i;if(e+11)return null;s=l[0].match(/([0-9]+)/g)[0]}try{i=parseInt(s)}catch{return null}let c=e.get(i);return c!==void 0?new _h(i,c,t.logs):(c=gS.get(i),c!==void 0?new _h(i,c,t.logs):null)}get program(){var t;return(t=this._programErrorStack)===null||t===void 0?void 0:t.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){var t;return(t=this._programErrorStack)===null||t===void 0?void 0:t.stack}toString(){return this.msg}}function sb(r,t){ob("debug-logs")&&console.log("Translating error:",r);const e=sf.parse(r.logs);if(e)return e;const n=_h.parse(r,t);if(n)return n;if(r.logs){const s={get:function(i,c){return c==="programErrorStack"?i.programErrorStack.stack:c==="program"?i.programErrorStack.stack[r.programErrorStack.stack.length-1]:Reflect.get(...arguments)}};return r.programErrorStack=Wf.parse(r.logs),new Proxy(r,s)}return r}const qe={InstructionMissing:100,InstructionFallbackNotFound:101,InstructionDidNotDeserialize:102,InstructionDidNotSerialize:103,IdlInstructionStub:1e3,IdlInstructionInvalidProgram:1001,ConstraintMut:2e3,ConstraintHasOne:2001,ConstraintSigner:2002,ConstraintRaw:2003,ConstraintOwner:2004,ConstraintRentExempt:2005,ConstraintSeeds:2006,ConstraintExecutable:2007,ConstraintState:2008,ConstraintAssociated:2009,ConstraintAssociatedInit:2010,ConstraintClose:2011,ConstraintAddress:2012,ConstraintZero:2013,ConstraintTokenMint:2014,ConstraintTokenOwner:2015,ConstraintMintMintAuthority:2016,ConstraintMintFreezeAuthority:2017,ConstraintMintDecimals:2018,ConstraintSpace:2019,ConstraintAccountIsNone:2020,RequireViolated:2500,RequireEqViolated:2501,RequireKeysEqViolated:2502,RequireNeqViolated:2503,RequireKeysNeqViolated:2504,RequireGtViolated:2505,RequireGteViolated:2506,AccountDiscriminatorAlreadySet:3e3,AccountDiscriminatorNotFound:3001,AccountDiscriminatorMismatch:3002,AccountDidNotDeserialize:3003,AccountDidNotSerialize:3004,AccountNotEnoughKeys:3005,AccountNotMutable:3006,AccountOwnedByWrongProgram:3007,InvalidProgramId:3008,InvalidProgramExecutable:3009,AccountNotSigner:3010,AccountNotSystemOwned:3011,AccountNotInitialized:3012,AccountNotProgramData:3013,AccountNotAssociatedTokenAccount:3014,AccountSysvarMismatch:3015,AccountReallocExceedsLimit:3016,AccountDuplicateReallocs:3017,DeclaredProgramIdMismatch:4100,Deprecated:5e3},gS=new Map([[qe.InstructionMissing,"8 byte instruction identifier not provided"],[qe.InstructionFallbackNotFound,"Fallback functions are not supported"],[qe.InstructionDidNotDeserialize,"The program could not deserialize the given instruction"],[qe.InstructionDidNotSerialize,"The program could not serialize the given instruction"],[qe.IdlInstructionStub,"The program was compiled without idl instructions"],[qe.IdlInstructionInvalidProgram,"The transaction was given an invalid program for the IDL instruction"],[qe.ConstraintMut,"A mut constraint was violated"],[qe.ConstraintHasOne,"A has one constraint was violated"],[qe.ConstraintSigner,"A signer constraint was violated"],[qe.ConstraintRaw,"A raw constraint was violated"],[qe.ConstraintOwner,"An owner constraint was violated"],[qe.ConstraintRentExempt,"A rent exemption constraint was violated"],[qe.ConstraintSeeds,"A seeds constraint was violated"],[qe.ConstraintExecutable,"An executable constraint was violated"],[qe.ConstraintState,"Deprecated Error, feel free to replace with something else"],[qe.ConstraintAssociated,"An associated constraint was violated"],[qe.ConstraintAssociatedInit,"An associated init constraint was violated"],[qe.ConstraintClose,"A close constraint was violated"],[qe.ConstraintAddress,"An address constraint was violated"],[qe.ConstraintZero,"Expected zero account discriminant"],[qe.ConstraintTokenMint,"A token mint constraint was violated"],[qe.ConstraintTokenOwner,"A token owner constraint was violated"],[qe.ConstraintMintMintAuthority,"A mint mint authority constraint was violated"],[qe.ConstraintMintFreezeAuthority,"A mint freeze authority constraint was violated"],[qe.ConstraintMintDecimals,"A mint decimals constraint was violated"],[qe.ConstraintSpace,"A space constraint was violated"],[qe.ConstraintAccountIsNone,"A required account for the constraint is None"],[qe.RequireViolated,"A require expression was violated"],[qe.RequireEqViolated,"A require_eq expression was violated"],[qe.RequireKeysEqViolated,"A require_keys_eq expression was violated"],[qe.RequireNeqViolated,"A require_neq expression was violated"],[qe.RequireKeysNeqViolated,"A require_keys_neq expression was violated"],[qe.RequireGtViolated,"A require_gt expression was violated"],[qe.RequireGteViolated,"A require_gte expression was violated"],[qe.AccountDiscriminatorAlreadySet,"The account discriminator was already set on this account"],[qe.AccountDiscriminatorNotFound,"No 8 byte discriminator was found on the account"],[qe.AccountDiscriminatorMismatch,"8 byte discriminator did not match what was expected"],[qe.AccountDidNotDeserialize,"Failed to deserialize the account"],[qe.AccountDidNotSerialize,"Failed to serialize the account"],[qe.AccountNotEnoughKeys,"Not enough account keys given to the instruction"],[qe.AccountNotMutable,"The given account is not mutable"],[qe.AccountOwnedByWrongProgram,"The given account is owned by a different program than expected"],[qe.InvalidProgramId,"Program ID was not as expected"],[qe.InvalidProgramExecutable,"Program account is not executable"],[qe.AccountNotSigner,"The given account did not sign"],[qe.AccountNotSystemOwned,"The given account is not owned by the system program"],[qe.AccountNotInitialized,"The program expected this account to be already initialized"],[qe.AccountNotProgramData,"The given account is not a program data account"],[qe.AccountNotAssociatedTokenAccount,"The given account is not the associated token account"],[qe.AccountSysvarMismatch,"The given public key does not match the required sysvar"],[qe.AccountReallocExceedsLimit,"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"],[qe.AccountDuplicateReallocs,"The account was duplicated for more than one reallocation"],[qe.DeclaredProgramIdMismatch,"The declared program id does not match the actual program id"],[qe.Deprecated,"The API being used is deprecated and should no longer be used"]]);var $2=function(){return $2=Object.assign||function(r){for(var t,e=1,n=arguments.length;ec.name===s);if(i.length!==1)throw new xh(`Type not found: ${JSON.stringify(t)}`);return ki.typeDefLayout(i[0],e,n)}if("array"in t.type){let s=t.type.array[0],i=t.type.array[1],c=ki.fieldLayout({name:void 0,type:s},e);return Ze.array(c,i,n)}throw new Error(`Not yet implemented: ${t}`)}}static typeDefLayout(t,e=[],n){if(t.type.kind==="struct"){const s=t.type.fields.map(i=>ki.fieldLayout(i,e));return Ze.struct(s,n)}if(t.type.kind==="enum"){let s=t.type.variants.map(i=>{const c=Dr(i.name);if(i.fields===void 0)return Ze.struct([],c);const l=i.fields.map((p,v)=>p.hasOwnProperty("name")?ki.fieldLayout(p,e):ki.fieldLayout({type:p,name:v.toString()},e));return Ze.struct(l,c)});return n!==void 0?Ze.rustEnum(s).replicate(n):Ze.rustEnum(s,n)}throw new Error(`Unknown type kint: ${t}`)}}const G8="global";class f1{constructor(t){this.idl=t,this.ixLayout=f1.parseIxLayout(t);const e=new Map;t.instructions.forEach(n=>{const s=Y8(G8,n.name);e.set(nf.encode(s),{layout:this.ixLayout.get(n.name),name:n.name})}),this.sighashLayouts=e}encode(t,e){return this._encode(G8,t,e)}_encode(t,e,n){const s=Ae.Buffer.alloc(1e3),i=Dr(e),c=this.ixLayout.get(i);if(!c)throw new Error(`Unknown method: ${i}`);const l=c.encode(n,s),p=s.slice(0,l);return Ae.Buffer.concat([Y8(t,e),p])}static parseIxLayout(t){const e=t.instructions.map(n=>{let s=n.args.map(c=>{var l,p;return ki.fieldLayout(c,Array.from([...(l=t.accounts)!==null&&l!==void 0?l:[],...(p=t.types)!==null&&p!==void 0?p:[]]))});const i=Dr(n.name);return[i,Ze.struct(s,i)]});return new Map(e)}decode(t,e="hex"){typeof t=="string"&&(t=e==="hex"?Ae.Buffer.from(t,"hex"):nf.decode(t));let n=nf.encode(t.slice(0,8)),s=t.slice(8);const i=this.sighashLayouts.get(n);return i?{data:i.layout.decode(s),name:i.name}:null}format(t,e){return ds.format(t,e,this.idl)}}class ds{static format(t,e,n){const s=n.instructions.filter(l=>t.name===l.name)[0];if(s===void 0)return console.error("Invalid instruction given"),null;const i=s.args.map(l=>({name:l.name,type:ds.formatIdlType(l.type),data:ds.formatIdlData(l,t.data[l.name],n.types)})),c=ds.flattenIdlAccounts(s.accounts);return{args:i,accounts:e.map((l,p)=>p`;if("option"in t)return`Option<${this.formatIdlType(t.option)}>`;if("defined"in t)return t.defined;if("array"in t)return`Array<${t.array[0]}; ${t.array[1]}>`;throw new Error(`Unknown IDL type: ${t}`)}static formatIdlData(t,e,n){if(typeof t.type=="string")return e.toString();if(t.type.hasOwnProperty("vec"))return"["+e.map(s=>this.formatIdlData({name:"",type:t.type.vec},s)).join(", ")+"]";if(t.type.hasOwnProperty("option"))return e===null?"null":this.formatIdlData({name:"",type:t.type.option},e,n);if(t.type.hasOwnProperty("defined")){if(n===void 0)throw new Error("User defined types not provided");const s=n.filter(i=>i.name===t.type.defined);if(s.length!==1)throw new Error(`Type not found: ${t.type.defined}`);return ds.formatIdlDataDefined(s[0],e,n)}return"unknown"}static formatIdlDataDefined(t,e,n){if(t.type.kind==="struct"){const s=t.type;return"{ "+Object.keys(e).map(c=>{const l=s.fields.filter(p=>p.name===c)[0];if(l===void 0)throw new Error("Unable to find type");return c+": "+ds.formatIdlData(l,e[c],n)}).join(", ")+" }"}if(t.type.variants.length===0)return"{}";if(t.type.variants[0].name){const s=t.type.variants,i=Object.keys(e)[0],c=e[i],l=Object.keys(c).map(v=>{var y;const E=c[v],M=(y=s[i])===null||y===void 0?void 0:y.filter(w=>w.name===v)[0];if(M===void 0)throw new Error("Unable to find variant");return v+": "+ds.formatIdlData(M,E,n)}).join(", "),p=Dr(i,{pascalCase:!0});return l.length===0?p:`${p} { ${l} }`}return"Tuple formatting not yet implemented"}static flattenIdlAccounts(t,e){return t.map(n=>{const s=function(i){const c=i.replace(/([A-Z])/g," $1");return c.charAt(0).toUpperCase()+c.slice(1)}(n.name);if(n.hasOwnProperty("accounts")){const i=e?`${e} > ${s}`:s;return ds.flattenIdlAccounts(n.accounts,i)}return{...n,name:e?`${e} > ${s}`:s}}).flat()}}function Y8(r,t){var e;let n=`${r}:${e===void 0&&(e={}),jV(t,$2({delimiter:"_"},e))}`;return Ae.Buffer.from(fu(n).slice(0,8))}function ab(r,t){if(t.type.kind==="enum"){const e=t.type.variants.map(n=>n.fields?n.fields.map(s=>Hc(r,typeof s=="object"&&"name"in s?s.type:s)).reduce((s,i)=>s+i,0):0);return Math.max(...e)+1}return t.type.fields.map(e=>Hc(r,e.type)).reduce((e,n)=>e+n,0)}function Hc(r,t){var e,n;switch(t){case"bool":case"u8":case"i8":case"bytes":case"string":return 1;case"i16":case"u16":return 2;case"u32":case"i32":case"f32":return 4;case"u64":case"i64":case"f64":return 8;case"u128":case"i128":return 16;case"u256":case"i256":case"publicKey":return 32;default:if("vec"in t)return 1;if("option"in t)return 1+Hc(r,t.option);if("coption"in t)return 4+Hc(r,t.coption);if("defined"in t){const s=(n=(e=r.types)===null||e===void 0?void 0:e.filter(i=>i.name===t.defined))!==null&&n!==void 0?n:[];if(s.length!==1)throw new xh(`Type not found: ${JSON.stringify(t)}`);return ab(r,s[0])}if("array"in t){let s=t.array[0],i=t.array[1];return Hc(r,s)*i}throw new Error(`Invalid type ${JSON.stringify(t)}`)}}const Hl=8;function yS(r){return Gt.Buffer.from(fu(r).slice(0,Hl))}class Va{constructor(t){if(t.accounts===void 0)return void(this.accountLayouts=new Map);const e=t.accounts.map(n=>[n.name,ki.typeDefLayout(n,t.types)]);this.accountLayouts=new Map(e),this.idl=t}async encode(t,e){const n=Ae.Buffer.alloc(1e3),s=this.accountLayouts.get(t);if(!s)throw new Error(`Unknown account: ${t}`);const i=s.encode(e,n);let c=n.slice(0,i),l=Va.accountDiscriminator(t);return Ae.Buffer.concat([l,c])}decode(t,e){if(Va.accountDiscriminator(t).compare(e.slice(0,8)))throw new Error("Invalid account discriminator");return this.decodeUnchecked(t,e)}decodeAny(t){const e=t.slice(0,8),n=Array.from(this.accountLayouts.keys()).find(s=>Va.accountDiscriminator(s).equals(e));if(!n)throw new Error("Account descriminator not found");return this.decodeUnchecked(n,t)}decodeUnchecked(t,e){const n=e.subarray(Hl),s=this.accountLayouts.get(t);if(!s)throw new Error(`Unknown account: ${t}`);return s.decode(n)}memcmp(t,e){const n=Va.accountDiscriminator(t);return{offset:0,bytes:nf.encode(e?Ae.Buffer.concat([n,e]):n)}}size(t){var e;return Hl+((e=ab(this.idl,t))!==null&&e!==void 0?e:0)}static accountDiscriminator(t){return yS(`account:${Dr(t,{pascalCase:!0,preserveConsecutiveUppercase:!0})}`)}}class bS{constructor(t){if(t.events===void 0)return void(this.layouts=new Map);const e=t.events.map(n=>{let s={name:n.name,type:{kind:"struct",fields:n.fields.map(i=>({name:i.name,type:i.type}))}};return[n.name,ki.typeDefLayout(s,t.types)]});this.layouts=new Map(e),this.discriminators=new Map(t.events===void 0?[]:t.events.map(n=>[o2(wS(n.name)),n.name]))}decode(t){let e;try{e=Ae.Buffer.from(cE(t))}catch{return null}const n=o2(e.slice(0,8)),s=this.discriminators.get(n);if(s===void 0)return null;const i=this.layouts.get(s);if(!i)throw new Error(`Unknown event: ${s}`);return{data:i.decode(e.slice(8)),name:s}}}function wS(r){return yS(`event:${r}`)}class $V{constructor(t){if(t.types===void 0)return void(this.typeLayouts=new Map);const e=t.types.map(n=>[n.name,ki.typeDefLayout(n,t.types)]);this.typeLayouts=new Map(e),this.idl=t}encode(t,e){const n=Ae.Buffer.alloc(1e3),s=this.typeLayouts.get(t);if(!s)throw new Error(`Unknown type: ${t}`);const i=s.encode(e,n);return n.slice(0,i)}decode(t,e){const n=this.typeLayouts.get(t);if(!n)throw new Error(`Unknown type: ${t}`);return n.decode(e)}}class ub{constructor(t){this.instruction=new f1(t),this.accounts=new Va(t),this.events=new bS(t),this.types=new $V(t)}}var KV=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Gt.global<"u"?Gt.global:typeof self<"u"?self:{};function HV(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}class vi{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}var c1=vi;class Za extends vi{isCount(){throw new Error("ExternalLayout is abstract")}}class xS extends Za{constructor(t,e,n){if(!(t instanceof vi))throw new TypeError("layout must be a Layout");if(e===void 0)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof h1||this.layout instanceof _S}decode(t,e){return e===void 0&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return n===void 0&&(n=0),this.layout.encode(t,e,n+this.offset)}}class h1 extends vi{constructor(t,e){if(super(t,e),6i&&c instanceof vi,!0))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const i of t)if(0>i.span&&i.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let s=-1;try{s=t.reduce((i,c)=>i+c.getSpan(),0)}catch{}super(s,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;try{n=this.fields.reduce((s,i)=>{const c=i.getSpan(t,e);return e+=c,s+c},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e){e===void 0&&(e=0);const n=this.makeDestinationObject();for(const s of this.fields)if(s.property!==void 0&&(n[s.property]=s.decode(t,e)),e+=s.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){n===void 0&&(n=0);const s=n;let i=0,c=0;for(const l of this.fields){let p=l.span;if(c=0p&&(p=l.getSpan(e,n)))}i=n,n+=p}return i+c-s}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?e=-1:0<=e&&(e+=n.span)}}}class AS{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class X8 extends AS{constructor(t,e){if(!(t instanceof Za&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class SS extends vi{constructor(t,e,n){const s=t instanceof h1||t instanceof _S;if(s)t=new X8(new xS(t));else if(t instanceof Za&&t.isCount())t=new X8(t);else if(!(t instanceof AS))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof vi))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&s&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=s,this.defaultLayout=e,this.registry={};let c=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(l){return c(l)},this.configGetSourceVariant=function(l){c=l.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){let n;e===void 0&&(e=0);const s=this.discriminator,i=s.decode(t,e);let c=this.registry[i];if(c===void 0){let l=0;c=this.defaultLayout,this.usesPrefixDiscriminator&&(l=s.layout.span),n=this.makeDestinationObject(),n[s.property]=i,n[c.property]=this.defaultLayout.decode(t,e+l)}else n=c.decode(t,e);return n}encode(t,e,n){n===void 0&&(n=0);const s=this.getSourceVariant(t);if(s===void 0){const i=this.discriminator,c=this.defaultLayout;let l=0;return this.usesPrefixDiscriminator&&(l=i.layout.span),i.encode(t[i.property],e,n),l+c.encode(t[c.property],e,n+l)}return s.encode(t,e,n)}addVariant(t,e,n){const s=new GV(this,t,e,n);return this.registry[t]=s,s}getVariant(t,e){let n=t;return Gt.Buffer.isBuffer(t)&&(e===void 0&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class GV extends vi{constructor(t,e,n,s){if(!(t instanceof SS))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&s===void 0&&(s=n,n=null),n){if(!(n instanceof vi))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof s!="string")throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,s),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(e===void 0&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let s=0;return this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+s):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){n===void 0&&(n=0);let s=0;if(this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=s;if(this.layout&&(this.layout.encode(t[this.property],e,n+s),i+=this.layout.getSpan(e,n+s),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}class YV extends vi{constructor(t,e){if(!(t instanceof Za&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;t instanceof Za||(n=t),super(n,e),this.length=t}getSpan(t,e){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),n}decode(t,e){e===void 0&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let s=this.length;if(this.length instanceof Za&&(s=t.length),!Gt.Buffer.isBuffer(t)||s!==t.length)throw new TypeError(function(i,c){return c.property?i+"["+c.property+"]":i}("Blob.encode",this)+" requires (length "+s+") Buffer as src");if(n+s>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,s,"hex"),this.length instanceof Za&&this.length.encode(s,e,n),s}}var XV=(r,t,e)=>new xS(r,t,e),Ss=r=>new h1(4,r),us=r=>new ZV(r),ln=(r,t,e)=>new WV(r,t,e),kS=(r,t,e)=>new SS(r,t,e),t0=(r,t)=>new YV(r,t);class JV{constructor(t){}encode(t,e){switch(Dr(t)){case"createAccount":return function({lamports:n,space:s,owner:i}){return Ui({createAccount:{lamports:n,space:s,owner:i.toBuffer()}})}(e);case"assign":return function({owner:n}){return Ui({assign:{owner:n.toBuffer()}})}(e);case"transfer":return function({lamports:n}){return Ui({transfer:{lamports:n}})}(e);case"createAccountWithSeed":return function({base:n,seed:s,lamports:i,space:c,owner:l}){return Ui({createAccountWithSeed:{base:n.toBuffer(),seed:s,lamports:i,space:c,owner:l.toBuffer()}},bn.getVariant(3).span+s.length)}(e);case"advanceNonceAccount":return function({authorized:n}){return Ui({advanceNonceAccount:{authorized:n.toBuffer()}})}(e);case"withdrawNonceAccount":return function({lamports:n}){return Ui({withdrawNonceAccount:{lamports:n}})}(e);case"initializeNonceAccount":return function({authorized:n}){return Ui({initializeNonceAccount:{authorized:n.toBuffer()}})}(e);case"authorizeNonceAccount":return function({authorized:n}){return Ui({authorizeNonceAccount:{authorized:n.toBuffer()}})}(e);case"allocate":return function({space:n}){return Ui({allocate:{space:n}})}(e);case"allocateWithSeed":return function({base:n,seed:s,space:i,owner:c}){return Ui({allocateWithSeed:{base:n.toBuffer(),seed:s,space:i,owner:c.toBuffer()}},bn.getVariant(9).span+s.length)}(e);case"assignWithSeed":return function({base:n,seed:s,owner:i}){return Ui({assignWithSeed:{base:n.toBuffer(),seed:s,owner:i.toBuffer()}},bn.getVariant(10).span+s.length)}(e);case"transferWithSeed":return function({lamports:n,seed:s,owner:i}){return Ui({transferWithSeed:{lamports:n,seed:s,owner:i.toBuffer()}},bn.getVariant(11).span+s.length)}(e);default:throw new Error(`Invalid instruction: ${t}`)}}encodeState(t,e){throw new Error("System does not have state")}}class QV extends c1{constructor(t){super(-1,t),this.property=t,this.layout=ln([Ss("length"),Ss("lengthPadding"),t0(XV(Ss(),-8),"chars")],this.property)}encode(t,e,n=0){if(t==null)return this.layout.span;const s={chars:Gt.Buffer.from(t,"utf8")};return this.layout.encode(s,e,n)}decode(t,e=0){return this.layout.decode(t,e).chars.toString()}getSpan(t,e=0){return Ss().span+Ss().span+new hh(new Uint8Array(t).slice(e,e+4),10,"le").toNumber()}}function $0(r){return new QV(r)}function Oi(r){return t0(32,r)}const bn=kS(Ss("instruction"));function Ui(r,t){const e=Gt.Buffer.alloc(t??tZ),n=bn.encode(r,e);return t===void 0?e.slice(0,n):e}bn.addVariant(0,ln([us("lamports"),us("space"),Oi("owner")]),"createAccount"),bn.addVariant(1,ln([Oi("owner")]),"assign"),bn.addVariant(2,ln([us("lamports")]),"transfer"),bn.addVariant(3,ln([Oi("base"),$0("seed"),us("lamports"),us("space"),Oi("owner")]),"createAccountWithSeed"),bn.addVariant(4,ln([Oi("authorized")]),"advanceNonceAccount"),bn.addVariant(5,ln([us("lamports")]),"withdrawNonceAccount"),bn.addVariant(6,ln([Oi("authorized")]),"initializeNonceAccount"),bn.addVariant(7,ln([Oi("authorized")]),"authorizeNonceAccount"),bn.addVariant(8,ln([us("space")]),"allocate"),bn.addVariant(9,ln([Oi("base"),$0("seed"),us("space"),Oi("owner")]),"allocateWithSeed"),bn.addVariant(10,ln([Oi("base"),$0("seed"),Oi("owner")]),"assignWithSeed"),bn.addVariant(11,ln([us("lamports"),$0("seed"),Oi("owner")]),"transferWithSeed");const tZ=Math.max(...Object.values(bn.registry).map(r=>r.span));class eZ{constructor(t){this.idl=t}async encode(t,e){if(t==="nonce"){const n=Gt.Buffer.alloc(mh),s=Q8.encode(e,n);return n.slice(0,s)}throw new Error(`Invalid account name: ${t}`)}decode(t,e){return this.decodeUnchecked(t,e)}decodeUnchecked(t,e){if(t==="nonce")return function(n){return Q8.decode(n)}(e);throw new Error(`Invalid account name: ${t}`)}memcmp(t,e){if(t==="nonce")return{dataSize:mh};throw new Error(`Invalid account name: ${t}`)}size(t){var e;return(e=ab(this.idl,t))!==null&&e!==void 0?e:0}}class rZ extends c1{constructor(t,e,n,s){super(t.span,s),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}function J8(r){return new rZ(t0(32),t=>new Xt(t),t=>t.toBuffer(),r)}const Q8=ln([Ss("version"),Ss("state"),J8("authorizedPubkey"),J8("nonce"),ln([(tx="lamportsPerSignature",new VV(tx))],"feeCalculator")]);var tx;class nZ{constructor(t){}decode(t){throw new Error("System program does not have events")}}class iZ{constructor(t){}encode(t,e){throw new Error("System does not have user-defined types")}decode(t,e){throw new Error("System does not have user-defined types")}}class IS{constructor(t){this.instruction=new JV(t),this.accounts=new eZ(t),this.events=new nZ(t),this.types=new iZ(t)}}var oZ=Object.freeze({__proto__:null,hash:function(r){return new TextDecoder().decode(fu(r))}});function BS(r,...t){let e=[Ae.Buffer.from([97,110,99,104,111,114])];t.forEach(s=>{e.push(s instanceof Ae.Buffer?s:ci(s).toBuffer())});const[n]=Xt.findProgramAddressSync(e,ci(r));return n}var sZ=Object.freeze({__proto__:null,createWithSeedSync:function(r,t,e){const n=Ae.Buffer.concat([r.toBuffer(),Ae.Buffer.from(t),e.toBuffer()]);return new Xt(fu(n))},associated:BS});const V2=new Xt("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),Z2=new Xt("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");var aZ=Object.freeze({__proto__:null,TOKEN_PROGRAM_ID:V2,ASSOCIATED_PROGRAM_ID:Z2,associatedAddress:function({mint:r,owner:t}){return Xt.findProgramAddressSync([t.toBuffer(),V2.toBuffer(),r.toBuffer()],Z2)[0]}}),W2={exports:{}};(function(r,t){var e=typeof self<"u"?self:KV,n=function(){function i(){this.fetch=!1,this.DOMException=e.DOMException}return i.prototype=e,new i}();(function(i){(function(c){var l="URLSearchParams"in i,p="Symbol"in i&&"iterator"in Symbol,v="FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch{return!1}}(),y="FormData"in i,E="ArrayBuffer"in i;if(E)var M=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],w=ArrayBuffer.isView||function(a){return a&&M.indexOf(Object.prototype.toString.call(a))>-1};function _(a){if(typeof a!="string"&&(a=String(a)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(a))throw new TypeError("Invalid character in header field name");return a.toLowerCase()}function k(a){return typeof a!="string"&&(a=String(a)),a}function B(a){var f={next:function(){var h=a.shift();return{done:h===void 0,value:h}}};return p&&(f[Symbol.iterator]=function(){return f}),f}function P(a){this.map={},a instanceof P?a.forEach(function(f,h){this.append(h,f)},this):Array.isArray(a)?a.forEach(function(f){this.append(f[0],f[1])},this):a&&Object.getOwnPropertyNames(a).forEach(function(f){this.append(f,a[f])},this)}function R(a){if(a.bodyUsed)return Promise.reject(new TypeError("Already read"));a.bodyUsed=!0}function T(a){return new Promise(function(f,h){a.onload=function(){f(a.result)},a.onerror=function(){h(a.error)}})}function U(a){var f=new FileReader,h=T(f);return f.readAsArrayBuffer(a),h}function j(a){if(a.slice)return a.slice(0);var f=new Uint8Array(a.byteLength);return f.set(new Uint8Array(a)),f.buffer}function Y(){return this.bodyUsed=!1,this._initBody=function(a){var f;this._bodyInit=a,a?typeof a=="string"?this._bodyText=a:v&&Blob.prototype.isPrototypeOf(a)?this._bodyBlob=a:y&&FormData.prototype.isPrototypeOf(a)?this._bodyFormData=a:l&&URLSearchParams.prototype.isPrototypeOf(a)?this._bodyText=a.toString():E&&v&&(f=a)&&DataView.prototype.isPrototypeOf(f)?(this._bodyArrayBuffer=j(a.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):E&&(ArrayBuffer.prototype.isPrototypeOf(a)||w(a))?this._bodyArrayBuffer=j(a):this._bodyText=a=Object.prototype.toString.call(a):this._bodyText="",this.headers.get("content-type")||(typeof a=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):l&&URLSearchParams.prototype.isPrototypeOf(a)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},v&&(this.blob=function(){var a=R(this);if(a)return a;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?R(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(U)}),this.text=function(){var a=R(this);if(a)return a;if(this._bodyBlob)return function(f){var h=new FileReader,g=T(h);return h.readAsText(f),g}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(f){for(var h=new Uint8Array(f),g=new Array(h.length),A=0;A-1?g:h),this.mode=f.mode||this.mode||null,this.signal=f.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&A)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(A)}function Z(a){var f=new FormData;return a.trim().split("&").forEach(function(h){if(h){var g=h.split("="),A=g.shift().replace(/\+/g," "),I=g.join("=").replace(/\+/g," ");f.append(decodeURIComponent(A),decodeURIComponent(I))}}),f}function x(a,f){f||(f={}),this.type="default",this.status=f.status===void 0?200:f.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in f?f.statusText:"OK",this.headers=new P(f.headers),this.url=f.url||"",this._initBody(a)}nt.prototype.clone=function(){return new nt(this,{body:this._bodyInit})},Y.call(nt.prototype),Y.call(x.prototype),x.prototype.clone=function(){return new x(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new P(this.headers),url:this.url})},x.error=function(){var a=new x(null,{status:0,statusText:""});return a.type="error",a};var d=[301,302,303,307,308];x.redirect=function(a,f){if(d.indexOf(f)===-1)throw new RangeError("Invalid status code");return new x(null,{status:f,headers:{location:a}})},c.DOMException=i.DOMException;try{new c.DOMException}catch{c.DOMException=function(f,h){this.message=f,this.name=h;var g=Error(f);this.stack=g.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function o(a,f){return new Promise(function(h,g){var A=new nt(a,f);if(A.signal&&A.signal.aborted)return g(new c.DOMException("Aborted","AbortError"));var I=new XMLHttpRequest;function b(){I.abort()}I.onload=function(){var u,m,L={status:I.status,statusText:I.statusText,headers:(u=I.getAllResponseHeaders()||"",m=new P,u.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(z){var W=z.split(":"),ot=W.shift().trim();if(ot){var ut=W.join(":").trim();m.append(ot,ut)}}),m)};L.url="responseURL"in I?I.responseURL:L.headers.get("X-Request-URL");var q="response"in I?I.response:I.responseText;h(new x(q,L))},I.onerror=function(){g(new TypeError("Network request failed"))},I.ontimeout=function(){g(new TypeError("Network request failed"))},I.onabort=function(){g(new c.DOMException("Aborted","AbortError"))},I.open(A.method,A.url,!0),A.credentials==="include"?I.withCredentials=!0:A.credentials==="omit"&&(I.withCredentials=!1),"responseType"in I&&v&&(I.responseType="blob"),A.headers.forEach(function(u,m){I.setRequestHeader(m,u)}),A.signal&&(A.signal.addEventListener("abort",b),I.onreadystatechange=function(){I.readyState===4&&A.signal.removeEventListener("abort",b)}),I.send(A._bodyInit===void 0?null:A._bodyInit)})}o.polyfill=!0,i.fetch||(i.fetch=o,i.Headers=P,i.Request=nt,i.Response=x),c.Headers=P,c.Request=nt,c.Response=x,c.fetch=o,Object.defineProperty(c,"__esModule",{value:!0})})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var s=n;(t=s.fetch).default=s.fetch,t.fetch=s.fetch,t.Headers=s.Headers,t.Request=s.Request,t.Response=s.Response,r.exports=t})(W2,W2.exports);var uZ=HV(W2.exports);async function ex(r,t){const e=await r.getAccountInfo(t);if(e===null)throw new Error("program account not found");const{program:n}=G2(e.data),s=await r.getAccountInfo(n.programdataAddress);if(s===null)throw new Error("program data account not found");const{programData:i}=G2(s.data);return i}const fZ=Ze.rustEnum([Ze.struct([],"uninitialized"),Ze.struct([Ze.option(Ze.publicKey(),"authorityAddress")],"buffer"),Ze.struct([Ze.publicKey("programdataAddress")],"program"),Ze.struct([Ze.u64("slot"),Ze.option(Ze.publicKey(),"upgradeAuthorityAddress")],"programData")],void 0,Ze.u32());function G2(r){return fZ.decode(r)}var cZ=Object.freeze({__proto__:null,verifiedBuild:async function(r,t,e=5){const n=`https://api.apr.dev/api/v0/program/${t.toString()}/latest?limit=${e}`,[s,i]=await Promise.all([ex(r,t),uZ(n)]),c=(await i.json()).filter(p=>!p.aborted&&p.state==="Built"&&p.verified==="Verified");if(c.length===0)return null;const l=c[0];return s.slot.toNumber()!==l.verified_slot?null:l},fetchData:ex,decodeUpgradeableLoaderState:G2}),hZ=Object.freeze({__proto__:null,sha256:oZ,rpc:OV,publicKey:sZ,bytes:BV,token:aZ,features:DV,registry:cZ});function lZ(r){return"accounts"in r}const dZ=Ze.struct([Ze.publicKey("authority"),Ze.vecU8("data")]);function e0(r,t){var e,n;let s={};const i=r.args?r.args.length:0;if(t.length>i){if(t.length!==i+1)throw new Error(`provided too many arguments ${t} to instruction ${r==null?void 0:r.name} expecting: ${(n=(e=r.args)===null||e===void 0?void 0:e.map(c=>c.name))!==null&&n!==void 0?n:[]}`);s=t.pop()}return[t,s]}class Vl{static build(t,e,n){if(t.name==="_inner")throw new xh("the _inner name is reserved");const s=(...i)=>{const[c,l]=e0(t,[...i]);eb(t.accounts,l.accounts);const p=s.accounts(l.accounts);return l.remainingAccounts!==void 0&&p.push(...l.remainingAccounts),ob("debug-logs")&&console.log("Outgoing account metas:",p),new kr({keys:p,programId:n,data:e(t.name,cS(t,...c))})};return s.accounts=i=>Vl.accountsArray(i,t.accounts,n,t.name),s}static accountsArray(t,e,n,s){return t?e.map(i=>{if(("accounts"in i?i.accounts:void 0)!==void 0){const c=t[i.name];return Vl.accountsArray(c,i.accounts,n,s).flat()}{const c=i;let l;try{l=ci(t[i.name])}catch{throw new Error(`Wrong input type for account "${i.name}" in the instruction accounts object${s!==void 0?' for instruction "'+s+'"':""}. Expected PublicKey or string.`)}const p=c.isOptional&&l.equals(n);return{pubkey:l,isWritable:c.isMut&&!p,isSigner:c.isSigner&&!p}}}).flat():[]}}class pZ{static build(t,e){return(...n)=>{var s,i,c;const[,l]=e0(t,[...n]),p=new wr;if(l.preInstructions&&l.instructions)throw new Error("instructions is deprecated, use preInstructions");return(s=l.preInstructions)===null||s===void 0||s.forEach(v=>p.add(v)),(i=l.instructions)===null||i===void 0||i.forEach(v=>p.add(v)),p.add(e(...n)),(c=l.postInstructions)===null||c===void 0||c.forEach(v=>p.add(v)),p}}}class mZ{static build(t,e,n,s){return async(...i)=>{var c;const l=e(...i),[,p]=e0(t,[...i]);if(s.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");try{return await s.sendAndConfirm(l,(c=p.signers)!==null&&c!==void 0?c:[],p.options)}catch(v){throw sb(v,n)}}}}class vZ{static build(t,e,n,s){var i;const c={};return(i=t.accounts)===null||i===void 0||i.forEach(l=>{const p=Dr(l.name);c[p]=new PS(t,l,n,s,e)}),c}}class PS{get size(){return this._size}get programId(){return this._programId}get provider(){return this._provider}get coder(){return this._coder}get idlAccount(){return this._idlAccount}constructor(t,e,n,s,i){this._idlAccount=e,this._programId=n,this._provider=s??wh(),this._coder=i??new ub(t),this._size=this._coder.accounts.size(e)}async fetchNullable(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);return n}async fetchNullableAndContext(t,e){const n=await this.getAccountInfoAndContext(t,e),{value:s,context:i}=n;return{data:s&&s.data.length!==0?this._coder.accounts.decode(this._idlAccount.name,s.data):null,context:i}}async fetch(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);if(n===null)throw new Error(`Account does not exist or has no data ${t.toString()}`);return n}async fetchAndContext(t,e){const{data:n,context:s}=await this.fetchNullableAndContext(t,e);if(n===null)throw new Error(`Account does not exist ${t.toString()}`);return{data:n,context:s}}async fetchMultiple(t,e){return(await this.fetchMultipleAndContext(t,e)).map(n=>n?n.data:null)}async fetchMultipleAndContext(t,e){return(await q2(this._provider.connection,t.map(n=>ci(n)),e)).map(n=>{if(n==null)return null;const{account:s,context:i}=n;return{data:this._coder.accounts.decode(this._idlAccount.name,s.data),context:i}})}async all(t){const e=this.coder.accounts.memcmp(this._idlAccount.name,t instanceof Gt.Buffer?t:void 0),n=[];return(e==null?void 0:e.offset)!=null&&(e==null?void 0:e.bytes)!=null&&n.push({memcmp:{offset:e.offset,bytes:e.bytes}}),(e==null?void 0:e.dataSize)!=null&&n.push({dataSize:e.dataSize}),(await this._provider.connection.getProgramAccounts(this._programId,{commitment:this._provider.connection.commitment,filters:[...n,...Array.isArray(t)?t:[]]})).map(({pubkey:s,account:i})=>({publicKey:s,account:this._coder.accounts.decode(this._idlAccount.name,i.data)}))}subscribe(t,e){const n=Ac.get(t.toString());if(n)return n.ee;const s=new EV;t=ci(t);const i=this._provider.connection.onAccountChange(t,c=>{const l=this._coder.accounts.decode(this._idlAccount.name,c.data);s.emit("change",l)},e);return Ac.set(t.toString(),{ee:s,listener:i}),s}async unsubscribe(t){let e=Ac.get(t.toString());e?Ac&&await this._provider.connection.removeAccountChangeListener(e.listener).then(()=>{Ac.delete(t.toString())}).catch(console.error):console.warn("Address is not subscribed")}async createInstruction(t,e){const n=this.size;if(this._provider.publicKey===void 0)throw new Error("This function requires the Provider interface implementor to have a 'publicKey' field.");return an.createAccount({fromPubkey:this._provider.publicKey,newAccountPubkey:t.publicKey,space:e??n,lamports:await this._provider.connection.getMinimumBalanceForRentExemption(e??n),programId:this._programId})}async associated(...t){const e=await this.associatedAddress(...t);return await this.fetch(e)}async associatedAddress(...t){return await BS(this._programId,...t)}async getAccountInfo(t,e){return await this._provider.connection.getAccountInfo(ci(t),e)}async getAccountInfoAndContext(t,e){return await this._provider.connection.getAccountInfoAndContext(ci(t),e)}}const Ac=new Map,rx="Program log: ",gZ="Program data: ";class RS{constructor(t,e,n){this._programId=t,this._provider=e,this._eventParser=new fb(t,n),this._eventCallbacks=new Map,this._eventListeners=new Map,this._listenerIdCount=0}addEventListener(t,e){var n;let s=this._listenerIdCount;return this._listenerIdCount+=1,this._eventListeners.has(t)||this._eventListeners.set(t,[]),this._eventListeners.set(t,((n=this._eventListeners.get(t))!==null&&n!==void 0?n:[]).concat(s)),this._eventCallbacks.set(s,[t,e]),this._onLogsSubscriptionId!==void 0||(this._onLogsSubscriptionId=this._provider.connection.onLogs(this._programId,(i,c)=>{if(!i.err)for(const l of this._eventParser.parseLogs(i.logs)){const p=this._eventListeners.get(l.name);p&&p.forEach(v=>{const y=this._eventCallbacks.get(v);if(y){const[,E]=y;E(l.data,c.slot,i.signature)}})}})),s}async removeEventListener(t){const e=this._eventCallbacks.get(t);if(!e)throw new Error(`Event listener ${t} doesn't exist!`);const[n]=e;let s=this._eventListeners.get(n);if(!s)throw new Error(`Event listeners don't exist for ${n}!`);if(this._eventCallbacks.delete(t),s=s.filter(i=>i!==t),this._eventListeners.set(n,s),s.length===0&&this._eventListeners.delete(n),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 fb{constructor(t,e){this.coder=e,this.programId=t}*parseLogs(t,e=!1){const n=new bZ(t),s=new yZ;let i=n.next();for(;i!==null;){let[c,l,p]=this.handleLog(s,i,e);c&&(yield c),l&&s.push(l),p&&s.pop(),i=n.next()}}handleLog(t,e,n){return t.stack.length>0&&t.program()===this.programId.toString()?this.handleProgramLog(e,n):[null,...this.handleSystemLog(e)]}handleProgramLog(t,e){if(t.startsWith(rx)||t.startsWith(gZ)){const n=t.startsWith(rx)?t.slice(13):t.slice(14),s=this.coder.events.decode(n);if(e&&s===null)throw new Error(`Unable to decode event ${n}`);return[s,null,!1]}return[null,...this.handleSystemLog(t)]}handleSystemLog(t){const e=t.split(":")[0];return e.match(/^Program (.*) success/g)!==null?[null,!0]:e.startsWith(`Program ${this.programId.toString()} invoke`)?[this.programId.toString(),!1]:e.includes("invoke")?["cpi",!1]:[null,!1]}}class yZ{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(t){this.stack.push(t)}pop(){if(!this.stack.length)throw new Error("Expected the stack to have elements");this.stack.pop()}}class bZ{constructor(t){this.logs=t}next(){if(this.logs.length===0)return null;let t=this.logs[0];return this.logs=this.logs.slice(1),t}}class wZ{static build(t,e,n,s,i,c,l){return async(...p)=>{var v;const y=e(...p),[,E]=e0(t,[...p]);let M;if(s.simulate===void 0)throw new Error("This function requires 'Provider.simulate' to be implemented.");try{M=await s.simulate(y,E.signers,(v=E.options)===null||v===void 0?void 0:v.commitment)}catch(k){throw sb(k,n)}if(M===void 0)throw new Error("Unable to simulate transaction");const w=M.logs;if(!w)throw new Error("Simulated logs not found");const _=[];if(l.events){let k=new fb(c,i);for(const B of k.parseLogs(w))_.push(B)}return{events:_,raw:w}}}}function iv(r){return new CS(t0(8),t=>cb.fromBuffer(t),t=>t.toBuffer(),r)}function K0(r){return new CS(t0(32),t=>new Xt(t),t=>t.toBuffer(),r)}function ov(r,t){return new xZ(r,t)}class CS extends c1{constructor(t,e,n,s){super(t.span,s),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}class xZ extends c1{constructor(t,e){super(-1,e),this.layout=t,this.discriminator=Ss()}encode(t,e,n=0){return t==null?this.layout.span+this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+4)+4)}decode(t,e=0){const n=this.discriminator.decode(t,e);if(n===0)return null;if(n===1)return this.layout.decode(t,e+4);throw new Error("Invalid coption "+this.layout.property)}getSpan(t,e=0){return this.layout.getSpan(t,e+4)+4}}class cb extends hh{toBuffer(){const t=super.toArray().reverse(),e=Gt.Buffer.from(t);if(e.length===8)return e;if(e.length>=8)throw new Error("u64 too large");const n=Gt.Buffer.alloc(8);return e.copy(n),n}static fromBuffer(t){if(t.length!==8)throw new Error(`Invalid buffer length: ${t.length}`);return new cb([...t].reverse().map(e=>`00${e.toString(16)}`.slice(-2)).join(""),16)}}const _Z=ln([K0("mint"),K0("owner"),iv("amount"),ov(K0(),"delegate"),(r=>{const t=kS((e=>new h1(1,e))("discriminator"),null,"state");return t.addVariant(0,ln([]),"uninitialized"),t.addVariant(1,ln([]),"initialized"),t.addVariant(2,ln([]),"frozen"),t})(),ov(iv(),"isNative"),iv("delegatedAmount"),ov(K0(),"closeAuthority")]);class Mh{constructor(t,e,n,s,i,c,l,p){this._accounts=e,this._provider=n,this._programId=s,this._idlIx=i,this._idlTypes=l,this._customResolver=p,this._args=t,this._accountStore=new MZ(n,c,this._programId)}args(t){this._args=t}async resolve(){for(await this.resolveConst(this._idlIx.accounts),this._resolveEventCpi(this._idlIx.accounts);await this.resolvePdas(this._idlIx.accounts)+await this.resolveRelations(this._idlIx.accounts)+await this.resolveCustom()>0;);}async resolveCustom(){if(this._customResolver){const{accounts:t,resolved:e}=await this._customResolver({args:this._args,accounts:this._accounts,provider:this._provider,programId:this._programId,idlIx:this._idlIx});return this._accounts=t,e}return 0}resolveOptionalsHelper(t,e){const n={};for(const s of e){const i=s.name,c=t[i];c!==void 0&&(LS(c)?lZ(s)?n[i]=this.resolveOptionalsHelper(c,s.accounts):n[i]=OS(c,!0):c!==null?n[i]=ci(c):s.isOptional&&(n[i]=this._programId))}return n}resolveOptionals(t){Object.assign(this._accounts,this.resolveOptionalsHelper(t,this._idlIx.accounts))}get(t){const e=t.reduce((n,s)=>n&&n[s],this._accounts);if(e&&e.toBase58)return e}set(t,e){let n=this._accounts;t.forEach((s,i)=>{i==t.length-1&&(n[s]=e),n[s]=n[s]||{},n=n[s]})}async resolveConst(t,e=[]){for(let n=0;n0&&!this.get([...e,p])&&await this.autoPopulatePda(l,e)&&(n+=1)}return n}async resolveRelations(t,e=[]){let n=0;for(let s=0;s!this.get([...e,Dr(M)]));if(n+=E.length,E.length>0){const M=await this._accountStore.fetchAccount({publicKey:y});await Promise.all(E.map(async w=>{const _=Dr(w);return this.set([...e,_],M[_]),M[_]}))}}}return n}async autoPopulatePda(t,e=[]){if(!t.pda||!t.pda.seeds)throw new Error("Must have seeds");const n=await Promise.all(t.pda.seeds.map(c=>this.toBuffer(c,e)));if(n.some(c=>c===void 0))return;const s=await this.parseProgramId(t,e);if(!s)return;const[i]=await Xt.findProgramAddress(n,s);this.set([...e,Dr(t.name)],i)}async parseProgramId(t,e=[]){var n;if(!(!((n=t.pda)===null||n===void 0)&&n.programId))return this._programId;switch(t.pda.programId.kind){case"const":return new Xt(this.toBufferConst(t.pda.programId.value));case"arg":return this.argValue(t.pda.programId);case"account":return await this.accountValue(t.pda.programId,e);default:throw new Error(`Unexpected program seed kind: ${t.pda.programId.kind}`)}}async toBuffer(t,e=[]){switch(t.kind){case"const":return this.toBufferConst(t);case"arg":return await this.toBufferArg(t);case"account":return await this.toBufferAccount(t,e);default:throw new Error(`Unexpected seed kind: ${t.kind}`)}}getType(t,e=[]){if(e.length>0&&t.defined){const n=this._idlTypes.find(i=>i.name===t.defined);if(!n)throw new Error(`Cannot find type ${t.defined}`);const s=n.type.fields.find(i=>i.name===e[0]);return this.getType(s.type,e.slice(1))}return t}toBufferConst(t){return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),t.value)}async toBufferArg(t){const e=this.argValue(t);if(e!==void 0)return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),e)}argValue(t){const e=t.path.split("."),n=Dr(e[0]),s=this._idlIx.args.findIndex(i=>i.name===n);if(s===-1)throw new Error(`Unable to find argument for seed: ${n}`);return e.slice(1).reduce((i,c)=>(i||{})[c],this._args[s])}async toBufferAccount(t,e=[]){const n=await this.accountValue(t,e);if(n)return this.toBufferValue(t.type,n)}async accountValue(t,e=[]){const n=t.path.split("."),s=n[0],i=this.get([...e,Dr(s)]);if(i===null)throw new Error("fieldPubkey is null");if(n.length===1)return i;const c=await this._accountStore.fetchAccount({publicKey:i,name:t.account});return this.parseAccountValue(c,n.slice(1))}parseAccountValue(t,e){let n;for(;e.length>0;)n=t[Dr(e[0])],e=e.slice(1);return n}toBufferValue(t,e){switch(t){case"u8":return Gt.Buffer.from([e]);case"u16":let n=Gt.Buffer.alloc(2);return n.writeUInt16LE(e),n;case"u32":let s=Gt.Buffer.alloc(4);return s.writeUInt32LE(e),s;case"u64":let i=Gt.Buffer.alloc(8);return i.writeBigUInt64LE(BigInt(e)),i;case"string":return Gt.Buffer.from(aS(e));case"publicKey":return e.toBuffer();default:if(t.array)return Gt.Buffer.from(e);throw new Error(`Unexpected seed type: ${t}`)}}}Mh.CONST_ACCOUNTS={associatedTokenProgram:Z2,rent:fa,systemProgram:an.programId,tokenProgram:V2,clock:co};class MZ{constructor(t,e,n){this._provider=t,this._programId=n,this._cache=new Map,this._idls={},this._idls[n.toBase58()]=e}async ensureIdl(t){if(!this._idls[t.toBase58()]){const e=await lu.fetchIdl(t,this._provider);if(e){const n=new lu(e,t,this._provider);this._idls[t.toBase58()]=n.account}}return this._idls[t.toBase58()]}async fetchAccount({publicKey:t,name:e,programId:n=this._programId}){const s=t.toString();if(!this._cache.has(s))if(e==="TokenAccount"){const i=await this._provider.connection.getAccountInfo(t);if(i===null)throw new Error(`invalid account info for ${s}`);const c=function(l){return _Z.decode(l)}(i.data);this._cache.set(s,c)}else if(e){const i=await this.ensureIdl(n);if(i){const c=i[Dr(e)];if(c){const l=await c.fetch(t);this._cache.set(s,l)}}}else{const i=await this._provider.connection.getAccountInfo(t);if(i===null)throw new Error(`invalid account info for ${s}`);const c=i.data,l=await this.ensureIdl(i.owner);if(l){const p=Object.values(l)[0];if(!p)throw new Error("No accounts for this program");const v=p.coder.accounts.decodeAny(c);this._cache.set(s,v)}}return this._cache.get(s)}}class TS{static build(t,e,n,s,i,c,l,p,v,y,E){return(...M)=>new EZ(M,s,i,c,l,p,t,e,n,v,y,E)}}function LS(r){return typeof r=="object"&&r!==null&&!("_bn"in r)}function OS(r,t){const e={};for(const n in r){const s=r[n];if(s!==null)e[n]=LS(s)?OS(s,!0):ci(s);else if(t)throw new Error("Failed to resolve optionals due to IDL type mismatch with input accounts!")}return e}class EZ{constructor(t,e,n,s,i,c,l,p,v,y,E,M){this._ixFn=e,this._txFn=n,this._rpcFn=s,this._simulateFn=i,this._viewFn=c,this._programId=p,this._accounts={},this._remainingAccounts=[],this._signers=[],this._preInstructions=[],this._postInstructions=[],this._autoResolveAccounts=!0,this._args=t,this._accountsResolver=new Mh(t,this._accounts,l,p,v,y,E,M)}args(t){this._args=t,this._accountsResolver.args(t)}async pubkeys(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._accounts}accounts(t){return this._autoResolveAccounts=!0,this._accountsResolver.resolveOptionals(t),this}accountsStrict(t){return this._autoResolveAccounts=!1,this._accountsResolver.resolveOptionals(t),this}signers(t){return this._signers=this._signers.concat(t),this}remainingAccounts(t){return this._remainingAccounts=this._remainingAccounts.concat(t),this}preInstructions(t){return this._preInstructions=this._preInstructions.concat(t),this}postInstructions(t){return this._postInstructions=this._postInstructions.concat(t),this}async rpc(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._rpcFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async rpcAndKeys(t){return{pubkeys:await this.pubkeys(),signature:await this.rpc(t)}}async view(t){if(this._autoResolveAccounts&&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:t})}async simulate(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._simulateFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async instruction(){return this._autoResolveAccounts&&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:await this._signers}}async transaction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._txFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}}class AZ{static build(t,e,n,s){const i=e.accounts.find(l=>l.isMut),c=!!e.returns;if(!(i||!c))return async(...l)=>{var p,v;let y=await n(...l);const E=`Program return: ${t} `;let M=y.raw.find(k=>k.startsWith(E));if(!M)throw new Error("View expected return log");let w=uS(M.slice(E.length)),_=e.returns;if(!_)throw new Error("View expected return type");return ki.fieldLayout({type:_},Array.from([...(p=s.accounts)!==null&&p!==void 0?p:[],...(v=s.types)!==null&&v!==void 0?v:[]])).decode(w)}}}class SZ{static build(t,e,n,s,i){const c={},l={},p={},v={},y={},E={},M=fS(t),w=t.accounts?vZ.build(t,e,n,s):{};return t.instructions.forEach(_=>{const k=Vl.build(_,(Y,rt)=>e.instruction.encode(Y,rt),n),B=pZ.build(_,k),P=mZ.build(_,B,M,s),R=wZ.build(_,B,M,s,e,n,t),T=AZ.build(n,_,R,t),U=TS.build(s,n,_,k,B,P,R,T,w,t.types||[],i&&i(_)),j=Dr(_.name);l[j]=k,p[j]=B,c[j]=P,v[j]=R,y[j]=U,T&&(E[j]=T)}),[c,l,p,w,v,y,E]}}class lu{get programId(){return this._programId}get idl(){return this._idl}get coder(){return this._coder}get provider(){return this._provider}constructor(t,e,n,s,i){e=ci(e),n||(n=wh()),this._idl=t,this._provider=n,this._programId=e,this._coder=s??new ub(t),this._events=new RS(this._programId,n,this._coder);const[c,l,p,v,y,E,M]=SZ.build(t,this._coder,e,n,i??(()=>{}));this.rpc=c,this.instruction=l,this.transaction=p,this.account=v,this.simulate=y,this.methods=E,this.views=M}static async at(t,e){const n=ci(t),s=await lu.fetchIdl(n,e);if(!s)throw new Error(`IDL not found for program: ${t.toString()}`);return new lu(s,n,e)}static async fetchIdl(t,e){e=e??wh();const n=ci(t),s=await async function(v){const y=(await Xt.findProgramAddress([],v))[0];return await Xt.createWithSeed(y,"anchor:idl",v)}(n),i=await e.connection.getAccountInfo(s);if(!i)return null;let c=(l=i.data.slice(8),dZ.decode(l));var l;const p=MV(c.data);return JSON.parse(sS(p))}addEventListener(t,e){return this._events.addEventListener(t,e)}async removeEventListener(t){return await this._events.removeEventListener(t)}}const kZ=new Xt("11111111111111111111111111111111");function IZ(r){return new lu(nx,kZ,r,new IS(nx))}const nx={version:"0.1.0",name:"system_program",instructions:[{name:"createAccount",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!0}],args:[{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assign",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"owner",type:"publicKey"}]},{name:"transfer",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"}]},{name:"createAccountWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"advanceNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"withdrawNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"to",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"lamports",type:"u64"}]},{name:"initializeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!0},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"authorized",type:"publicKey"}]},{name:"authorizeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"allocate",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"space",type:"u64"}]},{name:"allocateWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assignWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]},{name:"transferWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]}],accounts:[{name:"nonce",type:{kind:"struct",fields:[{name:"version",type:"u32"},{name:"state",type:"u32"},{name:"authorizedPubkey",type:"publicKey"},{name:"nonce",type:"publicKey"},{name:"feeCalculator",type:{defined:"FeeCalculator"}}]}}],types:[{name:"FeeCalculator",type:{kind:"struct",fields:[{name:"lamportsPerSignature",type:"u64"}]}}]};var ix,US=Zh(Object.freeze({__proto__:null,web3:CA,AccountClient:PS,AnchorError:sf,AnchorProvider:mS,BorshAccountsCoder:Va,BorshCoder:ub,BorshEventCoder:bS,BorshInstructionCoder:f1,DISCRIMINATOR_SIZE:Hl,EventManager:RS,EventParser:fb,IdlError:xh,LangErrorCode:qe,LangErrorMessage:gS,MethodsBuilderFactory:TS,Native:class{static system(r){return IZ(r)}},Program:lu,ProgramError:_h,ProgramErrorStack:Wf,SystemCoder:IS,eventDiscriminator:wS,getProvider:wh,parseIdlErrors:fS,setProvider:function(r){j2=r},splitArgsAndCtx:e0,toInstruction:cS,translateAddress:ci,translateError:sb,utils:hZ,validateAccounts:eb,BN:hh})),Sc={},kc={},ox,Ic={};function BZ(){if(ox)return Ic;ox=1;var r=Ke&&Ke.__awaiter||function(n,s,i,c){return new(i||(i=Promise))(function(l,p){function v(M){try{E(c.next(M))}catch(w){p(w)}}function y(M){try{E(c.throw(M))}catch(w){p(w)}}function E(M){M.done?l(M.value):function(w){return w instanceof i?w:new i(function(_){_(w)})}(M.value).then(v,y)}E((c=c.apply(n,s||[])).next())})},t=Ke&&Ke.__generator||function(n,s){var i,c,l,p,v={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return p={next:y(0),throw:y(1),return:y(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function y(E){return function(M){return function(w){if(i)throw new TypeError("Generator is already executing.");for(;v;)try{if(i=1,c&&(l=2&w[0]?c.return:w[0]?c.throw||((l=c.return)&&l.call(c),0):c.next)&&!(l=l.call(c,w[1])).done)return l;switch(c=0,l&&(w=[2&w[0],l.value]),w[0]){case 0:case 1:l=w;break;case 4:return v.label++,{value:w[1],done:!1};case 5:v.label++,c=w[1],w=[0];continue;case 7:w=v.ops.pop(),v.trys.pop();continue;default:if(l=v.trys,!((l=l.length>0&&l[l.length-1])||w[0]!==6&&w[0]!==2)){v=0;continue}if(w[0]===3&&(!l||w[1]>l[0]&&w[1]=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),e=0;e>>0,B=new Uint8Array(k);E[M];){var P=t[E.charCodeAt(M)];if(P===255)return;for(var R=0,T=k-1;(P!==0||R<_)&&T!==-1;T--,R++)P+=c*B[T]>>>0,B[T]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");_=R,M++}for(var U=k-_;U!==k&&B[U]===0;)U++;for(var j=new Uint8Array(w+(k-U)),Y=w;U!==k;)j[Y++]=B[U++];return j}return{encode:function(E){if(E instanceof Uint8Array||(ArrayBuffer.isView(E)?E=new Uint8Array(E.buffer,E.byteOffset,E.byteLength):Array.isArray(E)&&(E=Uint8Array.from(E))),!(E instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(E.length===0)return"";for(var M=0,w=0,_=0,k=E.length;_!==k&&E[_]===0;)_++,M++;for(var B=(k-_)*v+1>>>0,P=new Uint8Array(B);_!==k;){for(var R=E[_],T=0,U=B-1;(R!==0||T>>0,P[U]=R%c>>>0,R=R/c>>>0;if(R!==0)throw new Error("Non-zero carry");w=T,_++}for(var j=B-w;j!==B&&P[j]===0;)j++;for(var Y=l.repeat(M);j464)throw new Error("The metadata is too long");var Y=_.subarray(0,R);return c.Buffer.concat([P,Y])}var rt=B.encode(w,_);return Y=_.subarray(0,rt),c.Buffer.concat([P,Y])},E.parseIxLayout=function(M){var w=M.instructions.map(function(_){var k=_.args.map(function(P){var R,T;return v.IdlCoder.fieldLayout(P,Array.from(n(n([],(R=M.accounts)!==null&&R!==void 0?R:[]),(T=M.types)!==null&&T!==void 0?T:[])))}),B=l.default(_.name);return[B,p.struct(k,B)]});return new Map(w)},E.prototype.decode=function(M,w){w===void 0&&(w="hex"),typeof M=="string"&&(M=w==="hex"?c.Buffer.from(M,"hex"):c.Buffer.from(i.default.decode(M)));var _=i.default.encode(M.subarray(0,this.discriminatorLength)),k=M.subarray(this.discriminatorLength),B=this.discriminatorLayouts.get(_);if(!B)return null;if(B.name==="updProduct"||B.name==="addProduct"){for(var P={},R=0;Rr.MAX_SLOT_DIFFERENCE&&(mt=t.Unknown),mt===t.Trading&&(R=yt.price,T=yt.confidence);for(var jt=[],dt=240;jt.length0?s-4:s;for(e=0;e>16&255,c[l++]=t>>8&255,c[l++]=255&t;return i===2&&(t=qi[r.charCodeAt(e)]<<2|qi[r.charCodeAt(e+1)]>>4,c[l++]=255&t),i===1&&(t=qi[r.charCodeAt(e)]<<10|qi[r.charCodeAt(e+1)]<<4|qi[r.charCodeAt(e+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t),c},fromByteArray:function(r){for(var t,e=r.length,n=e%3,s=[],i=16383,c=0,l=e-n;cl?l:c+i));return n===1?(t=r[e-1],s.push(Fo[t>>2]+Fo[t<<4&63]+"==")):n===2&&(t=(r[e-2]<<8)+r[e-1],s.push(Fo[t>>10]+Fo[t>>4&63]+Fo[t<<2&63]+"=")),s.join("")}},Fo=[],qi=[],OZ=typeof Uint8Array<"u"?Uint8Array:Array,vx="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Pu=0;Pu<64;++Pu)Fo[Pu]=vx[Pu],qi[vx.charCodeAt(Pu)]=Pu;function gx(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");return e===-1&&(e=t),[e,e===t?0:4-e%4]}function UZ(r,t,e){for(var n,s,i=[],c=t;c>18&63]+Fo[s>>12&63]+Fo[s>>6&63]+Fo[63&s]);return i.join("")}qi["-".charCodeAt(0)]=62,qi["_".charCodeAt(0)]=63;var sv={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */function yx(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function zS(r,...t){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(r.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${r.length}`)}function Zl(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}sv.read=function(r,t,e,n,s){var i,c,l=8*s-n-1,p=(1<>1,y=-7,E=e?s-1:0,M=e?-1:1,w=r[t+E];for(E+=M,i=w&(1<<-y)-1,w>>=-y,y+=l;y>0;i=256*i+r[t+E],E+=M,y-=8);for(c=i&(1<<-y)-1,i>>=-y,y+=n;y>0;c=256*c+r[t+E],E+=M,y-=8);if(i===0)i=1-v;else{if(i===p)return c?NaN:1/0*(w?-1:1);c+=Math.pow(2,n),i-=v}return(w?-1:1)*c*Math.pow(2,i-n)},sv.write=function(r,t,e,n,s,i){var c,l,p,v=8*i-s-1,y=(1<>1,M=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:i-1,_=n?1:-1,k=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,c=y):(c=Math.floor(Math.log(t)/Math.LN2),t*(p=Math.pow(2,-c))<1&&(c--,p*=2),(t+=c+E>=1?M/p:M*Math.pow(2,1-E))*p>=2&&(c++,p/=2),c+E>=y?(l=0,c=y):c+E>=1?(l=(t*p-1)*Math.pow(2,s),c+=E):(l=t*Math.pow(2,E-1)*Math.pow(2,s),c=0));s>=8;r[e+w]=255&l,w+=_,l/=256,s-=8);for(c=c<0;r[e+w]=255&c,w+=_,c/=256,v-=8);r[e+w-_]|=128*k},function(r){const t=LZ,e=sv,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=c,r.SlowBuffer=function(S){return+S!=S&&(S=0),c.alloc(+S)},r.INSPECT_MAX_BYTES=50;const s=2147483647;function i(S){if(S>s)throw new RangeError('The value "'+S+'" is invalid for option "size"');const C=new Uint8Array(S);return Object.setPrototypeOf(C,c.prototype),C}function c(S,C,O){if(typeof S=="number"){if(typeof C=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return v(S)}return l(S,C,O)}function l(S,C,O){if(typeof S=="string")return function(Q,it){if(typeof it=="string"&&it!==""||(it="utf8"),!c.isEncoding(it))throw new TypeError("Unknown encoding: "+it);const qt=0|w(Q,it);let It=i(qt);const xt=It.write(Q,it);return xt!==qt&&(It=It.slice(0,xt)),It}(S,C);if(ArrayBuffer.isView(S))return function(Q){if(jt(Q,Uint8Array)){const it=new Uint8Array(Q);return E(it.buffer,it.byteOffset,it.byteLength)}return y(Q)}(S);if(S==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof S);if(jt(S,ArrayBuffer)||S&&jt(S.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(jt(S,SharedArrayBuffer)||S&&jt(S.buffer,SharedArrayBuffer)))return E(S,C,O);if(typeof S=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const F=S.valueOf&&S.valueOf();if(F!=null&&F!==S)return c.from(F,C,O);const et=function(Q){if(c.isBuffer(Q)){const it=0|M(Q.length),qt=i(it);return qt.length===0||Q.copy(qt,0,0,it),qt}return Q.length!==void 0?typeof Q.length!="number"||dt(Q.length)?i(0):y(Q):Q.type==="Buffer"&&Array.isArray(Q.data)?y(Q.data):void 0}(S);if(et)return et;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof S[Symbol.toPrimitive]=="function")return c.from(S[Symbol.toPrimitive]("string"),C,O);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof S)}function p(S){if(typeof S!="number")throw new TypeError('"size" argument must be of type number');if(S<0)throw new RangeError('The value "'+S+'" is invalid for option "size"')}function v(S){return p(S),i(S<0?0:0|M(S))}function y(S){const C=S.length<0?0:0|M(S.length),O=i(C);for(let F=0;F=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|S}function w(S,C){if(c.isBuffer(S))return S.length;if(ArrayBuffer.isView(S)||jt(S,ArrayBuffer))return S.byteLength;if(typeof S!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof S);const O=S.length,F=arguments.length>2&&arguments[2]===!0;if(!F&&O===0)return 0;let et=!1;for(;;)switch(C){case"ascii":case"latin1":case"binary":return O;case"utf8":case"utf-8":return Ct(S).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*O;case"hex":return O>>>1;case"base64":return yt(S).length;default:if(et)return F?-1:Ct(S).length;C=(""+C).toLowerCase(),et=!0}}function _(S,C,O){let F=!1;if((C===void 0||C<0)&&(C=0),C>this.length||((O===void 0||O>this.length)&&(O=this.length),O<=0)||(O>>>=0)<=(C>>>=0))return"";for(S||(S="utf8");;)switch(S){case"hex":return o(this,C,O);case"utf8":case"utf-8":return nt(this,C,O);case"ascii":return x(this,C,O);case"latin1":case"binary":return d(this,C,O);case"base64":return rt(this,C,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a(this,C,O);default:if(F)throw new TypeError("Unknown encoding: "+S);S=(S+"").toLowerCase(),F=!0}}function k(S,C,O){const F=S[C];S[C]=S[O],S[O]=F}function B(S,C,O,F,et){if(S.length===0)return-1;if(typeof O=="string"?(F=O,O=0):O>2147483647?O=2147483647:O<-2147483648&&(O=-2147483648),dt(O=+O)&&(O=et?0:S.length-1),O<0&&(O=S.length+O),O>=S.length){if(et)return-1;O=S.length-1}else if(O<0){if(!et)return-1;O=0}if(typeof C=="string"&&(C=c.from(C,F)),c.isBuffer(C))return C.length===0?-1:P(S,C,O,F,et);if(typeof C=="number")return C&=255,typeof Uint8Array.prototype.indexOf=="function"?et?Uint8Array.prototype.indexOf.call(S,C,O):Uint8Array.prototype.lastIndexOf.call(S,C,O):P(S,[C],O,F,et);throw new TypeError("val must be string, number or Buffer")}function P(S,C,O,F,et){let Q,it=1,qt=S.length,It=C.length;if(F!==void 0&&((F=String(F).toLowerCase())==="ucs2"||F==="ucs-2"||F==="utf16le"||F==="utf-16le")){if(S.length<2||C.length<2)return-1;it=2,qt/=2,It/=2,O/=2}function xt(Qt,Rt){return it===1?Qt[Rt]:Qt.readUInt16BE(Rt*it)}if(et){let Qt=-1;for(Q=O;Qqt&&(O=qt-It),Q=O;Q>=0;Q--){let Qt=!0;for(let Rt=0;Rtet&&(F=et):F=et;const Q=C.length;let it;for(F>Q/2&&(F=Q/2),it=0;it>8,It=it%256,xt.push(It),xt.push(qt);return xt}(C,S.length-O),S,O,F)}function rt(S,C,O){return C===0&&O===S.length?t.fromByteArray(S):t.fromByteArray(S.slice(C,O))}function nt(S,C,O){O=Math.min(S.length,O);const F=[];let et=C;for(;et239?4:Q>223?3:Q>191?2:1;if(et+qt<=O){let It,xt,Qt,Rt;switch(qt){case 1:Q<128&&(it=Q);break;case 2:It=S[et+1],(192&It)==128&&(Rt=(31&Q)<<6|63&It,Rt>127&&(it=Rt));break;case 3:It=S[et+1],xt=S[et+2],(192&It)==128&&(192&xt)==128&&(Rt=(15&Q)<<12|(63&It)<<6|63&xt,Rt>2047&&(Rt<55296||Rt>57343)&&(it=Rt));break;case 4:It=S[et+1],xt=S[et+2],Qt=S[et+3],(192&It)==128&&(192&xt)==128&&(192&Qt)==128&&(Rt=(15&Q)<<18|(63&It)<<12|(63&xt)<<6|63&Qt,Rt>65535&&Rt<1114112&&(it=Rt))}}it===null?(it=65533,qt=1):it>65535&&(it-=65536,F.push(it>>>10&1023|55296),it=56320|1023&it),F.push(it),et+=qt}return function(Q){const it=Q.length;if(it<=Z)return String.fromCharCode.apply(String,Q);let qt="",It=0;for(;It"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."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(S,C,O){return l(S,C,O)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(S,C,O){return function(F,et,Q){return p(F),F<=0?i(F):et!==void 0?typeof Q=="string"?i(F).fill(et,Q):i(F).fill(et):i(F)}(S,C,O)},c.allocUnsafe=function(S){return v(S)},c.allocUnsafeSlow=function(S){return v(S)},c.isBuffer=function(S){return S!=null&&S._isBuffer===!0&&S!==c.prototype},c.compare=function(S,C){if(jt(S,Uint8Array)&&(S=c.from(S,S.offset,S.byteLength)),jt(C,Uint8Array)&&(C=c.from(C,C.offset,C.byteLength)),!c.isBuffer(S)||!c.isBuffer(C))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(S===C)return 0;let O=S.length,F=C.length;for(let et=0,Q=Math.min(O,F);etF.length?(c.isBuffer(Q)||(Q=c.from(Q)),Q.copy(F,et)):Uint8Array.prototype.set.call(F,Q,et);else{if(!c.isBuffer(Q))throw new TypeError('"list" argument must be an Array of Buffers');Q.copy(F,et)}et+=Q.length}return F},c.byteLength=w,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const S=this.length;if(S%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let C=0;CC&&(S+=" ... "),""},n&&(c.prototype[n]=c.prototype.inspect),c.prototype.compare=function(S,C,O,F,et){if(jt(S,Uint8Array)&&(S=c.from(S,S.offset,S.byteLength)),!c.isBuffer(S))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof S);if(C===void 0&&(C=0),O===void 0&&(O=S?S.length:0),F===void 0&&(F=0),et===void 0&&(et=this.length),C<0||O>S.length||F<0||et>this.length)throw new RangeError("out of range index");if(F>=et&&C>=O)return 0;if(F>=et)return-1;if(C>=O)return 1;if(this===S)return 0;let Q=(et>>>=0)-(F>>>=0),it=(O>>>=0)-(C>>>=0);const qt=Math.min(Q,it),It=this.slice(F,et),xt=S.slice(C,O);for(let Qt=0;Qt>>=0,isFinite(O)?(O>>>=0,F===void 0&&(F="utf8")):(F=O,O=void 0)}const et=this.length-C;if((O===void 0||O>et)&&(O=et),S.length>0&&(O<0||C<0)||C>this.length)throw new RangeError("Attempt to write outside buffer bounds");F||(F="utf8");let Q=!1;for(;;)switch(F){case"hex":return R(this,S,C,O);case"utf8":case"utf-8":return T(this,S,C,O);case"ascii":case"latin1":case"binary":return U(this,S,C,O);case"base64":return j(this,S,C,O);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Y(this,S,C,O);default:if(Q)throw new TypeError("Unknown encoding: "+F);F=(""+F).toLowerCase(),Q=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const Z=4096;function x(S,C,O){let F="";O=Math.min(S.length,O);for(let et=C;etF)&&(O=F);let et="";for(let Q=C;QO)throw new RangeError("Trying to access beyond buffer length")}function h(S,C,O,F,et,Q){if(!c.isBuffer(S))throw new TypeError('"buffer" argument must be a Buffer instance');if(C>et||CS.length)throw new RangeError("Index out of range")}function g(S,C,O,F,et){z(C,F,et,S,O,7);let Q=Number(C&BigInt(4294967295));S[O++]=Q,Q>>=8,S[O++]=Q,Q>>=8,S[O++]=Q,Q>>=8,S[O++]=Q;let it=Number(C>>BigInt(32)&BigInt(4294967295));return S[O++]=it,it>>=8,S[O++]=it,it>>=8,S[O++]=it,it>>=8,S[O++]=it,O}function A(S,C,O,F,et){z(C,F,et,S,O,7);let Q=Number(C&BigInt(4294967295));S[O+7]=Q,Q>>=8,S[O+6]=Q,Q>>=8,S[O+5]=Q,Q>>=8,S[O+4]=Q;let it=Number(C>>BigInt(32)&BigInt(4294967295));return S[O+3]=it,it>>=8,S[O+2]=it,it>>=8,S[O+1]=it,it>>=8,S[O]=it,O+8}function I(S,C,O,F,et,Q){if(O+F>S.length)throw new RangeError("Index out of range");if(O<0)throw new RangeError("Index out of range")}function b(S,C,O,F,et){return C=+C,O>>>=0,et||I(S,0,O,4),e.write(S,C,O,F,23,4),O+4}function u(S,C,O,F,et){return C=+C,O>>>=0,et||I(S,0,O,8),e.write(S,C,O,F,52,8),O+8}c.prototype.slice=function(S,C){const O=this.length;(S=~~S)<0?(S+=O)<0&&(S=0):S>O&&(S=O),(C=C===void 0?O:~~C)<0?(C+=O)<0&&(C=0):C>O&&(C=O),C>>=0,C>>>=0,O||f(S,C,this.length);let F=this[S],et=1,Q=0;for(;++Q>>=0,C>>>=0,O||f(S,C,this.length);let F=this[S+--C],et=1;for(;C>0&&(et*=256);)F+=this[S+--C]*et;return F},c.prototype.readUint8=c.prototype.readUInt8=function(S,C){return S>>>=0,C||f(S,1,this.length),this[S]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(S,C){return S>>>=0,C||f(S,2,this.length),this[S]|this[S+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(S,C){return S>>>=0,C||f(S,2,this.length),this[S]<<8|this[S+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(S,C){return S>>>=0,C||f(S,4,this.length),(this[S]|this[S+1]<<8|this[S+2]<<16)+16777216*this[S+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(S,C){return S>>>=0,C||f(S,4,this.length),16777216*this[S]+(this[S+1]<<16|this[S+2]<<8|this[S+3])},c.prototype.readBigUInt64LE=Tt(function(S){W(S>>>=0,"offset");const C=this[S],O=this[S+7];C!==void 0&&O!==void 0||ot(S,this.length-8);const F=C+256*this[++S]+65536*this[++S]+this[++S]*2**24,et=this[++S]+256*this[++S]+65536*this[++S]+O*2**24;return BigInt(F)+(BigInt(et)<>>=0,"offset");const C=this[S],O=this[S+7];C!==void 0&&O!==void 0||ot(S,this.length-8);const F=C*2**24+65536*this[++S]+256*this[++S]+this[++S],et=this[++S]*2**24+65536*this[++S]+256*this[++S]+O;return(BigInt(F)<>>=0,C>>>=0,O||f(S,C,this.length);let F=this[S],et=1,Q=0;for(;++Q=et&&(F-=Math.pow(2,8*C)),F},c.prototype.readIntBE=function(S,C,O){S>>>=0,C>>>=0,O||f(S,C,this.length);let F=C,et=1,Q=this[S+--F];for(;F>0&&(et*=256);)Q+=this[S+--F]*et;return et*=128,Q>=et&&(Q-=Math.pow(2,8*C)),Q},c.prototype.readInt8=function(S,C){return S>>>=0,C||f(S,1,this.length),128&this[S]?-1*(255-this[S]+1):this[S]},c.prototype.readInt16LE=function(S,C){S>>>=0,C||f(S,2,this.length);const O=this[S]|this[S+1]<<8;return 32768&O?4294901760|O:O},c.prototype.readInt16BE=function(S,C){S>>>=0,C||f(S,2,this.length);const O=this[S+1]|this[S]<<8;return 32768&O?4294901760|O:O},c.prototype.readInt32LE=function(S,C){return S>>>=0,C||f(S,4,this.length),this[S]|this[S+1]<<8|this[S+2]<<16|this[S+3]<<24},c.prototype.readInt32BE=function(S,C){return S>>>=0,C||f(S,4,this.length),this[S]<<24|this[S+1]<<16|this[S+2]<<8|this[S+3]},c.prototype.readBigInt64LE=Tt(function(S){W(S>>>=0,"offset");const C=this[S],O=this[S+7];C!==void 0&&O!==void 0||ot(S,this.length-8);const F=this[S+4]+256*this[S+5]+65536*this[S+6]+(O<<24);return(BigInt(F)<>>=0,"offset");const C=this[S],O=this[S+7];C!==void 0&&O!==void 0||ot(S,this.length-8);const F=(C<<24)+65536*this[++S]+256*this[++S]+this[++S];return(BigInt(F)<>>=0,C||f(S,4,this.length),e.read(this,S,!0,23,4)},c.prototype.readFloatBE=function(S,C){return S>>>=0,C||f(S,4,this.length),e.read(this,S,!1,23,4)},c.prototype.readDoubleLE=function(S,C){return S>>>=0,C||f(S,8,this.length),e.read(this,S,!0,52,8)},c.prototype.readDoubleBE=function(S,C){return S>>>=0,C||f(S,8,this.length),e.read(this,S,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(S,C,O,F){S=+S,C>>>=0,O>>>=0,F||h(this,S,C,O,Math.pow(2,8*O)-1,0);let et=1,Q=0;for(this[C]=255&S;++Q>>=0,O>>>=0,F||h(this,S,C,O,Math.pow(2,8*O)-1,0);let et=O-1,Q=1;for(this[C+et]=255&S;--et>=0&&(Q*=256);)this[C+et]=S/Q&255;return C+O},c.prototype.writeUint8=c.prototype.writeUInt8=function(S,C,O){return S=+S,C>>>=0,O||h(this,S,C,1,255,0),this[C]=255&S,C+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(S,C,O){return S=+S,C>>>=0,O||h(this,S,C,2,65535,0),this[C]=255&S,this[C+1]=S>>>8,C+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(S,C,O){return S=+S,C>>>=0,O||h(this,S,C,2,65535,0),this[C]=S>>>8,this[C+1]=255&S,C+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(S,C,O){return S=+S,C>>>=0,O||h(this,S,C,4,4294967295,0),this[C+3]=S>>>24,this[C+2]=S>>>16,this[C+1]=S>>>8,this[C]=255&S,C+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(S,C,O){return S=+S,C>>>=0,O||h(this,S,C,4,4294967295,0),this[C]=S>>>24,this[C+1]=S>>>16,this[C+2]=S>>>8,this[C+3]=255&S,C+4},c.prototype.writeBigUInt64LE=Tt(function(S,C=0){return g(this,S,C,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Tt(function(S,C=0){return A(this,S,C,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(S,C,O,F){if(S=+S,C>>>=0,!F){const qt=Math.pow(2,8*O-1);h(this,S,C,O,qt-1,-qt)}let et=0,Q=1,it=0;for(this[C]=255&S;++et>0)-it&255;return C+O},c.prototype.writeIntBE=function(S,C,O,F){if(S=+S,C>>>=0,!F){const qt=Math.pow(2,8*O-1);h(this,S,C,O,qt-1,-qt)}let et=O-1,Q=1,it=0;for(this[C+et]=255&S;--et>=0&&(Q*=256);)S<0&&it===0&&this[C+et+1]!==0&&(it=1),this[C+et]=(S/Q>>0)-it&255;return C+O},c.prototype.writeInt8=function(S,C,O){return S=+S,C>>>=0,O||h(this,S,C,1,127,-128),S<0&&(S=255+S+1),this[C]=255&S,C+1},c.prototype.writeInt16LE=function(S,C,O){return S=+S,C>>>=0,O||h(this,S,C,2,32767,-32768),this[C]=255&S,this[C+1]=S>>>8,C+2},c.prototype.writeInt16BE=function(S,C,O){return S=+S,C>>>=0,O||h(this,S,C,2,32767,-32768),this[C]=S>>>8,this[C+1]=255&S,C+2},c.prototype.writeInt32LE=function(S,C,O){return S=+S,C>>>=0,O||h(this,S,C,4,2147483647,-2147483648),this[C]=255&S,this[C+1]=S>>>8,this[C+2]=S>>>16,this[C+3]=S>>>24,C+4},c.prototype.writeInt32BE=function(S,C,O){return S=+S,C>>>=0,O||h(this,S,C,4,2147483647,-2147483648),S<0&&(S=4294967295+S+1),this[C]=S>>>24,this[C+1]=S>>>16,this[C+2]=S>>>8,this[C+3]=255&S,C+4},c.prototype.writeBigInt64LE=Tt(function(S,C=0){return g(this,S,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Tt(function(S,C=0){return A(this,S,C,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(S,C,O){return b(this,S,C,!0,O)},c.prototype.writeFloatBE=function(S,C,O){return b(this,S,C,!1,O)},c.prototype.writeDoubleLE=function(S,C,O){return u(this,S,C,!0,O)},c.prototype.writeDoubleBE=function(S,C,O){return u(this,S,C,!1,O)},c.prototype.copy=function(S,C,O,F){if(!c.isBuffer(S))throw new TypeError("argument should be a Buffer");if(O||(O=0),F||F===0||(F=this.length),C>=S.length&&(C=S.length),C||(C=0),F>0&&F=this.length)throw new RangeError("Index out of range");if(F<0)throw new RangeError("sourceEnd out of bounds");F>this.length&&(F=this.length),S.length-C>>=0,O=O===void 0?this.length:O>>>0,S||(S=0),typeof S=="number")for(et=C;et=F+4;O-=3)C=`_${S.slice(O-3,O)}${C}`;return`${S.slice(0,O)}${C}`}function z(S,C,O,F,et,Q){if(S>O||S3?C===0||C===BigInt(0)?`>= 0${it} and < 2${it} ** ${8*(Q+1)}${it}`:`>= -(2${it} ** ${8*(Q+1)-1}${it}) and < 2 ** ${8*(Q+1)-1}${it}`:`>= ${C}${it} and <= ${O}${it}`,new m.ERR_OUT_OF_RANGE("value",qt,S)}(function(it,qt,It){W(qt,"offset"),it[qt]!==void 0&&it[qt+It]!==void 0||ot(qt,it.length-(It+1))})(F,et,Q)}function W(S,C){if(typeof S!="number")throw new m.ERR_INVALID_ARG_TYPE(C,"number",S)}function ot(S,C,O){throw Math.floor(S)!==S?(W(S,O),new m.ERR_OUT_OF_RANGE(O||"offset","an integer",S)):C<0?new m.ERR_BUFFER_OUT_OF_BOUNDS:new m.ERR_OUT_OF_RANGE(O||"offset",`>= ${O?1:0} and <= ${C}`,S)}L("ERR_BUFFER_OUT_OF_BOUNDS",function(S){return S?`${S} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),L("ERR_INVALID_ARG_TYPE",function(S,C){return`The "${S}" argument must be of type number. Received type ${typeof C}`},TypeError),L("ERR_OUT_OF_RANGE",function(S,C,O){let F=`The value of "${S}" is out of range.`,et=O;return Number.isInteger(O)&&Math.abs(O)>2**32?et=q(String(O)):typeof O=="bigint"&&(et=String(O),(O>BigInt(2)**BigInt(32)||O<-(BigInt(2)**BigInt(32)))&&(et=q(et)),et+="n"),F+=` It must be ${C}. Received ${et}`,F},RangeError);const ut=/[^+/0-9A-Za-z-_]/g;function Ct(S,C){let O;C=C||1/0;const F=S.length;let et=null;const Q=[];for(let it=0;it55295&&O<57344){if(!et){if(O>56319){(C-=3)>-1&&Q.push(239,191,189);continue}if(it+1===F){(C-=3)>-1&&Q.push(239,191,189);continue}et=O;continue}if(O<56320){(C-=3)>-1&&Q.push(239,191,189),et=O;continue}O=65536+(et-55296<<10|O-56320)}else et&&(C-=3)>-1&&Q.push(239,191,189);if(et=null,O<128){if((C-=1)<0)break;Q.push(O)}else if(O<2048){if((C-=2)<0)break;Q.push(O>>6|192,63&O|128)}else if(O<65536){if((C-=3)<0)break;Q.push(O>>12|224,O>>6&63|128,63&O|128)}else{if(!(O<1114112))throw new Error("Invalid code point");if((C-=4)<0)break;Q.push(O>>18|240,O>>12&63|128,O>>6&63|128,63&O|128)}}return Q}function yt(S){return t.toByteArray(function(C){if((C=(C=C.split("=")[0]).trim().replace(ut,"")).length<2)return"";for(;C.length%4!=0;)C+="=";return C}(S))}function mt(S,C,O,F){let et;for(et=0;et=C.length||et>=S.length);++et)C[et+O]=S[et];return et}function jt(S,C){return S instanceof C||S!=null&&S.constructor!=null&&S.constructor.name!=null&&S.constructor.name===C.name}function dt(S){return S!=S}const ct=function(){const S="0123456789abcdef",C=new Array(256);for(let O=0;O<16;++O){const F=16*O;for(let et=0;et<16;++et)C[F+et]=S[O]+S[et]}return C}();function Tt(S){return typeof BigInt>"u"?kt:S}function kt(){throw new Error("BigInt not supported")}}(Hr);const av=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,qS=r=>r instanceof Uint8Array,uv=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),Bo=(r,t)=>r<<32-t|r>>>t;if(new Uint8Array(new Uint32Array([287454020]).buffer)[0]!==68)throw new Error("Non little-endian hardware is not supported");function db(r){if(typeof r=="string"&&(r=function(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}(r)),!qS(r))throw new Error("expected Uint8Array, got "+typeof r);return r}class FS{clone(){return this._cloneInto()}}function jS(r){const t=n=>r().update(db(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function $S(r=32){if(av&&typeof av.getRandomValues=="function")return av.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}class KS extends FS{constructor(t,e,n,s){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=uv(this.buffer)}update(t){Zl(this);const{view:e,buffer:n,blockLen:s}=this,i=(t=db(t)).length;for(let c=0;cs-c&&(this.process(n,0),c=0);for(let E=c;E>k&B),R=Number(w&B),T=_?4:0,U=_?0:4;E.setUint32(M+T,P,_),E.setUint32(M+U,R,_)})(n,s-8,BigInt(8*this.length),i),this.process(n,0);const l=uv(t),p=this.outputLen;if(p%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const v=p/4,y=this.get();if(v>y.length)throw new Error("_sha2: outputLen bigger than state");for(let E=0;E>Y2&H0)}:{h:0|Number(r>>Y2&H0),l:0|Number(r&H0)}}const NZ={fromBig:bx,split:function(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let s=0;sBigInt(r>>>0)<>>0),shrSH:(r,t,e)=>r>>>e,shrSL:(r,t,e)=>r<<32-e|t>>>e,rotrSH:(r,t,e)=>r>>>e|t<<32-e,rotrSL:(r,t,e)=>r<<32-e|t>>>e,rotrBH:(r,t,e)=>r<<64-e|t>>>e-32,rotrBL:(r,t,e)=>r>>>e-32|t<<64-e,rotr32H:(r,t)=>t,rotr32L:(r,t)=>r,rotlSH:(r,t,e)=>r<>>32-e,rotlSL:(r,t,e)=>t<>>32-e,rotlBH:(r,t,e)=>t<>>64-e,rotlBL:(r,t,e)=>r<>>64-e,add:function(r,t,e,n){const s=(t>>>0)+(n>>>0);return{h:r+e+(s/2**32|0)|0,l:0|s}},add3L:(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),add3H:(r,t,e,n)=>t+e+n+(r/2**32|0)|0,add4L:(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),add4H:(r,t,e,n,s)=>t+e+n+s+(r/2**32|0)|0,add5H:(r,t,e,n,s,i)=>t+e+n+s+i+(r/2**32|0)|0,add5L:(r,t,e,n,s)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(s>>>0)};var er=NZ;const[DZ,zZ]=er.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(r=>BigInt(r))),js=new Uint32Array(80),$s=new Uint32Array(80);class qZ extends KS{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:t,Al:e,Bh:n,Bl:s,Ch:i,Cl:c,Dh:l,Dl:p,Eh:v,El:y,Fh:E,Fl:M,Gh:w,Gl:_,Hh:k,Hl:B}=this;return[t,e,n,s,i,c,l,p,v,y,E,M,w,_,k,B]}set(t,e,n,s,i,c,l,p,v,y,E,M,w,_,k,B){this.Ah=0|t,this.Al=0|e,this.Bh=0|n,this.Bl=0|s,this.Ch=0|i,this.Cl=0|c,this.Dh=0|l,this.Dl=0|p,this.Eh=0|v,this.El=0|y,this.Fh=0|E,this.Fl=0|M,this.Gh=0|w,this.Gl=0|_,this.Hh=0|k,this.Hl=0|B}process(t,e){for(let T=0;T<16;T++,e+=4)js[T]=t.getUint32(e),$s[T]=t.getUint32(e+=4);for(let T=16;T<80;T++){const U=0|js[T-15],j=0|$s[T-15],Y=er.rotrSH(U,j,1)^er.rotrSH(U,j,8)^er.shrSH(U,j,7),rt=er.rotrSL(U,j,1)^er.rotrSL(U,j,8)^er.shrSL(U,j,7),nt=0|js[T-2],Z=0|$s[T-2],x=er.rotrSH(nt,Z,19)^er.rotrBH(nt,Z,61)^er.shrSH(nt,Z,6),d=er.rotrSL(nt,Z,19)^er.rotrBL(nt,Z,61)^er.shrSL(nt,Z,6),o=er.add4L(rt,d,$s[T-7],$s[T-16]),a=er.add4H(o,Y,x,js[T-7],js[T-16]);js[T]=0|a,$s[T]=0|o}let{Ah:n,Al:s,Bh:i,Bl:c,Ch:l,Cl:p,Dh:v,Dl:y,Eh:E,El:M,Fh:w,Fl:_,Gh:k,Gl:B,Hh:P,Hl:R}=this;for(let T=0;T<80;T++){const U=er.rotrSH(E,M,14)^er.rotrSH(E,M,18)^er.rotrBH(E,M,41),j=er.rotrSL(E,M,14)^er.rotrSL(E,M,18)^er.rotrBL(E,M,41),Y=E&w^~E&k,rt=M&_^~M&B,nt=er.add5L(R,j,rt,zZ[T],$s[T]),Z=er.add5H(nt,P,U,Y,DZ[T],js[T]),x=0|nt,d=er.rotrSH(n,s,28)^er.rotrBH(n,s,34)^er.rotrBH(n,s,39),o=er.rotrSL(n,s,28)^er.rotrBL(n,s,34)^er.rotrBL(n,s,39),a=n&i^n&l^i&l,f=s&c^s&p^c&p;P=0|k,R=0|B,k=0|w,B=0|_,w=0|E,_=0|M,{h:E,l:M}=er.add(0|v,0|y,0|Z,0|x),v=0|l,y=0|p,l=0|i,p=0|c,i=0|n,c=0|s;const h=er.add3L(x,o,f);n=er.add3H(h,Z,d,a),s=0|h}({h:n,l:s}=er.add(0|this.Ah,0|this.Al,0|n,0|s)),{h:i,l:c}=er.add(0|this.Bh,0|this.Bl,0|i,0|c),{h:l,l:p}=er.add(0|this.Ch,0|this.Cl,0|l,0|p),{h:v,l:y}=er.add(0|this.Dh,0|this.Dl,0|v,0|y),{h:E,l:M}=er.add(0|this.Eh,0|this.El,0|E,0|M),{h:w,l:_}=er.add(0|this.Fh,0|this.Fl,0|w,0|_),{h:k,l:B}=er.add(0|this.Gh,0|this.Gl,0|k,0|B),{h:P,l:R}=er.add(0|this.Hh,0|this.Hl,0|P,0|R),this.set(n,s,i,c,l,p,v,y,E,M,w,_,k,B,P,R)}roundClean(){js.fill(0),$s.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 FZ=jS(()=>new qZ),wx=BigInt(0),ml=BigInt(1),jZ=BigInt(2),l1=r=>r instanceof Uint8Array,$Z=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Qa(r){if(!l1(r))throw new Error("Uint8Array expected");let t="";for(let e=0;en+s.length,0));let e=0;return r.forEach(n=>{if(!l1(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}const mb=r=>(jZ<new Uint8Array(r),_x=r=>Uint8Array.from(r);function HS(r,t,e){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let n=fv(r),s=fv(r),i=0;const c=()=>{n.fill(1),s.fill(0),i=0},l=(...y)=>e(s,n,...y),p=(y=fv())=>{s=l(_x([0]),y),n=l(),y.length!==0&&(s=l(_x([1]),y),n=l())},v=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let y=0;const E=[];for(;y{let M;for(c(),p(y);!(M=E(v()));)p();return c(),M}}const KZ={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||r instanceof Uint8Array,isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function kf(r,t,e={}){const n=(s,i,c)=>{const l=KZ[i];if(typeof l!="function")throw new Error(`Invalid validator "${i}", expected function`);const p=r[s];if(!(c&&p===void 0||l(p,r)))throw new Error(`Invalid param ${String(s)}=${p} (${typeof p}), expected ${i}`)};for(const[s,i]of Object.entries(t))n(s,i,!1);for(const[s,i]of Object.entries(e))n(s,i,!0);return r}var HZ=Object.freeze({__proto__:null,bytesToHex:Qa,numberToHexUnpadded:xx,hexToNumber:pb,hexToBytes:Sf,bytesToNumberBE:Ta,bytesToNumberLE:af,numberToBytesBE:uf,numberToBytesLE:Eh,numberToVarBytesBE:function(r){return Sf(xx(r))},ensureBytes:dn,concatBytes:tu,equalBytes:function(r,t){if(r.length!==t.length)return!1;for(let e=0;ewx;r>>=ml,t+=1);return t},bitGet:function(r,t){return r>>BigInt(t)&ml},bitSet:(r,t,e)=>r|(e?ml:wx)<=_n?e:t+e}function ZZ(r,t,e){if(e<=_n||t<_n)throw new Error("Expected power/modulo > 0");if(e===Kr)return _n;let n=Kr;for(;t>_n;)t&Kr&&(n=n*r%e),r=r*r%e,t>>=Kr;return n}function en(r,t,e){let n=r;for(;t-- >_n;)n*=n,n%=e;return n}function X2(r,t){if(r===_n||t<=_n)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=$r(r,t),n=t,s=_n,i=Kr;for(;e!==_n;){const c=n%e,l=s-i*(n/e);n=e,e=c,s=i,i=l}if(n!==Kr)throw new Error("invert: does not exist");return $r(s,t)}BigInt(9),BigInt(16);const WZ=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function VS(r,t){const e=t!==void 0?t:r.toString(2).length;return{nBitLength:e,nByteLength:Math.ceil(e/8)}}function ZS(r,t,e=!1,n={}){if(r<=_n)throw new Error(`Expected Field ORDER > 0, got ${r}`);const{nBitLength:s,nByteLength:i}=VS(r,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const c=function(p){if(p%cv===VZ){const v=(p+Kr)/cv;return function(y,E){const M=y.pow(E,v);if(!y.eql(y.sqr(M),E))throw new Error("Cannot find square root");return M}}if(p%Ex===Mx){const v=(p-Mx)/Ex;return function(y,E){const M=y.mul(E,Sa),w=y.pow(M,v),_=y.mul(E,w),k=y.mul(y.mul(_,Sa),w),B=y.mul(_,y.sub(k,y.ONE));if(!y.eql(y.sqr(B),E))throw new Error("Cannot find square root");return B}}return function(v){const y=(v-Kr)/Sa;let E,M,w;for(E=v-Kr,M=0;E%Sa===_n;E/=Sa,M++);for(w=Sa;w$r(p,r),isValid:p=>{if(typeof p!="bigint")throw new Error("Invalid field element: expected bigint, got "+typeof p);return _n<=p&&pp===_n,isOdd:p=>(p&Kr)===Kr,neg:p=>$r(-p,r),eql:(p,v)=>p===v,sqr:p=>$r(p*p,r),add:(p,v)=>$r(p+v,r),sub:(p,v)=>$r(p-v,r),mul:(p,v)=>$r(p*v,r),pow:(p,v)=>function(y,E,M){if(M<_n)throw new Error("Expected power > 0");if(M===_n)return y.ONE;if(M===Kr)return E;let w=y.ONE,_=E;for(;M>_n;)M&Kr&&(w=y.mul(w,_)),_=y.sqr(_),M>>=Kr;return w}(l,p,v),div:(p,v)=>$r(p*X2(v,r),r),sqrN:p=>p*p,addN:(p,v)=>p+v,subN:(p,v)=>p-v,mulN:(p,v)=>p*v,inv:p=>X2(p,r),sqrt:n.sqrt||(p=>c(l,p)),invertBatch:p=>function(v,y){const E=new Array(y.length),M=y.reduce((_,k,B)=>v.is0(k)?_:(E[B]=_,v.mul(_,k)),v.ONE),w=v.inv(M);return y.reduceRight((_,k,B)=>v.is0(k)?_:(E[B]=v.mul(_,E[B]),v.mul(_,k)),w),E}(l,p),cmov:(p,v,y)=>y?v:p,toBytes:p=>e?Eh(p,i):uf(p,i),fromBytes:p=>{if(p.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${p.length}`);return e?af(p):Ta(p)}});return Object.freeze(l)}function WS(r){if(typeof r!="bigint")throw new Error("field order must be bigint");const t=r.toString(2).length;return Math.ceil(t/8)}function Ax(r){const t=WS(r);return t+Math.ceil(t/2)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const GZ=BigInt(0),hv=BigInt(1);function GS(r,t){const e=(s,i)=>{const c=i.negate();return s?c:i},n=s=>({windows:Math.ceil(t/s)+1,windowSize:2**(s-1)});return{constTimeNegate:e,unsafeLadder(s,i){let c=r.ZERO,l=s;for(;i>GZ;)i&hv&&(c=c.add(l)),l=l.double(),i>>=hv;return c},precomputeWindow(s,i){const{windows:c,windowSize:l}=n(i),p=[];let v=s,y=v;for(let E=0;E>=w,B>p&&(B-=M,c+=hv);const P=k,R=k+Math.abs(B)-1,T=_%2!=0,U=B<0;B===0?y=y.add(e(T,i[P])):v=v.add(e(U,i[R]))}return{p:v,f:y}},wNAFCached(s,i,c,l){const p=s._WINDOW_SIZE||1;let v=i.get(s);return v||(v=this.precomputeWindow(s,p),p!==1&&i.set(s,l(v))),this.wNAF(p,v,c)}}}function J2(r){return kf(r.Fp,WZ.reduce((t,e)=>(t[e]="function",t),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),kf(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...VS(r.n,r.nBitLength),...r,p:r.Fp.ORDER});/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */}const oo=BigInt(0),wi=BigInt(1),V0=BigInt(2),YZ=BigInt(8),XZ={zip215:!0};/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Q2=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Sx=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const JZ=BigInt(1),tg=BigInt(2),QZ=BigInt(5),kx=BigInt(10),tW=BigInt(20),eW=BigInt(40),Ix=BigInt(80),ps=ZS(Q2,void 0,!0),rW={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:ps,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:FZ,randomBytes:$S,adjustScalarBytes:function(r){return r[0]&=248,r[31]&=127,r[31]|=64,r},uvRatio:function(r,t){const e=Q2,n=$r(t*t*t,e),s=function(M){const w=Q2,_=M*M%w*M%w,k=en(_,tg,w)*_%w,B=en(k,JZ,w)*M%w,P=en(B,QZ,w)*B%w,R=en(P,kx,w)*P%w,T=en(R,tW,w)*R%w,U=en(T,eW,w)*T%w,j=en(U,Ix,w)*U%w,Y=en(j,Ix,w)*U%w,rt=en(Y,kx,w)*P%w;return{pow_p_5_8:en(rt,tg,w)*M%w,b2:_}}(r*$r(n*n*t,e)).pow_p_5_8;let i=$r(r*n*s,e);const c=$r(t*i*i,e),l=i,p=$r(i*Sx,e),v=c===r,y=c===$r(-r,e),E=c===$r(-r*Sx,e);return v&&(i=l),(y||E)&&(i=p),($r(i,e)&Kr)===Kr&&(i=$r(-i,e)),{isValid:v||y,value:i}}},nW=function(r){const t=function(f){const h=J2(f);return kf(f,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...h})}(r),{Fp:e,n,prehash:s,hash:i,randomBytes:c,nByteLength:l,h:p}=t,v=V0<{try{return{isValid:!0,value:e.sqrt(f*e.inv(h))}}catch{return{isValid:!1,value:oo}}}),M=t.adjustScalarBytes||(f=>f),w=t.domain||((f,h,g)=>{if(h.length||g)throw new Error("Contexts/pre-hash are not supported");return f}),_=f=>typeof f=="bigint"&&oo_(f)&&_(h)&&ff===oo||k(f,v);function P(f,h){if(k(f,h))return f;throw new Error(`Expected valid scalar < ${h}, got ${typeof f} ${f}`)}function R(f){return f===oo?f:P(f,n)}const T=new Map;function U(f){if(!(f instanceof j))throw new Error("ExtendedPoint expected")}class j{constructor(h,g,A,I){if(this.ex=h,this.ey=g,this.ez=A,this.et=I,!B(h))throw new Error("x required");if(!B(g))throw new Error("y required");if(!B(A))throw new Error("z required");if(!B(I))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(h){if(h instanceof j)throw new Error("extended point not allowed");const{x:g,y:A}=h||{};if(!B(g)||!B(A))throw new Error("invalid affine point");return new j(g,A,wi,y(g*A))}static normalizeZ(h){const g=e.invertBatch(h.map(A=>A.ez));return h.map((A,I)=>A.toAffine(g[I])).map(j.fromAffine)}_setWindowSize(h){this._WINDOW_SIZE=h,T.delete(this)}assertValidity(){const{a:h,d:g}=t;if(this.is0())throw new Error("bad point: ZERO");const{ex:A,ey:I,ez:b,et:u}=this,m=y(A*A),L=y(I*I),q=y(b*b),z=y(q*q),W=y(m*h);if(y(q*y(W+L))!==y(z+y(g*y(m*L))))throw new Error("bad point: equation left != right (1)");if(y(A*I)!==y(b*u))throw new Error("bad point: equation left != right (2)")}equals(h){U(h);const{ex:g,ey:A,ez:I}=this,{ex:b,ey:u,ez:m}=h,L=y(g*m),q=y(b*I),z=y(A*m),W=y(u*I);return L===q&&z===W}is0(){return this.equals(j.ZERO)}negate(){return new j(y(-this.ex),this.ey,this.ez,y(-this.et))}double(){const{a:h}=t,{ex:g,ey:A,ez:I}=this,b=y(g*g),u=y(A*A),m=y(V0*y(I*I)),L=y(h*b),q=g+A,z=y(y(q*q)-b-u),W=L+u,ot=W-m,ut=L-u,Ct=y(z*ot),yt=y(W*ut),mt=y(z*ut),jt=y(ot*W);return new j(Ct,yt,jt,mt)}add(h){U(h);const{a:g,d:A}=t,{ex:I,ey:b,ez:u,et:m}=this,{ex:L,ey:q,ez:z,et:W}=h;if(g===BigInt(-1)){const O=y((b-I)*(q+L)),F=y((b+I)*(q-L)),et=y(F-O);if(et===oo)return this.double();const Q=y(u*V0*W),it=y(m*V0*z),qt=it+Q,It=F+O,xt=it-Q,Qt=y(qt*et),Rt=y(It*xt),Dt=y(qt*xt),Se=y(et*It);return new j(Qt,Rt,Se,Dt)}const ot=y(I*L),ut=y(b*q),Ct=y(m*A*W),yt=y(u*z),mt=y((I+b)*(L+q)-ot-ut),jt=yt-Ct,dt=yt+Ct,ct=y(ut-g*ot),Tt=y(mt*jt),kt=y(dt*ct),S=y(mt*ct),C=y(jt*dt);return new j(Tt,kt,C,S)}subtract(h){return this.add(h.negate())}wNAF(h){return nt.wNAFCached(this,T,h,j.normalizeZ)}multiply(h){const{p:g,f:A}=this.wNAF(P(h,n));return j.normalizeZ([g,A])[0]}multiplyUnsafe(h){let g=R(h);return g===oo?rt:this.equals(rt)||g===wi?this:this.equals(Y)?this.wNAF(g).p:nt.unsafeLadder(this,g)}isSmallOrder(){return this.multiplyUnsafe(p).is0()}isTorsionFree(){return nt.unsafeLadder(this,n).is0()}toAffine(h){const{ex:g,ey:A,ez:I}=this,b=this.is0();h==null&&(h=b?YZ:e.inv(I));const u=y(g*h),m=y(A*h),L=y(I*h);if(b)return{x:oo,y:wi};if(L!==wi)throw new Error("invZ was invalid");return{x:u,y:m}}clearCofactor(){const{h}=t;return h===wi?this:this.multiplyUnsafe(h)}static fromHex(h,g=!1){const{d:A,a:I}=t,b=e.BYTES,u=(h=dn("pointHex",h,b)).slice(),m=h[b-1];u[b-1]=-129&m;const L=af(u);L===oo||P(L,g?v:e.ORDER);const q=y(L*L),z=y(q-wi),W=y(A*q-I);let{isValid:ot,value:ut}=E(z,W);if(!ot)throw new Error("Point.fromHex: invalid y coordinate");const Ct=(ut&wi)===wi,yt=(128&m)!=0;if(!g&&ut===oo&&yt)throw new Error("Point.fromHex: x=0 and x_0=1");return yt!==Ct&&(ut=y(-ut)),j.fromAffine({x:ut,y:L})}static fromPrivateKey(h){return d(h).point}toRawBytes(){const{x:h,y:g}=this.toAffine(),A=Eh(g,e.BYTES);return A[A.length-1]|=h&wi?128:0,A}toHex(){return Qa(this.toRawBytes())}}j.BASE=new j(t.Gx,t.Gy,wi,y(t.Gx*t.Gy)),j.ZERO=new j(oo,wi,wi,oo);const{BASE:Y,ZERO:rt}=j,nt=GS(j,8*l);function Z(f){return $r(f,n)}function x(f){return Z(af(f))}function d(f){const h=l;f=dn("private key",f,h);const g=dn("hashed private key",i(f),2*h),A=M(g.slice(0,h)),I=g.slice(h,2*h),b=x(A),u=Y.multiply(b),m=u.toRawBytes();return{head:A,prefix:I,scalar:b,point:u,pointBytes:m}}function o(f=new Uint8Array,...h){const g=tu(...h);return x(i(w(g,dn("context",f),!!s)))}const a=XZ;return Y._setWindowSize(8),{CURVE:t,getPublicKey:function(f){return d(f).pointBytes},sign:function(f,h,g={}){f=dn("message",f),s&&(f=s(f));const{prefix:A,scalar:I,pointBytes:b}=d(h),u=o(g.context,A,f),m=Y.multiply(u).toRawBytes(),L=Z(u+o(g.context,m,b,f)*I);return R(L),dn("result",tu(m,Eh(L,e.BYTES)),2*l)},verify:function(f,h,g,A=a){const{context:I,zip215:b}=A,u=e.BYTES;f=dn("signature",f,2*u),h=dn("message",h),s&&(h=s(h));const m=af(f.slice(u,2*u));let L,q,z;try{L=j.fromHex(g,b),q=j.fromHex(f.slice(0,u),b),z=Y.multiplyUnsafe(m)}catch{return!1}if(!b&&L.isSmallOrder())return!1;const W=o(I,q.toRawBytes(),L.toRawBytes(),h);return q.add(L.multiplyUnsafe(W)).subtract(z).clearCofactor().equals(j.ZERO)},ExtendedPoint:j,utils:{getExtendedPublicKey:d,randomPrivateKey:()=>c(e.BYTES),precompute:(f=8,h=j.BASE)=>(h._setWindowSize(f),h.multiply(BigInt(3)),h)}}}(rW),iW=(ps.ORDER+BigInt(3))/BigInt(8);ps.pow(tg,iW),ps.sqrt(ps.neg(ps.ONE)),ps.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(r,t){if(!r.isOdd)throw new Error("Field doesn't have isOdd");const e=r.sqrt(t);r.isOdd(e)&&r.neg(e)}(ps,ps.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var eg={exports:{}},oW=lb(Object.freeze({__proto__:null,default:{}}));(function(r,t){function e(x,d){if(!x)throw new Error(d||"Assertion failed")}function n(x,d){x.super_=d;var o=function(){};o.prototype=d.prototype,x.prototype=new o,x.prototype.constructor=x}function s(x,d,o){if(s.isBN(x))return x;this.negative=0,this.words=null,this.length=0,this.red=null,x!==null&&(d!=="le"&&d!=="be"||(o=d,d=10),this._init(x||0,d||10,o||"be"))}var i;typeof eg=="object"?eg.exports=s:t.BN=s,s.BN=s,s.wordSize=26;try{i=typeof window<"u"&&window.Buffer!==void 0?window.Buffer:oW.Buffer}catch{}function c(x,d){var o=x.charCodeAt(d);return o>=48&&o<=57?o-48:o>=65&&o<=70?o-55:o>=97&&o<=102?o-87:void e(!1,"Invalid character in "+x)}function l(x,d,o){var a=c(x,o);return o-1>=d&&(a|=c(x,o-1)<<4),a}function p(x,d,o,a){for(var f=0,h=0,g=Math.min(x.length,o),A=d;A=49?I-49+10:I>=17?I-17+10:I,e(I>=0&&h0?x:d},s.min=function(x,d){return x.cmp(d)<0?x:d},s.prototype._init=function(x,d,o){if(typeof x=="number")return this._initNumber(x,d,o);if(typeof x=="object")return this._initArray(x,d,o);d==="hex"&&(d=16),e(d===(0|d)&&d>=2&&d<=36);var a=0;(x=x.toString().replace(/\s+/g,""))[0]==="-"&&(a++,this.negative=1),a=0;a-=3)h=x[a]|x[a-1]<<8|x[a-2]<<16,this.words[f]|=h<>>26-g&67108863,(g+=24)>=26&&(g-=26,f++);else if(o==="le")for(a=0,f=0;a>>26-g&67108863,(g+=24)>=26&&(g-=26,f++);return this._strip()},s.prototype._parseHex=function(x,d,o){this.length=Math.ceil((x.length-d)/6),this.words=new Array(this.length);for(var a=0;a=d;a-=2)f=l(x,d,a)<=18?(h-=18,g+=1,this.words[g]|=f>>>26):h+=8;else for(a=(x.length-d)%2==0?d+1:d;a=18?(h-=18,g+=1,this.words[g]|=f>>>26):h+=8;this._strip()},s.prototype._parseBase=function(x,d,o){this.words=[0],this.length=1;for(var a=0,f=1;f<=67108863;f*=d)a++;a--,f=f/d|0;for(var h=x.length-o,g=h%a,A=Math.min(h,h-g)+o,I=0,b=o;b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=y}catch{s.prototype.inspect=y}else s.prototype.inspect=y;function y(){return(this.red?""}var E=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],M=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],w=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function _(x,d,o){o.negative=d.negative^x.negative;var a=x.length+d.length|0;o.length=a,a=a-1|0;var f=0|x.words[0],h=0|d.words[0],g=f*h,A=67108863&g,I=g/67108864|0;o.words[0]=A;for(var b=1;b>>26,m=67108863&I,L=Math.min(b,d.length-1),q=Math.max(0,b-x.length+1);q<=L;q++){var z=b-q|0;u+=(g=(f=0|x.words[z])*(h=0|d.words[q])+m)/67108864|0,m=67108863&g}o.words[b]=0|m,I=0|u}return I!==0?o.words[b]=0|I:o.length--,o._strip()}s.prototype.toString=function(x,d){var o;if(d=0|d||1,(x=x||10)===16||x==="hex"){o="";for(var a=0,f=0,h=0;h>>24-a&16777215,(a+=2)>=26&&(a-=26,h--),o=f!==0||h!==this.length-1?E[6-A.length]+A+o:A+o}for(f!==0&&(o=f.toString(16)+o);o.length%d!=0;)o="0"+o;return this.negative!==0&&(o="-"+o),o}if(x===(0|x)&&x>=2&&x<=36){var I=M[x],b=w[x];o="";var u=this.clone();for(u.negative=0;!u.isZero();){var m=u.modrn(b).toString(x);o=(u=u.idivn(b)).isZero()?m+o:E[I-m.length]+m+o}for(this.isZero()&&(o="0"+o);o.length%d!=0;)o="0"+o;return this.negative!==0&&(o="-"+o),o}e(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var x=this.words[0];return this.length===2?x+=67108864*this.words[1]:this.length===3&&this.words[2]===1?x+=4503599627370496+67108864*this.words[1]:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-x:x},s.prototype.toJSON=function(){return this.toString(16,2)},i&&(s.prototype.toBuffer=function(x,d){return this.toArrayLike(i,x,d)}),s.prototype.toArray=function(x,d){return this.toArrayLike(Array,x,d)},s.prototype.toArrayLike=function(x,d,o){this._strip();var a=this.byteLength(),f=o||Math.max(1,a);e(a<=f,"byte array longer than desired length"),e(f>0,"Requested array length <= 0");var h=function(g,A){return g.allocUnsafe?g.allocUnsafe(A):new g(A)}(x,f);return this["_toArrayLike"+(d==="le"?"LE":"BE")](h,a),h},s.prototype._toArrayLikeLE=function(x,d){for(var o=0,a=0,f=0,h=0;f>8&255),o>16&255),h===6?(o>24&255),a=0,h=0):(a=g>>>24,h+=2)}if(o=0&&(x[o--]=g>>8&255),o>=0&&(x[o--]=g>>16&255),h===6?(o>=0&&(x[o--]=g>>24&255),a=0,h=0):(a=g>>>24,h+=2)}if(o>=0)for(x[o--]=a;o>=0;)x[o--]=0},Math.clz32?s.prototype._countBits=function(x){return 32-Math.clz32(x)}:s.prototype._countBits=function(x){var d=x,o=0;return d>=4096&&(o+=13,d>>>=13),d>=64&&(o+=7,d>>>=7),d>=8&&(o+=4,d>>>=4),d>=2&&(o+=2,d>>>=2),o+d},s.prototype._zeroBits=function(x){if(x===0)return 26;var d=x,o=0;return!(8191&d)&&(o+=13,d>>>=13),!(127&d)&&(o+=7,d>>>=7),!(15&d)&&(o+=4,d>>>=4),!(3&d)&&(o+=2,d>>>=2),!(1&d)&&o++,o},s.prototype.bitLength=function(){var x=this.words[this.length-1],d=this._countBits(x);return 26*(this.length-1)+d},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var x=0,d=0;dx.length?this.clone().ior(x):x.clone().ior(this)},s.prototype.uor=function(x){return this.length>x.length?this.clone().iuor(x):x.clone().iuor(this)},s.prototype.iuand=function(x){var d;d=this.length>x.length?x:this;for(var o=0;ox.length?this.clone().iand(x):x.clone().iand(this)},s.prototype.uand=function(x){return this.length>x.length?this.clone().iuand(x):x.clone().iuand(this)},s.prototype.iuxor=function(x){var d,o;this.length>x.length?(d=this,o=x):(d=x,o=this);for(var a=0;ax.length?this.clone().ixor(x):x.clone().ixor(this)},s.prototype.uxor=function(x){return this.length>x.length?this.clone().iuxor(x):x.clone().iuxor(this)},s.prototype.inotn=function(x){e(typeof x=="number"&&x>=0);var d=0|Math.ceil(x/26),o=x%26;this._expand(d),o>0&&d--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-o),this._strip()},s.prototype.notn=function(x){return this.clone().inotn(x)},s.prototype.setn=function(x,d){e(typeof x=="number"&&x>=0);var o=x/26|0,a=x%26;return this._expand(o+1),this.words[o]=d?this.words[o]|1<x.length?(o=this,a=x):(o=x,a=this);for(var f=0,h=0;h>>26;for(;f!==0&&h>>26;if(this.length=o.length,f!==0)this.words[this.length]=f,this.length++;else if(o!==this)for(;hx.length?this.clone().iadd(x):x.clone().iadd(this)},s.prototype.isub=function(x){if(x.negative!==0){x.negative=0;var d=this.iadd(x);return x.negative=1,d._normSign()}if(this.negative!==0)return this.negative=0,this.iadd(x),this.negative=1,this._normSign();var o,a,f=this.cmp(x);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;f>0?(o=this,a=x):(o=x,a=this);for(var h=0,g=0;g>26,this.words[g]=67108863&d;for(;h!==0&&g>26,this.words[g]=67108863&d;if(h===0&&g>>13,q=0|g[1],z=8191&q,W=q>>>13,ot=0|g[2],ut=8191&ot,Ct=ot>>>13,yt=0|g[3],mt=8191&yt,jt=yt>>>13,dt=0|g[4],ct=8191&dt,Tt=dt>>>13,kt=0|g[5],S=8191&kt,C=kt>>>13,O=0|g[6],F=8191&O,et=O>>>13,Q=0|g[7],it=8191&Q,qt=Q>>>13,It=0|g[8],xt=8191&It,Qt=It>>>13,Rt=0|g[9],Dt=8191&Rt,Se=Rt>>>13,te=0|A[0],Ut=8191&te,Te=te>>>13,J=0|A[1],X=8191&J,st=J>>>13,D=0|A[2],K=8191&D,gt=D>>>13,ft=0|A[3],pt=8191&ft,vt=ft>>>13,At=0|A[4],_t=8191&At,Wt=At>>>13,Pt=0|A[5],wt=8191&Pt,se=Pt>>>13,Lt=0|A[6],Et=8191&Lt,de=Lt>>>13,Bt=0|A[7],Mt=8191&Bt,$=Bt>>>13,G=0|A[8],H=8191&G,N=G>>>13,V=0|A[9],tt=8191&V,lt=V>>>13;o.negative=x.negative^d.negative,o.length=19;var at=(b+(a=Math.imul(m,Ut))|0)+((8191&(f=(f=Math.imul(m,Te))+Math.imul(L,Ut)|0))<<13)|0;b=((h=Math.imul(L,Te))+(f>>>13)|0)+(at>>>26)|0,at&=67108863,a=Math.imul(z,Ut),f=(f=Math.imul(z,Te))+Math.imul(W,Ut)|0,h=Math.imul(W,Te);var ht=(b+(a=a+Math.imul(m,X)|0)|0)+((8191&(f=(f=f+Math.imul(m,st)|0)+Math.imul(L,X)|0))<<13)|0;b=((h=h+Math.imul(L,st)|0)+(f>>>13)|0)+(ht>>>26)|0,ht&=67108863,a=Math.imul(ut,Ut),f=(f=Math.imul(ut,Te))+Math.imul(Ct,Ut)|0,h=Math.imul(Ct,Te),a=a+Math.imul(z,X)|0,f=(f=f+Math.imul(z,st)|0)+Math.imul(W,X)|0,h=h+Math.imul(W,st)|0;var zt=(b+(a=a+Math.imul(m,K)|0)|0)+((8191&(f=(f=f+Math.imul(m,gt)|0)+Math.imul(L,K)|0))<<13)|0;b=((h=h+Math.imul(L,gt)|0)+(f>>>13)|0)+(zt>>>26)|0,zt&=67108863,a=Math.imul(mt,Ut),f=(f=Math.imul(mt,Te))+Math.imul(jt,Ut)|0,h=Math.imul(jt,Te),a=a+Math.imul(ut,X)|0,f=(f=f+Math.imul(ut,st)|0)+Math.imul(Ct,X)|0,h=h+Math.imul(Ct,st)|0,a=a+Math.imul(z,K)|0,f=(f=f+Math.imul(z,gt)|0)+Math.imul(W,K)|0,h=h+Math.imul(W,gt)|0;var Zt=(b+(a=a+Math.imul(m,pt)|0)|0)+((8191&(f=(f=f+Math.imul(m,vt)|0)+Math.imul(L,pt)|0))<<13)|0;b=((h=h+Math.imul(L,vt)|0)+(f>>>13)|0)+(Zt>>>26)|0,Zt&=67108863,a=Math.imul(ct,Ut),f=(f=Math.imul(ct,Te))+Math.imul(Tt,Ut)|0,h=Math.imul(Tt,Te),a=a+Math.imul(mt,X)|0,f=(f=f+Math.imul(mt,st)|0)+Math.imul(jt,X)|0,h=h+Math.imul(jt,st)|0,a=a+Math.imul(ut,K)|0,f=(f=f+Math.imul(ut,gt)|0)+Math.imul(Ct,K)|0,h=h+Math.imul(Ct,gt)|0,a=a+Math.imul(z,pt)|0,f=(f=f+Math.imul(z,vt)|0)+Math.imul(W,pt)|0,h=h+Math.imul(W,vt)|0;var ye=(b+(a=a+Math.imul(m,_t)|0)|0)+((8191&(f=(f=f+Math.imul(m,Wt)|0)+Math.imul(L,_t)|0))<<13)|0;b=((h=h+Math.imul(L,Wt)|0)+(f>>>13)|0)+(ye>>>26)|0,ye&=67108863,a=Math.imul(S,Ut),f=(f=Math.imul(S,Te))+Math.imul(C,Ut)|0,h=Math.imul(C,Te),a=a+Math.imul(ct,X)|0,f=(f=f+Math.imul(ct,st)|0)+Math.imul(Tt,X)|0,h=h+Math.imul(Tt,st)|0,a=a+Math.imul(mt,K)|0,f=(f=f+Math.imul(mt,gt)|0)+Math.imul(jt,K)|0,h=h+Math.imul(jt,gt)|0,a=a+Math.imul(ut,pt)|0,f=(f=f+Math.imul(ut,vt)|0)+Math.imul(Ct,pt)|0,h=h+Math.imul(Ct,vt)|0,a=a+Math.imul(z,_t)|0,f=(f=f+Math.imul(z,Wt)|0)+Math.imul(W,_t)|0,h=h+Math.imul(W,Wt)|0;var Yt=(b+(a=a+Math.imul(m,wt)|0)|0)+((8191&(f=(f=f+Math.imul(m,se)|0)+Math.imul(L,wt)|0))<<13)|0;b=((h=h+Math.imul(L,se)|0)+(f>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(F,Ut),f=(f=Math.imul(F,Te))+Math.imul(et,Ut)|0,h=Math.imul(et,Te),a=a+Math.imul(S,X)|0,f=(f=f+Math.imul(S,st)|0)+Math.imul(C,X)|0,h=h+Math.imul(C,st)|0,a=a+Math.imul(ct,K)|0,f=(f=f+Math.imul(ct,gt)|0)+Math.imul(Tt,K)|0,h=h+Math.imul(Tt,gt)|0,a=a+Math.imul(mt,pt)|0,f=(f=f+Math.imul(mt,vt)|0)+Math.imul(jt,pt)|0,h=h+Math.imul(jt,vt)|0,a=a+Math.imul(ut,_t)|0,f=(f=f+Math.imul(ut,Wt)|0)+Math.imul(Ct,_t)|0,h=h+Math.imul(Ct,Wt)|0,a=a+Math.imul(z,wt)|0,f=(f=f+Math.imul(z,se)|0)+Math.imul(W,wt)|0,h=h+Math.imul(W,se)|0;var pe=(b+(a=a+Math.imul(m,Et)|0)|0)+((8191&(f=(f=f+Math.imul(m,de)|0)+Math.imul(L,Et)|0))<<13)|0;b=((h=h+Math.imul(L,de)|0)+(f>>>13)|0)+(pe>>>26)|0,pe&=67108863,a=Math.imul(it,Ut),f=(f=Math.imul(it,Te))+Math.imul(qt,Ut)|0,h=Math.imul(qt,Te),a=a+Math.imul(F,X)|0,f=(f=f+Math.imul(F,st)|0)+Math.imul(et,X)|0,h=h+Math.imul(et,st)|0,a=a+Math.imul(S,K)|0,f=(f=f+Math.imul(S,gt)|0)+Math.imul(C,K)|0,h=h+Math.imul(C,gt)|0,a=a+Math.imul(ct,pt)|0,f=(f=f+Math.imul(ct,vt)|0)+Math.imul(Tt,pt)|0,h=h+Math.imul(Tt,vt)|0,a=a+Math.imul(mt,_t)|0,f=(f=f+Math.imul(mt,Wt)|0)+Math.imul(jt,_t)|0,h=h+Math.imul(jt,Wt)|0,a=a+Math.imul(ut,wt)|0,f=(f=f+Math.imul(ut,se)|0)+Math.imul(Ct,wt)|0,h=h+Math.imul(Ct,se)|0,a=a+Math.imul(z,Et)|0,f=(f=f+Math.imul(z,de)|0)+Math.imul(W,Et)|0,h=h+Math.imul(W,de)|0;var ve=(b+(a=a+Math.imul(m,Mt)|0)|0)+((8191&(f=(f=f+Math.imul(m,$)|0)+Math.imul(L,Mt)|0))<<13)|0;b=((h=h+Math.imul(L,$)|0)+(f>>>13)|0)+(ve>>>26)|0,ve&=67108863,a=Math.imul(xt,Ut),f=(f=Math.imul(xt,Te))+Math.imul(Qt,Ut)|0,h=Math.imul(Qt,Te),a=a+Math.imul(it,X)|0,f=(f=f+Math.imul(it,st)|0)+Math.imul(qt,X)|0,h=h+Math.imul(qt,st)|0,a=a+Math.imul(F,K)|0,f=(f=f+Math.imul(F,gt)|0)+Math.imul(et,K)|0,h=h+Math.imul(et,gt)|0,a=a+Math.imul(S,pt)|0,f=(f=f+Math.imul(S,vt)|0)+Math.imul(C,pt)|0,h=h+Math.imul(C,vt)|0,a=a+Math.imul(ct,_t)|0,f=(f=f+Math.imul(ct,Wt)|0)+Math.imul(Tt,_t)|0,h=h+Math.imul(Tt,Wt)|0,a=a+Math.imul(mt,wt)|0,f=(f=f+Math.imul(mt,se)|0)+Math.imul(jt,wt)|0,h=h+Math.imul(jt,se)|0,a=a+Math.imul(ut,Et)|0,f=(f=f+Math.imul(ut,de)|0)+Math.imul(Ct,Et)|0,h=h+Math.imul(Ct,de)|0,a=a+Math.imul(z,Mt)|0,f=(f=f+Math.imul(z,$)|0)+Math.imul(W,Mt)|0,h=h+Math.imul(W,$)|0;var ge=(b+(a=a+Math.imul(m,H)|0)|0)+((8191&(f=(f=f+Math.imul(m,N)|0)+Math.imul(L,H)|0))<<13)|0;b=((h=h+Math.imul(L,N)|0)+(f>>>13)|0)+(ge>>>26)|0,ge&=67108863,a=Math.imul(Dt,Ut),f=(f=Math.imul(Dt,Te))+Math.imul(Se,Ut)|0,h=Math.imul(Se,Te),a=a+Math.imul(xt,X)|0,f=(f=f+Math.imul(xt,st)|0)+Math.imul(Qt,X)|0,h=h+Math.imul(Qt,st)|0,a=a+Math.imul(it,K)|0,f=(f=f+Math.imul(it,gt)|0)+Math.imul(qt,K)|0,h=h+Math.imul(qt,gt)|0,a=a+Math.imul(F,pt)|0,f=(f=f+Math.imul(F,vt)|0)+Math.imul(et,pt)|0,h=h+Math.imul(et,vt)|0,a=a+Math.imul(S,_t)|0,f=(f=f+Math.imul(S,Wt)|0)+Math.imul(C,_t)|0,h=h+Math.imul(C,Wt)|0,a=a+Math.imul(ct,wt)|0,f=(f=f+Math.imul(ct,se)|0)+Math.imul(Tt,wt)|0,h=h+Math.imul(Tt,se)|0,a=a+Math.imul(mt,Et)|0,f=(f=f+Math.imul(mt,de)|0)+Math.imul(jt,Et)|0,h=h+Math.imul(jt,de)|0,a=a+Math.imul(ut,Mt)|0,f=(f=f+Math.imul(ut,$)|0)+Math.imul(Ct,Mt)|0,h=h+Math.imul(Ct,$)|0,a=a+Math.imul(z,H)|0,f=(f=f+Math.imul(z,N)|0)+Math.imul(W,H)|0,h=h+Math.imul(W,N)|0;var ie=(b+(a=a+Math.imul(m,tt)|0)|0)+((8191&(f=(f=f+Math.imul(m,lt)|0)+Math.imul(L,tt)|0))<<13)|0;b=((h=h+Math.imul(L,lt)|0)+(f>>>13)|0)+(ie>>>26)|0,ie&=67108863,a=Math.imul(Dt,X),f=(f=Math.imul(Dt,st))+Math.imul(Se,X)|0,h=Math.imul(Se,st),a=a+Math.imul(xt,K)|0,f=(f=f+Math.imul(xt,gt)|0)+Math.imul(Qt,K)|0,h=h+Math.imul(Qt,gt)|0,a=a+Math.imul(it,pt)|0,f=(f=f+Math.imul(it,vt)|0)+Math.imul(qt,pt)|0,h=h+Math.imul(qt,vt)|0,a=a+Math.imul(F,_t)|0,f=(f=f+Math.imul(F,Wt)|0)+Math.imul(et,_t)|0,h=h+Math.imul(et,Wt)|0,a=a+Math.imul(S,wt)|0,f=(f=f+Math.imul(S,se)|0)+Math.imul(C,wt)|0,h=h+Math.imul(C,se)|0,a=a+Math.imul(ct,Et)|0,f=(f=f+Math.imul(ct,de)|0)+Math.imul(Tt,Et)|0,h=h+Math.imul(Tt,de)|0,a=a+Math.imul(mt,Mt)|0,f=(f=f+Math.imul(mt,$)|0)+Math.imul(jt,Mt)|0,h=h+Math.imul(jt,$)|0,a=a+Math.imul(ut,H)|0,f=(f=f+Math.imul(ut,N)|0)+Math.imul(Ct,H)|0,h=h+Math.imul(Ct,N)|0;var ue=(b+(a=a+Math.imul(z,tt)|0)|0)+((8191&(f=(f=f+Math.imul(z,lt)|0)+Math.imul(W,tt)|0))<<13)|0;b=((h=h+Math.imul(W,lt)|0)+(f>>>13)|0)+(ue>>>26)|0,ue&=67108863,a=Math.imul(Dt,K),f=(f=Math.imul(Dt,gt))+Math.imul(Se,K)|0,h=Math.imul(Se,gt),a=a+Math.imul(xt,pt)|0,f=(f=f+Math.imul(xt,vt)|0)+Math.imul(Qt,pt)|0,h=h+Math.imul(Qt,vt)|0,a=a+Math.imul(it,_t)|0,f=(f=f+Math.imul(it,Wt)|0)+Math.imul(qt,_t)|0,h=h+Math.imul(qt,Wt)|0,a=a+Math.imul(F,wt)|0,f=(f=f+Math.imul(F,se)|0)+Math.imul(et,wt)|0,h=h+Math.imul(et,se)|0,a=a+Math.imul(S,Et)|0,f=(f=f+Math.imul(S,de)|0)+Math.imul(C,Et)|0,h=h+Math.imul(C,de)|0,a=a+Math.imul(ct,Mt)|0,f=(f=f+Math.imul(ct,$)|0)+Math.imul(Tt,Mt)|0,h=h+Math.imul(Tt,$)|0,a=a+Math.imul(mt,H)|0,f=(f=f+Math.imul(mt,N)|0)+Math.imul(jt,H)|0,h=h+Math.imul(jt,N)|0;var fe=(b+(a=a+Math.imul(ut,tt)|0)|0)+((8191&(f=(f=f+Math.imul(ut,lt)|0)+Math.imul(Ct,tt)|0))<<13)|0;b=((h=h+Math.imul(Ct,lt)|0)+(f>>>13)|0)+(fe>>>26)|0,fe&=67108863,a=Math.imul(Dt,pt),f=(f=Math.imul(Dt,vt))+Math.imul(Se,pt)|0,h=Math.imul(Se,vt),a=a+Math.imul(xt,_t)|0,f=(f=f+Math.imul(xt,Wt)|0)+Math.imul(Qt,_t)|0,h=h+Math.imul(Qt,Wt)|0,a=a+Math.imul(it,wt)|0,f=(f=f+Math.imul(it,se)|0)+Math.imul(qt,wt)|0,h=h+Math.imul(qt,se)|0,a=a+Math.imul(F,Et)|0,f=(f=f+Math.imul(F,de)|0)+Math.imul(et,Et)|0,h=h+Math.imul(et,de)|0,a=a+Math.imul(S,Mt)|0,f=(f=f+Math.imul(S,$)|0)+Math.imul(C,Mt)|0,h=h+Math.imul(C,$)|0,a=a+Math.imul(ct,H)|0,f=(f=f+Math.imul(ct,N)|0)+Math.imul(Tt,H)|0,h=h+Math.imul(Tt,N)|0;var ce=(b+(a=a+Math.imul(mt,tt)|0)|0)+((8191&(f=(f=f+Math.imul(mt,lt)|0)+Math.imul(jt,tt)|0))<<13)|0;b=((h=h+Math.imul(jt,lt)|0)+(f>>>13)|0)+(ce>>>26)|0,ce&=67108863,a=Math.imul(Dt,_t),f=(f=Math.imul(Dt,Wt))+Math.imul(Se,_t)|0,h=Math.imul(Se,Wt),a=a+Math.imul(xt,wt)|0,f=(f=f+Math.imul(xt,se)|0)+Math.imul(Qt,wt)|0,h=h+Math.imul(Qt,se)|0,a=a+Math.imul(it,Et)|0,f=(f=f+Math.imul(it,de)|0)+Math.imul(qt,Et)|0,h=h+Math.imul(qt,de)|0,a=a+Math.imul(F,Mt)|0,f=(f=f+Math.imul(F,$)|0)+Math.imul(et,Mt)|0,h=h+Math.imul(et,$)|0,a=a+Math.imul(S,H)|0,f=(f=f+Math.imul(S,N)|0)+Math.imul(C,H)|0,h=h+Math.imul(C,N)|0;var $t=(b+(a=a+Math.imul(ct,tt)|0)|0)+((8191&(f=(f=f+Math.imul(ct,lt)|0)+Math.imul(Tt,tt)|0))<<13)|0;b=((h=h+Math.imul(Tt,lt)|0)+(f>>>13)|0)+($t>>>26)|0,$t&=67108863,a=Math.imul(Dt,wt),f=(f=Math.imul(Dt,se))+Math.imul(Se,wt)|0,h=Math.imul(Se,se),a=a+Math.imul(xt,Et)|0,f=(f=f+Math.imul(xt,de)|0)+Math.imul(Qt,Et)|0,h=h+Math.imul(Qt,de)|0,a=a+Math.imul(it,Mt)|0,f=(f=f+Math.imul(it,$)|0)+Math.imul(qt,Mt)|0,h=h+Math.imul(qt,$)|0,a=a+Math.imul(F,H)|0,f=(f=f+Math.imul(F,N)|0)+Math.imul(et,H)|0,h=h+Math.imul(et,N)|0;var oe=(b+(a=a+Math.imul(S,tt)|0)|0)+((8191&(f=(f=f+Math.imul(S,lt)|0)+Math.imul(C,tt)|0))<<13)|0;b=((h=h+Math.imul(C,lt)|0)+(f>>>13)|0)+(oe>>>26)|0,oe&=67108863,a=Math.imul(Dt,Et),f=(f=Math.imul(Dt,de))+Math.imul(Se,Et)|0,h=Math.imul(Se,de),a=a+Math.imul(xt,Mt)|0,f=(f=f+Math.imul(xt,$)|0)+Math.imul(Qt,Mt)|0,h=h+Math.imul(Qt,$)|0,a=a+Math.imul(it,H)|0,f=(f=f+Math.imul(it,N)|0)+Math.imul(qt,H)|0,h=h+Math.imul(qt,N)|0;var Jt=(b+(a=a+Math.imul(F,tt)|0)|0)+((8191&(f=(f=f+Math.imul(F,lt)|0)+Math.imul(et,tt)|0))<<13)|0;b=((h=h+Math.imul(et,lt)|0)+(f>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(Dt,Mt),f=(f=Math.imul(Dt,$))+Math.imul(Se,Mt)|0,h=Math.imul(Se,$),a=a+Math.imul(xt,H)|0,f=(f=f+Math.imul(xt,N)|0)+Math.imul(Qt,H)|0,h=h+Math.imul(Qt,N)|0;var le=(b+(a=a+Math.imul(it,tt)|0)|0)+((8191&(f=(f=f+Math.imul(it,lt)|0)+Math.imul(qt,tt)|0))<<13)|0;b=((h=h+Math.imul(qt,lt)|0)+(f>>>13)|0)+(le>>>26)|0,le&=67108863,a=Math.imul(Dt,H),f=(f=Math.imul(Dt,N))+Math.imul(Se,H)|0,h=Math.imul(Se,N);var ae=(b+(a=a+Math.imul(xt,tt)|0)|0)+((8191&(f=(f=f+Math.imul(xt,lt)|0)+Math.imul(Qt,tt)|0))<<13)|0;b=((h=h+Math.imul(Qt,lt)|0)+(f>>>13)|0)+(ae>>>26)|0,ae&=67108863;var ne=(b+(a=Math.imul(Dt,tt))|0)+((8191&(f=(f=Math.imul(Dt,lt))+Math.imul(Se,tt)|0))<<13)|0;return b=((h=Math.imul(Se,lt))+(f>>>13)|0)+(ne>>>26)|0,ne&=67108863,I[0]=at,I[1]=ht,I[2]=zt,I[3]=Zt,I[4]=ye,I[5]=Yt,I[6]=pe,I[7]=ve,I[8]=ge,I[9]=ie,I[10]=ue,I[11]=fe,I[12]=ce,I[13]=$t,I[14]=oe,I[15]=Jt,I[16]=le,I[17]=ae,I[18]=ne,b!==0&&(I[19]=b,o.length++),o};function B(x,d,o){o.negative=d.negative^x.negative,o.length=x.length+d.length;for(var a=0,f=0,h=0;h>>26)|0)>>>26,g&=67108863}o.words[h]=A,a=g,g=f}return a!==0?o.words[h]=a:o.length--,o._strip()}function P(x,d,o){return B(x,d,o)}Math.imul||(k=_),s.prototype.mulTo=function(x,d){var o=this.length+x.length;return this.length===10&&x.length===10?k(this,x,d):o<63?_(this,x,d):o<1024?B(this,x,d):P(this,x,d)},s.prototype.mul=function(x){var d=new s(null);return d.words=new Array(this.length+x.length),this.mulTo(x,d)},s.prototype.mulf=function(x){var d=new s(null);return d.words=new Array(this.length+x.length),P(this,x,d)},s.prototype.imul=function(x){return this.clone().mulTo(x,this)},s.prototype.imuln=function(x){var d=x<0;d&&(x=-x),e(typeof x=="number"),e(x<67108864);for(var o=0,a=0;a>=26,o+=f/67108864|0,o+=h>>>26,this.words[a]=67108863&h}return o!==0&&(this.words[a]=o,this.length++),d?this.ineg():this},s.prototype.muln=function(x){return this.clone().imuln(x)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(x){var d=function(h){for(var g=new Array(h.bitLength()),A=0;A>>b&1}return g}(x);if(d.length===0)return new s(1);for(var o=this,a=0;a=0);var d,o=x%26,a=(x-o)/26,f=67108863>>>26-o<<26-o;if(o!==0){var h=0;for(d=0;d>>26-o}h&&(this.words[d]=h,this.length++)}if(a!==0){for(d=this.length-1;d>=0;d--)this.words[d+a]=this.words[d];for(d=0;d=0),a=d?(d-d%26)/26:0;var f=x%26,h=Math.min((x-f)/26,this.length),g=67108863^67108863>>>f<h)for(this.length-=h,I=0;I=0&&(b!==0||I>=a);I--){var u=0|this.words[I];this.words[I]=b<<26-f|u>>>f,b=u&g}return A&&b!==0&&(A.words[A.length++]=b),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(x,d,o){return e(this.negative===0),this.iushrn(x,d,o)},s.prototype.shln=function(x){return this.clone().ishln(x)},s.prototype.ushln=function(x){return this.clone().iushln(x)},s.prototype.shrn=function(x){return this.clone().ishrn(x)},s.prototype.ushrn=function(x){return this.clone().iushrn(x)},s.prototype.testn=function(x){e(typeof x=="number"&&x>=0);var d=x%26,o=(x-d)/26,a=1<=0);var d=x%26,o=(x-d)/26;if(e(this.negative===0,"imaskn works only with positive numbers"),this.length<=o)return this;if(d!==0&&o++,this.length=Math.min(o,this.length),d!==0){var a=67108863^67108863>>>d<=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},s.prototype.isubn=function(x){if(e(typeof x=="number"),e(x<67108864),x<0)return this.iaddn(-x);if(this.negative!==0)return this.negative=0,this.iaddn(x),this.negative=1,this;if(this.words[0]-=x,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d>26)-(A/67108864|0),this.words[a+o]=67108863&f}for(;a>26,this.words[a+o]=67108863&f;if(g===0)return this._strip();for(e(g===-1),g=0,a=0;a>26,this.words[a]=67108863&f;return this.negative=1,this._strip()},s.prototype._wordDiv=function(x,d){var o=(this.length,x.length),a=this.clone(),f=x,h=0|f.words[f.length-1];(o=26-this._countBits(h))!=0&&(f=f.ushln(o),a.iushln(o),h=0|f.words[f.length-1]);var g,A=a.length-f.length;if(d!=="mod"){(g=new s(null)).length=A+1,g.words=new Array(g.length);for(var I=0;I=0;u--){var m=67108864*(0|a.words[f.length+u])+(0|a.words[f.length+u-1]);for(m=Math.min(m/h|0,67108863),a._ishlnsubmul(f,m,u);a.negative!==0;)m--,a.negative=0,a._ishlnsubmul(f,1,u),a.isZero()||(a.negative^=1);g&&(g.words[u]=m)}return g&&g._strip(),a._strip(),d!=="div"&&o!==0&&a.iushrn(o),{div:g||null,mod:a}},s.prototype.divmod=function(x,d,o){return e(!x.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:this.negative!==0&&x.negative===0?(h=this.neg().divmod(x,d),d!=="mod"&&(a=h.div.neg()),d!=="div"&&(f=h.mod.neg(),o&&f.negative!==0&&f.iadd(x)),{div:a,mod:f}):this.negative===0&&x.negative!==0?(h=this.divmod(x.neg(),d),d!=="mod"&&(a=h.div.neg()),{div:a,mod:h.mod}):this.negative&x.negative?(h=this.neg().divmod(x.neg(),d),d!=="div"&&(f=h.mod.neg(),o&&f.negative!==0&&f.isub(x)),{div:h.div,mod:f}):x.length>this.length||this.cmp(x)<0?{div:new s(0),mod:this}:x.length===1?d==="div"?{div:this.divn(x.words[0]),mod:null}:d==="mod"?{div:null,mod:new s(this.modrn(x.words[0]))}:{div:this.divn(x.words[0]),mod:new s(this.modrn(x.words[0]))}:this._wordDiv(x,d);var a,f,h},s.prototype.div=function(x){return this.divmod(x,"div",!1).div},s.prototype.mod=function(x){return this.divmod(x,"mod",!1).mod},s.prototype.umod=function(x){return this.divmod(x,"mod",!0).mod},s.prototype.divRound=function(x){var d=this.divmod(x);if(d.mod.isZero())return d.div;var o=d.div.negative!==0?d.mod.isub(x):d.mod,a=x.ushrn(1),f=x.andln(1),h=o.cmp(a);return h<0||f===1&&h===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},s.prototype.modrn=function(x){var d=x<0;d&&(x=-x),e(x<=67108863);for(var o=(1<<26)%x,a=0,f=this.length-1;f>=0;f--)a=(o*a+(0|this.words[f]))%x;return d?-a:a},s.prototype.modn=function(x){return this.modrn(x)},s.prototype.idivn=function(x){var d=x<0;d&&(x=-x),e(x<=67108863);for(var o=0,a=this.length-1;a>=0;a--){var f=(0|this.words[a])+67108864*o;this.words[a]=f/x|0,o=f%x}return this._strip(),d?this.ineg():this},s.prototype.divn=function(x){return this.clone().idivn(x)},s.prototype.egcd=function(x){e(x.negative===0),e(!x.isZero());var d=this,o=x.clone();d=d.negative!==0?d.umod(x):d.clone();for(var a=new s(1),f=new s(0),h=new s(0),g=new s(1),A=0;d.isEven()&&o.isEven();)d.iushrn(1),o.iushrn(1),++A;for(var I=o.clone(),b=d.clone();!d.isZero();){for(var u=0,m=1;!(d.words[0]&m)&&u<26;++u,m<<=1);if(u>0)for(d.iushrn(u);u-- >0;)(a.isOdd()||f.isOdd())&&(a.iadd(I),f.isub(b)),a.iushrn(1),f.iushrn(1);for(var L=0,q=1;!(o.words[0]&q)&&L<26;++L,q<<=1);if(L>0)for(o.iushrn(L);L-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(I),g.isub(b)),h.iushrn(1),g.iushrn(1);d.cmp(o)>=0?(d.isub(o),a.isub(h),f.isub(g)):(o.isub(d),h.isub(a),g.isub(f))}return{a:h,b:g,gcd:o.iushln(A)}},s.prototype._invmp=function(x){e(x.negative===0),e(!x.isZero());var d=this,o=x.clone();d=d.negative!==0?d.umod(x):d.clone();for(var a,f=new s(1),h=new s(0),g=o.clone();d.cmpn(1)>0&&o.cmpn(1)>0;){for(var A=0,I=1;!(d.words[0]&I)&&A<26;++A,I<<=1);if(A>0)for(d.iushrn(A);A-- >0;)f.isOdd()&&f.iadd(g),f.iushrn(1);for(var b=0,u=1;!(o.words[0]&u)&&b<26;++b,u<<=1);if(b>0)for(o.iushrn(b);b-- >0;)h.isOdd()&&h.iadd(g),h.iushrn(1);d.cmp(o)>=0?(d.isub(o),f.isub(h)):(o.isub(d),h.isub(f))}return(a=d.cmpn(1)===0?f:h).cmpn(0)<0&&a.iadd(x),a},s.prototype.gcd=function(x){if(this.isZero())return x.abs();if(x.isZero())return this.abs();var d=this.clone(),o=x.clone();d.negative=0,o.negative=0;for(var a=0;d.isEven()&&o.isEven();a++)d.iushrn(1),o.iushrn(1);for(;;){for(;d.isEven();)d.iushrn(1);for(;o.isEven();)o.iushrn(1);var f=d.cmp(o);if(f<0){var h=d;d=o,o=h}else if(f===0||o.cmpn(1)===0)break;d.isub(o)}return o.iushln(a)},s.prototype.invm=function(x){return this.egcd(x).a.umod(x)},s.prototype.isEven=function(){return(1&this.words[0])==0},s.prototype.isOdd=function(){return(1&this.words[0])==1},s.prototype.andln=function(x){return this.words[0]&x},s.prototype.bincn=function(x){e(typeof x=="number");var d=x%26,o=(x-d)/26,a=1<>>26,g&=67108863,this.words[h]=g}return f!==0&&(this.words[h]=f,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(x){var d,o=x<0;if(this.negative!==0&&!o)return-1;if(this.negative===0&&o)return 1;if(this._strip(),this.length>1)d=1;else{o&&(x=-x),e(x<=67108863,"Number is too big");var a=0|this.words[0];d=a===x?0:ax.length)return 1;if(this.length=0;o--){var a=0|this.words[o],f=0|x.words[o];if(a!==f){af&&(d=1);break}}return d},s.prototype.gtn=function(x){return this.cmpn(x)===1},s.prototype.gt=function(x){return this.cmp(x)===1},s.prototype.gten=function(x){return this.cmpn(x)>=0},s.prototype.gte=function(x){return this.cmp(x)>=0},s.prototype.ltn=function(x){return this.cmpn(x)===-1},s.prototype.lt=function(x){return this.cmp(x)===-1},s.prototype.lten=function(x){return this.cmpn(x)<=0},s.prototype.lte=function(x){return this.cmp(x)<=0},s.prototype.eqn=function(x){return this.cmpn(x)===0},s.prototype.eq=function(x){return this.cmp(x)===0},s.red=function(x){return new nt(x)},s.prototype.toRed=function(x){return e(!this.red,"Already a number in reduction context"),e(this.negative===0,"red works only with positives"),x.convertTo(this)._forceRed(x)},s.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(x){return this.red=x,this},s.prototype.forceRed=function(x){return e(!this.red,"Already a number in reduction context"),this._forceRed(x)},s.prototype.redAdd=function(x){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,x)},s.prototype.redIAdd=function(x){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,x)},s.prototype.redSub=function(x){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,x)},s.prototype.redISub=function(x){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,x)},s.prototype.redShl=function(x){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,x)},s.prototype.redMul=function(x){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,x),this.red.mul(this,x)},s.prototype.redIMul=function(x){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,x),this.red.imul(this,x)},s.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(x){return e(this.red&&!x.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,x)};var R={k256:null,p224:null,p192:null,p25519:null};function T(x,d){this.name=x,this.p=new s(d,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function U(){T.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function j(){T.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function Y(){T.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function rt(){T.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function nt(x){if(typeof x=="string"){var d=s._prime(x);this.m=d.p,this.prime=d}else e(x.gtn(1),"modulus must be greater than 1"),this.m=x,this.prime=null}function Z(x){nt.call(this,x),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(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)}T.prototype._tmp=function(){var x=new s(null);return x.words=new Array(Math.ceil(this.n/13)),x},T.prototype.ireduce=function(x){var d,o=x;do this.split(o,this.tmp),d=(o=(o=this.imulK(o)).iadd(this.tmp)).bitLength();while(d>this.n);var a=d0?o.isub(this.p):o.strip!==void 0?o.strip():o._strip(),o},T.prototype.split=function(x,d){x.iushrn(this.n,0,d)},T.prototype.imulK=function(x){return x.imul(this.k)},n(U,T),U.prototype.split=function(x,d){for(var o=4194303,a=Math.min(x.length,9),f=0;f>>22,h=g}h>>>=22,x.words[f-10]=h,h===0&&x.length>10?x.length-=10:x.length-=9},U.prototype.imulK=function(x){x.words[x.length]=0,x.words[x.length+1]=0,x.length+=2;for(var d=0,o=0;o>>=26,x.words[o]=f,d=a}return d!==0&&(x.words[x.length++]=d),x},s._prime=function(x){if(R[x])return R[x];var d;if(x==="k256")d=new U;else if(x==="p224")d=new j;else if(x==="p192")d=new Y;else{if(x!=="p25519")throw new Error("Unknown prime "+x);d=new rt}return R[x]=d,d},nt.prototype._verify1=function(x){e(x.negative===0,"red works only with positives"),e(x.red,"red works only with red numbers")},nt.prototype._verify2=function(x,d){e((x.negative|d.negative)==0,"red works only with positives"),e(x.red&&x.red===d.red,"red works only with red numbers")},nt.prototype.imod=function(x){return this.prime?this.prime.ireduce(x)._forceRed(this):(v(x,x.umod(this.m)._forceRed(this)),x)},nt.prototype.neg=function(x){return x.isZero()?x.clone():this.m.sub(x)._forceRed(this)},nt.prototype.add=function(x,d){this._verify2(x,d);var o=x.add(d);return o.cmp(this.m)>=0&&o.isub(this.m),o._forceRed(this)},nt.prototype.iadd=function(x,d){this._verify2(x,d);var o=x.iadd(d);return o.cmp(this.m)>=0&&o.isub(this.m),o},nt.prototype.sub=function(x,d){this._verify2(x,d);var o=x.sub(d);return o.cmpn(0)<0&&o.iadd(this.m),o._forceRed(this)},nt.prototype.isub=function(x,d){this._verify2(x,d);var o=x.isub(d);return o.cmpn(0)<0&&o.iadd(this.m),o},nt.prototype.shl=function(x,d){return this._verify1(x),this.imod(x.ushln(d))},nt.prototype.imul=function(x,d){return this._verify2(x,d),this.imod(x.imul(d))},nt.prototype.mul=function(x,d){return this._verify2(x,d),this.imod(x.mul(d))},nt.prototype.isqr=function(x){return this.imul(x,x.clone())},nt.prototype.sqr=function(x){return this.mul(x,x)},nt.prototype.sqrt=function(x){if(x.isZero())return x.clone();var d=this.m.andln(3);if(e(d%2==1),d===3){var o=this.m.add(new s(1)).iushrn(2);return this.pow(x,o)}for(var a=this.m.subn(1),f=0;!a.isZero()&&a.andln(1)===0;)f++,a.iushrn(1);e(!a.isZero());var h=new s(1).toRed(this),g=h.redNeg(),A=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,A).cmp(g)!==0;)I.redIAdd(g);for(var b=this.pow(I,a),u=this.pow(x,a.addn(1).iushrn(1)),m=this.pow(x,a),L=f;m.cmp(h)!==0;){for(var q=m,z=0;q.cmp(h)!==0;z++)q=q.redSqr();e(z=0;a--){for(var I=d.words[a],b=A-1;b>=0;b--){var u=I>>b&1;f!==o[0]&&(f=this.sqr(f)),u!==0||h!==0?(h<<=1,h|=u,(++g==4||a===0&&b===0)&&(f=this.mul(f,o[h]),g=0,h=0)):g=0}A=26}return f},nt.prototype.convertTo=function(x){var d=x.umod(this.m);return d===x?d.clone():d},nt.prototype.convertFrom=function(x){var d=x.clone();return d.red=null,d},s.mont=function(x){return new Z(x)},n(Z,nt),Z.prototype.convertTo=function(x){return this.imod(x.ushln(this.shift))},Z.prototype.convertFrom=function(x){var d=this.imod(x.mul(this.rinv));return d.red=null,d},Z.prototype.imul=function(x,d){if(x.isZero()||d.isZero())return x.words[0]=0,x.length=1,x;var o=x.imul(d),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=o.isub(a).iushrn(this.shift),h=f;return f.cmp(this.m)>=0?h=f.isub(this.m):f.cmpn(0)<0&&(h=f.iadd(this.m)),h._forceRed(this)},Z.prototype.mul=function(x,d){if(x.isZero()||d.isZero())return new s(0)._forceRed(this);var o=x.mul(d),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=o.isub(a).iushrn(this.shift),h=f;return f.cmp(this.m)>=0?h=f.isub(this.m):f.cmpn(0)<0&&(h=f.iadd(this.m)),h._forceRed(this)},Z.prototype.invm=function(x){return this.imod(x._invmp(this.m).mul(this.r2))._forceRed(this)}})(0,go);var YS=eg.exports,Bx=DS(YS),rg={exports:{}};(function(r,t){var e=Hr,n=e.Buffer;function s(c,l){for(var p in c)l[p]=c[p]}function i(c,l,p){return n(c,l,p)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?r.exports=e:(s(e,t),t.Buffer=i),i.prototype=Object.create(n.prototype),s(n,i),i.from=function(c,l,p){if(typeof c=="number")throw new TypeError("Argument must not be a number");return n(c,l,p)},i.alloc=function(c,l,p){if(typeof c!="number")throw new TypeError("Argument must be a number");var v=n(c);return l!==void 0?typeof p=="string"?v.fill(l,p):v.fill(l):v.fill(0),v},i.allocUnsafe=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return n(c)},i.allocUnsafeSlow=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return e.SlowBuffer(c)}})(rg,rg.exports);var Z0=rg.exports.Buffer,XS=function(r){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),e=0;e>>0,B=new Uint8Array(k);E[M];){var P=t[E.charCodeAt(M)];if(P===255)return;for(var R=0,T=k-1;(P!==0||R<_)&&T!==-1;T--,R++)P+=c*B[T]>>>0,B[T]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");_=R,M++}for(var U=k-_;U!==k&&B[U]===0;)U++;var j=Z0.allocUnsafe(w+(k-U));j.fill(0,0,w);for(var Y=w;U!==k;)j[Y++]=B[U++];return j}return{encode:function(E){if((Array.isArray(E)||E instanceof Uint8Array)&&(E=Z0.from(E)),!Z0.isBuffer(E))throw new TypeError("Expected Buffer");if(E.length===0)return"";for(var M=0,w=0,_=0,k=E.length;_!==k&&E[_]===0;)_++,M++;for(var B=(k-_)*v+1>>>0,P=new Uint8Array(B);_!==k;){for(var R=E[_],T=0,U=B-1;(R!==0||T>>0,P[U]=R%c>>>0,R=R/c>>>0;if(R!==0)throw new Error("Non-zero carry");w=T,_++}for(var j=B-w;j!==B&&P[j]===0;)j++;for(var Y=l.repeat(M);jr&t^r&e^t&e,aW=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]),Ks=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Hs=new Uint32Array(64);class uW extends KS{constructor(){super(64,32,8,!1),this.A=0|Ks[0],this.B=0|Ks[1],this.C=0|Ks[2],this.D=0|Ks[3],this.E=0|Ks[4],this.F=0|Ks[5],this.G=0|Ks[6],this.H=0|Ks[7]}get(){const{A:t,B:e,C:n,D:s,E:i,F:c,G:l,H:p}=this;return[t,e,n,s,i,c,l,p]}set(t,e,n,s,i,c,l,p){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|s,this.E=0|i,this.F=0|c,this.G=0|l,this.H=0|p}process(t,e){for(let M=0;M<16;M++,e+=4)Hs[M]=t.getUint32(e,!1);for(let M=16;M<64;M++){const w=Hs[M-15],_=Hs[M-2],k=Bo(w,7)^Bo(w,18)^w>>>3,B=Bo(_,17)^Bo(_,19)^_>>>10;Hs[M]=B+Hs[M-7]+k+Hs[M-16]|0}let{A:n,B:s,C:i,D:c,E:l,F:p,G:v,H:y}=this;for(let M=0;M<64;M++){const w=y+(Bo(l,6)^Bo(l,11)^Bo(l,25))+((E=l)&p^~E&v)+aW[M]+Hs[M]|0,_=(Bo(n,2)^Bo(n,13)^Bo(n,22))+sW(n,s,i)|0;y=v,v=p,p=l,l=c+w|0,c=i,i=s,s=n,n=w+_|0}var E;n=n+this.A|0,s=s+this.B|0,i=i+this.C|0,c=c+this.D|0,l=l+this.E|0,p=p+this.F|0,v=v+this.G|0,y=y+this.H|0,this.set(n,s,i,c,l,p,v,y)}roundClean(){Hs.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const ng=jS(()=>new uW);var On={};function ks(r,t,e){return t<=r&&r<=e}function Wl(r){if(r===void 0)return{};if(r===Object(r))return r;throw TypeError("Could not convert argument to dictionary")}function ig(r){this.tokens=[].slice.call(r)}ig.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(r){if(Array.isArray(r))for(var t=r;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(r)},push:function(r){if(Array.isArray(r))for(var t=r;t.length;)this.tokens.push(t.shift());else this.tokens.push(r)}};var Fu=-1;function lv(r,t){if(r)throw TypeError("Decoder error");return t||65533}var Gl="utf-8";function Yl(r,t){if(!(this instanceof Yl))return new Yl(r,t);if((r=r!==void 0?String(r).toLowerCase():Gl)!==Gl)throw new Error("Encoding not supported. Only utf-8 is supported");t=Wl(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function Xl(r,t){if(!(this instanceof Xl))return new Xl(r,t);if((r=r!==void 0?String(r).toLowerCase():Gl)!==Gl)throw new Error("Encoding not supported. Only utf-8 is supported");t=Wl(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}function fW(r){var t=r.fatal,e=0,n=0,s=0,i=128,c=191;this.handler=function(l,p){if(p===-1&&s!==0)return s=0,lv(t);if(p===-1)return Fu;if(s===0){if(ks(p,0,127))return p;if(ks(p,194,223))s=1,e=p-192;else if(ks(p,224,239))p===224&&(i=160),p===237&&(c=159),s=2,e=p-224;else{if(!ks(p,240,244))return lv(t);p===240&&(i=144),p===244&&(c=143),s=3,e=p-240}return e<<=6*s,null}if(!ks(p,i,c))return e=s=n=0,i=128,c=191,l.prepend(p),lv(t);if(i=128,c=191,e+=p-128<<6*(s-(n+=1)),n!==s)return null;var v=e;return e=s=n=0,v}}function cW(r){r.fatal,this.handler=function(t,e){if(e===-1)return Fu;if(ks(e,0,127))return e;var n,s;ks(e,128,2047)?(n=1,s=192):ks(e,2048,65535)?(n=2,s=224):ks(e,65536,1114111)&&(n=3,s=240);for(var i=[(e>>6*n)+s];n>0;){var c=e>>6*(n-1);i.push(128|63&c),n-=1}return i}}Yl.prototype={decode:function(r,t){var e;e=typeof r=="object"&&r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="object"&&"buffer"in r&&r.buffer instanceof ArrayBuffer?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(0),t=Wl(t),this._streaming||(this._decoder=new fW({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!t.stream;for(var n,s=new ig(e),i=[];!s.endOfStream()&&(n=this._decoder.handler(s,s.read()))!==Fu;)n!==null&&(Array.isArray(n)?i.push.apply(i,n):i.push(n));if(!this._streaming){do{if((n=this._decoder.handler(s,s.read()))===Fu)break;n!==null&&(Array.isArray(n)?i.push.apply(i,n):i.push(n))}while(!s.endOfStream());this._decoder=null}return i.length&&(["utf-8"].indexOf(this.encoding)===-1||this._ignoreBOM||this._BOMseen||(i[0]===65279?(this._BOMseen=!0,i.shift()):this._BOMseen=!0)),function(c){for(var l="",p=0;p>10),56320+(1023&v)))}return l}(i)}},Xl.prototype={encode:function(r,t){r=r?String(r):"",t=Wl(t),this._streaming||(this._encoder=new cW(this._options)),this._streaming=!!t.stream;for(var e,n=[],s=new ig(function(i){for(var c=String(i),l=c.length,p=0,v=[];p57343)v.push(y);else if(56320<=y&&y<=57343)v.push(65533);else if(55296<=y&&y<=56319)if(p===l-1)v.push(65533);else{var E=i.charCodeAt(p+1);if(56320<=E&&E<=57343){var M=1023&y,w=1023&E;v.push(65536+(M<<10)+w),p+=1}else v.push(65533)}p+=1}return v}(r));!s.endOfStream()&&(e=this._encoder.handler(s,s.read()))!==Fu;)Array.isArray(e)?n.push.apply(n,e):n.push(e);if(!this._streaming){for(;(e=this._encoder.handler(s,s.read()))!==Fu;)Array.isArray(e)?n.push.apply(n,e):n.push(e);this._encoder=null}return new Uint8Array(n)}};var hW=lb(Object.freeze({__proto__:null,TextEncoder:Xl,TextDecoder:Yl})),lW=go&&go.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e),Object.defineProperty(r,n,{enumerable:!0,get:function(){return t[e]}})}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),dW=go&&go.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),Po=go&&go.__decorate||function(r,t,e,n){var s,i=arguments.length,c=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(r,t,e,n);else for(var l=r.length-1;l>=0;l--)(s=r[l])&&(c=(i<3?s(c):i>3?s(t,e,c):s(t,e))||c);return i>3&&c&&Object.defineProperty(t,e,c),c},pW=go&&go.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.hasOwnProperty.call(r,e)&&lW(t,r,e);return dW(t,r),t},JS=go&&go.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(On,"__esModule",{value:!0});var QS=On.deserializeUnchecked=ik=On.deserialize=nk=On.serialize=On.BinaryReader=On.BinaryWriter=On.BorshError=On.baseDecode=On.baseEncode=void 0;const Xs=JS(YS),Rx=JS(XS),mW=pW(hW),vW=new(typeof TextDecoder!="function"?mW.TextDecoder:TextDecoder)("utf-8",{fatal:!0});On.baseEncode=function(r){return typeof r=="string"&&(r=Gt.Buffer.from(r,"utf8")),Rx.default.encode(Gt.Buffer.from(r))},On.baseDecode=function(r){return Gt.Buffer.from(Rx.default.decode(r))};const dv=1024;class ni extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}On.BorshError=ni;class tk{constructor(){this.buf=Gt.Buffer.alloc(dv),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Gt.Buffer.concat([this.buf,Gt.Buffer.alloc(dv)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(Gt.Buffer.from(new Xs.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(Gt.Buffer.from(new Xs.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(Gt.Buffer.from(new Xs.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(Gt.Buffer.from(new Xs.default(t).toArray("le",64)))}writeBuffer(t){this.buf=Gt.Buffer.concat([Gt.Buffer.from(this.buf.subarray(0,this.length)),t,Gt.Buffer.alloc(dv)]),this.length+=t.length}writeString(t){this.maybeResize();const e=Gt.Buffer.from(t,"utf8");this.writeU32(e.length),this.writeBuffer(e)}writeFixedArray(t){this.writeBuffer(Gt.Buffer.from(t))}writeArray(t,e){this.maybeResize(),this.writeU32(t.length);for(const n of t)this.maybeResize(),e(n)}toArray(){return this.buf.subarray(0,this.length)}}function Ro(r,t,e){const n=e.value;e.value=function(...s){try{return n.apply(this,s)}catch(i){if(i instanceof RangeError){const c=i.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(c)>=0)throw new ni("Reached the end of buffer when deserializing")}throw i}}}On.BinaryWriter=tk;class _i{constructor(t){this.buf=t,this.offset=0}readU8(){const t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){const t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){const t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){const t=this.readBuffer(8);return new Xs.default(t,"le")}readU128(){const t=this.readBuffer(16);return new Xs.default(t,"le")}readU256(){const t=this.readBuffer(32);return new Xs.default(t,"le")}readU512(){const t=this.readBuffer(64);return new Xs.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new ni(`Expected buffer length ${t} isn't within bounds`);const e=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,e}readString(){const t=this.readU32(),e=this.readBuffer(t);try{return vW.decode(e)}catch(n){throw new ni(`Error decoding UTF-8 string: ${n}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){const e=this.readU32(),n=Array();for(let s=0;s{La(r,t,i,n[0],s)});else if(n.kind!==void 0)switch(n.kind){case"option":e==null?s.writeU8(0):(s.writeU8(1),La(r,t,e,n.type,s));break;case"map":s.writeU32(e.size),e.forEach((i,c)=>{La(r,t,c,n.key,s),La(r,t,i,n.value,s)});break;default:throw new ni(`FieldType ${n} unrecognized`)}else rk(r,e,s)}catch(i){throw i instanceof ni&&i.addToFieldPath(t),i}}function rk(r,t,e){if(typeof t.borshSerialize=="function")return void t.borshSerialize(e);const n=r.get(t.constructor);if(!n)throw new ni(`Class ${t.constructor.name} is missing in schema`);if(n.kind==="struct")n.fields.map(([s,i])=>{La(r,s,t[s],i,e)});else{if(n.kind!=="enum")throw new ni(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`);{const s=t[n.field];for(let i=0;iOa(r,t,e[0],n))}if(e.kind==="option")return n.readU8()?Oa(r,t,e.type,n):void 0;if(e.kind==="map"){let s=new Map;const i=n.readU32();for(let c=0;c=n.values.length)throw new ni(`Enum index: ${s} is out of range`);const[i,c]=n.values[s];return new t({[i]:Oa(r,i,c,e)})}throw new ni(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`)}var ik=On.deserialize=function(r,t,e,n=_i){const s=new n(e),i=vb(r,t,s);if(s.offsetthis.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function yb(r,t){return t.property?r+"["+t.property+"]":r}Vt.Layout=Cr,Vt.nameWithProperty=yb,Vt.bindConstructorLayout=function(r,t){if(typeof r!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(r,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Cr))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");r.layout_=t,t.boundConstructor_=r,t.makeDestinationObject=()=>new r,Object.defineProperty(r.prototype,"encode",{value(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(r,"decode",{value:(e,n)=>t.decode(e,n),writable:!0})};class ai extends Cr{isCount(){throw new Error("ExternalLayout is abstract")}}Vt.ExternalLayout=ai;class ok extends ai{constructor(t=1,e){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e=0){Gf(t);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}Vt.GreedyCount=ok;class bb extends ai{constructor(t,e=0,n){if(!(t instanceof Cr))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof Wi||this.layout instanceof lo}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,n=0){return this.layout.encode(t,e,n+this.offset)}}Vt.OffsetLayout=bb;class Wi extends Cr{constructor(t,e){if(super(t,e),6c+s.encode(l,e,n+c),0);return this.count instanceof ai&&this.count.encode(t.length,e,n),i}}Vt.Sequence=pk;class mk extends Cr{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce((i,c)=>i&&c instanceof Cr,!0))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const i of t)if(0>i.span&&i.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let s=-1;try{s=t.reduce((i,c)=>i+c.getSpan(),0)}catch{}super(s,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce((s,i)=>{const c=i.getSpan(t,e);return e+=c,s+c},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e=0){Gf(t);const n=this.makeDestinationObject();for(const s of this.fields)if(s.property!==void 0&&(n[s.property]=s.decode(t,e)),e+=s.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n=0){const s=n;let i=0,c=0;for(const l of this.fields){let p=l.span;if(c=0p&&(p=l.getSpan(e,n)))}i=n,n+=p}return i+c-s}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?e=-1:0<=e&&(e+=n.span)}}}Vt.Structure=mk;class wb{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,n){throw new Error("UnionDiscriminator is abstract")}}Vt.UnionDiscriminator=wb;class Jl extends wb{constructor(t,e){if(!(t instanceof ai&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}Vt.UnionLayoutDiscriminator=Jl;class xb extends Cr{constructor(t,e,n){let s;if(t instanceof Wi||t instanceof lo)s=new Jl(new bb(t));else if(t instanceof ai&&t.isCount())s=new Jl(t);else{if(!(t instanceof wb))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");s=t}if(e===void 0&&(e=null),!(e===null||e instanceof Cr))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&(t instanceof Wi||t instanceof lo)&&(i+=s.layout.span)),super(i,n),this.discriminator=s,this.usesPrefixDiscriminator=t instanceof Wi||t instanceof lo,this.defaultLayout=e,this.registry={};let c=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(l){return c(l)},this.configGetSourceVariant=function(l){c=l.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(n.property&&Object.prototype.hasOwnProperty.call(t,n.property))return n}throw new Error("unable to infer src variant")}decode(t,e=0){let n;const s=this.discriminator,i=s.decode(t,e),c=this.registry[i];if(c===void 0){const l=this.defaultLayout;let p=0;this.usesPrefixDiscriminator&&(p=s.layout.span),n=this.makeDestinationObject(),n[s.property]=i,n[l.property]=l.decode(t,e+p)}else n=c.decode(t,e);return n}encode(t,e,n=0){const s=this.getSourceVariant(t);if(s===void 0){const i=this.discriminator,c=this.defaultLayout;let l=0;return this.usesPrefixDiscriminator&&(l=i.layout.span),i.encode(t[i.property],e,n),l+c.encode(t[c.property],e,n+l)}return s.encode(t,e,n)}addVariant(t,e,n){const s=new vk(this,t,e,n);return this.registry[t]=s,s}getVariant(t,e=0){let n;return n=t instanceof Uint8Array?this.discriminator.decode(t,e):t,this.registry[n]}}Vt.Union=xb;class vk extends Cr{constructor(t,e,n,s){if(!(t instanceof xb))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&s===void 0&&(s=n,n=null),n){if(!(n instanceof Cr))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof s!="string")throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,s),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let s=0;return this.layout&&(s=this.layout.getSpan(t,e+n)),n+s}decode(t,e=0){const n=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let s=0;return this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+s):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n=0){let s=0;if(this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=s;if(this.layout&&(this.layout.encode(t[this.property],e,n+s),i+=this.layout.getSpan(e,n+s),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function Du(r){return 0>r&&(r+=4294967296),r}Vt.VariantLayout=vk;class _b extends Cr{constructor(t,e,n){if(!(t instanceof Wi||t instanceof lo))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof e=="string"&&n===void 0&&(n=e,e=!1),4=e)throw new TypeError("bits must be positive integer");const s=8*t.span,i=t.fields.reduce((c,l)=>c+l.bits,0);if(e+i>s)throw new Error("bits too long for span remainder ("+(s-i)+" of "+s+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(typeof t!="number"||!Number.isInteger(t)||t!==Du(t&this.valueMask))throw new TypeError(yb("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=Du(t<n&&(n=this.length.decode(t,e)),n}decode(t,e=0){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),Mr(t).slice(e,e+n)}encode(t,e,n){let s=this.length;if(this.length instanceof ai&&(s=t.length),!(t instanceof Uint8Array&&s===t.length))throw new TypeError(yb("Blob.encode",this)+" requires (length "+s+") Uint8Array as src");if(n+s>e.length)throw new RangeError("encoding overruns Uint8Array");const i=Mr(t);return Mr(e).write(i.toString("hex"),n,s,"hex"),this.length instanceof ai&&this.length.encode(s,e,n),s}}Vt.Blob=yk;class bk extends Cr{constructor(t){super(-1,t)}getSpan(t,e=0){Gf(t);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");const c=Mr(e);return s.copy(c,n),c[n+i]=0,i+1}}Vt.CString=bk;class wk extends Cr{constructor(t,e){if(typeof t=="string"&&e===void 0&&(e=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return Gf(t),t.length-e}decode(t,e=0){const n=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return s.copy(Mr(e),n),i}}Vt.UTF8=wk;class xk extends Cr{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,n){return 0}}Vt.Constant=xk,Vt.greedy=(r,t)=>new ok(r,t);var eu=Vt.offset=(r,t,e)=>new bb(r,t,e),fn=Vt.u8=r=>new Wi(1,r),Di=Vt.u16=r=>new Wi(2,r);Vt.u24=r=>new Wi(3,r);var $e=Vt.u32=r=>new Wi(4,r);Vt.u40=r=>new Wi(5,r),Vt.u48=r=>new Wi(6,r);var Rn=Vt.nu64=r=>new sk(r);Vt.u16be=r=>new lo(2,r),Vt.u24be=r=>new lo(3,r),Vt.u32be=r=>new lo(4,r),Vt.u40be=r=>new lo(5,r),Vt.u48be=r=>new lo(6,r),Vt.nu64be=r=>new ak(r),Vt.s8=r=>new Pa(1,r),Vt.s16=r=>new Pa(2,r),Vt.s24=r=>new Pa(3,r),Vt.s32=r=>new Pa(4,r),Vt.s40=r=>new Pa(5,r),Vt.s48=r=>new Pa(6,r);var Ii=Vt.ns64=r=>new uk(r);Vt.s16be=r=>new Nu(2,r),Vt.s24be=r=>new Nu(3,r),Vt.s32be=r=>new Nu(4,r),Vt.s40be=r=>new Nu(5,r),Vt.s48be=r=>new Nu(6,r),Vt.ns64be=r=>new fk(r),Vt.f32=r=>new ck(r),Vt.f32be=r=>new hk(r),Vt.f64=r=>new lk(r),Vt.f64be=r=>new dk(r);var je=Vt.struct=(r,t,e)=>new mk(r,t,e);Vt.bits=(r,t,e)=>new _b(r,t,e);var Wa=Vt.seq=(r,t,e)=>new pk(r,t,e);Vt.union=(r,t,e)=>new xb(r,t,e),Vt.unionLayoutDiscriminator=(r,t)=>new Jl(r,t);var If=Vt.blob=(r,t)=>new yk(r,t);Vt.cstr=r=>new bk(r),Vt.utf8=(r,t)=>new wk(r,t),Vt.constant=(r,t)=>new xk(r,t);var r0={};Object.defineProperty(r0,"__esModule",{value:!0});var gW=r0.toBigIntLE=function(r){{const t=Gt.Buffer.from(r);t.reverse();const e=t.toString("hex");return e.length===0?BigInt(0):BigInt(`0x${e}`)}};r0.toBigIntBE=function(r){{const t=r.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}};var pv,yW=r0.toBufferLE=function(r,t){{const e=r.toString(16),n=Gt.Buffer.from(e.padStart(2*t,"0").slice(0,2*t),"hex");return n.reverse(),n}};r0.toBufferBE=function(r,t){{const e=r.toString(16);return Gt.Buffer.from(e.padStart(2*t,"0").slice(0,2*t),"hex")}};class bW extends TypeError{constructor(t,e){let n;const{message:s,...i}=t,{path:c}=t;super(c.length===0?s:"At path: "+c.join(".")+" -- "+s),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var l;return(l=n)!=null?l:n=[t,...e()]}}}function sa(r){return typeof r=="object"&&r!=null}function yo(r){return typeof r=="string"?JSON.stringify(r):""+r}function wW(r,t,e,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:s,branch:i}=t,{type:c}=e,{refinement:l,message:p="Expected a value of type `"+c+"`"+(l?" with refinement `"+l+"`":"")+", but received: `"+yo(n)+"`"}=r;return{value:n,type:c,refinement:l,key:s[s.length-1],path:s,branch:i,...r,message:p}}function*Cx(r,t,e,n){var s;sa(s=r)&&typeof s[Symbol.iterator]=="function"||(r=[r]);for(const i of r){const c=wW(i,t,e,n);c&&(yield c)}}function*Eb(r,t,e={}){const{path:n=[],branch:s=[r],coerce:i=!1,mask:c=!1}=e,l={path:n,branch:s};if(i&&(r=t.coercer(r,l),c&&t.type!=="type"&&sa(t.schema)&&sa(r)&&!Array.isArray(r)))for(const v in r)t.schema[v]===void 0&&delete r[v];let p=!0;for(const v of t.validator(r,l))p=!1,yield[v,void 0];for(let[v,y,E]of t.entries(r,l)){const M=Eb(y,E,{path:v===void 0?n:[...n,v],branch:v===void 0?s:[...s,y],coerce:i,mask:c});for(const w of M)w[0]?(p=!1,yield[w[0],void 0]):i&&(y=w[1],v===void 0?r=y:r instanceof Map?r.set(v,y):r instanceof Set?r.add(y):sa(r)&&(r[v]=y))}if(p)for(const v of t.refiner(r,l))p=!1,yield[v,void 0];p&&(yield[void 0,r])}class is{constructor(t){const{type:e,schema:n,validator:s,refiner:i,coercer:c=p=>p,entries:l=function*(){}}=t;this.type=e,this.schema=n,this.entries=l,this.coercer=c,this.validator=s?(p,v)=>Cx(s(p,v),v,this,p):()=>[],this.refiner=i?(p,v)=>Cx(i(p,v),v,this,p):()=>[]}assert(t){return function(e,n){const s=Vc(e,n);if(s[0])throw s[0]}(t,this)}create(t){return m1(t,this)}is(t){return _k(t,this)}mask(t){return function(e,n){const s=Vc(e,n,{coerce:!0,mask:!0});if(s[0])throw s[0];return s[1]}(t,this)}validate(t,e={}){return Vc(t,this,e)}}function m1(r,t){const e=Vc(r,t,{coerce:!0});if(e[0])throw e[0];return e[1]}function _k(r,t){return!Vc(r,t)[0]}function Vc(r,t,e={}){const n=Eb(r,t,e),s=function(i){const{done:c,value:l}=i.next();return c?void 0:l}(n);return s[0]?[new bW(s[0],function*(){for(const i of n)i[0]&&(yield i[0])}),void 0]:[void 0,s[1]]}function xu(r,t){return new is({type:r,schema:null,validator:t})}function Oe(r){return new is({type:"array",schema:r,*entries(t){if(r&&Array.isArray(t))for(const[e,n]of t.entries())yield[e,n,r]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||"Expected an array value, but received: "+yo(t)})}function ts(){return xu("boolean",r=>typeof r=="boolean")}function Ab(r){return xu("instance",t=>t instanceof r||"Expected a `"+r.name+"` instance, but received: "+yo(t))}function Wr(r){const t=yo(r),e=typeof r;return new is({type:"literal",schema:e==="string"||e==="number"||e==="boolean"?r:null,validator:n=>n===r||"Expected the literal `"+t+"`, but received: "+yo(n)})}function Le(r){return new is({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function Kt(){return xu("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+yo(r))}function He(r){return new is({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function Mk(r,t){return new is({type:"record",schema:null,*entries(e){if(sa(e))for(const n in e){const s=e[n];yield[n,n,r],yield[n,s,t]}},validator:e=>sa(e)||"Expected an object, but received: "+yo(e)})}function Me(){return xu("string",r=>typeof r=="string"||"Expected a string, but received: "+yo(r))}function Sb(r){const t=xu("never",()=>!1);return new is({type:"tuple",schema:null,*entries(e){if(Array.isArray(e)){const n=Math.max(r.length,e.length);for(let s=0;sArray.isArray(e)||"Expected an array, but received: "+yo(e)})}function be(r){const t=Object.keys(r);return new is({type:"type",schema:r,*entries(e){if(sa(e))for(const n of t)yield[n,e[n],r[n]]},validator:e=>sa(e)||"Expected an object, but received: "+yo(e)})}function gi(r){const t=r.map(e=>e.type).join(" | ");return new is({type:"union",schema:null,validator(e,n){const s=[];for(const i of r){const[...c]=Eb(e,i,n),[l]=c;if(!l[0])return[];for(const[p]of c)p&&s.push(p)}return["Expected the value to satisfy a union of `"+t+"`, but received: "+yo(e),...s]}})}function n0(){return xu("unknown",()=>!0)}function i0(r,t,e){return new is({...r,coercer:(n,s)=>_k(n,t)?r.coercer(e(n,s),s):r.coercer(n,s)})}var xW=new Uint8Array(16);function Tx(){if(!pv&&!(pv=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return pv(xW)}var _W=/^(?:[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 Ql(r){return typeof r=="string"&&_W.test(r)}for(var Lx,mv,Bn=[],vv=0;vv<256;++vv)Bn.push((vv+256).toString(16).substr(1));function vl(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(Bn[r[t+0]]+Bn[r[t+1]]+Bn[r[t+2]]+Bn[r[t+3]]+"-"+Bn[r[t+4]]+Bn[r[t+5]]+"-"+Bn[r[t+6]]+Bn[r[t+7]]+"-"+Bn[r[t+8]]+Bn[r[t+9]]+"-"+Bn[r[t+10]]+Bn[r[t+11]]+Bn[r[t+12]]+Bn[r[t+13]]+Bn[r[t+14]]+Bn[r[t+15]]).toLowerCase();if(!Ql(e))throw TypeError("Stringified UUID is invalid");return e}var gv=0,yv=0;function Ek(r){if(!Ql(r))throw TypeError("Invalid UUID");var t,e=new Uint8Array(16);return e[0]=(t=parseInt(r.slice(0,8),16))>>>24,e[1]=t>>>16&255,e[2]=t>>>8&255,e[3]=255&t,e[4]=(t=parseInt(r.slice(9,13),16))>>>8,e[5]=255&t,e[6]=(t=parseInt(r.slice(14,18),16))>>>8,e[7]=255&t,e[8]=(t=parseInt(r.slice(19,23),16))>>>8,e[9]=255&t,e[10]=(t=parseInt(r.slice(24,36),16))/1099511627776&255,e[11]=t/4294967296&255,e[12]=t>>>24&255,e[13]=t>>>16&255,e[14]=t>>>8&255,e[15]=255&t,e}function Ak(r,t,e){function n(s,i,c,l){if(typeof s=="string"&&(s=function(y){y=unescape(encodeURIComponent(y));for(var E=[],M=0;M>>9<<4)+1}function Js(r,t){var e=(65535&r)+(65535&t);return(r>>16)+(t>>16)+(e>>16)<<16|65535&e}function v1(r,t,e,n,s,i){return Js((c=Js(Js(t,r),Js(n,i)))<<(l=s)|c>>>32-l,e);var c,l}function Yn(r,t,e,n,s,i,c){return v1(t&e|~t&n,r,t,s,i,c)}function Xn(r,t,e,n,s,i,c){return v1(t&n|e&~n,r,t,s,i,c)}function Jn(r,t,e,n,s,i,c){return v1(t^e^n,r,t,s,i,c)}function Qn(r,t,e,n,s,i,c){return v1(e^(t|~n),r,t,s,i,c)}var MW=Ak("v3",48,function(r){if(typeof r=="string"){var t=unescape(encodeURIComponent(r));r=new Uint8Array(t.length);for(var e=0;e>5]>>>l%32&255,v=parseInt(c.charAt(p>>>4&15)+c.charAt(15&p),16);s.push(v)}return s}(function(n,s){n[s>>5]|=128<>5]|=(255&n[c/8])<>>32-t}var SW=Ak("v5",80,function(r){var t=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof r=="string"){var n=unescape(encodeURIComponent(r));r=[];for(var s=0;s>>0;T=R,R=P,P=bv(B,30)>>>0,B=k,k=Y}e[0]=e[0]+k>>>0,e[1]=e[1]+B>>>0,e[2]=e[2]+P>>>0,e[3]=e[3]+R>>>0,e[4]=e[4]+T>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,255&e[0],e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,255&e[1],e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,255&e[2],e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,255&e[3],e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,255&e[4]]}),kW=SW,IW=Object.freeze({__proto__:null,v1:function(r,t,e){var n=t&&e||0,s=t||new Array(16),i=(r=r||{}).node||Lx,c=r.clockseq!==void 0?r.clockseq:mv;if(i==null||c==null){var l=r.random||(r.rng||Tx)();i==null&&(i=Lx=[1|l[0],l[1],l[2],l[3],l[4],l[5]]),c==null&&(c=mv=16383&(l[6]<<8|l[7]))}var p=r.msecs!==void 0?r.msecs:Date.now(),v=r.nsecs!==void 0?r.nsecs:yv+1,y=p-gv+(v-yv)/1e4;if(y<0&&r.clockseq===void 0&&(c=c+1&16383),(y<0||p>gv)&&r.nsecs===void 0&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");gv=p,yv=v,mv=c;var E=(1e4*(268435455&(p+=122192928e5))+v)%4294967296;s[n++]=E>>>24&255,s[n++]=E>>>16&255,s[n++]=E>>>8&255,s[n++]=255&E;var M=p/4294967296*1e4&268435455;s[n++]=M>>>8&255,s[n++]=255&M,s[n++]=M>>>24&15|16,s[n++]=M>>>16&255,s[n++]=c>>>8|128,s[n++]=255&c;for(var w=0;w<6;++w)s[n+w]=i[w];return t||vl(s)},v3:EW,v4:function(r,t,e){var n=(r=r||{}).random||(r.rng||Tx)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){e=e||0;for(var s=0;s<16;++s)t[e+s]=n[s];return t}return vl(n)},v5:kW,NIL:"00000000-0000-0000-0000-000000000000",version:function(r){if(!Ql(r))throw TypeError("Invalid UUID");return parseInt(r.substr(14,1),16)},validate:Ql,stringify:vl,parse:Ek}),Ux=lb(IW);Ux.v4,Ux.v4;var W0,Sk={exports:{}};(W0=Sk).exports=function(r){return r&&r.__esModule?r:{default:r}},W0.exports.__esModule=!0,W0.exports.default=W0.exports;var Nx,Dx,wv,zx,qx=Sk.exports,Fx={exports:{}},jx={exports:{}};function Ah(){return Nx||(Nx=1,function(r){function t(e){return r.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},r.exports.__esModule=!0,r.exports.default=r.exports,t(e)}r.exports=t,r.exports.__esModule=!0,r.exports.default=r.exports}(jx)),jx.exports}var $x,Kx,Hx={exports:{}},Vx={exports:{}};function Zx(){return Kx||(Kx=1,function(r){r.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},r.exports.__esModule=!0,r.exports.default=r.exports}(Vx)),Vx.exports}var Wx,Gx,Yx,Xx={exports:{}},Jx={exports:{}},Qx={exports:{}};function BW(){return Gx||(Gx=1,function(r){var t=Ah().default,e=(Wx||(Wx=1,function(n){var s=Ah().default;n.exports=function(i,c){if(s(i)!=="object"||i===null)return i;var l=i[Symbol.toPrimitive];if(l!==void 0){var p=l.call(i,c||"default");if(s(p)!=="object")return p;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(i)},n.exports.__esModule=!0,n.exports.default=n.exports}(Qx)),Qx.exports);r.exports=function(n){var s=e(n,"string");return t(s)==="symbol"?s:String(s)},r.exports.__esModule=!0,r.exports.default=r.exports}(Jx)),Jx.exports}function t7(){return Yx||(Yx=1,function(r){var t=BW();function e(n,s){for(var i=0;i=0;--kt){var S=this.tryEntries[kt],C=S.completion;if(S.tryLoc==="root")return Tt("end");if(S.tryLoc<=this.prev){var O=T.call(S,"catchLoc"),F=T.call(S,"finallyLoc");if(O&&F){if(this.prev=0;--Tt){var kt=this.tryEntries[Tt];if(kt.tryLoc<=this.prev&&T.call(kt,"finallyLoc")&&this.prev=0;--ct){var Tt=this.tryEntries[ct];if(Tt.finallyLoc===dt)return this.complete(Tt.completion,Tt.afterLoc),yt(Tt),g}},catch:function(dt){for(var ct=this.tryEntries.length-1;ct>=0;--ct){var Tt=this.tryEntries[ct];if(Tt.tryLoc===dt){var kt=Tt.completion;if(kt.type==="throw"){var S=kt.arg;yt(Tt)}return S}}throw new Error("illegal catch attempt")},delegateYield:function(dt,ct,Tt){return this.delegate={iterator:jt(dt),resultName:ct,nextLoc:Tt},this.method==="next"&&(this.arg=B),g}},P}w.exports=k,w.exports.__esModule=!0,w.exports.default=w.exports}(Fx)),Fx.exports)();wv=M;try{regeneratorRuntime=M}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=M:Function("r","regeneratorRuntime = r")(M)}return wv}()),n=t(($x||($x=1,function(M){function w(_,k,B,P,R,T,U){try{var j=_[T](U),Y=j.value}catch(rt){return void B(rt)}j.done?k(Y):Promise.resolve(Y).then(P,R)}M.exports=function(_){return function(){var k=this,B=arguments;return new Promise(function(P,R){var T=_.apply(k,B);function U(Y){w(T,P,R,U,j,"next",Y)}function j(Y){w(T,P,R,U,j,"throw",Y)}U(void 0)})}},M.exports.__esModule=!0,M.exports.default=M.exports}(Hx)),Hx.exports)),s=t(Ah()),i=t(Zx()),c=t(t7()),l=t(o7()),p=t(c7()),v=t(d7());function y(M){var w=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var _,k=(0,v.default)(M);if(w){var B=(0,v.default)(this).constructor;_=Reflect.construct(k,arguments,B)}else _=k.apply(this,arguments);return(0,p.default)(this,_)}}var E=function(M){(0,l.default)(R,M);var w,_,k,B,P=y(R);function R(T){var U,j=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"ws://localhost:8080",Y=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},rt=arguments.length>3?arguments[3]:void 0;(0,i.default)(this,R);var nt=Y.autoconnect,Z=nt===void 0||nt,x=Y.reconnect,d=x===void 0||x,o=Y.reconnect_interval,a=o===void 0?1e3:o,f=Y.max_reconnects,h=f===void 0?5:f,g=function(A,I){var b={};for(var u in A)Object.prototype.hasOwnProperty.call(A,u)&&I.indexOf(u)<0&&(b[u]=A[u]);if(A!=null&&typeof Object.getOwnPropertySymbols=="function"){var m=0;for(u=Object.getOwnPropertySymbols(A);mj.current_reconnects||j.max_reconnects===0)&&(j.reconnect_timer_id=setTimeout(function(){return j._connect(T,U)},j.reconnect_interval)))})}}]),R}(v7().EventEmitter);r.default=E})({}),function(r){var t=qx;Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(v,y){return new p(v,y)};var e=t(Zx()),n=t(t7()),s=t(o7()),i=t(c7()),c=t(d7());function l(v){var y=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var E,M=(0,c.default)(v);if(y){var w=(0,c.default)(this).constructor;E=Reflect.construct(M,arguments,w)}else E=M.apply(this,arguments);return(0,i.default)(this,E)}}var p=function(v){(0,s.default)(E,v);var y=l(E);function E(M,w,_){var k;return(0,e.default)(this,E),(k=y.call(this)).socket=new window.WebSocket(M,_),k.socket.onopen=function(){return k.emit("open")},k.socket.onmessage=function(B){return k.emit("message",B.data)},k.socket.onerror=function(B){return k.emit("error",B)},k.socket.onclose=function(B){k.emit("close",B.code,B.reason)},k}return(0,n.default)(E,[{key:"send",value:function(M,w,_){var k=_||w;try{this.socket.send(M),k()}catch(B){k(B)}}},{key:"close",value:function(M,w){this.socket.close(M,w)}},{key:"addEventListener",value:function(M,w,_){this.socket.addEventListener(M,w,_)}}]),E}(v7().EventEmitter)}({});const{bytesToNumberBE:PW,hexToBytes:RW}=HZ,Ga={Err:class extends Error{constructor(r=""){super(r)}},_parseInt(r){const{Err:t}=Ga;if(r.length<2||r[0]!==2)throw new t("Invalid signature integer tag");const e=r[1],n=r.subarray(2,e+2);if(!e||n.length!==e)throw new t("Invalid signature integer: wrong length");if(128&n[0])throw new t("Invalid signature integer: negative");if(n[0]===0&&!(128&n[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:PW(n),l:r.subarray(e+2)}},toSig(r){const{Err:t}=Ga,e=typeof r=="string"?RW(r):r;if(!(e instanceof Uint8Array))throw new Error("ui8a expected");let n=e.length;if(n<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==n-2)throw new t("Invalid signature: incorrect length");const{d:s,l:i}=Ga._parseInt(e.subarray(2)),{d:c,l}=Ga._parseInt(i);if(l.length)throw new t("Invalid signature: left bytes after parsing");return{r:s,s:c}},hexFromSig(r){const t=v=>8&Number.parseInt(v[0],16)?"00"+v:v,e=v=>{const y=v.toString(16);return 1&y.length?`0${y}`:y},n=t(e(r.s)),s=t(e(r.r)),i=n.length/2,c=s.length/2,l=e(i),p=e(c);return`30${e(c+i+4)}02${p}${s}02${l}${n}`}},fs=BigInt(0),Ni=BigInt(1);BigInt(2);const g7=BigInt(3);function CW(r){const t=function(Z){const x=J2(Z);return kf(x,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...x})}(r),{Fp:e,n}=t,s=e.BYTES+1,i=2*e.BYTES+1;function c(Z){return $r(Z,n)}function l(Z){return X2(Z,n)}const{ProjectivePoint:p,normPrivateKeyToScalar:v,weierstrassEquation:y,isWithinCurveOrder:E}=function(Z){const x=function(q){const z=J2(q);kf(z,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:W,Fp:ot,a:ut}=z;if(W){if(!ot.eql(ut,ot.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof W!="object"||typeof W.beta!="bigint"||typeof W.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...z})}(Z),{Fp:d}=x,o=x.toBytes||((q,z,W)=>{const ot=z.toAffine();return tu(Uint8Array.from([4]),d.toBytes(ot.x),d.toBytes(ot.y))}),a=x.fromBytes||(q=>{const z=q.subarray(1);return{x:d.fromBytes(z.subarray(0,d.BYTES)),y:d.fromBytes(z.subarray(d.BYTES,2*d.BYTES))}});function f(q){const{a:z,b:W}=x,ot=d.sqr(q),ut=d.mul(ot,q);return d.add(d.add(ut,d.mul(q,z)),W)}if(!d.eql(d.sqr(x.Gy),f(x.Gx)))throw new Error("bad generator point: equation left != right");function h(q){return typeof q=="bigint"&&fsd.eql(Ct,d.ZERO);return ut(W)&&ut(ot)?u.ZERO:new u(W,ot,d.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(z){const W=d.invertBatch(z.map(ot=>ot.pz));return z.map((ot,ut)=>ot.toAffine(W[ut])).map(u.fromAffine)}static fromHex(z){const W=u.fromAffine(a(dn("pointHex",z)));return W.assertValidity(),W}static fromPrivateKey(z){return u.BASE.multiply(A(z))}_setWindowSize(z){this._WINDOW_SIZE=z,I.delete(this)}assertValidity(){if(this.is0()){if(x.allowInfinityPoint&&!d.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:z,y:W}=this.toAffine();if(!d.isValid(z)||!d.isValid(W))throw new Error("bad point: x or y not FE");const ot=d.sqr(W),ut=f(z);if(!d.eql(ot,ut))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:z}=this.toAffine();if(d.isOdd)return!d.isOdd(z);throw new Error("Field doesn't support isOdd")}equals(z){b(z);const{px:W,py:ot,pz:ut}=this,{px:Ct,py:yt,pz:mt}=z,jt=d.eql(d.mul(W,mt),d.mul(Ct,ut)),dt=d.eql(d.mul(ot,mt),d.mul(yt,ut));return jt&&dt}negate(){return new u(this.px,d.neg(this.py),this.pz)}double(){const{a:z,b:W}=x,ot=d.mul(W,g7),{px:ut,py:Ct,pz:yt}=this;let mt=d.ZERO,jt=d.ZERO,dt=d.ZERO,ct=d.mul(ut,ut),Tt=d.mul(Ct,Ct),kt=d.mul(yt,yt),S=d.mul(ut,Ct);return S=d.add(S,S),dt=d.mul(ut,yt),dt=d.add(dt,dt),mt=d.mul(z,dt),jt=d.mul(ot,kt),jt=d.add(mt,jt),mt=d.sub(Tt,jt),jt=d.add(Tt,jt),jt=d.mul(mt,jt),mt=d.mul(S,mt),dt=d.mul(ot,dt),kt=d.mul(z,kt),S=d.sub(ct,kt),S=d.mul(z,S),S=d.add(S,dt),dt=d.add(ct,ct),ct=d.add(dt,ct),ct=d.add(ct,kt),ct=d.mul(ct,S),jt=d.add(jt,ct),kt=d.mul(Ct,yt),kt=d.add(kt,kt),ct=d.mul(kt,S),mt=d.sub(mt,ct),dt=d.mul(kt,Tt),dt=d.add(dt,dt),dt=d.add(dt,dt),new u(mt,jt,dt)}add(z){b(z);const{px:W,py:ot,pz:ut}=this,{px:Ct,py:yt,pz:mt}=z;let jt=d.ZERO,dt=d.ZERO,ct=d.ZERO;const Tt=x.a,kt=d.mul(x.b,g7);let S=d.mul(W,Ct),C=d.mul(ot,yt),O=d.mul(ut,mt),F=d.add(W,ot),et=d.add(Ct,yt);F=d.mul(F,et),et=d.add(S,C),F=d.sub(F,et),et=d.add(W,ut);let Q=d.add(Ct,mt);return et=d.mul(et,Q),Q=d.add(S,O),et=d.sub(et,Q),Q=d.add(ot,ut),jt=d.add(yt,mt),Q=d.mul(Q,jt),jt=d.add(C,O),Q=d.sub(Q,jt),ct=d.mul(Tt,et),jt=d.mul(kt,O),ct=d.add(jt,ct),jt=d.sub(C,ct),ct=d.add(C,ct),dt=d.mul(jt,ct),C=d.add(S,S),C=d.add(C,S),O=d.mul(Tt,O),et=d.mul(kt,et),C=d.add(C,O),O=d.sub(S,O),O=d.mul(Tt,O),et=d.add(et,O),S=d.mul(C,et),dt=d.add(dt,S),S=d.mul(Q,et),jt=d.mul(F,jt),jt=d.sub(jt,S),S=d.mul(F,C),ct=d.mul(Q,ct),ct=d.add(ct,S),new u(jt,dt,ct)}subtract(z){return this.add(z.negate())}is0(){return this.equals(u.ZERO)}wNAF(z){return L.wNAFCached(this,I,z,W=>{const ot=d.invertBatch(W.map(ut=>ut.pz));return W.map((ut,Ct)=>ut.toAffine(ot[Ct])).map(u.fromAffine)})}multiplyUnsafe(z){const W=u.ZERO;if(z===fs)return W;if(g(z),z===Ni)return this;const{endo:ot}=x;if(!ot)return L.unsafeLadder(this,z);let{k1neg:ut,k1:Ct,k2neg:yt,k2:mt}=ot.splitScalar(z),jt=W,dt=W,ct=this;for(;Ct>fs||mt>fs;)Ct&Ni&&(jt=jt.add(ct)),mt&Ni&&(dt=dt.add(ct)),ct=ct.double(),Ct>>=Ni,mt>>=Ni;return ut&&(jt=jt.negate()),yt&&(dt=dt.negate()),dt=new u(d.mul(dt.px,ot.beta),dt.py,dt.pz),jt.add(dt)}multiply(z){g(z);let W,ot,ut=z;const{endo:Ct}=x;if(Ct){const{k1neg:yt,k1:mt,k2neg:jt,k2:dt}=Ct.splitScalar(ut);let{p:ct,f:Tt}=this.wNAF(mt),{p:kt,f:S}=this.wNAF(dt);ct=L.constTimeNegate(yt,ct),kt=L.constTimeNegate(jt,kt),kt=new u(d.mul(kt.px,Ct.beta),kt.py,kt.pz),W=ct.add(kt),ot=Tt.add(S)}else{const{p:yt,f:mt}=this.wNAF(ut);W=yt,ot=mt}return u.normalizeZ([W,ot])[0]}multiplyAndAddUnsafe(z,W,ot){const ut=u.BASE,Ct=(mt,jt)=>jt!==fs&&jt!==Ni&&mt.equals(ut)?mt.multiply(jt):mt.multiplyUnsafe(jt),yt=Ct(this,W).add(Ct(z,ot));return yt.is0()?void 0:yt}toAffine(z){const{px:W,py:ot,pz:ut}=this,Ct=this.is0();z==null&&(z=Ct?d.ONE:d.inv(ut));const yt=d.mul(W,z),mt=d.mul(ot,z),jt=d.mul(ut,z);if(Ct)return{x:d.ZERO,y:d.ZERO};if(!d.eql(jt,d.ONE))throw new Error("invZ was invalid");return{x:yt,y:mt}}isTorsionFree(){const{h:z,isTorsionFree:W}=x;if(z===Ni)return!0;if(W)return W(u,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:z,clearCofactor:W}=x;return z===Ni?this:W?W(u,this):this.multiplyUnsafe(x.h)}toRawBytes(z=!0){return this.assertValidity(),o(u,this,z)}toHex(z=!0){return Qa(this.toRawBytes(z))}}u.BASE=new u(x.Gx,x.Gy,d.ONE),u.ZERO=new u(d.ZERO,d.ONE,d.ZERO);const m=x.nBitLength,L=GS(u,x.endo?Math.ceil(m/2):m);return{CURVE:x,ProjectivePoint:u,normPrivateKeyToScalar:A,weierstrassEquation:f,isWithinCurveOrder:h}}({...t,toBytes(Z,x,d){const o=x.toAffine(),a=e.toBytes(o.x),f=tu;return d?f(Uint8Array.from([x.hasEvenY()?2:3]),a):f(Uint8Array.from([4]),a,e.toBytes(o.y))},fromBytes(Z){const x=Z.length,d=Z[0],o=Z.subarray(1);if(x!==s||d!==2&&d!==3){if(x===i&&d===4)return{x:e.fromBytes(o.subarray(0,e.BYTES)),y:e.fromBytes(o.subarray(e.BYTES,2*e.BYTES))};throw new Error(`Point of length ${x} was invalid. Expected ${s} compressed bytes or ${i} uncompressed bytes`)}{const f=Ta(o);if(!(fs<(a=f)&&aQa(uf(Z,t.nByteLength));function w(Z){return Z>n>>Ni}const _=(Z,x,d)=>Ta(Z.slice(x,d));class k{constructor(x,d,o){this.r=x,this.s=d,this.recovery=o,this.assertValidity()}static fromCompact(x){const d=t.nByteLength;return x=dn("compactSignature",x,2*d),new k(_(x,0,d),_(x,d,2*d))}static fromDER(x){const{r:d,s:o}=Ga.toSig(dn("DER",x));return new k(d,o)}assertValidity(){if(!E(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!E(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(x){return new k(this.r,this.s,x)}recoverPublicKey(x){const{r:d,s:o,recovery:a}=this,f=T(dn("msgHash",x));if(a==null||![0,1,2,3].includes(a))throw new Error("recovery id invalid");const h=a===2||a===3?d+t.n:d;if(h>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");const g=1&a?"03":"02",A=p.fromHex(g+M(h)),I=l(h),b=c(-f*I),u=c(o*I),m=p.BASE.multiplyAndAddUnsafe(A,b,u);if(!m)throw new Error("point at infinify");return m.assertValidity(),m}hasHighS(){return w(this.s)}normalizeS(){return this.hasHighS()?new k(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return Sf(this.toDERHex())}toDERHex(){return Ga.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Sf(this.toCompactHex())}toCompactHex(){return M(this.r)+M(this.s)}}const B={isValidPrivateKey(Z){try{return v(Z),!0}catch{return!1}},normPrivateKeyToScalar:v,randomPrivateKey:()=>{const Z=Ax(t.n);return function(x,d,o=!1){const a=x.length,f=WS(d),h=Ax(d);if(a<16||a1024)throw new Error(`expected ${h}-1024 bytes of input, got ${a}`);const g=$r(o?Ta(x):af(x),d-Kr)+Kr;return o?Eh(g,f):uf(g,f)}(t.randomBytes(Z),t.n)},precompute:(Z=8,x=p.BASE)=>(x._setWindowSize(Z),x.multiply(BigInt(3)),x)};function P(Z){const x=Z instanceof Uint8Array,d=typeof Z=="string",o=(x||d)&&Z.length;return x?o===s||o===i:d?o===2*s||o===2*i:Z instanceof p}const R=t.bits2int||function(Z){const x=Ta(Z),d=8*Z.length-t.nBitLength;return d>0?x>>BigInt(d):x},T=t.bits2int_modN||function(Z){return c(R(Z))},U=mb(t.nBitLength);function j(Z){if(typeof Z!="bigint")throw new Error("bigint expected");if(!(fs<=Z&&ZL in d))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:a}=t;let{lowS:f,prehash:h,extraEntropy:g}=d;f==null&&(f=!0),Z=dn("msgHash",Z),h&&(Z=dn("prehashed msgHash",o(Z)));const A=T(Z),I=v(x),b=[j(I),j(A)];if(g!=null){const L=g===!0?a(e.BYTES):g;b.push(dn("extraEntropy",L))}const u=tu(...b),m=A;return{seed:u,k2sig:function(L){const q=R(L);if(!E(q))return;const z=l(q),W=p.BASE.multiply(q).toAffine(),ot=c(W.x);if(ot===fs)return;const ut=c(z*c(m+ot*I));if(ut===fs)return;let Ct=(W.x===ot?0:2)|Number(W.y&Ni),yt=ut;return f&&w(ut)&&(yt=function(mt){return w(mt)?c(-mt):mt}(ut),Ct^=1),new k(ot,yt,Ct)}}}const rt={lowS:t.lowS,prehash:!1},nt={lowS:t.lowS,prehash:!1};return p.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(Z,x=!0){return p.fromPrivateKey(Z).toRawBytes(x)},getSharedSecret:function(Z,x,d=!0){if(P(Z))throw new Error("first arg must be private key");if(!P(x))throw new Error("second arg must be public key");return p.fromHex(x).multiply(v(Z)).toRawBytes(d)},sign:function(Z,x,d=rt){const{seed:o,k2sig:a}=Y(Z,x,d),f=t;return HS(f.hash.outputLen,f.nByteLength,f.hmac)(o,a)},verify:function(Z,x,d,o=nt){var W;const a=Z;if(x=dn("msgHash",x),d=dn("publicKey",d),"strict"in o)throw new Error("options.strict was renamed to lowS");const{lowS:f,prehash:h}=o;let g,A;try{if(typeof a=="string"||a instanceof Uint8Array)try{g=k.fromDER(a)}catch(ot){if(!(ot instanceof Ga.Err))throw ot;g=k.fromCompact(a)}else{if(typeof a!="object"||typeof a.r!="bigint"||typeof a.s!="bigint")throw new Error("PARSE");{const{r:ot,s:ut}=a;g=new k(ot,ut)}}A=p.fromHex(d)}catch(ot){if(ot.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(f&&g.hasHighS())return!1;h&&(x=t.hash(x));const{r:I,s:b}=g,u=T(x),m=l(b),L=c(u*m),q=c(I*m),z=(W=p.BASE.multiplyAndAddUnsafe(A,L,q))==null?void 0:W.toAffine();return!!z&&c(z.x)===I},ProjectivePoint:p,Signature:k,utils:B}}BigInt(4);class kk extends FS{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(c){if(typeof c!="function"||typeof c.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");yx(c.outputLen),yx(c.blockLen)}(t);const n=db(e);if(this.iHash=t.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 s=this.blockLen,i=new Uint8Array(s);i.set(n.length>s?t.create().update(n).digest():n);for(let c=0;cnew kk(r,t).update(e).digest();function TW(r){return{hash:r,hmac:(t,...e)=>Ik(r,t,function(...n){const s=new Uint8Array(n.reduce((c,l)=>c+l.length,0));let i=0;return n.forEach(c=>{if(!qS(c))throw new Error("Uint8Array expected");s.set(c,i),i+=c.length}),s}(...e)),randomBytes:$S}}Ik.create=(r,t)=>new kk(r,t);const y7=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),b7=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),LW=BigInt(1),sg=BigInt(2),w7=(r,t)=>(r+t/sg)/t,ag=ZS(y7,void 0,void 0,{sqrt:function(r){const t=y7,e=BigInt(3),n=BigInt(6),s=BigInt(11),i=BigInt(22),c=BigInt(23),l=BigInt(44),p=BigInt(88),v=r*r*r%t,y=v*v*r%t,E=en(y,e,t)*y%t,M=en(E,e,t)*y%t,w=en(M,sg,t)*v%t,_=en(w,s,t)*w%t,k=en(_,i,t)*_%t,B=en(k,l,t)*k%t,P=en(B,p,t)*B%t,R=en(P,l,t)*k%t,T=en(R,e,t)*y%t,U=en(T,c,t)*_%t,j=en(U,n,t)*v%t,Y=en(j,sg,t);if(!ag.eql(ag.sqr(Y),r))throw new Error("Cannot find square root");return Y}}),ug=function(r,t){const e=n=>CW({...r,...TW(n)});return Object.freeze({...e(t),create:e})}({a:BigInt(0),b:BigInt(7),Fp:ag,n:b7,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{const t=b7,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-LW*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=e,c=BigInt("0x100000000000000000000000000000000"),l=w7(i*r,t),p=w7(-n*r,t);let v=$r(r-l*e-p*s,t),y=$r(-l*n-p*i,t);const E=v>c,M=y>c;if(E&&(v=t-v),M&&(y=t-y),v>c||y>c)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:E,k1:v,k2neg:M,k2:y}}}},ng);function x7(r){try{return nW.ExtendedPoint.fromHex(r),!0}catch{return!1}}BigInt(0),ug.ProjectivePoint;const OW=r=>Hr.Buffer.isBuffer(r)?r:r instanceof Uint8Array?Hr.Buffer.from(r.buffer,r.byteOffset,r.byteLength):Hr.Buffer.from(r);class UW{constructor(t){Object.assign(this,t)}encode(){return Hr.Buffer.from(nk(gl,this))}static decode(t){return ik(gl,this,t)}static decodeUnchecked(t){return QS(gl,this,t)}}const gl=new Map;var _7;let Bk;const xv=32;let M7=1;Bk=Symbol.toStringTag;class lr extends UW{constructor(t){if(super({}),this._bn=void 0,function(e){return e._bn!==void 0}(t))this._bn=t._bn;else{if(typeof t=="string"){const e=Px.decode(t);if(e.length!=xv)throw new Error("Invalid public key input");this._bn=new Bx(e)}else this._bn=new Bx(t);if(this._bn.byteLength()>xv)throw new Error("Invalid public key input")}}static unique(){const t=new lr(M7);return M7+=1,new lr(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return Px.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(Hr.Buffer);if(t.length===xv)return t;const e=Hr.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[Bk](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,n){const s=Hr.Buffer.concat([t.toBuffer(),Hr.Buffer.from(e),n.toBuffer()]),i=ng(s);return new lr(i)}static createProgramAddressSync(t,e){let n=Hr.Buffer.alloc(0);t.forEach(function(i){if(i.length>32)throw new TypeError("Max seed length exceeded");n=Hr.Buffer.concat([n,OW(i)])}),n=Hr.Buffer.concat([n,e.toBuffer(),Hr.Buffer.from("ProgramDerivedAddress")]);const s=ng(n);if(x7(s))throw new Error("Invalid seeds, address must fall off the curve");return new lr(s)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n,s=255;for(;s!=0;){try{const i=t.concat(Hr.Buffer.from([s]));n=this.createProgramAddressSync(i,e)}catch(i){if(i instanceof TypeError)throw i;s--;continue}return[n,s]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return x7(new lr(t).toBytes())}}_7=lr,lr.default=new _7("11111111111111111111111111111111"),gl.set(lr,{kind:"struct",fields:[["_bn","u256"]]}),new lr("BPFLoader1111111111111111111111111111111111");const Sr=(r="publicKey")=>If(32,r),ju=(r="string")=>{const t=je([$e("length"),$e("lengthPadding"),If(eu($e(),-8),"chars")],r),e=t.decode.bind(t),n=t.encode.bind(t),s=t;return s.decode=(i,c)=>e(i,c).chars.toString(),s.encode=(i,c,l)=>{const p={chars:Hr.Buffer.from(i,"utf8")};return n(p,c,l)},s.alloc=i=>$e().span+$e().span+Hr.Buffer.from(i,"utf8").length,s};Hr.Buffer.alloc(64).fill(0);new lr("SysvarC1ock11111111111111111111111111111111"),new lr("SysvarEpochSchedu1e111111111111111111111111"),new lr("Sysvar1nstructions1111111111111111111111111");new lr("SysvarRecentB1ockHashes11111111111111111111");new lr("SysvarRent111111111111111111111111111111111");new lr("SysvarRewards111111111111111111111111111111"),new lr("SysvarS1otHashes111111111111111111111111111"),new lr("SysvarS1otHistory11111111111111111111111111"),new lr("SysvarStakeHistory1111111111111111111111111");const NW=Rn("lamportsPerSignature");je([$e("version"),$e("state"),Sr("authorizedPubkey"),Sr("nonce"),je([NW],"feeCalculator")]).span;const ff=r=>{const t=If(8,r),{encode:e,decode:n}=(i=>({decode:i.decode.bind(i),encode:i.encode.bind(i)}))(t),s=t;return s.decode=(i,c)=>{const l=n(i,c);return gW(Hr.Buffer.from(l))},s.encode=(i,c,l)=>{const p=yW(i,8);return e(p,c,l)},s};Object.freeze({Create:{index:0,layout:je([$e("instruction"),Ii("lamports"),Ii("space"),Sr("programId")])},Assign:{index:1,layout:je([$e("instruction"),Sr("programId")])},Transfer:{index:2,layout:je([$e("instruction"),ff("lamports")])},CreateWithSeed:{index:3,layout:je([$e("instruction"),Sr("base"),ju("seed"),Ii("lamports"),Ii("space"),Sr("programId")])},AdvanceNonceAccount:{index:4,layout:je([$e("instruction")])},WithdrawNonceAccount:{index:5,layout:je([$e("instruction"),Ii("lamports")])},InitializeNonceAccount:{index:6,layout:je([$e("instruction"),Sr("authorized")])},AuthorizeNonceAccount:{index:7,layout:je([$e("instruction"),Sr("authorized")])},Allocate:{index:8,layout:je([$e("instruction"),Ii("space")])},AllocateWithSeed:{index:9,layout:je([$e("instruction"),Sr("base"),ju("seed"),Ii("space"),Sr("programId")])},AssignWithSeed:{index:10,layout:je([$e("instruction"),Sr("base"),ju("seed"),Sr("programId")])},TransferWithSeed:{index:11,layout:je([$e("instruction"),ff("lamports"),ju("seed"),Sr("programId")])},UpgradeNonceAccount:{index:12,layout:je([$e("instruction")])}});new lr("11111111111111111111111111111111"),new lr("BPFLoader2111111111111111111111111111111111"),je([$e("typeIndex"),ff("deactivationSlot"),Rn("lastExtendedSlot"),fn("lastExtendedStartIndex"),fn(),Wa(Sr(),eu(fn(),-1),"authority")]);const vn=i0(Ab(lr),Me(),r=>new lr(r)),Pk=Sb([Me(),Wr("base64")]),kb=i0(Ab(Hr.Buffer),Pk,r=>Hr.Buffer.from(r[0],"base64"));function Rk(r){return gi([be({jsonrpc:Wr("2.0"),id:Me(),result:r}),be({jsonrpc:Wr("2.0"),id:Me(),error:be({code:n0(),message:Me(),data:He(xu("any",()=>!0))})})])}const DW=Rk(n0());function Or(r){return i0(Rk(r),DW,t=>"error"in t?t:{...t,result:m1(t.result,r)})}function Vi(r){return Or(be({context:be({slot:Kt()}),value:r}))}function g1(r){return be({context:be({slot:Kt()}),value:r})}const zW=be({foundation:Kt(),foundationTerm:Kt(),initial:Kt(),taper:Kt(),terminal:Kt()});Or(Oe(Le(be({epoch:Kt(),effectiveSlot:Kt(),amount:Kt(),postBalance:Kt(),commission:He(Le(Kt()))}))));const qW=Oe(be({slot:Kt(),prioritizationFee:Kt()})),FW=be({total:Kt(),validator:Kt(),foundation:Kt(),epoch:Kt()}),jW=be({epoch:Kt(),slotIndex:Kt(),slotsInEpoch:Kt(),absoluteSlot:Kt(),blockHeight:He(Kt()),transactionCount:He(Kt())}),$W=be({slotsPerEpoch:Kt(),leaderScheduleSlotOffset:Kt(),warmup:ts(),firstNormalEpoch:Kt(),firstNormalSlot:Kt()}),KW=Mk(Me(),Oe(Kt())),du=Le(gi([be({}),Me()])),HW=be({err:du}),VW=Wr("receivedSignature");be({"solana-core":Me(),"feature-set":He(Kt())}),Vi(be({err:Le(gi([be({}),Me()])),logs:Le(Oe(Me())),accounts:He(Le(Oe(Le(be({executable:ts(),owner:Me(),lamports:Kt(),data:Oe(Me()),rentEpoch:He(Kt())}))))),unitsConsumed:He(Kt()),returnData:He(Le(be({programId:Me(),data:Sb([Me(),Wr("base64")])})))})),Vi(be({byIdentity:Mk(Me(),Oe(Kt())),range:be({firstSlot:Kt(),lastSlot:Kt()})})),Or(zW),Or(FW),Or(qW),Or(jW),Or($W),Or(KW),Or(Kt()),Vi(be({total:Kt(),circulating:Kt(),nonCirculating:Kt(),nonCirculatingAccounts:Oe(vn)}));const ZW=be({amount:Me(),uiAmount:Le(Kt()),decimals:Kt(),uiAmountString:He(Me())});Vi(Oe(be({address:vn,amount:Me(),uiAmount:Le(Kt()),decimals:Kt(),uiAmountString:He(Me())}))),Vi(Oe(be({pubkey:vn,account:be({executable:ts(),owner:vn,lamports:Kt(),data:kb,rentEpoch:Kt()})})));const fg=be({program:Me(),parsed:n0(),space:Kt()});Vi(Oe(be({pubkey:vn,account:be({executable:ts(),owner:vn,lamports:Kt(),data:fg,rentEpoch:Kt()})}))),Vi(Oe(be({lamports:Kt(),address:vn})));const Ib=be({executable:ts(),owner:vn,lamports:Kt(),data:kb,rentEpoch:Kt()});be({pubkey:vn,account:Ib});const WW=i0(gi([Ab(Hr.Buffer),fg]),gi([Pk,fg]),r=>Array.isArray(r)?m1(r,kb):r),GW=be({executable:ts(),owner:vn,lamports:Kt(),data:WW,rentEpoch:Kt()});be({pubkey:vn,account:GW}),be({state:gi([Wr("active"),Wr("inactive"),Wr("activating"),Wr("deactivating")]),active:Kt(),inactive:Kt()}),Or(Oe(be({signature:Me(),slot:Kt(),err:du,memo:Le(Me()),blockTime:He(Le(Kt()))}))),Or(Oe(be({signature:Me(),slot:Kt(),err:du,memo:Le(Me()),blockTime:He(Le(Kt()))}))),be({subscription:Kt(),result:g1(Ib)});const YW=be({pubkey:vn,account:Ib});be({subscription:Kt(),result:g1(YW)});const XW=be({parent:Kt(),slot:Kt(),root:Kt()});be({subscription:Kt(),result:XW});const JW=gi([be({type:gi([Wr("firstShredReceived"),Wr("completed"),Wr("optimisticConfirmation"),Wr("root")]),slot:Kt(),timestamp:Kt()}),be({type:Wr("createdBank"),parent:Kt(),slot:Kt(),timestamp:Kt()}),be({type:Wr("frozen"),slot:Kt(),timestamp:Kt(),stats:be({numTransactionEntries:Kt(),numSuccessfulTransactions:Kt(),numFailedTransactions:Kt(),maxTransactionsPerEntry:Kt()})}),be({type:Wr("dead"),slot:Kt(),timestamp:Kt(),err:Me()})]);be({subscription:Kt(),result:JW}),be({subscription:Kt(),result:g1(gi([HW,VW]))}),be({subscription:Kt(),result:Kt()}),be({pubkey:Me(),gossip:Le(Me()),tpu:Le(Me()),rpc:Le(Me()),version:Le(Me())});const E7=be({votePubkey:Me(),nodePubkey:Me(),activatedStake:Kt(),epochVoteAccount:ts(),epochCredits:Oe(Sb([Kt(),Kt(),Kt()])),commission:Kt(),lastVote:Kt(),rootSlot:Le(Kt())});Or(be({current:Oe(E7),delinquent:Oe(E7)}));const QW=gi([Wr("processed"),Wr("confirmed"),Wr("finalized")]),tG=be({slot:Kt(),confirmations:Le(Kt()),err:du,confirmationStatus:He(QW)});Vi(Oe(Le(tG))),Or(Kt());const Ck=be({accountKey:vn,writableIndexes:Oe(Kt()),readonlyIndexes:Oe(Kt())}),_v=be({signatures:Oe(Me()),message:be({accountKeys:Oe(Me()),header:be({numRequiredSignatures:Kt(),numReadonlySignedAccounts:Kt(),numReadonlyUnsignedAccounts:Kt()}),instructions:Oe(be({accounts:Oe(Kt()),data:Me(),programIdIndex:Kt()})),recentBlockhash:Me(),addressTableLookups:He(Oe(Ck))})}),Tk=be({pubkey:vn,signer:ts(),writable:ts(),source:He(gi([Wr("transaction"),Wr("lookupTable")]))}),A7=be({accountKeys:Oe(Tk),signatures:Oe(Me())}),S7=be({parsed:n0(),program:Me(),programId:vn}),k7=be({accounts:Oe(vn),data:Me(),programId:vn}),Lk=i0(gi([k7,S7]),gi([be({parsed:n0(),program:Me(),programId:Me()}),be({accounts:Oe(Me()),data:Me(),programId:Me()})]),r=>m1(r,"accounts"in r?k7:S7)),I7=be({signatures:Oe(Me()),message:be({accountKeys:Oe(Tk),instructions:Oe(Lk),recentBlockhash:Me(),addressTableLookups:He(Le(Oe(Ck)))})}),td=be({accountIndex:Kt(),mint:Me(),owner:He(Me()),uiTokenAmount:ZW}),Ok=be({writable:Oe(vn),readonly:Oe(vn)}),G0=be({err:du,fee:Kt(),innerInstructions:He(Le(Oe(be({index:Kt(),instructions:Oe(be({accounts:Oe(Kt()),data:Me(),programIdIndex:Kt()}))})))),preBalances:Oe(Kt()),postBalances:Oe(Kt()),logMessages:He(Le(Oe(Me()))),preTokenBalances:He(Le(Oe(td))),postTokenBalances:He(Le(Oe(td))),loadedAddresses:He(Ok),computeUnitsConsumed:He(Kt())}),Mv=be({err:du,fee:Kt(),innerInstructions:He(Le(Oe(be({index:Kt(),instructions:Oe(Lk)})))),preBalances:Oe(Kt()),postBalances:Oe(Kt()),logMessages:He(Le(Oe(Me()))),preTokenBalances:He(Le(Oe(td))),postTokenBalances:He(Le(Oe(td))),loadedAddresses:He(Ok),computeUnitsConsumed:He(Kt())}),Ru=gi([Wr(0),Wr("legacy")]),ka=be({pubkey:Me(),lamports:Kt(),postBalance:Le(Kt()),rewardType:Le(Me()),commission:He(Le(Kt()))});Or(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:Kt(),transactions:Oe(be({transaction:_v,meta:Le(G0),version:He(Ru)})),rewards:He(Oe(ka)),blockTime:Le(Kt()),blockHeight:Le(Kt())}))),Or(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:Kt(),rewards:He(Oe(ka)),blockTime:Le(Kt()),blockHeight:Le(Kt())}))),Or(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:Kt(),transactions:Oe(be({transaction:A7,meta:Le(G0),version:He(Ru)})),rewards:He(Oe(ka)),blockTime:Le(Kt()),blockHeight:Le(Kt())}))),Or(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:Kt(),transactions:Oe(be({transaction:I7,meta:Le(Mv),version:He(Ru)})),rewards:He(Oe(ka)),blockTime:Le(Kt()),blockHeight:Le(Kt())}))),Or(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:Kt(),transactions:Oe(be({transaction:A7,meta:Le(Mv),version:He(Ru)})),rewards:He(Oe(ka)),blockTime:Le(Kt()),blockHeight:Le(Kt())}))),Or(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:Kt(),rewards:He(Oe(ka)),blockTime:Le(Kt()),blockHeight:Le(Kt())}))),Or(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:Kt(),transactions:Oe(be({transaction:_v,meta:Le(G0)})),rewards:He(Oe(ka)),blockTime:Le(Kt())}))),Or(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:Kt(),signatures:Oe(Me()),blockTime:Le(Kt())}))),Or(Le(be({slot:Kt(),meta:G0,blockTime:He(Le(Kt())),transaction:_v,version:He(Ru)}))),Or(Le(be({slot:Kt(),transaction:I7,meta:Le(Mv),blockTime:He(Le(Kt())),version:He(Ru)}))),Vi(be({blockhash:Me(),feeCalculator:be({lamportsPerSignature:Kt()})})),Vi(be({blockhash:Me(),lastValidBlockHeight:Kt()})),Vi(ts()),Or(Oe(be({slot:Kt(),numTransactions:Kt(),numSlots:Kt(),samplePeriodSecs:Kt()}))),Vi(Le(be({feeCalculator:be({lamportsPerSignature:Kt()})}))),Or(Me()),Or(Me());const eG=be({err:du,logs:Oe(Me()),signature:Me()});var B7;be({result:g1(eG),subscription:Kt()}),Object.freeze({CreateLookupTable:{index:0,layout:je([$e("instruction"),ff("recentSlot"),fn("bumpSeed")])},FreezeLookupTable:{index:1,layout:je([$e("instruction")])},ExtendLookupTable:{index:2,layout:je([$e("instruction"),ff(),Wa(Sr(),eu($e(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:je([$e("instruction")])},CloseLookupTable:{index:4,layout:je([$e("instruction")])}}),new lr("AddressLookupTab1e1111111111111111111111111"),Object.freeze({RequestUnits:{index:0,layout:je([fn("instruction"),$e("units"),$e("additionalFee")])},RequestHeapFrame:{index:1,layout:je([fn("instruction"),$e("bytes")])},SetComputeUnitLimit:{index:2,layout:je([fn("instruction"),$e("units")])},SetComputeUnitPrice:{index:3,layout:je([fn("instruction"),ff("microLamports")])}}),new lr("ComputeBudget111111111111111111111111111111"),je([fn("numSignatures"),fn("padding"),Di("signatureOffset"),Di("signatureInstructionIndex"),Di("publicKeyOffset"),Di("publicKeyInstructionIndex"),Di("messageDataOffset"),Di("messageDataSize"),Di("messageInstructionIndex")]),new lr("Ed25519SigVerify111111111111111111111111111"),ug.utils.isValidPrivateKey,ug.getPublicKey,je([fn("numSignatures"),Di("signatureOffset"),fn("signatureInstructionIndex"),Di("ethAddressOffset"),fn("ethAddressInstructionIndex"),Di("messageDataOffset"),Di("messageDataSize"),fn("messageInstructionIndex"),If(20,"ethAddress"),If(64,"signature"),fn("recoveryId")]),new lr("KeccakSecp256k11111111111111111111111111111"),new lr("StakeConfig11111111111111111111111111111111");class P7{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}}B7=P7,P7.default=new B7(0,0,lr.default),Object.freeze({Initialize:{index:0,layout:je([$e("instruction"),((r="authorized")=>je([Sr("staker"),Sr("withdrawer")],r))(),((r="lockup")=>je([Ii("unixTimestamp"),Ii("epoch"),Sr("custodian")],r))()])},Authorize:{index:1,layout:je([$e("instruction"),Sr("newAuthorized"),$e("stakeAuthorizationType")])},Delegate:{index:2,layout:je([$e("instruction")])},Split:{index:3,layout:je([$e("instruction"),Ii("lamports")])},Withdraw:{index:4,layout:je([$e("instruction"),Ii("lamports")])},Deactivate:{index:5,layout:je([$e("instruction")])},Merge:{index:7,layout:je([$e("instruction")])},AuthorizeWithSeed:{index:8,layout:je([$e("instruction"),Sr("newAuthorized"),$e("stakeAuthorizationType"),ju("authoritySeed"),Sr("authorityOwner")])}}),new lr("Stake11111111111111111111111111111111111111"),Object.freeze({InitializeAccount:{index:0,layout:je([$e("instruction"),((r="voteInit")=>je([Sr("nodePubkey"),Sr("authorizedVoter"),Sr("authorizedWithdrawer"),fn("commission")],r))()])},Authorize:{index:1,layout:je([$e("instruction"),Sr("newAuthorized"),$e("voteAuthorizationType")])},Withdraw:{index:3,layout:je([$e("instruction"),Ii("lamports")])},AuthorizeWithSeed:{index:10,layout:je([$e("instruction"),((r="voteAuthorizeWithSeedArgs")=>je([$e("voteAuthorizationType"),Sr("currentAuthorityDerivedKeyOwnerPubkey"),ju("currentAuthorityDerivedKeySeed"),Sr("newAuthorized")],r))()])}}),new lr("Vote111111111111111111111111111111111111111"),new lr("Va1idator1nfo111111111111111111111111111111"),be({name:Me(),website:He(Me()),details:He(Me()),keybaseUsername:He(Me())}),new lr("Vote111111111111111111111111111111111111111"),je([Sr("nodePubkey"),Sr("authorizedWithdrawer"),fn("commission"),Rn(),Wa(je([Rn("slot"),$e("confirmationCount")]),eu($e(),-8),"votes"),fn("rootSlotValid"),Rn("rootSlot"),Rn(),Wa(je([Rn("epoch"),Sr("authorizedVoter")]),eu($e(),-8),"authorizedVoters"),je([Wa(je([Sr("authorizedPubkey"),Rn("epochOfLastAuthorizedSwitch"),Rn("targetEpoch")]),32,"buf"),Rn("idx"),fn("isEmpty")],"priorVoters"),Rn(),Wa(je([Rn("epoch"),Rn("credits"),Rn("prevCredits")]),eu($e(),-8),"epochCredits"),je([Rn("slot"),Rn("timestamp")],"lastTimestamp")]);var Y0,rG=(Y0=function(r,t){return Y0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])},Y0(r,t)},function(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=r}Y0(r,t),r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)});(function(r){function t(e,n){var s="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(n);return r.call(this,s)||this}return rG(t,r),t})(Error);const R7=new lr("HP3D4D1ZCmohQGFVms2SS4LCANgJyksBf5s1F77FuFjZ");lr.findProgramAddressSync([R7.toBuffer()],R7);var C7;(function(r){r[r.None=0]="None",r[r.Solana=1]="Solana",r[r.Ethereum=2]="Ethereum",r[r.UnverifiedSolana=3]="UnverifiedSolana"})(C7||(C7={}));var cr;(function(r){r.IPFS="IPFS",r.ARWV="ARWV",r.SOL="SOL",r.ETH="ETH",r.BTC="BTC",r.LTC="LTC",r.DOGE="DOGE",r.Email="email",r.Url="url",r.Discord="discord",r.Github="github",r.Reddit="reddit",r.Twitter="twitter",r.Telegram="telegram",r.Pic="pic",r.SHDW="SHDW",r.POINT="POINT",r.BSC="BSC",r.Injective="INJ",r.Backpack="backpack",r.A="A",r.AAAA="AAAA",r.CNAME="CNAME",r.TXT="TXT",r.Background="background"})(cr||(cr={}));cr.SOL,cr.ETH,cr.BSC,cr.Injective,cr.A,cr.AAAA,cr.Background;var T7;(function(r){r[r.V1=1]="V1",r[r.V2=2]="V2"})(T7||(T7={}));const L7=r=>{const t=CH+r,e=RH(Ae.Buffer.from(t,"utf8")).slice(2);return Ae.Buffer.from(e,"hex")},O7=(r,t,e)=>{const n=[r];t?n.push(t.toBuffer()):n.push(Ae.Buffer.alloc(32)),e?n.push(e.toBuffer()):n.push(Ae.Buffer.alloc(32));const[s]=Xt.findProgramAddressSync(n,ZA);return s};var Bs={},$u={};function U7(r,t,e,n,s){var i=(1<=n;)l-=n,e[p]=c>>l&i,p+=1}),s)l>0&&(e[p]=c<=t)throw new Error("Excessive padding: ".concat(l," (max ").concat(t-1," allowed)"));if(c%(1<8||t<1)throw new RangeError("Invalid bits per element; 1 to 8 expected");return U7(r,t,e,8,!1),e},$u.toBits=function(r,t,e){if(t>8||t<1)throw new RangeError("Invalid bits per element; 1 to 8 expected");return U7(r,8,e,t,!0),e};var so={};Object.defineProperty(so,"__esModule",{value:!0}),so.CHECKSUM_LENGTH=void 0,so.createChecksum=function(r,t){var e;switch(t){case"bech32":e=1;break;case"bech32m":e=N7;break;default:throw Error("Invalid encoding value: ".concat(t,"; expected bech32 or bech32m"))}for(var n=q7(r)^e,s=0;s>i&31}},so.decode=j7,so.decodeWithPrefix=function(r,t){var e=t.length+2*r.length+1,n=(0,Uk.createBitArray)(e);return F7(r,n.subarray(0,2*r.length+1)),j7(t,n.subarray(2*r.length+1)),n},so.detectCase=function(r){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"message",e=!1,n=!1,s=0;sz7)throw new TypeError("Invalid char in ".concat(t,": ").concat(i,"; ")+"should be in ASCII range ".concat(D7,"-").concat(z7));n=n||i>=65&&i<=90,e=e||i>=97&&i<=122}if(e&&n)throw new TypeError("Mixed-case ".concat(t));return n?"upper":e?"lower":null},so.encode=function(r){return r.reduce(function(t,e){return t+cg[e]},"")},so.expandPrefix=F7,so.verifyChecksum=function(r){switch(q7(r)){case 1:return"bech32";case N7:return"bech32m";default:return}};var Uk=$u,cg="qpzry9x8gf2tvdw0s3jn54khce6mua7l",N7=734539939,D7=33,z7=126,hg=6;so.CHECKSUM_LENGTH=hg;var nG=function(){for(var r=new Map,t=0;t>25,s=(33554431&t)<<5^e;return iG.reduce(function(i,c,l){return n>>l&1?i^c:i},s)},1)}function F7(r,t){for(var e=0;e>5,t[e+r.length+1]=31&n}t[r.length]=0}function j7(r,t){for(var e=t||(0,Uk.createBitArray)(r.length),n=0;n2&&arguments[2]!==void 0?arguments[2]:"bech32";return Rb(r,Bb(t),e)};Bs.encode5BitArray=Rb,Bs.from5BitArray=Pb,Bs.to5BitArray=Bb;var Sh=$u,Ki=so;function $7(r,t){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:"bech32",s=2*r.length+1+t.length+Ki.CHECKSUM_LENGTH;if(s-r.length>ed)throw new Error("Message to be produced is too long (max ".concat(ed," supported)"));var i=(e=(0,Ki.detectCase)(r,"prefix"))!==null&&e!==void 0?e:"lower",c=(0,Sh.createBitArray)(s);(0,Ki.expandPrefix)(r.toLowerCase(),c.subarray(0,2*r.length+1)),c.subarray(2*r.length+1,c.length-Ki.CHECKSUM_LENGTH).set(t),(0,Ki.createChecksum)(c,n);var l=(0,Ki.encode)(c.subarray(2*r.length+1));return i==="upper"&&(l=l.toUpperCase()),"".concat(r,"1").concat(l)}function Cb(r){if(r.length>ed)throw new TypeError("Message too long; max ".concat(ed," expected"));(0,Ki.detectCase)(r);var t=r.toLowerCase(),e=t.lastIndexOf("1");if(e<0)throw new Error('No separator char ("1") found');if(e>r.length-Ki.CHECKSUM_LENGTH-1)throw new Error("Data part of the message too short (at least ".concat(Ki.CHECKSUM_LENGTH," chars expected)"));var n=t.substring(0,e),s=(0,Ki.decodeWithPrefix)(n,t.substring(e+1)),i=(0,Ki.verifyChecksum)(s);if(i===void 0)throw new Error("Invalid checksum");return{prefix:n,encoding:i,data:s.subarray(2*n.length+1,s.length-Ki.CHECKSUM_LENGTH)}}var oG=function(){function r(s,i,c){if(function(l,p){if(!(l instanceof p))throw new TypeError("Cannot call a class as a function")}(this,r),s!=="bc"&&s!=="tb")throw new Error('Invalid human-readable prefix, "bc" or "tb" expected');if(i<0||i>16)throw new RangeError("Invalid scriptVersion, value in range [0, 16] expected");if(c.length<2||c.length>40)throw new RangeError("Invalid script length: expected 2 to 40 bytes");if(i===0&&c.length!==20&&c.length!==32)throw new Error("Invalid v0 script length: expected 20 or 32 bytes");this.prefix=s,this.scriptVersion=i,this.data=c}var t,e,n;return t=r,e=[{key:"type",value:function(){if(this.scriptVersion===0)switch(this.data.length){case 20:return"p2wpkh";case 32:return"p2wsh";default:return}}},{key:"encode",value:function(){var s=Math.ceil(8*this.data.length/5),i=(0,Sh.createBitArray)(s+1);i[0]=this.scriptVersion,Bb(this.data,i.subarray(1));var c=this.scriptVersion===0?"bech32":"bech32m";return Rb(this.prefix,i,c)}}],n=[{key:"decode",value:function(s){var i=Cb(s),c=i.prefix,l=i.data,p=i.encoding;if(c!=="bc"&&c!=="tb")throw new Error('Invalid human-readable prefix, "bc" or "tb" expected');var v=l[0];if(v===0&&p!=="bech32")throw Error("Unexpected encoding ".concat(p," used for version 0 script"));if(v>0&&p!=="bech32m")throw Error("Unexpected encoding ".concat(p," used for version ").concat(v," script"));return new this(c,v,Pb(l.subarray(1)))}}],e&&$7(t.prototype,e),n&&$7(t,n),Object.defineProperty(t,"prototype",{writable:!1}),r}();Bs.BitcoinAddress=oG;var Nk={exports:{}};(function(r){(function(t){const e="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${e}\\.${e}\\.${e}\\.${e}$`,"i"),threeOctet:new RegExp(`^${e}\\.${e}\\.${e}$`,"i"),twoOctet:new RegExp(`^${e}\\.${e}$`,"i"),longValue:new RegExp(`^${e}$`,"i")},s=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),c="%[0-9a-z]{1,}",l="(?:[0-9a-f]+::?)+",p={zoneIndex:new RegExp(c,"i"),native:new RegExp(`^(::)?(${l})?([0-9a-f]+)?(::)?(${c})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${e}\\.${e}\\.${e}\\.${e}(${c})?)$`,"i"),transitional:new RegExp(`^((?:${l})|(?:::)(?:${l})?)${e}\\.${e}\\.${e}\\.${e}(${c})?$`,"i")};function v(_,k){if(_.indexOf("::")!==_.lastIndexOf("::"))return null;let B,P,R=0,T=-1,U=(_.match(p.zoneIndex)||[])[0];for(U&&(U=U.substring(1),_=_.replace(/%.+$/,""));(T=_.indexOf(":",T+1))>=0;)R++;if(_.substr(0,2)==="::"&&R--,_.substr(-2,2)==="::"&&R--,R>k)return null;for(P=k-R,B=":";P--;)B+="0:";return(_=_.replace("::",B))[0]===":"&&(_=_.slice(1)),_[_.length-1]===":"&&(_=_.slice(0,-1)),k=function(){const j=_.split(":"),Y=[];for(let rt=0;rt0;){if(R=B-P,R<0&&(R=0),_[T]>>R!=k[T]>>R)return!1;P-=B,T+=1}return!0}function E(_){if(i.test(_))return parseInt(_,16);if(_[0]==="0"&&!isNaN(parseInt(_[1],10))){if(s.test(_))return parseInt(_,8);throw new Error(`ipaddr: cannot parse ${_} as octal`)}return parseInt(_,10)}function M(_,k){for(;_.length=0;R-=1){if(T=this.octets[R],!(T in P)||(U=P[T],B&&U!==0))return null;U!==8&&(B=!0),k+=U}return 32-k},_.prototype.range=function(){return w.subnetMatch(this,this.SpecialRanges)},_.prototype.toByteArray=function(){return this.octets.slice(0)},_.prototype.toIPv4MappedAddress=function(){return w.IPv6.parse(`::ffff:${this.toString()}`)},_.prototype.toNormalizedString=function(){return this.toString()},_.prototype.toString=function(){return this.octets.join(".")},_}(),w.IPv4.broadcastAddressFromCIDR=function(_){try{const k=this.parseCIDR(_),B=k[0].toByteArray(),P=this.subnetMaskFromPrefixLength(k[1]).toByteArray(),R=[];let T=0;for(;T<4;)R.push(parseInt(B[T],10)|255^parseInt(P[T],10)),T++;return new this(R)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},w.IPv4.isIPv4=function(_){return this.parser(_)!==null},w.IPv4.isValid=function(_){try{return new this(this.parser(_)),!0}catch{return!1}},w.IPv4.isValidFourPartDecimal=function(_){return!(!w.IPv4.isValid(_)||!_.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},w.IPv4.networkAddressFromCIDR=function(_){let k,B,P,R,T;try{for(k=this.parseCIDR(_),P=k[0].toByteArray(),T=this.subnetMaskFromPrefixLength(k[1]).toByteArray(),R=[],B=0;B<4;)R.push(parseInt(P[B],10)&parseInt(T[B],10)),B++;return new this(R)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},w.IPv4.parse=function(_){const k=this.parser(_);if(k===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(k)},w.IPv4.parseCIDR=function(_){let k;if(k=_.match(/^(.+)\/(\d+)$/)){const B=parseInt(k[2]);if(B>=0&&B<=32){const P=[this.parse(k[1]),B];return Object.defineProperty(P,"toString",{value:function(){return this.join("/")}}),P}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},w.IPv4.parser=function(_){let k,B,P;if(k=_.match(n.fourOctet))return function(){const R=k.slice(1,6),T=[];for(let U=0;U4294967295||P<0)throw new Error("ipaddr: address outside defined range");return function(){const R=[];let T;for(T=0;T<=24;T+=8)R.push(P>>T&255);return R}().reverse()}return(k=_.match(n.twoOctet))?function(){const R=k.slice(1,4),T=[];if(P=E(R[1]),P>16777215||P<0)throw new Error("ipaddr: address outside defined range");return T.push(E(R[0])),T.push(P>>16&255),T.push(P>>8&255),T.push(255&P),T}():(k=_.match(n.threeOctet))?function(){const R=k.slice(1,5),T=[];if(P=E(R[2]),P>65535||P<0)throw new Error("ipaddr: address outside defined range");return T.push(E(R[0])),T.push(E(R[1])),T.push(P>>8&255),T.push(255&P),T}():null},w.IPv4.subnetMaskFromPrefixLength=function(_){if((_=parseInt(_))<0||_>32)throw new Error("ipaddr: invalid IPv4 prefix length");const k=[0,0,0,0];let B=0;const P=Math.floor(_/8);for(;B=0;U-=1){if(R=this.parts[U],!(R in P)||(T=P[R],B&&T!==0))return null;T!==16&&(B=!0),k+=T}return 128-k},_.prototype.range=function(){return w.subnetMatch(this,this.SpecialRanges)},_.prototype.toByteArray=function(){let k;const B=[],P=this.parts;for(let R=0;R>8),B.push(255&k);return B},_.prototype.toFixedLengthString=function(){const k=(function(){const P=[];for(let R=0;R>8,255&B,P>>8,255&P])},_.prototype.toNormalizedString=function(){const k=(function(){const P=[];for(let R=0;RT&&(R=P.index,T=P[0].length);return T<0?B:`${B.substring(0,R)}::${B.substring(R+T)}`},_.prototype.toString=function(){return this.toRFC5952String()},_}(),w.IPv6.broadcastAddressFromCIDR=function(_){try{const k=this.parseCIDR(_),B=k[0].toByteArray(),P=this.subnetMaskFromPrefixLength(k[1]).toByteArray(),R=[];let T=0;for(;T<16;)R.push(parseInt(B[T],10)|255^parseInt(P[T],10)),T++;return new this(R)}catch(k){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${k})`)}},w.IPv6.isIPv6=function(_){return this.parser(_)!==null},w.IPv6.isValid=function(_){if(typeof _=="string"&&_.indexOf(":")===-1)return!1;try{const k=this.parser(_);return new this(k.parts,k.zoneId),!0}catch{return!1}},w.IPv6.networkAddressFromCIDR=function(_){let k,B,P,R,T;try{for(k=this.parseCIDR(_),P=k[0].toByteArray(),T=this.subnetMaskFromPrefixLength(k[1]).toByteArray(),R=[],B=0;B<16;)R.push(parseInt(P[B],10)&parseInt(T[B],10)),B++;return new this(R)}catch(U){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${U})`)}},w.IPv6.parse=function(_){const k=this.parser(_);if(k.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(k.parts,k.zoneId)},w.IPv6.parseCIDR=function(_){let k,B,P;if((B=_.match(/^(.+)\/(\d+)$/))&&(k=parseInt(B[2]),k>=0&&k<=128))return P=[this.parse(B[1]),k],Object.defineProperty(P,"toString",{value:function(){return this.join("/")}}),P;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},w.IPv6.parser=function(_){let k,B,P,R,T,U;if(P=_.match(p.deprecatedTransitional))return this.parser(`::ffff:${P[1]}`);if(p.native.test(_))return v(_,8);if((P=_.match(p.transitional))&&(U=P[6]||"",k=v(P[1].slice(0,-1)+U,6),k.parts)){for(T=[parseInt(P[2]),parseInt(P[3]),parseInt(P[4]),parseInt(P[5])],B=0;B128)throw new Error("ipaddr: invalid IPv6 prefix length");const k=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let B=0;const P=Math.floor(_/8);for(;B>24&255,J[X+1]=st>>16&255,J[X+2]=st>>8&255,J[X+3]=255&st,J[X+4]=D>>24&255,J[X+5]=D>>16&255,J[X+6]=D>>8&255,J[X+7]=255&D}function _(J,X,st,D,K){var gt,ft=0;for(gt=0;gt>>8)-1}function k(J,X,st,D){return _(J,X,st,D,16)}function B(J,X,st,D){return _(J,X,st,D,32)}function P(J,X,st,D){(function(K,gt,ft,pt){for(var vt,At=255&pt[0]|(255&pt[1])<<8|(255&pt[2])<<16|(255&pt[3])<<24,_t=255&ft[0]|(255&ft[1])<<8|(255&ft[2])<<16|(255&ft[3])<<24,Wt=255&ft[4]|(255&ft[5])<<8|(255&ft[6])<<16|(255&ft[7])<<24,Pt=255&ft[8]|(255&ft[9])<<8|(255&ft[10])<<16|(255&ft[11])<<24,wt=255&ft[12]|(255&ft[13])<<8|(255&ft[14])<<16|(255&ft[15])<<24,se=255&pt[4]|(255&pt[5])<<8|(255&pt[6])<<16|(255&pt[7])<<24,Lt=255>[0]|(255>[1])<<8|(255>[2])<<16|(255>[3])<<24,Et=255>[4]|(255>[5])<<8|(255>[6])<<16|(255>[7])<<24,de=255>[8]|(255>[9])<<8|(255>[10])<<16|(255>[11])<<24,Bt=255>[12]|(255>[13])<<8|(255>[14])<<16|(255>[15])<<24,Mt=255&pt[8]|(255&pt[9])<<8|(255&pt[10])<<16|(255&pt[11])<<24,$=255&ft[16]|(255&ft[17])<<8|(255&ft[18])<<16|(255&ft[19])<<24,G=255&ft[20]|(255&ft[21])<<8|(255&ft[22])<<16|(255&ft[23])<<24,H=255&ft[24]|(255&ft[25])<<8|(255&ft[26])<<16|(255&ft[27])<<24,N=255&ft[28]|(255&ft[29])<<8|(255&ft[30])<<16|(255&ft[31])<<24,V=255&pt[12]|(255&pt[13])<<8|(255&pt[14])<<16|(255&pt[15])<<24,tt=At,lt=_t,at=Wt,ht=Pt,zt=wt,Zt=se,ye=Lt,Yt=Et,pe=de,ve=Bt,ge=Mt,ie=$,ue=G,fe=H,ce=N,$t=V,oe=0;oe<20;oe+=2)tt^=(vt=(ue^=(vt=(pe^=(vt=(zt^=(vt=tt+ue|0)<<7|vt>>>25)+tt|0)<<9|vt>>>23)+zt|0)<<13|vt>>>19)+pe|0)<<18|vt>>>14,Zt^=(vt=(lt^=(vt=(fe^=(vt=(ve^=(vt=Zt+lt|0)<<7|vt>>>25)+Zt|0)<<9|vt>>>23)+ve|0)<<13|vt>>>19)+fe|0)<<18|vt>>>14,ge^=(vt=(ye^=(vt=(at^=(vt=(ce^=(vt=ge+ye|0)<<7|vt>>>25)+ge|0)<<9|vt>>>23)+ce|0)<<13|vt>>>19)+at|0)<<18|vt>>>14,$t^=(vt=(ie^=(vt=(Yt^=(vt=(ht^=(vt=$t+ie|0)<<7|vt>>>25)+$t|0)<<9|vt>>>23)+ht|0)<<13|vt>>>19)+Yt|0)<<18|vt>>>14,tt^=(vt=(ht^=(vt=(at^=(vt=(lt^=(vt=tt+ht|0)<<7|vt>>>25)+tt|0)<<9|vt>>>23)+lt|0)<<13|vt>>>19)+at|0)<<18|vt>>>14,Zt^=(vt=(zt^=(vt=(Yt^=(vt=(ye^=(vt=Zt+zt|0)<<7|vt>>>25)+Zt|0)<<9|vt>>>23)+ye|0)<<13|vt>>>19)+Yt|0)<<18|vt>>>14,ge^=(vt=(ve^=(vt=(pe^=(vt=(ie^=(vt=ge+ve|0)<<7|vt>>>25)+ge|0)<<9|vt>>>23)+ie|0)<<13|vt>>>19)+pe|0)<<18|vt>>>14,$t^=(vt=(ce^=(vt=(fe^=(vt=(ue^=(vt=$t+ce|0)<<7|vt>>>25)+$t|0)<<9|vt>>>23)+ue|0)<<13|vt>>>19)+fe|0)<<18|vt>>>14;tt=tt+At|0,lt=lt+_t|0,at=at+Wt|0,ht=ht+Pt|0,zt=zt+wt|0,Zt=Zt+se|0,ye=ye+Lt|0,Yt=Yt+Et|0,pe=pe+de|0,ve=ve+Bt|0,ge=ge+Mt|0,ie=ie+$|0,ue=ue+G|0,fe=fe+H|0,ce=ce+N|0,$t=$t+V|0,K[0]=tt>>>0&255,K[1]=tt>>>8&255,K[2]=tt>>>16&255,K[3]=tt>>>24&255,K[4]=lt>>>0&255,K[5]=lt>>>8&255,K[6]=lt>>>16&255,K[7]=lt>>>24&255,K[8]=at>>>0&255,K[9]=at>>>8&255,K[10]=at>>>16&255,K[11]=at>>>24&255,K[12]=ht>>>0&255,K[13]=ht>>>8&255,K[14]=ht>>>16&255,K[15]=ht>>>24&255,K[16]=zt>>>0&255,K[17]=zt>>>8&255,K[18]=zt>>>16&255,K[19]=zt>>>24&255,K[20]=Zt>>>0&255,K[21]=Zt>>>8&255,K[22]=Zt>>>16&255,K[23]=Zt>>>24&255,K[24]=ye>>>0&255,K[25]=ye>>>8&255,K[26]=ye>>>16&255,K[27]=ye>>>24&255,K[28]=Yt>>>0&255,K[29]=Yt>>>8&255,K[30]=Yt>>>16&255,K[31]=Yt>>>24&255,K[32]=pe>>>0&255,K[33]=pe>>>8&255,K[34]=pe>>>16&255,K[35]=pe>>>24&255,K[36]=ve>>>0&255,K[37]=ve>>>8&255,K[38]=ve>>>16&255,K[39]=ve>>>24&255,K[40]=ge>>>0&255,K[41]=ge>>>8&255,K[42]=ge>>>16&255,K[43]=ge>>>24&255,K[44]=ie>>>0&255,K[45]=ie>>>8&255,K[46]=ie>>>16&255,K[47]=ie>>>24&255,K[48]=ue>>>0&255,K[49]=ue>>>8&255,K[50]=ue>>>16&255,K[51]=ue>>>24&255,K[52]=fe>>>0&255,K[53]=fe>>>8&255,K[54]=fe>>>16&255,K[55]=fe>>>24&255,K[56]=ce>>>0&255,K[57]=ce>>>8&255,K[58]=ce>>>16&255,K[59]=ce>>>24&255,K[60]=$t>>>0&255,K[61]=$t>>>8&255,K[62]=$t>>>16&255,K[63]=$t>>>24&255})(J,X,st,D)}function R(J,X,st,D){(function(K,gt,ft,pt){for(var vt,At=255&pt[0]|(255&pt[1])<<8|(255&pt[2])<<16|(255&pt[3])<<24,_t=255&ft[0]|(255&ft[1])<<8|(255&ft[2])<<16|(255&ft[3])<<24,Wt=255&ft[4]|(255&ft[5])<<8|(255&ft[6])<<16|(255&ft[7])<<24,Pt=255&ft[8]|(255&ft[9])<<8|(255&ft[10])<<16|(255&ft[11])<<24,wt=255&ft[12]|(255&ft[13])<<8|(255&ft[14])<<16|(255&ft[15])<<24,se=255&pt[4]|(255&pt[5])<<8|(255&pt[6])<<16|(255&pt[7])<<24,Lt=255>[0]|(255>[1])<<8|(255>[2])<<16|(255>[3])<<24,Et=255>[4]|(255>[5])<<8|(255>[6])<<16|(255>[7])<<24,de=255>[8]|(255>[9])<<8|(255>[10])<<16|(255>[11])<<24,Bt=255>[12]|(255>[13])<<8|(255>[14])<<16|(255>[15])<<24,Mt=255&pt[8]|(255&pt[9])<<8|(255&pt[10])<<16|(255&pt[11])<<24,$=255&ft[16]|(255&ft[17])<<8|(255&ft[18])<<16|(255&ft[19])<<24,G=255&ft[20]|(255&ft[21])<<8|(255&ft[22])<<16|(255&ft[23])<<24,H=255&ft[24]|(255&ft[25])<<8|(255&ft[26])<<16|(255&ft[27])<<24,N=255&ft[28]|(255&ft[29])<<8|(255&ft[30])<<16|(255&ft[31])<<24,V=255&pt[12]|(255&pt[13])<<8|(255&pt[14])<<16|(255&pt[15])<<24,tt=0;tt<20;tt+=2)At^=(vt=(G^=(vt=(de^=(vt=(wt^=(vt=At+G|0)<<7|vt>>>25)+At|0)<<9|vt>>>23)+wt|0)<<13|vt>>>19)+de|0)<<18|vt>>>14,se^=(vt=(_t^=(vt=(H^=(vt=(Bt^=(vt=se+_t|0)<<7|vt>>>25)+se|0)<<9|vt>>>23)+Bt|0)<<13|vt>>>19)+H|0)<<18|vt>>>14,Mt^=(vt=(Lt^=(vt=(Wt^=(vt=(N^=(vt=Mt+Lt|0)<<7|vt>>>25)+Mt|0)<<9|vt>>>23)+N|0)<<13|vt>>>19)+Wt|0)<<18|vt>>>14,V^=(vt=($^=(vt=(Et^=(vt=(Pt^=(vt=V+$|0)<<7|vt>>>25)+V|0)<<9|vt>>>23)+Pt|0)<<13|vt>>>19)+Et|0)<<18|vt>>>14,At^=(vt=(Pt^=(vt=(Wt^=(vt=(_t^=(vt=At+Pt|0)<<7|vt>>>25)+At|0)<<9|vt>>>23)+_t|0)<<13|vt>>>19)+Wt|0)<<18|vt>>>14,se^=(vt=(wt^=(vt=(Et^=(vt=(Lt^=(vt=se+wt|0)<<7|vt>>>25)+se|0)<<9|vt>>>23)+Lt|0)<<13|vt>>>19)+Et|0)<<18|vt>>>14,Mt^=(vt=(Bt^=(vt=(de^=(vt=($^=(vt=Mt+Bt|0)<<7|vt>>>25)+Mt|0)<<9|vt>>>23)+$|0)<<13|vt>>>19)+de|0)<<18|vt>>>14,V^=(vt=(N^=(vt=(H^=(vt=(G^=(vt=V+N|0)<<7|vt>>>25)+V|0)<<9|vt>>>23)+G|0)<<13|vt>>>19)+H|0)<<18|vt>>>14;K[0]=At>>>0&255,K[1]=At>>>8&255,K[2]=At>>>16&255,K[3]=At>>>24&255,K[4]=se>>>0&255,K[5]=se>>>8&255,K[6]=se>>>16&255,K[7]=se>>>24&255,K[8]=Mt>>>0&255,K[9]=Mt>>>8&255,K[10]=Mt>>>16&255,K[11]=Mt>>>24&255,K[12]=V>>>0&255,K[13]=V>>>8&255,K[14]=V>>>16&255,K[15]=V>>>24&255,K[16]=Lt>>>0&255,K[17]=Lt>>>8&255,K[18]=Lt>>>16&255,K[19]=Lt>>>24&255,K[20]=Et>>>0&255,K[21]=Et>>>8&255,K[22]=Et>>>16&255,K[23]=Et>>>24&255,K[24]=de>>>0&255,K[25]=de>>>8&255,K[26]=de>>>16&255,K[27]=de>>>24&255,K[28]=Bt>>>0&255,K[29]=Bt>>>8&255,K[30]=Bt>>>16&255,K[31]=Bt>>>24&255})(J,X,st,D)}var T=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function U(J,X,st,D,K,gt,ft){var pt,vt,At=new Uint8Array(16),_t=new Uint8Array(64);for(vt=0;vt<16;vt++)At[vt]=0;for(vt=0;vt<8;vt++)At[vt]=gt[vt];for(;K>=64;){for(P(_t,At,ft,T),vt=0;vt<64;vt++)J[X+vt]=st[D+vt]^_t[vt];for(pt=1,vt=8;vt<16;vt++)pt=pt+(255&At[vt])|0,At[vt]=255&pt,pt>>>=8;K-=64,X+=64,D+=64}if(K>0)for(P(_t,At,ft,T),vt=0;vt=64;){for(P(vt,pt,K,T),ft=0;ft<64;ft++)J[X+ft]=vt[ft];for(gt=1,ft=8;ft<16;ft++)gt=gt+(255&pt[ft])|0,pt[ft]=255>,gt>>>=8;st-=64,X+=64}if(st>0)for(P(vt,pt,K,T),ft=0;ft>>13|st<<3),D=255&J[4]|(255&J[5])<<8,this.r[2]=7939&(st>>>10|D<<6),K=255&J[6]|(255&J[7])<<8,this.r[3]=8191&(D>>>7|K<<9),gt=255&J[8]|(255&J[9])<<8,this.r[4]=255&(K>>>4|gt<<12),this.r[5]=gt>>>1&8190,ft=255&J[10]|(255&J[11])<<8,this.r[6]=8191&(gt>>>14|ft<<2),pt=255&J[12]|(255&J[13])<<8,this.r[7]=8065&(ft>>>11|pt<<5),vt=255&J[14]|(255&J[15])<<8,this.r[8]=8191&(pt>>>8|vt<<8),this.r[9]=vt>>>5&127,this.pad[0]=255&J[16]|(255&J[17])<<8,this.pad[1]=255&J[18]|(255&J[19])<<8,this.pad[2]=255&J[20]|(255&J[21])<<8,this.pad[3]=255&J[22]|(255&J[23])<<8,this.pad[4]=255&J[24]|(255&J[25])<<8,this.pad[5]=255&J[26]|(255&J[27])<<8,this.pad[6]=255&J[28]|(255&J[29])<<8,this.pad[7]=255&J[30]|(255&J[31])<<8};function Z(J,X,st,D,K,gt){var ft=new nt(gt);return ft.update(st,D,K),ft.finish(J,X),0}function x(J,X,st,D,K,gt){var ft=new Uint8Array(16);return Z(ft,0,st,D,K,gt),k(J,X,ft,0)}function d(J,X,st,D,K){var gt;if(st<32)return-1;for(rt(J,0,X,0,st,D,K),Z(J,16,J,32,st-32,J),gt=0;gt<16;gt++)J[gt]=0;return 0}function o(J,X,st,D,K){var gt,ft=new Uint8Array(32);if(st<32||(Y(ft,0,32,D,K),x(X,16,X,32,st-32,ft)!==0))return-1;for(rt(J,0,X,0,st,D,K),gt=0;gt<32;gt++)J[gt]=0;return 0}function a(J,X){var st;for(st=0;st<16;st++)J[st]=0|X[st]}function f(J){var X,st,D=1;for(X=0;X<16;X++)st=J[X]+D+65535,D=Math.floor(st/65536),J[X]=st-65536*D;J[0]+=D-1+37*(D-1)}function h(J,X,st){for(var D,K=~(st-1),gt=0;gt<16;gt++)D=K&(J[gt]^X[gt]),J[gt]^=D,X[gt]^=D}function g(J,X){var st,D,K,gt=t(),ft=t();for(st=0;st<16;st++)ft[st]=X[st];for(f(ft),f(ft),f(ft),D=0;D<2;D++){for(gt[0]=ft[0]-65517,st=1;st<15;st++)gt[st]=ft[st]-65535-(gt[st-1]>>16&1),gt[st-1]&=65535;gt[15]=ft[15]-32767-(gt[14]>>16&1),K=gt[15]>>16&1,gt[14]&=65535,h(ft,gt,1-K)}for(st=0;st<16;st++)J[2*st]=255&ft[st],J[2*st+1]=ft[st]>>8}function A(J,X){var st=new Uint8Array(32),D=new Uint8Array(32);return g(st,J),g(D,X),B(st,0,D,0)}function I(J){var X=new Uint8Array(32);return g(X,J),1&X[0]}function b(J,X){var st;for(st=0;st<16;st++)J[st]=X[2*st]+(X[2*st+1]<<8);J[15]&=32767}function u(J,X,st){for(var D=0;D<16;D++)J[D]=X[D]+st[D]}function m(J,X,st){for(var D=0;D<16;D++)J[D]=X[D]-st[D]}function L(J,X,st){var D,K,gt=0,ft=0,pt=0,vt=0,At=0,_t=0,Wt=0,Pt=0,wt=0,se=0,Lt=0,Et=0,de=0,Bt=0,Mt=0,$=0,G=0,H=0,N=0,V=0,tt=0,lt=0,at=0,ht=0,zt=0,Zt=0,ye=0,Yt=0,pe=0,ve=0,ge=0,ie=st[0],ue=st[1],fe=st[2],ce=st[3],$t=st[4],oe=st[5],Jt=st[6],le=st[7],ae=st[8],ne=st[9],Ot=st[10],Nt=st[11],he=st[12],ee=st[13],re=st[14],me=st[15];gt+=(D=X[0])*ie,ft+=D*ue,pt+=D*fe,vt+=D*ce,At+=D*$t,_t+=D*oe,Wt+=D*Jt,Pt+=D*le,wt+=D*ae,se+=D*ne,Lt+=D*Ot,Et+=D*Nt,de+=D*he,Bt+=D*ee,Mt+=D*re,$+=D*me,ft+=(D=X[1])*ie,pt+=D*ue,vt+=D*fe,At+=D*ce,_t+=D*$t,Wt+=D*oe,Pt+=D*Jt,wt+=D*le,se+=D*ae,Lt+=D*ne,Et+=D*Ot,de+=D*Nt,Bt+=D*he,Mt+=D*ee,$+=D*re,G+=D*me,pt+=(D=X[2])*ie,vt+=D*ue,At+=D*fe,_t+=D*ce,Wt+=D*$t,Pt+=D*oe,wt+=D*Jt,se+=D*le,Lt+=D*ae,Et+=D*ne,de+=D*Ot,Bt+=D*Nt,Mt+=D*he,$+=D*ee,G+=D*re,H+=D*me,vt+=(D=X[3])*ie,At+=D*ue,_t+=D*fe,Wt+=D*ce,Pt+=D*$t,wt+=D*oe,se+=D*Jt,Lt+=D*le,Et+=D*ae,de+=D*ne,Bt+=D*Ot,Mt+=D*Nt,$+=D*he,G+=D*ee,H+=D*re,N+=D*me,At+=(D=X[4])*ie,_t+=D*ue,Wt+=D*fe,Pt+=D*ce,wt+=D*$t,se+=D*oe,Lt+=D*Jt,Et+=D*le,de+=D*ae,Bt+=D*ne,Mt+=D*Ot,$+=D*Nt,G+=D*he,H+=D*ee,N+=D*re,V+=D*me,_t+=(D=X[5])*ie,Wt+=D*ue,Pt+=D*fe,wt+=D*ce,se+=D*$t,Lt+=D*oe,Et+=D*Jt,de+=D*le,Bt+=D*ae,Mt+=D*ne,$+=D*Ot,G+=D*Nt,H+=D*he,N+=D*ee,V+=D*re,tt+=D*me,Wt+=(D=X[6])*ie,Pt+=D*ue,wt+=D*fe,se+=D*ce,Lt+=D*$t,Et+=D*oe,de+=D*Jt,Bt+=D*le,Mt+=D*ae,$+=D*ne,G+=D*Ot,H+=D*Nt,N+=D*he,V+=D*ee,tt+=D*re,lt+=D*me,Pt+=(D=X[7])*ie,wt+=D*ue,se+=D*fe,Lt+=D*ce,Et+=D*$t,de+=D*oe,Bt+=D*Jt,Mt+=D*le,$+=D*ae,G+=D*ne,H+=D*Ot,N+=D*Nt,V+=D*he,tt+=D*ee,lt+=D*re,at+=D*me,wt+=(D=X[8])*ie,se+=D*ue,Lt+=D*fe,Et+=D*ce,de+=D*$t,Bt+=D*oe,Mt+=D*Jt,$+=D*le,G+=D*ae,H+=D*ne,N+=D*Ot,V+=D*Nt,tt+=D*he,lt+=D*ee,at+=D*re,ht+=D*me,se+=(D=X[9])*ie,Lt+=D*ue,Et+=D*fe,de+=D*ce,Bt+=D*$t,Mt+=D*oe,$+=D*Jt,G+=D*le,H+=D*ae,N+=D*ne,V+=D*Ot,tt+=D*Nt,lt+=D*he,at+=D*ee,ht+=D*re,zt+=D*me,Lt+=(D=X[10])*ie,Et+=D*ue,de+=D*fe,Bt+=D*ce,Mt+=D*$t,$+=D*oe,G+=D*Jt,H+=D*le,N+=D*ae,V+=D*ne,tt+=D*Ot,lt+=D*Nt,at+=D*he,ht+=D*ee,zt+=D*re,Zt+=D*me,Et+=(D=X[11])*ie,de+=D*ue,Bt+=D*fe,Mt+=D*ce,$+=D*$t,G+=D*oe,H+=D*Jt,N+=D*le,V+=D*ae,tt+=D*ne,lt+=D*Ot,at+=D*Nt,ht+=D*he,zt+=D*ee,Zt+=D*re,ye+=D*me,de+=(D=X[12])*ie,Bt+=D*ue,Mt+=D*fe,$+=D*ce,G+=D*$t,H+=D*oe,N+=D*Jt,V+=D*le,tt+=D*ae,lt+=D*ne,at+=D*Ot,ht+=D*Nt,zt+=D*he,Zt+=D*ee,ye+=D*re,Yt+=D*me,Bt+=(D=X[13])*ie,Mt+=D*ue,$+=D*fe,G+=D*ce,H+=D*$t,N+=D*oe,V+=D*Jt,tt+=D*le,lt+=D*ae,at+=D*ne,ht+=D*Ot,zt+=D*Nt,Zt+=D*he,ye+=D*ee,Yt+=D*re,pe+=D*me,Mt+=(D=X[14])*ie,$+=D*ue,G+=D*fe,H+=D*ce,N+=D*$t,V+=D*oe,tt+=D*Jt,lt+=D*le,at+=D*ae,ht+=D*ne,zt+=D*Ot,Zt+=D*Nt,ye+=D*he,Yt+=D*ee,pe+=D*re,ve+=D*me,$+=(D=X[15])*ie,ft+=38*(H+=D*fe),pt+=38*(N+=D*ce),vt+=38*(V+=D*$t),At+=38*(tt+=D*oe),_t+=38*(lt+=D*Jt),Wt+=38*(at+=D*le),Pt+=38*(ht+=D*ae),wt+=38*(zt+=D*ne),se+=38*(Zt+=D*Ot),Lt+=38*(ye+=D*Nt),Et+=38*(Yt+=D*he),de+=38*(pe+=D*ee),Bt+=38*(ve+=D*re),Mt+=38*(ge+=D*me),gt=(D=(gt+=38*(G+=D*ue))+(K=1)+65535)-65536*(K=Math.floor(D/65536)),ft=(D=ft+K+65535)-65536*(K=Math.floor(D/65536)),pt=(D=pt+K+65535)-65536*(K=Math.floor(D/65536)),vt=(D=vt+K+65535)-65536*(K=Math.floor(D/65536)),At=(D=At+K+65535)-65536*(K=Math.floor(D/65536)),_t=(D=_t+K+65535)-65536*(K=Math.floor(D/65536)),Wt=(D=Wt+K+65535)-65536*(K=Math.floor(D/65536)),Pt=(D=Pt+K+65535)-65536*(K=Math.floor(D/65536)),wt=(D=wt+K+65535)-65536*(K=Math.floor(D/65536)),se=(D=se+K+65535)-65536*(K=Math.floor(D/65536)),Lt=(D=Lt+K+65535)-65536*(K=Math.floor(D/65536)),Et=(D=Et+K+65535)-65536*(K=Math.floor(D/65536)),de=(D=de+K+65535)-65536*(K=Math.floor(D/65536)),Bt=(D=Bt+K+65535)-65536*(K=Math.floor(D/65536)),Mt=(D=Mt+K+65535)-65536*(K=Math.floor(D/65536)),$=(D=$+K+65535)-65536*(K=Math.floor(D/65536)),gt=(D=(gt+=K-1+37*(K-1))+(K=1)+65535)-65536*(K=Math.floor(D/65536)),ft=(D=ft+K+65535)-65536*(K=Math.floor(D/65536)),pt=(D=pt+K+65535)-65536*(K=Math.floor(D/65536)),vt=(D=vt+K+65535)-65536*(K=Math.floor(D/65536)),At=(D=At+K+65535)-65536*(K=Math.floor(D/65536)),_t=(D=_t+K+65535)-65536*(K=Math.floor(D/65536)),Wt=(D=Wt+K+65535)-65536*(K=Math.floor(D/65536)),Pt=(D=Pt+K+65535)-65536*(K=Math.floor(D/65536)),wt=(D=wt+K+65535)-65536*(K=Math.floor(D/65536)),se=(D=se+K+65535)-65536*(K=Math.floor(D/65536)),Lt=(D=Lt+K+65535)-65536*(K=Math.floor(D/65536)),Et=(D=Et+K+65535)-65536*(K=Math.floor(D/65536)),de=(D=de+K+65535)-65536*(K=Math.floor(D/65536)),Bt=(D=Bt+K+65535)-65536*(K=Math.floor(D/65536)),Mt=(D=Mt+K+65535)-65536*(K=Math.floor(D/65536)),$=(D=$+K+65535)-65536*(K=Math.floor(D/65536)),gt+=K-1+37*(K-1),J[0]=gt,J[1]=ft,J[2]=pt,J[3]=vt,J[4]=At,J[5]=_t,J[6]=Wt,J[7]=Pt,J[8]=wt,J[9]=se,J[10]=Lt,J[11]=Et,J[12]=de,J[13]=Bt,J[14]=Mt,J[15]=$}function q(J,X){L(J,X,X)}function z(J,X){var st,D=t();for(st=0;st<16;st++)D[st]=X[st];for(st=253;st>=0;st--)q(D,D),st!==2&&st!==4&&L(D,D,X);for(st=0;st<16;st++)J[st]=D[st]}function W(J,X){var st,D=t();for(st=0;st<16;st++)D[st]=X[st];for(st=250;st>=0;st--)q(D,D),st!==1&&L(D,D,X);for(st=0;st<16;st++)J[st]=D[st]}function ot(J,X,st){var D,K,gt=new Uint8Array(32),ft=new Float64Array(80),pt=t(),vt=t(),At=t(),_t=t(),Wt=t(),Pt=t();for(K=0;K<31;K++)gt[K]=X[K];for(gt[31]=127&X[31]|64,gt[0]&=248,b(ft,st),K=0;K<16;K++)vt[K]=ft[K],_t[K]=pt[K]=At[K]=0;for(pt[0]=_t[0]=1,K=254;K>=0;--K)h(pt,vt,D=gt[K>>>3]>>>(7&K)&1),h(At,_t,D),u(Wt,pt,At),m(pt,pt,At),u(At,vt,_t),m(vt,vt,_t),q(_t,Wt),q(Pt,pt),L(pt,At,pt),L(At,vt,Wt),u(Wt,pt,At),m(pt,pt,At),q(vt,pt),m(At,_t,Pt),L(pt,At,l),u(pt,pt,_t),L(At,At,pt),L(pt,_t,Pt),L(_t,vt,ft),q(vt,Wt),h(pt,vt,D),h(At,_t,D);for(K=0;K<16;K++)ft[K+16]=pt[K],ft[K+32]=At[K],ft[K+48]=vt[K],ft[K+64]=_t[K];var wt=ft.subarray(32),se=ft.subarray(16);return z(wt,wt),L(se,se,wt),g(J,se),0}function ut(J,X){return ot(J,X,s)}function Ct(J,X){return e(X,32),ut(J,X)}function yt(J,X,st){var D=new Uint8Array(32);return ot(D,st,X),R(J,n,D,T)}nt.prototype.blocks=function(J,X,st){for(var D,K,gt,ft,pt,vt,At,_t,Wt,Pt,wt,se,Lt,Et,de,Bt,Mt,$,G,H=this.fin?0:2048,N=this.h[0],V=this.h[1],tt=this.h[2],lt=this.h[3],at=this.h[4],ht=this.h[5],zt=this.h[6],Zt=this.h[7],ye=this.h[8],Yt=this.h[9],pe=this.r[0],ve=this.r[1],ge=this.r[2],ie=this.r[3],ue=this.r[4],fe=this.r[5],ce=this.r[6],$t=this.r[7],oe=this.r[8],Jt=this.r[9];st>=16;)Pt=Wt=0,Pt+=(N+=8191&(D=255&J[X+0]|(255&J[X+1])<<8))*pe,Pt+=(V+=8191&(D>>>13|(K=255&J[X+2]|(255&J[X+3])<<8)<<3))*(5*Jt),Pt+=(tt+=8191&(K>>>10|(gt=255&J[X+4]|(255&J[X+5])<<8)<<6))*(5*oe),Pt+=(lt+=8191&(gt>>>7|(ft=255&J[X+6]|(255&J[X+7])<<8)<<9))*(5*$t),Wt=(Pt+=(at+=8191&(ft>>>4|(pt=255&J[X+8]|(255&J[X+9])<<8)<<12))*(5*ce))>>>13,Pt&=8191,Pt+=(ht+=pt>>>1&8191)*(5*fe),Pt+=(zt+=8191&(pt>>>14|(vt=255&J[X+10]|(255&J[X+11])<<8)<<2))*(5*ue),Pt+=(Zt+=8191&(vt>>>11|(At=255&J[X+12]|(255&J[X+13])<<8)<<5))*(5*ie),Pt+=(ye+=8191&(At>>>8|(_t=255&J[X+14]|(255&J[X+15])<<8)<<8))*(5*ge),wt=Wt+=(Pt+=(Yt+=_t>>>5|H)*(5*ve))>>>13,wt+=N*ve,wt+=V*pe,wt+=tt*(5*Jt),wt+=lt*(5*oe),Wt=(wt+=at*(5*$t))>>>13,wt&=8191,wt+=ht*(5*ce),wt+=zt*(5*fe),wt+=Zt*(5*ue),wt+=ye*(5*ie),Wt+=(wt+=Yt*(5*ge))>>>13,wt&=8191,se=Wt,se+=N*ge,se+=V*ve,se+=tt*pe,se+=lt*(5*Jt),Wt=(se+=at*(5*oe))>>>13,se&=8191,se+=ht*(5*$t),se+=zt*(5*ce),se+=Zt*(5*fe),se+=ye*(5*ue),Lt=Wt+=(se+=Yt*(5*ie))>>>13,Lt+=N*ie,Lt+=V*ge,Lt+=tt*ve,Lt+=lt*pe,Wt=(Lt+=at*(5*Jt))>>>13,Lt&=8191,Lt+=ht*(5*oe),Lt+=zt*(5*$t),Lt+=Zt*(5*ce),Lt+=ye*(5*fe),Et=Wt+=(Lt+=Yt*(5*ue))>>>13,Et+=N*ue,Et+=V*ie,Et+=tt*ge,Et+=lt*ve,Wt=(Et+=at*pe)>>>13,Et&=8191,Et+=ht*(5*Jt),Et+=zt*(5*oe),Et+=Zt*(5*$t),Et+=ye*(5*ce),de=Wt+=(Et+=Yt*(5*fe))>>>13,de+=N*fe,de+=V*ue,de+=tt*ie,de+=lt*ge,Wt=(de+=at*ve)>>>13,de&=8191,de+=ht*pe,de+=zt*(5*Jt),de+=Zt*(5*oe),de+=ye*(5*$t),Bt=Wt+=(de+=Yt*(5*ce))>>>13,Bt+=N*ce,Bt+=V*fe,Bt+=tt*ue,Bt+=lt*ie,Wt=(Bt+=at*ge)>>>13,Bt&=8191,Bt+=ht*ve,Bt+=zt*pe,Bt+=Zt*(5*Jt),Bt+=ye*(5*oe),Mt=Wt+=(Bt+=Yt*(5*$t))>>>13,Mt+=N*$t,Mt+=V*ce,Mt+=tt*fe,Mt+=lt*ue,Wt=(Mt+=at*ie)>>>13,Mt&=8191,Mt+=ht*ge,Mt+=zt*ve,Mt+=Zt*pe,Mt+=ye*(5*Jt),$=Wt+=(Mt+=Yt*(5*oe))>>>13,$+=N*oe,$+=V*$t,$+=tt*ce,$+=lt*fe,Wt=($+=at*ue)>>>13,$&=8191,$+=ht*ie,$+=zt*ge,$+=Zt*ve,$+=ye*pe,G=Wt+=($+=Yt*(5*Jt))>>>13,G+=N*Jt,G+=V*oe,G+=tt*$t,G+=lt*ce,Wt=(G+=at*fe)>>>13,G&=8191,G+=ht*ue,G+=zt*ie,G+=Zt*ge,G+=ye*ve,N=Pt=8191&(Wt=(Wt=((Wt+=(G+=Yt*pe)>>>13)<<2)+Wt|0)+(Pt&=8191)|0),V=wt+=Wt>>>=13,tt=se&=8191,lt=Lt&=8191,at=Et&=8191,ht=de&=8191,zt=Bt&=8191,Zt=Mt&=8191,ye=$&=8191,Yt=G&=8191,X+=16,st-=16;this.h[0]=N,this.h[1]=V,this.h[2]=tt,this.h[3]=lt,this.h[4]=at,this.h[5]=ht,this.h[6]=zt,this.h[7]=Zt,this.h[8]=ye,this.h[9]=Yt},nt.prototype.finish=function(J,X){var st,D,K,gt,ft=new Uint16Array(10);if(this.leftover){for(gt=this.leftover,this.buffer[gt++]=1;gt<16;gt++)this.buffer[gt]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(st=this.h[1]>>>13,this.h[1]&=8191,gt=2;gt<10;gt++)this.h[gt]+=st,st=this.h[gt]>>>13,this.h[gt]&=8191;for(this.h[0]+=5*st,st=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=st,st=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=st,ft[0]=this.h[0]+5,st=ft[0]>>>13,ft[0]&=8191,gt=1;gt<10;gt++)ft[gt]=this.h[gt]+st,st=ft[gt]>>>13,ft[gt]&=8191;for(ft[9]-=8192,D=(1^st)-1,gt=0;gt<10;gt++)ft[gt]&=D;for(D=~D,gt=0;gt<10;gt++)this.h[gt]=this.h[gt]&D|ft[gt];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),K=this.h[0]+this.pad[0],this.h[0]=65535&K,gt=1;gt<8;gt++)K=(this.h[gt]+this.pad[gt]|0)+(K>>>16)|0,this.h[gt]=65535&K;J[X+0]=this.h[0]>>>0&255,J[X+1]=this.h[0]>>>8&255,J[X+2]=this.h[1]>>>0&255,J[X+3]=this.h[1]>>>8&255,J[X+4]=this.h[2]>>>0&255,J[X+5]=this.h[2]>>>8&255,J[X+6]=this.h[3]>>>0&255,J[X+7]=this.h[3]>>>8&255,J[X+8]=this.h[4]>>>0&255,J[X+9]=this.h[4]>>>8&255,J[X+10]=this.h[5]>>>0&255,J[X+11]=this.h[5]>>>8&255,J[X+12]=this.h[6]>>>0&255,J[X+13]=this.h[6]>>>8&255,J[X+14]=this.h[7]>>>0&255,J[X+15]=this.h[7]>>>8&255},nt.prototype.update=function(J,X,st){var D,K;if(this.leftover){for((K=16-this.leftover)>st&&(K=st),D=0;D=16&&(K=st-st%16,this.blocks(J,X,K),X+=K,st-=K),st){for(D=0;D=128;){for(H=0;H<16;H++)N=8*H+he,Zt[H]=st[N+0]<<24|st[N+1]<<16|st[N+2]<<8|st[N+3],ye[H]=st[N+4]<<24|st[N+5]<<16|st[N+6]<<8|st[N+7];for(H=0;H<80;H++)if(K=Yt,gt=pe,ft=ve,pt=ge,vt=ie,At=ue,_t=fe,Pt=$t,wt=oe,se=Jt,Lt=le,Et=ae,de=ne,Bt=Ot,lt=65535&(tt=Nt),at=tt>>>16,ht=65535&(V=ce),zt=V>>>16,lt+=65535&(tt=(ae>>>14|ie<<18)^(ae>>>18|ie<<14)^(ie>>>9|ae<<23)),at+=tt>>>16,ht+=65535&(V=(ie>>>14|ae<<18)^(ie>>>18|ae<<14)^(ae>>>9|ie<<23)),zt+=V>>>16,lt+=65535&(tt=ae&ne^~ae&Ot),at+=tt>>>16,ht+=65535&(V=ie&ue^~ie&fe),zt+=V>>>16,V=dt[2*H],lt+=65535&(tt=dt[2*H+1]),at+=tt>>>16,ht+=65535&V,zt+=V>>>16,V=Zt[H%16],at+=(tt=ye[H%16])>>>16,ht+=65535&V,zt+=V>>>16,ht+=(at+=(lt+=65535&tt)>>>16)>>>16,lt=65535&(tt=G=65535<|at<<16),at=tt>>>16,ht=65535&(V=$=65535&ht|(zt+=ht>>>16)<<16),zt=V>>>16,lt+=65535&(tt=($t>>>28|Yt<<4)^(Yt>>>2|$t<<30)^(Yt>>>7|$t<<25)),at+=tt>>>16,ht+=65535&(V=(Yt>>>28|$t<<4)^($t>>>2|Yt<<30)^($t>>>7|Yt<<25)),zt+=V>>>16,at+=(tt=$t&oe^$t&Jt^oe&Jt)>>>16,ht+=65535&(V=Yt&pe^Yt&ve^pe&ve),zt+=V>>>16,Wt=65535&(ht+=(at+=(lt+=65535&tt)>>>16)>>>16)|(zt+=ht>>>16)<<16,Mt=65535<|at<<16,lt=65535&(tt=Lt),at=tt>>>16,ht=65535&(V=pt),zt=V>>>16,at+=(tt=G)>>>16,ht+=65535&(V=$),zt+=V>>>16,pe=K,ve=gt,ge=ft,ie=pt=65535&(ht+=(at+=(lt+=65535&tt)>>>16)>>>16)|(zt+=ht>>>16)<<16,ue=vt,fe=At,ce=_t,Yt=Wt,oe=Pt,Jt=wt,le=se,ae=Lt=65535<|at<<16,ne=Et,Ot=de,Nt=Bt,$t=Mt,H%16==15)for(N=0;N<16;N++)V=Zt[N],lt=65535&(tt=ye[N]),at=tt>>>16,ht=65535&V,zt=V>>>16,V=Zt[(N+9)%16],lt+=65535&(tt=ye[(N+9)%16]),at+=tt>>>16,ht+=65535&V,zt+=V>>>16,$=Zt[(N+1)%16],lt+=65535&(tt=((G=ye[(N+1)%16])>>>1|$<<31)^(G>>>8|$<<24)^(G>>>7|$<<25)),at+=tt>>>16,ht+=65535&(V=($>>>1|G<<31)^($>>>8|G<<24)^$>>>7),zt+=V>>>16,$=Zt[(N+14)%16],at+=(tt=((G=ye[(N+14)%16])>>>19|$<<13)^($>>>29|G<<3)^(G>>>6|$<<26))>>>16,ht+=65535&(V=($>>>19|G<<13)^(G>>>29|$<<3)^$>>>6),zt+=V>>>16,zt+=(ht+=(at+=(lt+=65535&tt)>>>16)>>>16)>>>16,Zt[N]=65535&ht|zt<<16,ye[N]=65535<|at<<16;lt=65535&(tt=$t),at=tt>>>16,ht=65535&(V=Yt),zt=V>>>16,V=J[0],at+=(tt=X[0])>>>16,ht+=65535&V,zt+=V>>>16,zt+=(ht+=(at+=(lt+=65535&tt)>>>16)>>>16)>>>16,J[0]=Yt=65535&ht|zt<<16,X[0]=$t=65535<|at<<16,lt=65535&(tt=oe),at=tt>>>16,ht=65535&(V=pe),zt=V>>>16,V=J[1],at+=(tt=X[1])>>>16,ht+=65535&V,zt+=V>>>16,zt+=(ht+=(at+=(lt+=65535&tt)>>>16)>>>16)>>>16,J[1]=pe=65535&ht|zt<<16,X[1]=oe=65535<|at<<16,lt=65535&(tt=Jt),at=tt>>>16,ht=65535&(V=ve),zt=V>>>16,V=J[2],at+=(tt=X[2])>>>16,ht+=65535&V,zt+=V>>>16,zt+=(ht+=(at+=(lt+=65535&tt)>>>16)>>>16)>>>16,J[2]=ve=65535&ht|zt<<16,X[2]=Jt=65535<|at<<16,lt=65535&(tt=le),at=tt>>>16,ht=65535&(V=ge),zt=V>>>16,V=J[3],at+=(tt=X[3])>>>16,ht+=65535&V,zt+=V>>>16,zt+=(ht+=(at+=(lt+=65535&tt)>>>16)>>>16)>>>16,J[3]=ge=65535&ht|zt<<16,X[3]=le=65535<|at<<16,lt=65535&(tt=ae),at=tt>>>16,ht=65535&(V=ie),zt=V>>>16,V=J[4],at+=(tt=X[4])>>>16,ht+=65535&V,zt+=V>>>16,zt+=(ht+=(at+=(lt+=65535&tt)>>>16)>>>16)>>>16,J[4]=ie=65535&ht|zt<<16,X[4]=ae=65535<|at<<16,lt=65535&(tt=ne),at=tt>>>16,ht=65535&(V=ue),zt=V>>>16,V=J[5],at+=(tt=X[5])>>>16,ht+=65535&V,zt+=V>>>16,zt+=(ht+=(at+=(lt+=65535&tt)>>>16)>>>16)>>>16,J[5]=ue=65535&ht|zt<<16,X[5]=ne=65535<|at<<16,lt=65535&(tt=Ot),at=tt>>>16,ht=65535&(V=fe),zt=V>>>16,V=J[6],at+=(tt=X[6])>>>16,ht+=65535&V,zt+=V>>>16,zt+=(ht+=(at+=(lt+=65535&tt)>>>16)>>>16)>>>16,J[6]=fe=65535&ht|zt<<16,X[6]=Ot=65535<|at<<16,lt=65535&(tt=Nt),at=tt>>>16,ht=65535&(V=ce),zt=V>>>16,V=J[7],at+=(tt=X[7])>>>16,ht+=65535&V,zt+=V>>>16,zt+=(ht+=(at+=(lt+=65535&tt)>>>16)>>>16)>>>16,J[7]=ce=65535&ht|zt<<16,X[7]=Nt=65535<|at<<16,he+=128,D-=128}return D}function Tt(J,X,st){var D,K=new Int32Array(8),gt=new Int32Array(8),ft=new Uint8Array(256),pt=st;for(K[0]=1779033703,K[1]=3144134277,K[2]=1013904242,K[3]=2773480762,K[4]=1359893119,K[5]=2600822924,K[6]=528734635,K[7]=1541459225,gt[0]=4089235720,gt[1]=2227873595,gt[2]=4271175723,gt[3]=1595750129,gt[4]=2917565137,gt[5]=725511199,gt[6]=4215389547,gt[7]=327033209,ct(K,gt,X,st),st%=128,D=0;D=0;--K)S(J,X,D=st[K/8|0]>>(7&K)&1),kt(X,J),kt(J,J),S(J,X,D)}function F(J,X){var st=[t(),t(),t(),t()];a(st[0],y),a(st[1],E),a(st[2],c),L(st[3],y,E),O(J,st,X)}function et(J,X,st){var D,K=new Uint8Array(64),gt=[t(),t(),t(),t()];for(st||e(X,32),Tt(K,X,32),K[0]&=248,K[31]&=127,K[31]|=64,F(gt,K),C(J,gt),D=0;D<32;D++)X[D+32]=J[D];return 0}var Q=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function it(J,X){var st,D,K,gt;for(D=63;D>=32;--D){for(st=0,K=D-32,gt=D-12;K>4)*Q[K],st=X[K]>>8,X[K]&=255;for(K=0;K<32;K++)X[K]-=st*Q[K];for(D=0;D<32;D++)X[D+1]+=X[D]>>8,J[D]=255&X[D]}function qt(J){var X,st=new Float64Array(64);for(X=0;X<64;X++)st[X]=J[X];for(X=0;X<64;X++)J[X]=0;it(J,st)}function It(J,X,st,D){var K,gt,ft=new Uint8Array(64),pt=new Uint8Array(64),vt=new Uint8Array(64),At=new Float64Array(64),_t=[t(),t(),t(),t()];Tt(ft,D,32),ft[0]&=248,ft[31]&=127,ft[31]|=64;var Wt=st+64;for(K=0;K>7&&m(At[0],i,At[0]),L(At[3],At[0],At[1]),0)}(vt,D))return-1;for(K=0;K=0},r.sign.keyPair=function(){var J=new Uint8Array(Dt),X=new Uint8Array(Se);return et(J,X),{publicKey:J,secretKey:X}},r.sign.keyPair.fromSecretKey=function(J){if(Ut(J),J.length!==Se)throw new Error("bad secret key size");for(var X=new Uint8Array(Dt),st=0;st{if(t.includes(".")||t.trim().toLowerCase()!==t)throw new jl(Fl.InvalidDomain);const[l]=Xt.findProgramAddressSync([L0.toBuffer()],L0),p=L7(t),v=O7(p,void 0,m8),y=L7(v.toBase58()),E=O7(y,l),[M]=Xt.findProgramAddressSync([v.toBuffer()],L0),w=WA.findIndex(rt=>c==null?void 0:c.equals(rt));let _;const k=[];if(w!==-1&&c){_=X4(i,c,!0);const rt=await r.getAccountInfo(_);if(!(rt!=null&&rt.data)){const nt=BK(n,_,c,i);k.push(nt)}}const B=new mx.PythHttpClient(r,mx.getPythProgramKeyForCluster("mainnet-beta")),P=await B.getData(),R=LH.get(i.toBase58());if(!R)throw new jl(Fl.SymbolNotFound,`No symbol found for mint ${i.toBase58()}`);const T=P.productPrice.get("Crypto."+R+"/USD"),U=P.productFromSymbol.get("Crypto."+R+"/USD"),j=X4(i,UH),Y=new yh({name:t,space:e,referrerIdxOpt:w!=-1?w:null}).getInstruction(L0,ZA,m8,v,E,an.programId,l,n,s,OH,T.productAccountKey,new Xt(U.price_account),j,ql,fa,M,_);return k.push(Y),[[],k]};new Xt("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29");var H7;(function(r){r.DegenPoet1="DegenPoet#1",r.Rgb0x001="rgb0x00#1"})(H7||(H7={}));new Xt("ART5dr4bDic2sQVZoFheEmUxwQq5VGSx9he7JxHcXNQD");new Xt("CSWvuDHXExVGEMR9kP8xYAHuNjXogeRck9Cnr312CC9g");const uG=({domain:r,onEdit:t})=>{const{cart:e,removeFromCart:n}=xe.useContext(Nh),s=e[r];return St.jsx(fE,{domain:s.domain,available:!0,price:s.price,children:St.jsxs("div",{className:"flex flex-col items-end gap-2 text-sm",children:[St.jsxs("div",{className:"flex flex-row gap-2",children:[St.jsxs("span",{children:["Storage: ",s.storage/1e3,"kB"]}),St.jsxs("button",{type:"button",className:"flex items-center text-theme-primary dark:text-theme-secondary gap-0.5",tabIndex:0,onClick:t,children:["Edit",St.jsx(nz,{width:16,height:16})]})]}),St.jsxs("button",{type:"button",className:"flex items-center gap-2 text-theme-primary dark:text-theme-secondary",tabIndex:0,onClick:()=>n(r),children:["Remove",St.jsx(qM,{width:20,height:20})]})]})})},V7=({children:r,isVisible:t,toggleVisibility:e})=>{const n=xe.useRef(null),s=c=>{c.preventDefault(),c.target===n.current&&e(!t)},i=xe.useCallback(c=>{c.code==="Escape"&&e(!1)},[e]);return xe.useEffect(()=>{t&&document.addEventListener("keydown",i),t||document.removeEventListener("keydown",i)},[t,i]),t?St.jsx("div",{className:sn("animate-modal-fade-in absolute top-0 bottom-0 left-0 right-0","bg-modal-overlay-bg bg-opacity-60 z-[1]","flex items-center justify-center"),ref:n,onClick:s,children:r}):null},fG=new Ne("ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF"),cG=new Ne("H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG"),hG=new Ne("Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD"),lG=new Ne("3vxLXJqLqF3JG5TCbYycbKWRBbCJQLxQmBGCkyqEEefL"),dG=new Ne("E4v1BBgoso9s64TQvmyownAVJbhbEPGyzA3qn4n46qj9"),pG=new Ne("8ihFLu5FimgTQ1Unh4dVyEHUGodJ5gJQCrQf4KUVB9bN"),mG=new Ne("AbMTYZ82Xfv9PtTQ5e1fJXemXjzqEEFHP3oDLRTae6yz"),Z7=new Map([["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",fG],["So11111111111111111111111111111111111111112",cG],["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",hG],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",lG],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",dG],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",pG],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz",mG]]),vG=async(r,t)=>{var s;const e=(s=await r.getAccountInfo(t))==null?void 0:s.data;if(!e)throw new Error("Unable to retrieve oracle data");const n=PD.parsePriceData(e);return n.price||n.previousPrice},gG=()=>{const{connection:r}=Ug();return Dg(async()=>{var n;if(!r)return;const e=new Map;for(const s of Z7.keys())e.set(s,{price:await vG(r,Z7.get(s)),decimals:((n=uh.find(i=>i.mintAddress===s))==null?void 0:n.decimals)||4});return e},[!!r])},yG=async(r,t)=>{var e;try{const n=await r.getTokenAccountBalance(t);return((e=n==null?void 0:n.value)==null?void 0:e.uiAmount)||0}catch{return 0}},bG=()=>{const{publicKey:r,connection:t}=Sd(),[e,n]=xe.useState({}),s=xe.useCallback(async()=>{if(r){const i={};for(const c of uh){const l=new Ne(c.mintAddress),p=d9(l,r),v=await yG(t,p);if(l.equals(qg)){const y=await t.getBalance(r)/Qk;i[c.tokenSymbol]=y+v}else i[c.tokenSymbol]=v}n(i)}},[r,t]);return xe.useEffect(()=>{s()},[r,t,s]),{balances:e}},wG=()=>St.jsxs("div",{className:"flex flex-col items-center justify-center gap-10 grow",children:[St.jsx("div",{className:"w-[76px] h-[76px] rounded-full border-4 border-theme-secondary border-t-theme-primary animate-spin"}),St.jsx("span",{className:"max-w-[225px] font-primary text-center font-medium tracking-wider",children:"Your transaction is being processed..."})]}),xG=()=>St.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 px-3 grow-[0.5] text-center",children:[St.jsx(az,{width:90,height:90,className:"text-theme-primary text-opacity-60"}),St.jsx("p",{className:"text-lg font-bold font-primary",children:"Congrats on registering your domains!"}),St.jsxs("p",{className:"text-sm font-primary",children:["Head over to",St.jsx("a",{href:"https://www.sns.id/",rel:"noopener",target:"_blank",className:"mx-1 text-theme-primary",children:"sns.id"}),"to learn how to take full advantage of your domains"]})]}),_G=()=>St.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 px-3 grow-[0.5] text-center",children:[St.jsx(jM,{width:90,height:90,className:"rotate-180 text-theme-primary text-opacity-60"}),St.jsx("p",{className:"text-lg font-bold font-primary",children:"Something went wrong"}),St.jsx("p",{className:"text-sm font-primary",children:"Please retry the process"})]}),MG=[{label:"1kb",value:1e3},{label:"2kb",value:2e3},{label:"3kb",value:3e3},{label:"4kb",value:4e3},{label:"5kb",value:5e3},{label:"6kb",value:6e3},{label:"7kb",value:7e3},{label:"8kb",value:8e3},{label:"9kb",value:9e3},{label:"10kb",value:1e4}],EG=({backHandler:r})=>{const t=gG(),{publicKey:e,connection:n,signAllTransactions:s}=Sd(),{balances:i}=bG(),[c,l]=xe.useState(1),{cart:p,emptyCart:v,addToCart:y,referrerKey:E}=xe.useContext(Nh),{setError:M}=xe.useContext(Ad),[w,_]=xe.useState(uh[0]),[k,B]=xe.useState(!1),[P,R]=xe.useState(""),[T,U]=xe.useState("registering"),j=w.mintAddress===M0,Y=j?.95:1,rt=Object.values(p).reduce((h,g)=>h+KM(g.domain,Y),0);xe.useEffect(()=>{},[e,n]);const nt=h=>{var A,I;const g=(I=(A=t.result)==null?void 0:A.get(h))==null?void 0:I.price;return rt/(g||1)},Z=h=>{const g=nt(h);return h===M0?g*.95:g};xe.useEffect(()=>{Object.keys(p).length||r()},[p,r]);const x={1:"w-[33%]",2:"w-[66%]",3:"w-full"},d=()=>{c===2?l(1):r()},o=async()=>{switch(c){case 2:await f();break;case 3:T==="error"&&await f(),T==="success"&&(v(),r(!0));break;default:l(c+1);break}},a=Z(w.mintAddress),f=async()=>{if(!(!n||!e||!s)){if(i[w.tokenSymbol]E.equals(z)):void 0);h.push(...q)}if(qg.equals(A)){const L=await qq(n,I,g,Math.ceil(a*1.01*Math.pow(10,9))),q=Fq(I,g);h=[...L,...h,...q]}const b=Dq(h,g),{blockhash:u}=await n.getLatestBlockhash();let m=b.map(L=>new sd().add(...L));m.forEach(L=>{L.feePayer=g,L.recentBlockhash=u}),m=await s(m);for(const L of m){const q=await n.sendRawTransaction(L.serialize());await n.confirmTransaction(q),console.log(q)}U("success"),l(3)}catch(h){if(console.error(h),h instanceof tI){M(h.message),U("registering");return}l(3),U("error")}}};return St.jsxs("div",{className:"flex flex-col flex-grow pb-14",children:[St.jsxs("div",{className:"sticky -top-1 bg-background-primary h-[48px] flex justify-center items-center px-3",children:[St.jsx("button",{type:"button",tabIndex:0,onClick:d,disabled:T==="processing",className:"absolute top-0 p-3 border-0 left-3 text-theme-primary dark:text-theme-secondary",children:St.jsx(uz,{width:24,height:24})}),St.jsx("div",{className:"w-[175px] h-[5px] rounded-md bg-background-interactive dark:bg-background-secondary bg-gradient-to-r",children:St.jsx("div",{className:sn("bg-theme-primary dark:bg-theme-secondary h-full rounded-md transition-[width] duration-500",x[c])})})]}),St.jsxs("div",{className:"flex flex-col flex-grow pt-6 body",children:[T==="success"&&St.jsx(xG,{}),T==="error"&&St.jsx(_G,{}),T==="processing"&&St.jsx(wG,{}),T==="registering"&&St.jsxs(St.Fragment,{children:[c===1&&St.jsxs(St.Fragment,{children:[St.jsx("p",{className:"px-3 mb-2 ml-4 text-sm text-text-secondary font-primary",children:"You are registering"}),St.jsx("div",{className:"flex flex-col gap-2 px-3 pb-4",children:Object.values(p).map(h=>St.jsx(uG,{domain:h.domain,onEdit:()=>R(h.domain)},h.domain))}),St.jsx(V7,{isVisible:!!P,toggleVisibility:()=>R(""),children:!!P&&St.jsxs("div",{className:"w-[320px] p bg-background-primary flex flex-col gap-3 p-4 rounded-xl",children:[St.jsxs("p",{className:"flex items-start justify-between text-lg font-medium font-primary",children:["Storage size",St.jsx("button",{type:"button",tabIndex:0,className:"p-1 -mt-3 -mr-3",onClick:()=>R(""),children:St.jsx($M,{width:24,height:24})})]}),St.jsxs("div",{className:"text-xs",children:[St.jsx("p",{className:"mb-2",children:"The storage size will determine the maximum amount of data you can store on your domain."}),St.jsxs("p",{className:"",children:[St.jsx(fz,{width:16,height:16,className:"inline mr-1 mb-[2px] text-accent"}),"Each additional kb of memory costs around 0.007 SOL (0.001 USDC)"]})]}),St.jsx("div",{className:"grid grid-cols-5 gap-2",children:MG.map(h=>{const g=p[P],A=h.value===(g==null?void 0:g.storage);return St.jsx("button",{type:"button",tabIndex:0,className:sn("border-2 border-solid rounded-lg px-2 py-2 border-theme-primary border-opacity-10 text-sm",A&&"border-opacity-100"),onClick:()=>{y({...g,storage:h.value}),R("")},children:h.label},h.value)})})]})})]}),c===2&&St.jsxs("div",{className:"flex flex-col flex-grow px-3 pb-5",children:[St.jsxs("div",{className:"mb-auto",children:[St.jsx("p",{className:"mb-3 ml-4 font-medium font-primary",children:"Pay with"}),St.jsx("div",{children:St.jsxs("button",{type:"button",tabIndex:0,className:"flex items-center w-full gap-4 p-4 border cursor-pointer rounded-xl border-interactive-border bg-background-interactive",onClick:()=>B(!k),children:[St.jsx("img",{className:"w-4 h-4 rounded-[50%]",src:w.icon,alt:w.tokenSymbol}),St.jsx("span",{className:"tracking-wide text-text-primary",children:w.tokenSymbol}),St.jsxs("div",{className:"relative w-[25px] h-[25px] flex justify-center items-center ml-auto",children:[St.jsx("div",{className:sn("transition-transform duration-200 absolute w-[8px] h-[2px] bg-theme-primary dark:bg-theme-secondary rounded-sm -rotate-[45deg] ml-[5px]",k&&"rotate-[45deg]")}),St.jsx("div",{className:sn("transition-transform duration-200 absolute w-[8px] h-[2px] bg-theme-primary dark:bg-theme-secondary rounded-sm rotate-[45deg] -ml-[4px]",k&&"-rotate-[45deg]")})]})]})})]}),St.jsxs("div",{children:[St.jsx("p",{className:"mb-3 font-medium font-primary",children:"Order summary"}),St.jsxs("div",{className:"flex items-start justify-between mb-2 text-sm font-medium leading-6 border-b border-interactive-border",children:[St.jsx("div",{children:"Total"}),St.jsxs("div",{className:"flex flex-col items-end",children:[St.jsxs("span",{children:[_0(a,!0)," ",w.tokenSymbol]}),St.jsx("span",{className:"text-xs leading-6 text-text-primary text-opacity-60 dark:text-text-secondary",children:_0(rt)})]})]}),St.jsxs("div",{className:"flex items-start justify-between text-sm font-medium leading-6 border-b border-interactive-border",children:[St.jsx("div",{children:"Discount"}),St.jsx("div",{children:j?"5%":"0%"})]})]}),St.jsx(V7,{isVisible:k,toggleVisibility:B,children:St.jsx("div",{className:"w-[320px] bg-background-primary flex flex-col gap-3 py-3 rounded-xl",children:uh.map(h=>{const g=Z(h.mintAddress),A=i[h.tokenSymbol]{_(h),B(!1)},children:[St.jsx("img",{src:h.icon,alt:h.tokenSymbol,className:"w-6 h-6 rounded-[50%]"}),St.jsxs("div",{className:"flex flex-col items-start",children:[St.jsx("span",{children:h.tokenSymbol}),St.jsxs("span",{className:"flex text-xs text-text-secondary gap-0.5 items-center",children:[St.jsx(FM,{width:14,height:14}),i[h.tokenSymbol]]})]}),St.jsxs("div",{className:"flex flex-col ml-auto text-sm",children:[St.jsxs("span",{className:sn("tabular-nums",h.mintAddress===M0&&"line-through"),children:[_0(nt(h.mintAddress),!0)," ",h.tokenSymbol]}),St.jsx("span",{className:"tabular-nums text-success",children:h.mintAddress===M0&&St.jsxs(St.Fragment,{children:[_0(Z(h.mintAddress),!0)," ","FIDA"]})})]})]},h.tokenSymbol)})})})]})]})]}),T==="processing"?null:St.jsxs("div",{className:"absolute flex flex-col gap-2 left-3 right-3 bottom-4",children:[St.jsxs(n2,{className:sn("text-base-button-content",T==="error"&&"bottom-[70px]"),onClick:o,children:[c===1&&"Continue to payment",c===2&&T==="registering"&&"Confirm and register",T==="success"&&"Done",T==="error"&&"Retry"]}),T==="error"&&St.jsx(n2,{className:sn("bg-transparent text-theme-primary"),onClick:()=>r(),children:"Close"})]})]})},AG=()=>{const{visible:r,setVisible:t,connected:e,publicKey:n,disconnect:s}=Sd(),[i,c]=xe.useState(!1),l=()=>{e?c(!i):t(!r)},p=()=>{s(),c(!1)};return St.jsxs("div",{className:"relative flex ml-auto",children:[St.jsxs("button",{type:"button",className:"relative flex items-center gap-2 px-3 h-[32px] py-1 text-xs tracking-wide rounded-lg bg-theme-secondary font-primary text-theme-primary",tabIndex:0,"aria-label":"Connect wallet","aria-haspopup":"true",onClick:l,children:[St.jsx(FM,{width:16,height:16}),e?uE(n==null?void 0:n.toString(),8,4):"Connect wallet",e&&St.jsx(cz,{className:sn("transition-transform",i&&"rotate-180")})]}),St.jsx("button",{type:"button",tabIndex:0,"aria-label":"Disconnect wallet",className:sn(!i&&"invisible opacity-0 -translate-y-1","absolute h-[48px] top-[100%] left-0 right-0 w-full z-10","duration-300 transition-[transform,opacity]","bg-background-secondary rounded-xl text-base flex items-center justify-center text-text-primary","shadow-domain dark:shadow-none dark:border dark:border-interactive-border","active:opacity-70 active:transition-none"),onClick:p,children:"Disconnect"})]})},SG=({status:r})=>{const{setStatus:t}=xe.useContext(Ad);return xe.useMemo(()=>{setTimeout(()=>{t(null)},4e3)},[t]),St.jsxs("div",{className:sn("bg-background-primary dark:border dark:border-interactive-border","shadow-xl dark:shadow-none","absolute top-2.5 left-3 right-3 rounded-lg py-3 px-4 flex gap-2 z-10 overflow-hidden"),children:[St.jsx("div",{className:sn("absolute top-0 left-0 right-0 h-0.5 animate-width-to-zero",r.status==="error"&&"bg-error",r.status==="success"&&"bg-success")}),St.jsxs("button",{className:"absolute flex items-center justify-center w-5 h-5 top-1 right-1",type:"button",tabIndex:0,onClick:()=>t(null),children:[St.jsx("div",{className:"absolute w-4 h-[1px] bg-text-primary rotate-45"}),St.jsx("div",{className:"absolute w-4 h-[1px] bg-text-primary -rotate-45"})]}),r.status==="error"&&St.jsx(jM,{width:20,height:20,className:"rotate-180 text-error mt-0.5 shrink-0"}),St.jsx("span",{className:"font-medium font-primary",children:r.message})]})},kG=({className:r,style:t,partnerLogo:e}={})=>{var a,f;const{connected:n,setVisible:s,visible:i,connection:c}=Sd(),[l,p]=xe.useState("home"),[v,y]=xe.useState(!1),[E,M]=xe.useState(!1),[w,_]=xe.useState(""),[k,B]=xe.useState(""),{isCartEmpty:P}=xe.useContext(Nh),{status:R}=xe.useContext(Ad),T=ez({connection:c,domain:k}),U=rz({connection:c,domain:k}),[j,Y]=xe.useState(null),rt=h=>{M(!1),j&&clearTimeout(j),_(_F({value:h,prev:w,onError:()=>{M(!0);const g=setTimeout(()=>{M(!1)},3e3);Y(g)}}))},nt=h=>{h.preventDefault(),p("search"),B(w)},Z=(h=!1)=>{h?(B(""),_(""),y(!1),p("home")):p("search")},x=l==="home",d=l==="search",o=l==="cart";return St.jsxs("div",{className:sn("flex flex-col w-[93svw] h-[560px] max-h-[75svh] max-w-[400px] bg-background-primary rounded-lg absolute bottom-16 right-0 text-text-primary overflow-auto","shadow-xl dark:border dark:border-interactive-border",r),style:t,"aria-label":"SNS widget allows you to quickly search and buy .sol domains",children:[R&&St.jsx(SG,{status:R}),St.jsxs("div",{className:"flex items-center px-3 pt-3",children:[!x&&St.jsx("div",{className:"flex items-center justify-center gap-2 text-sm font-medium text-center text-text-primary",children:St.jsx("span",{className:"h-[26px]",children:St.jsx(O5,{})})}),St.jsx(AG,{})]}),St.jsxs("div",{className:"flex flex-col flex-grow overflow-auto",children:[(x||d)&&St.jsxs(St.Fragment,{children:[St.jsxs("div",{className:sn("translate-y-[80px] transition-all duration-700 px-3",d&&"-translate-y-[22px]"),children:[St.jsx("h1",{className:sn("block max-h-[32px] text-2xl font-medium text-center font-primary transition-[opacity] ease-out duration-200",d&&"opacity-0 invisible",v&&"max-h-0"),onTransitionEnd:()=>{d&&y(!0)},children:"Secure a custom domain"}),St.jsxs("form",{className:"flex gap-2 mt-10",onSubmit:nt,children:[St.jsx(dz,{value:w,placeholder:"Search your domain",autoCapitalize:"off",spellCheck:"false",enterKeyHint:"search",className:"shadow-input-field dark:shadow-none",type:"search",required:!0,errorMessage:E?"Character not allowed":void 0,onChange:h=>rt(h.target.value)}),St.jsx("button",{className:` - rounded-[10px] bg-theme-primary h-[56px] w-[56px] p-2 - flex items-center justify-center text-base-button-content - `,tabIndex:0,children:St.jsx(sz,{width:24,height:24})})]})]}),d&&St.jsxs(St.Fragment,{children:[St.jsxs("div",{className:"px-3 mb-3 overflow-auto animate-fade-in",children:[T.loading?St.jsx(L5,{}):St.jsx(St.Fragment,{children:(a=T.result)==null?void 0:a.map(h=>St.jsx(T5,{domain:h.domain,available:h.available},h.domain))}),St.jsxs("div",{className:"mt-4",children:[U.status!=="error"&&St.jsx("p",{className:"mb-2 ml-4 text-sm text-text-secondary font-primary",children:"You might also like"}),St.jsxs("div",{className:"flex flex-col gap-2 pb-14",children:[U.status==="error"&&St.jsxs("div",{children:[St.jsx("p",{className:"mb-6 text-sm tracking-widest text-center",children:"Looks like we have an issue helping you with domain suggestions."}),St.jsxs("button",{type:"button",className:"m-auto flex items-center gap-2 px-3 h-[32px] w-max py-1 text-xs tracking-wide rounded-lg bg-theme-secondary font-primary text-theme-primary",tabIndex:0,"aria-label":`Try load suggestions for ${k} again`,onClick:()=>U.execute(),children:["Try again '",k,"'"]}),St.jsx("p",{className:"my-6 text-sm tracking-widest text-center",children:"...and if the problem persists"}),St.jsx("div",{className:"flex justify-center",children:St.jsxs("a",{className:"flex items-center gap-2 justify-center text-theme-primary text-[11px] tracking-wider dark:text-theme-secondary",href:"https://discord.bonfida.org",target:"_blank",rel:"noopener",children:[St.jsx(lz,{width:24}),"Tell us on discord",St.jsx(hz,{width:18})]})})]}),U.loading?St.jsx(St.Fragment,{children:new Array(5).fill(0).map((h,g)=>St.jsx(L5,{},g))}):St.jsx(St.Fragment,{children:(f=U.result)==null?void 0:f.map(h=>St.jsx(T5,{domain:h.domain,available:h.available},h.domain))})]})]})]}),!P&&St.jsx(n2,{className:"absolute left-3 right-3 bottom-3 text-base-button-content",onClick:()=>{n?p("cart"):s(!i)},children:n?"Go to cart":"Connect your wallet"})]})]}),o&&St.jsx(EG,{backHandler:Z})]}),x&&St.jsx("div",{className:"p-3",children:St.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm font-medium text-center text-text-primary",children:["Powered by",St.jsx("span",{className:"h-[20px] flex",children:St.jsx(O5,{})}),e&&St.jsxs(St.Fragment,{children:[St.jsx("span",{children:"x"}),St.jsx("span",{className:"flex",children:e})]})]})})]})},NG=({endpoint:r,connection:t,passthroughWallet:e,containerClassNames:n,containerStyles:s,referrerKey:i,partnerLogo:c})=>St.jsx(QC,{endpoint:r,connection:t,passthroughWallet:e,children:St.jsx(VC,{referrerKey:i,children:St.jsx(ZC,{children:St.jsx(kG,{className:n,style:s,partnerLogo:c})})})});export{NG as default}; diff --git a/preview-build/assets/widget-e5024a77.js b/preview-build/assets/widget-e5024a77.js new file mode 100644 index 0000000..fbc7360 --- /dev/null +++ b/preview-build/assets/widget-e5024a77.js @@ -0,0 +1,12 @@ +import{r as xe,C as Jk,R as Qk,a as tI,s as sr,b as yr,g as j7,i as K7,c as Re,d as Zt,e as Kl,f as Yv,j as St,u as eI,h as rI,k as nI,W as iI,S as oI,l as sI,P as Ne,m as $7,t as aI,n as uI,o as $l,p as Xv,T as gh,q as bb,v as Hl,w as Jv,x as fI,y as cI,z as o2,A as Vl,B as s2,D as H7,E as hI,N as wb,F as Zl,G as lI,H as sn,L as dI,I as pI}from"./index-f54a1fc2.js";import{r as V7,i as br,s as mI,a as vI,b as bf,c as gI}from"./punycode-06c60053.js";const yI=({children:r,endpoint:t,config:e={commitment:"confirmed"}})=>{const n=xe.useMemo(()=>new Jk(t,e),[t,e]);return Qk.createElement(tI.Provider,{value:{connection:n}},r)};function bI(r,t){var e=typeof Symbol=="function"&&r[Symbol.iterator];if(!e)return r;var n=e.call(r),s,i=[],c;try{for(;(t===void 0||t-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(l){c={error:l}}finally{try{s&&!s.done&&(e=n.return)&&e.call(n)}finally{if(c)throw c.error}}return i}var al=sr.Buffer,Z7=V7.Transform,wI=br;function xI(r,t){if(!al.isBuffer(r)&&typeof r!="string")throw new TypeError(t+" must be a string or a buffer")}function oa(r){Z7.call(this),this._block=al.allocUnsafe(r),this._blockSize=r,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}wI(oa,Z7);oa.prototype._transform=function(r,t,e){var n=null;try{this.update(r,t)}catch(s){n=s}e(n)};oa.prototype._flush=function(r){var t=null;try{this.push(this.digest())}catch(e){t=e}r(t)};oa.prototype.update=function(r,t){if(xI(r,"Data"),this._finalized)throw new Error("Digest already called");al.isBuffer(r)||(r=al.from(r,t));for(var e=this._block,n=0;this._blockOffset+r.length-n>=this._blockSize;){for(var s=this._blockOffset;s0;++i)this._length[i]+=c,c=this._length[i]/4294967296|0,c>0&&(this._length[i]-=4294967296*c);return this};oa.prototype._update=function(){throw new Error("_update is not implemented")};oa.prototype.digest=function(r){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var t=this._digest();r!==void 0&&(t=t.toString(r)),this._block.fill(0),this._blockOffset=0;for(var e=0;e<4;++e)this._length[e]=0;return t};oa.prototype._digest=function(){throw new Error("_digest is not implemented")};var W7=oa,_I=br,G7=W7,MI=sr.Buffer,EI=new Array(16);function Wl(){G7.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}_I(Wl,G7);Wl.prototype._update=function(){for(var r=EI,t=0;t<16;++t)r[t]=this._block.readInt32LE(t*4);var e=this._a,n=this._b,s=this._c,i=this._d;e=zn(e,n,s,i,r[0],3614090360,7),i=zn(i,e,n,s,r[1],3905402710,12),s=zn(s,i,e,n,r[2],606105819,17),n=zn(n,s,i,e,r[3],3250441966,22),e=zn(e,n,s,i,r[4],4118548399,7),i=zn(i,e,n,s,r[5],1200080426,12),s=zn(s,i,e,n,r[6],2821735955,17),n=zn(n,s,i,e,r[7],4249261313,22),e=zn(e,n,s,i,r[8],1770035416,7),i=zn(i,e,n,s,r[9],2336552879,12),s=zn(s,i,e,n,r[10],4294925233,17),n=zn(n,s,i,e,r[11],2304563134,22),e=zn(e,n,s,i,r[12],1804603682,7),i=zn(i,e,n,s,r[13],4254626195,12),s=zn(s,i,e,n,r[14],2792965006,17),n=zn(n,s,i,e,r[15],1236535329,22),e=qn(e,n,s,i,r[1],4129170786,5),i=qn(i,e,n,s,r[6],3225465664,9),s=qn(s,i,e,n,r[11],643717713,14),n=qn(n,s,i,e,r[0],3921069994,20),e=qn(e,n,s,i,r[5],3593408605,5),i=qn(i,e,n,s,r[10],38016083,9),s=qn(s,i,e,n,r[15],3634488961,14),n=qn(n,s,i,e,r[4],3889429448,20),e=qn(e,n,s,i,r[9],568446438,5),i=qn(i,e,n,s,r[14],3275163606,9),s=qn(s,i,e,n,r[3],4107603335,14),n=qn(n,s,i,e,r[8],1163531501,20),e=qn(e,n,s,i,r[13],2850285829,5),i=qn(i,e,n,s,r[2],4243563512,9),s=qn(s,i,e,n,r[7],1735328473,14),n=qn(n,s,i,e,r[12],2368359562,20),e=Fn(e,n,s,i,r[5],4294588738,4),i=Fn(i,e,n,s,r[8],2272392833,11),s=Fn(s,i,e,n,r[11],1839030562,16),n=Fn(n,s,i,e,r[14],4259657740,23),e=Fn(e,n,s,i,r[1],2763975236,4),i=Fn(i,e,n,s,r[4],1272893353,11),s=Fn(s,i,e,n,r[7],4139469664,16),n=Fn(n,s,i,e,r[10],3200236656,23),e=Fn(e,n,s,i,r[13],681279174,4),i=Fn(i,e,n,s,r[0],3936430074,11),s=Fn(s,i,e,n,r[3],3572445317,16),n=Fn(n,s,i,e,r[6],76029189,23),e=Fn(e,n,s,i,r[9],3654602809,4),i=Fn(i,e,n,s,r[12],3873151461,11),s=Fn(s,i,e,n,r[15],530742520,16),n=Fn(n,s,i,e,r[2],3299628645,23),e=jn(e,n,s,i,r[0],4096336452,6),i=jn(i,e,n,s,r[7],1126891415,10),s=jn(s,i,e,n,r[14],2878612391,15),n=jn(n,s,i,e,r[5],4237533241,21),e=jn(e,n,s,i,r[12],1700485571,6),i=jn(i,e,n,s,r[3],2399980690,10),s=jn(s,i,e,n,r[10],4293915773,15),n=jn(n,s,i,e,r[1],2240044497,21),e=jn(e,n,s,i,r[8],1873313359,6),i=jn(i,e,n,s,r[15],4264355552,10),s=jn(s,i,e,n,r[6],2734768916,15),n=jn(n,s,i,e,r[13],1309151649,21),e=jn(e,n,s,i,r[4],4149444226,6),i=jn(i,e,n,s,r[11],3174756917,10),s=jn(s,i,e,n,r[2],718787259,15),n=jn(n,s,i,e,r[9],3951481745,21),this._a=this._a+e|0,this._b=this._b+n|0,this._c=this._c+s|0,this._d=this._d+i|0};Wl.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 r=MI.allocUnsafe(16);return r.writeInt32LE(this._a,0),r.writeInt32LE(this._b,4),r.writeInt32LE(this._c,8),r.writeInt32LE(this._d,12),r};function Gl(r,t){return r<>>32-t}function zn(r,t,e,n,s,i,c){return Gl(r+(t&e|~t&n)+s+i|0,c)+t|0}function qn(r,t,e,n,s,i,c){return Gl(r+(t&n|e&~n)+s+i|0,c)+t|0}function Fn(r,t,e,n,s,i,c){return Gl(r+(t^e^n)+s+i|0,c)+t|0}function jn(r,t,e,n,s,i,c){return Gl(r+(e^(t|~n))+s+i|0,c)+t|0}var Qv=Wl,qd=yr.Buffer,AI=br,Y7=W7,SI=new Array(16),Df=[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],zf=[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],qf=[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],Ff=[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],jf=[0,1518500249,1859775393,2400959708,2840853838],Kf=[1352829926,1548603684,1836072691,2053994217,0];function Yl(){Y7.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}AI(Yl,Y7);Yl.prototype._update=function(){for(var r=SI,t=0;t<16;++t)r[t]=this._block.readInt32LE(t*4);for(var e=this._a|0,n=this._b|0,s=this._c|0,i=this._d|0,c=this._e|0,l=this._a|0,p=this._b|0,m=this._c|0,v=this._d|0,_=this._e|0,E=0;E<80;E+=1){var w,x;E<16?(w=xb(e,n,s,i,c,r[Df[E]],jf[0],qf[E]),x=Ab(l,p,m,v,_,r[zf[E]],Kf[0],Ff[E])):E<32?(w=_b(e,n,s,i,c,r[Df[E]],jf[1],qf[E]),x=Eb(l,p,m,v,_,r[zf[E]],Kf[1],Ff[E])):E<48?(w=Mb(e,n,s,i,c,r[Df[E]],jf[2],qf[E]),x=Mb(l,p,m,v,_,r[zf[E]],Kf[2],Ff[E])):E<64?(w=Eb(e,n,s,i,c,r[Df[E]],jf[3],qf[E]),x=_b(l,p,m,v,_,r[zf[E]],Kf[3],Ff[E])):(w=Ab(e,n,s,i,c,r[Df[E]],jf[4],qf[E]),x=xb(l,p,m,v,_,r[zf[E]],Kf[4],Ff[E])),e=c,c=i,i=Za(s,10),s=n,n=w,l=_,_=v,v=Za(m,10),m=p,p=x}var A=this._b+s+v|0;this._b=this._c+i+_|0,this._c=this._d+c+l|0,this._d=this._e+e+p|0,this._e=this._a+n+m|0,this._a=A};Yl.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 r=qd.alloc?qd.alloc(20):new qd(20);return r.writeInt32LE(this._a,0),r.writeInt32LE(this._b,4),r.writeInt32LE(this._c,8),r.writeInt32LE(this._d,12),r.writeInt32LE(this._e,16),r};function Za(r,t){return r<>>32-t}function xb(r,t,e,n,s,i,c,l){return Za(r+(t^e^n)+i+c|0,l)+s|0}function _b(r,t,e,n,s,i,c,l){return Za(r+(t&e|~t&n)+i+c|0,l)+s|0}function Mb(r,t,e,n,s,i,c,l){return Za(r+((t|~e)^n)+i+c|0,l)+s|0}function Eb(r,t,e,n,s,i,c,l){return Za(r+(t&n|e&~n)+i+c|0,l)+s|0}function Ab(r,t,e,n,s,i,c,l){return Za(r+(t^(e|~n))+i+c|0,l)+s|0}var tg=Yl,X7={exports:{}},J7=sr.Buffer;function Xl(r,t){this._block=J7.alloc(r),this._finalSize=t,this._blockSize=r,this._len=0}Xl.prototype.update=function(r,t){typeof r=="string"&&(t=t||"utf8",r=J7.from(r,t));for(var e=this._block,n=this._blockSize,s=r.length,i=this._len,c=0;c=this._finalSize&&(this._update(this._block),this._block.fill(0));var e=this._len*8;if(e<=4294967295)this._block.writeUInt32BE(e,this._blockSize-4);else{var n=(e&4294967295)>>>0,s=(e-n)/4294967296;this._block.writeUInt32BE(s,this._blockSize-8),this._block.writeUInt32BE(n,this._blockSize-4)}this._update(this._block);var i=this._hash();return r?i.toString(r):i};Xl.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var wf=Xl,kI=br,Q7=wf,II=sr.Buffer,BI=[1518500249,1859775393,-1894007588,-899497514],PI=new Array(80);function yh(){this.init(),this._w=PI,Q7.call(this,64,56)}kI(yh,Q7);yh.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function RI(r){return r<<5|r>>>27}function CI(r){return r<<30|r>>>2}function TI(r,t,e,n){return r===0?t&e|~t&n:r===2?t&e|t&n|e&n:t^e^n}yh.prototype._update=function(r){for(var t=this._w,e=this._a|0,n=this._b|0,s=this._c|0,i=this._d|0,c=this._e|0,l=0;l<16;++l)t[l]=r.readInt32BE(l*4);for(;l<80;++l)t[l]=t[l-3]^t[l-8]^t[l-14]^t[l-16];for(var p=0;p<80;++p){var m=~~(p/20),v=RI(e)+TI(m,n,s,i)+c+t[p]+BI[m]|0;c=i,i=s,s=CI(n),n=e,e=v}this._a=e+this._a|0,this._b=n+this._b|0,this._c=s+this._c|0,this._d=i+this._d|0,this._e=c+this._e|0};yh.prototype._hash=function(){var r=II.allocUnsafe(20);return r.writeInt32BE(this._a|0,0),r.writeInt32BE(this._b|0,4),r.writeInt32BE(this._c|0,8),r.writeInt32BE(this._d|0,12),r.writeInt32BE(this._e|0,16),r};var LI=yh,OI=br,t_=wf,UI=sr.Buffer,NI=[1518500249,1859775393,-1894007588,-899497514],DI=new Array(80);function bh(){this.init(),this._w=DI,t_.call(this,64,56)}OI(bh,t_);bh.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function zI(r){return r<<1|r>>>31}function qI(r){return r<<5|r>>>27}function FI(r){return r<<30|r>>>2}function jI(r,t,e,n){return r===0?t&e|~t&n:r===2?t&e|t&n|e&n:t^e^n}bh.prototype._update=function(r){for(var t=this._w,e=this._a|0,n=this._b|0,s=this._c|0,i=this._d|0,c=this._e|0,l=0;l<16;++l)t[l]=r.readInt32BE(l*4);for(;l<80;++l)t[l]=zI(t[l-3]^t[l-8]^t[l-14]^t[l-16]);for(var p=0;p<80;++p){var m=~~(p/20),v=qI(e)+jI(m,n,s,i)+c+t[p]+NI[m]|0;c=i,i=s,s=FI(n),n=e,e=v}this._a=e+this._a|0,this._b=n+this._b|0,this._c=s+this._c|0,this._d=i+this._d|0,this._e=c+this._e|0};bh.prototype._hash=function(){var r=UI.allocUnsafe(20);return r.writeInt32BE(this._a|0,0),r.writeInt32BE(this._b|0,4),r.writeInt32BE(this._c|0,8),r.writeInt32BE(this._d|0,12),r.writeInt32BE(this._e|0,16),r};var KI=bh,$I=br,e_=wf,HI=sr.Buffer,VI=[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],ZI=new Array(64);function wh(){this.init(),this._w=ZI,e_.call(this,64,56)}$I(wh,e_);wh.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 WI(r,t,e){return e^r&(t^e)}function GI(r,t,e){return r&t|e&(r|t)}function YI(r){return(r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10)}function XI(r){return(r>>>6|r<<26)^(r>>>11|r<<21)^(r>>>25|r<<7)}function JI(r){return(r>>>7|r<<25)^(r>>>18|r<<14)^r>>>3}function QI(r){return(r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10}wh.prototype._update=function(r){for(var t=this._w,e=this._a|0,n=this._b|0,s=this._c|0,i=this._d|0,c=this._e|0,l=this._f|0,p=this._g|0,m=this._h|0,v=0;v<16;++v)t[v]=r.readInt32BE(v*4);for(;v<64;++v)t[v]=QI(t[v-2])+t[v-7]+JI(t[v-15])+t[v-16]|0;for(var _=0;_<64;++_){var E=m+XI(c)+WI(c,l,p)+VI[_]+t[_]|0,w=YI(e)+GI(e,n,s)|0;m=p,p=l,l=c,c=i+E|0,i=s,s=n,n=e,e=E+w|0}this._a=e+this._a|0,this._b=n+this._b|0,this._c=s+this._c|0,this._d=i+this._d|0,this._e=c+this._e|0,this._f=l+this._f|0,this._g=p+this._g|0,this._h=m+this._h|0};wh.prototype._hash=function(){var r=HI.allocUnsafe(32);return r.writeInt32BE(this._a,0),r.writeInt32BE(this._b,4),r.writeInt32BE(this._c,8),r.writeInt32BE(this._d,12),r.writeInt32BE(this._e,16),r.writeInt32BE(this._f,20),r.writeInt32BE(this._g,24),r.writeInt32BE(this._h,28),r};var r_=wh,tB=br,eB=r_,rB=wf,nB=sr.Buffer,iB=new Array(64);function Jl(){this.init(),this._w=iB,rB.call(this,64,56)}tB(Jl,eB);Jl.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};Jl.prototype._hash=function(){var r=nB.allocUnsafe(28);return r.writeInt32BE(this._a,0),r.writeInt32BE(this._b,4),r.writeInt32BE(this._c,8),r.writeInt32BE(this._d,12),r.writeInt32BE(this._e,16),r.writeInt32BE(this._f,20),r.writeInt32BE(this._g,24),r};var oB=Jl,sB=br,n_=wf,aB=sr.Buffer,Sb=[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],uB=new Array(160);function xh(){this.init(),this._w=uB,n_.call(this,128,112)}sB(xh,n_);xh.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 kb(r,t,e){return e^r&(t^e)}function Ib(r,t,e){return r&t|e&(r|t)}function Bb(r,t){return(r>>>28|t<<4)^(t>>>2|r<<30)^(t>>>7|r<<25)}function Pb(r,t){return(r>>>14|t<<18)^(r>>>18|t<<14)^(t>>>9|r<<23)}function fB(r,t){return(r>>>1|t<<31)^(r>>>8|t<<24)^r>>>7}function cB(r,t){return(r>>>1|t<<31)^(r>>>8|t<<24)^(r>>>7|t<<25)}function hB(r,t){return(r>>>19|t<<13)^(t>>>29|r<<3)^r>>>6}function lB(r,t){return(r>>>19|t<<13)^(t>>>29|r<<3)^(r>>>6|t<<26)}function yn(r,t){return r>>>0>>0?1:0}xh.prototype._update=function(r){for(var t=this._w,e=this._ah|0,n=this._bh|0,s=this._ch|0,i=this._dh|0,c=this._eh|0,l=this._fh|0,p=this._gh|0,m=this._hh|0,v=this._al|0,_=this._bl|0,E=this._cl|0,w=this._dl|0,x=this._el|0,A=this._fl|0,B=this._gl|0,P=this._hl|0,R=0;R<32;R+=2)t[R]=r.readInt32BE(R*4),t[R+1]=r.readInt32BE(R*4+4);for(;R<160;R+=2){var C=t[R-30],O=t[R-15*2+1],z=fB(C,O),H=cB(O,C);C=t[R-2*2],O=t[R-2*2+1];var tt=hB(C,O),nt=lB(O,C),G=t[R-7*2],M=t[R-7*2+1],d=t[R-16*2],o=t[R-16*2+1],a=H+M|0,f=z+G+yn(a,H)|0;a=a+nt|0,f=f+tt+yn(a,nt)|0,a=a+o|0,f=f+d+yn(a,o)|0,t[R]=f,t[R+1]=a}for(var h=0;h<160;h+=2){f=t[h],a=t[h+1];var g=Ib(e,n,s),S=Ib(v,_,E),I=Bb(e,v),y=Bb(v,e),u=Pb(c,x),b=Pb(x,c),D=Sb[h],Z=Sb[h+1],F=kb(c,l,p),q=kb(x,A,B),it=P+b|0,at=m+u+yn(it,P)|0;it=it+q|0,at=at+F+yn(it,q)|0,it=it+Z|0,at=at+D+yn(it,Z)|0,it=it+a|0,at=at+f+yn(it,a)|0;var Bt=y+S|0,yt=I+g+yn(Bt,y)|0;m=p,P=B,p=l,B=A,l=c,A=x,x=w+it|0,c=i+at+yn(x,w)|0,i=s,w=E,s=n,E=_,n=e,_=v,v=it+Bt|0,e=at+yt+yn(v,it)|0}this._al=this._al+v|0,this._bl=this._bl+_|0,this._cl=this._cl+E|0,this._dl=this._dl+w|0,this._el=this._el+x|0,this._fl=this._fl+A|0,this._gl=this._gl+B|0,this._hl=this._hl+P|0,this._ah=this._ah+e+yn(this._al,v)|0,this._bh=this._bh+n+yn(this._bl,_)|0,this._ch=this._ch+s+yn(this._cl,E)|0,this._dh=this._dh+i+yn(this._dl,w)|0,this._eh=this._eh+c+yn(this._el,x)|0,this._fh=this._fh+l+yn(this._fl,A)|0,this._gh=this._gh+p+yn(this._gl,B)|0,this._hh=this._hh+m+yn(this._hl,P)|0};xh.prototype._hash=function(){var r=aB.allocUnsafe(64);function t(e,n,s){r.writeInt32BE(e,s),r.writeInt32BE(n,s+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),r};var i_=xh,dB=br,pB=i_,mB=wf,vB=sr.Buffer,gB=new Array(160);function Ql(){this.init(),this._w=gB,mB.call(this,128,112)}dB(Ql,pB);Ql.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};Ql.prototype._hash=function(){var r=vB.allocUnsafe(48);function t(e,n,s){r.writeInt32BE(e,s),r.writeInt32BE(n,s+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),r};var yB=Ql,ou=X7.exports=function(t){t=t.toLowerCase();var e=ou[t];if(!e)throw new Error(t+" is not supported (we accept pull requests)");return new e};ou.sha=LI;ou.sha1=KI;ou.sha224=oB;ou.sha256=r_;ou.sha384=yB;ou.sha512=i_;var eg=X7.exports,o_=sr.Buffer,s_=mI.Transform,bB=vI().StringDecoder,wB=br;function po(r){s_.call(this),this.hashMode=typeof r=="string",this.hashMode?this[r]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}wB(po,s_);po.prototype.update=function(r,t,e){typeof r=="string"&&(r=o_.from(r,t));var n=this._update(r);return this.hashMode?this:(e&&(n=this._toString(n,e)),n)};po.prototype.setAutoPadding=function(){};po.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")};po.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")};po.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")};po.prototype._transform=function(r,t,e){var n;try{this.hashMode?this._update(r):this.push(this._update(r))}catch(s){n=s}finally{e(n)}};po.prototype._flush=function(r){var t;try{this.push(this.__final())}catch(e){t=e}r(t)};po.prototype._finalOrDigest=function(r){var t=this.__final()||o_.alloc(0);return r&&(t=this._toString(t,r,!0)),t};po.prototype._toString=function(r,t,e){if(this._decoder||(this._decoder=new bB(t),this._encoding=t),this._encoding!==t)throw new Error("can't switch encodings");var n=this._decoder.write(r);return e&&(n+=this._decoder.end()),n};var sa=po,xB=br,_B=Qv,MB=tg,EB=eg,a_=sa;function td(r){a_.call(this,"digest"),this._hash=r}xB(td,a_);td.prototype._update=function(r){this._hash.update(r)};td.prototype._final=function(){return this._hash.digest()};var _h=function(t){return t=t.toLowerCase(),t==="md5"?new _B:t==="rmd160"||t==="ripemd160"?new MB:new td(EB(t))};const rg=j7(K7);var Je={},Fd,Rb;function AB(){if(Rb)return Fd;Rb=1;var r=br,t=sr.Buffer,e=sa,n=t.alloc(128),s=64;function i(c,l){e.call(this,"digest"),typeof l=="string"&&(l=t.from(l)),this._alg=c,this._key=l,l.length>s?l=c(l):l.length_){var E=m==="rmd160"?new i:c(m);v=E.update(v).digest()}else v.length<_&&(v=n.concat([v,l],_));for(var w=this._ipad=n.allocUnsafe(_),x=this._opad=n.allocUnsafe(_),A=0;A<_;A++)w[A]=v[A]^54,x[A]=v[A]^92;this._hash=m==="rmd160"?new i:c(m),this._hash.update(w)}return r(p,e),p.prototype._update=function(m){this._hash.update(m)},p.prototype._final=function(){var m=this._hash.digest(),v=this._alg==="rmd160"?new i:c(this._alg);return v.update(this._opad).update(m).digest()},Kd=function(v,_){return v=v.toLowerCase(),v==="rmd160"||v==="ripemd160"?new p("rmd160",_):v==="md5"?new t(s,_):new p(v,_)},Kd}const SB={sign:"rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},kB={sign:"rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},IB={sign:"rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},BB={sign:"rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},PB={sign:"ecdsa",hash:"sha256",id:""},RB={sign:"ecdsa",hash:"sha224",id:""},CB={sign:"ecdsa",hash:"sha384",id:""},TB={sign:"ecdsa",hash:"sha512",id:""},LB={sign:"dsa",hash:"sha1",id:""},OB={sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},UB={sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"},c_={sha224WithRSAEncryption:SB,"RSA-SHA224":{sign:"ecdsa/rsa",hash:"sha224",id:"302d300d06096086480165030402040500041c"},sha256WithRSAEncryption:kB,"RSA-SHA256":{sign:"ecdsa/rsa",hash:"sha256",id:"3031300d060960864801650304020105000420"},sha384WithRSAEncryption:IB,"RSA-SHA384":{sign:"ecdsa/rsa",hash:"sha384",id:"3041300d060960864801650304020205000430"},sha512WithRSAEncryption:BB,"RSA-SHA512":{sign:"ecdsa/rsa",hash:"sha512",id:"3051300d060960864801650304020305000440"},"RSA-SHA1":{sign:"rsa",hash:"sha1",id:"3021300906052b0e03021a05000414"},"ecdsa-with-SHA1":{sign:"ecdsa",hash:"sha1",id:""},sha256:PB,sha224:RB,sha384:CB,sha512:TB,"DSA-SHA":{sign:"dsa",hash:"sha1",id:""},"DSA-SHA1":{sign:"dsa",hash:"sha1",id:""},DSA:LB,"DSA-WITH-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-SHA224":{sign:"dsa",hash:"sha224",id:""},"DSA-WITH-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-SHA256":{sign:"dsa",hash:"sha256",id:""},"DSA-WITH-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-SHA384":{sign:"dsa",hash:"sha384",id:""},"DSA-WITH-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-SHA512":{sign:"dsa",hash:"sha512",id:""},"DSA-RIPEMD160":{sign:"dsa",hash:"rmd160",id:""},ripemd160WithRSA:OB,"RSA-RIPEMD160":{sign:"rsa",hash:"rmd160",id:"3021300906052b2403020105000414"},md5WithRSAEncryption:UB,"RSA-MD5":{sign:"rsa",hash:"md5",id:"3020300c06082a864886f70d020505000410"}};var $d,Lb;function NB(){return Lb||(Lb=1,$d=c_),$d}var Zh={},Hd,Ob;function h_(){if(Ob)return Hd;Ob=1;var r=Math.pow(2,30)-1;return Hd=function(t,e){if(typeof t!="number")throw new TypeError("Iterations not a number");if(t<0)throw new TypeError("Bad iterations");if(typeof e!="number")throw new TypeError("Key length not a number");if(e<0||e>r||e!==e)throw new TypeError("Bad key length")},Hd}var Vd,Ub;function l_(){if(Ub)return Vd;Ub=1;var r;if(Re.process&&Re.process.browser)r="utf-8";else if(Re.process&&Re.process.version){var t=parseInt(Zt.process.version.split(".")[0].slice(1),10);r=t>=6?"utf-8":"binary"}else r="utf-8";return Vd=r,Vd}var Zd,Nb;function d_(){if(Nb)return Zd;Nb=1;var r=sr.Buffer;return Zd=function(t,e,n){if(r.isBuffer(t))return t;if(typeof t=="string")return r.from(t,e);if(ArrayBuffer.isView(t))return r.from(t.buffer);throw new TypeError(n+" must be a string, a Buffer, a typed array or a DataView")},Zd}var Wd,Db;function p_(){if(Db)return Wd;Db=1;var r=u_(),t=tg,e=eg,n=sr.Buffer,s=h_(),i=l_(),c=d_(),l=n.alloc(128),p={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function m(E,w,x){var A=v(E),B=E==="sha512"||E==="sha384"?128:64;w.length>B?w=A(w):w.length>>0},pi.writeUInt32BE=function(s,i,c){s[0+c]=i>>>24,s[1+c]=i>>>16&255,s[2+c]=i>>>8&255,s[3+c]=i&255},pi.ip=function(s,i,c,l){for(var p=0,m=0,v=6;v>=0;v-=2){for(var _=0;_<=24;_+=8)p<<=1,p|=i>>>_+v&1;for(var _=0;_<=24;_+=8)p<<=1,p|=s>>>_+v&1}for(var v=6;v>=0;v-=2){for(var _=1;_<=25;_+=8)m<<=1,m|=i>>>_+v&1;for(var _=1;_<=25;_+=8)m<<=1,m|=s>>>_+v&1}c[l+0]=p>>>0,c[l+1]=m>>>0},pi.rip=function(s,i,c,l){for(var p=0,m=0,v=0;v<4;v++)for(var _=24;_>=0;_-=8)p<<=1,p|=i>>>_+v&1,p<<=1,p|=s>>>_+v&1;for(var v=4;v<8;v++)for(var _=24;_>=0;_-=8)m<<=1,m|=i>>>_+v&1,m<<=1,m|=s>>>_+v&1;c[l+0]=p>>>0,c[l+1]=m>>>0},pi.pc1=function(s,i,c,l){for(var p=0,m=0,v=7;v>=5;v--){for(var _=0;_<=24;_+=8)p<<=1,p|=i>>_+v&1;for(var _=0;_<=24;_+=8)p<<=1,p|=s>>_+v&1}for(var _=0;_<=24;_+=8)p<<=1,p|=i>>_+v&1;for(var v=1;v<=3;v++){for(var _=0;_<=24;_+=8)m<<=1,m|=i>>_+v&1;for(var _=0;_<=24;_+=8)m<<=1,m|=s>>_+v&1}for(var _=0;_<=24;_+=8)m<<=1,m|=s>>_+v&1;c[l+0]=p>>>0,c[l+1]=m>>>0},pi.r28shl=function(s,i){return s<>>28-i};var r=[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];pi.pc2=function(s,i,c,l){for(var p=0,m=0,v=r.length>>>1,_=0;_>>r[_]&1;for(var _=v;_>>r[_]&1;c[l+0]=p>>>0,c[l+1]=m>>>0},pi.expand=function(s,i,c){var l=0,p=0;l=(s&1)<<5|s>>>27;for(var m=23;m>=15;m-=4)l<<=6,l|=s>>>m&63;for(var m=11;m>=3;m-=4)p|=s>>>m&63,p<<=6;p|=(s&31)<<1|s>>>31,i[c+0]=l>>>0,i[c+1]=p>>>0};var t=[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];pi.substitute=function(s,i){for(var c=0,l=0;l<4;l++){var p=s>>>18-l*6&63,m=t[l*64+p];c<<=4,c|=m}for(var l=0;l<4;l++){var p=i>>>18-l*6&63,m=t[4*64+l*64+p];c<<=4,c|=m}return c>>>0};var e=[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];return pi.permute=function(s){for(var i=0,c=0;c>>e[c]&1;return i>>>0},pi.padSplit=function(s,i,c){for(var l=s.toString(2);l.length0;c--)s+=this._buffer(n,s),i+=this._flushBuffer(l,i);return s+=this._buffer(n,s),l},t.prototype.final=function(n){var s;n&&(s=this.update(n));var i;return this.type==="encrypt"?i=this._finalEncrypt():i=this._finalDecrypt(),s?s.concat(i):i},t.prototype._pad=function(n,s){if(s===0)return!1;for(;s>>1];v=e.r28shl(v,w),_=e.r28shl(_,w),e.pc2(v,_,p.keys,E)}},i.prototype._update=function(p,m,v,_){var E=this._desState,w=e.readUInt32BE(p,m),x=e.readUInt32BE(p,m+4);e.ip(w,x,E.tmp,0),w=E.tmp[0],x=E.tmp[1],this.type==="encrypt"?this._encrypt(E,w,x,E.tmp,0):this._decrypt(E,w,x,E.tmp,0),w=E.tmp[0],x=E.tmp[1],e.writeUInt32BE(v,w,_),e.writeUInt32BE(v,x,_+4)},i.prototype._pad=function(p,m){if(this.padding===!1)return!1;for(var v=p.length-m,_=m;_>>0,w=O}e.rip(x,w,_,E)},i.prototype._decrypt=function(p,m,v,_,E){for(var w=v,x=m,A=p.keys.length-2;A>=0;A-=2){var B=p.keys[A],P=p.keys[A+1];e.expand(w,p.tmp,0),B^=p.tmp[0],P^=p.tmp[1];var R=e.substitute(B,P),C=e.permute(R),O=w;w=(x^C)>>>0,x=O}e.rip(w,x,_,E)},Xd}var Jd={},$b;function zB(){if($b)return Jd;$b=1;var r=Zi,t=br,e={};function n(i){r.equal(i.length,8,"Invalid IV length"),this.iv=new Array(8);for(var c=0;c>l%8,n._prev=e(n._prev,i?v:_);return m}function e(n,s){var i=n.length,c=-1,l=r.allocUnsafe(n.length);for(n=r.concat([n,r.from([s])]);++c>7;return l}return i1.encrypt=function(n,s,i){for(var c=s.length,l=r.allocUnsafe(c),p=-1;++p>>24]^w[P>>>16&255]^x[R>>>8&255]^A[C&255]^p[nt++],z=E[P>>>24]^w[R>>>16&255]^x[C>>>8&255]^A[B&255]^p[nt++],H=E[R>>>24]^w[C>>>16&255]^x[B>>>8&255]^A[P&255]^p[nt++],tt=E[C>>>24]^w[B>>>16&255]^x[P>>>8&255]^A[R&255]^p[nt++],B=O,P=z,R=H,C=tt;return O=(v[B>>>24]<<24|v[P>>>16&255]<<16|v[R>>>8&255]<<8|v[C&255])^p[nt++],z=(v[P>>>24]<<24|v[R>>>16&255]<<16|v[C>>>8&255]<<8|v[B&255])^p[nt++],H=(v[R>>>24]<<24|v[C>>>16&255]<<16|v[B>>>8&255]<<8|v[P&255])^p[nt++],tt=(v[C>>>24]<<24|v[B>>>16&255]<<16|v[P>>>8&255]<<8|v[R&255])^p[nt++],O=O>>>0,z=z>>>0,H=H>>>0,tt=tt>>>0,[O,z,H,tt]}var s=[0,1,2,4,8,16,32,64,128,27,54],i=function(){for(var l=new Array(256),p=0;p<256;p++)p<128?l[p]=p<<1:l[p]=p<<1^283;for(var m=[],v=[],_=[[],[],[],[]],E=[[],[],[],[]],w=0,x=0,A=0;A<256;++A){var B=x^x<<1^x<<2^x<<3^x<<4;B=B>>>8^B&255^99,m[w]=B,v[B]=w;var P=l[w],R=l[P],C=l[R],O=l[B]*257^B*16843008;_[0][w]=O<<24|O>>>8,_[1][w]=O<<16|O>>>16,_[2][w]=O<<8|O>>>24,_[3][w]=O,O=C*16843009^R*65537^P*257^w*16843008,E[0][B]=O<<24|O>>>8,E[1][B]=O<<16|O>>>16,E[2][B]=O<<8|O>>>24,E[3][B]=O,w===0?w=x=1:(w=P^l[l[l[C^P]]],x^=l[l[x]])}return{SBOX:m,INV_SBOX:v,SUB_MIX:_,INV_SUB_MIX:E}}();function c(l){this._key=t(l),this._reset()}return c.blockSize=4*4,c.keySize=256/8,c.prototype.blockSize=c.blockSize,c.prototype.keySize=c.keySize,c.prototype._reset=function(){for(var l=this._key,p=l.length,m=p+6,v=(m+1)*4,_=[],E=0;E>>24,w=i.SBOX[w>>>24]<<24|i.SBOX[w>>>16&255]<<16|i.SBOX[w>>>8&255]<<8|i.SBOX[w&255],w^=s[E/p|0]<<24):p>6&&E%p===4&&(w=i.SBOX[w>>>24]<<24|i.SBOX[w>>>16&255]<<16|i.SBOX[w>>>8&255]<<8|i.SBOX[w&255]),_[E]=_[E-p]^w}for(var x=[],A=0;A>>24]]^i.INV_SUB_MIX[1][i.SBOX[P>>>16&255]]^i.INV_SUB_MIX[2][i.SBOX[P>>>8&255]]^i.INV_SUB_MIX[3][i.SBOX[P&255]]}this._nRounds=m,this._keySchedule=_,this._invKeySchedule=x},c.prototype.encryptBlockRaw=function(l){return l=t(l),n(l,this._keySchedule,i.SUB_MIX,i.SBOX,this._nRounds)},c.prototype.encryptBlock=function(l){var p=this.encryptBlockRaw(l),m=r.allocUnsafe(16);return m.writeUInt32BE(p[0],0),m.writeUInt32BE(p[1],4),m.writeUInt32BE(p[2],8),m.writeUInt32BE(p[3],12),m},c.prototype.decryptBlock=function(l){l=t(l);var p=l[1];l[1]=l[3],l[3]=p;var m=n(l,this._invKeySchedule,i.INV_SUB_MIX,i.INV_SBOX,this._nRounds),v=r.allocUnsafe(16);return v.writeUInt32BE(m[0],0),v.writeUInt32BE(m[3],4),v.writeUInt32BE(m[2],8),v.writeUInt32BE(m[1],12),v},c.prototype.scrub=function(){e(this._keySchedule),e(this._invKeySchedule),e(this._key)},f1.AES=c,f1}var c1,sw;function JB(){if(sw)return c1;sw=1;var r=sr.Buffer,t=r.alloc(16,0);function e(i){return[i.readUInt32BE(0),i.readUInt32BE(4),i.readUInt32BE(8),i.readUInt32BE(12)]}function n(i){var c=r.allocUnsafe(16);return c.writeUInt32BE(i[0]>>>0,0),c.writeUInt32BE(i[1]>>>0,4),c.writeUInt32BE(i[2]>>>0,8),c.writeUInt32BE(i[3]>>>0,12),c}function s(i){this.h=i,this.state=r.alloc(16,0),this.cache=r.allocUnsafe(0)}return s.prototype.ghash=function(i){for(var c=-1;++c0;l--)i[l]=i[l]>>>1|(i[l-1]&1)<<31;i[0]=i[0]>>>1,m&&(i[0]=i[0]^225<<24)}this.state=n(c)},s.prototype.update=function(i){this.cache=r.concat([this.cache,i]);for(var c;this.cache.length>=16;)c=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(c)},s.prototype.final=function(i,c){return this.cache.length&&this.ghash(r.concat([this.cache,t],16)),this.ghash(n([0,i,0,c])),this.state},c1=s,c1}var h1,aw;function x_(){if(aw)return h1;aw=1;var r=ed(),t=sr.Buffer,e=sa,n=br,s=JB(),i=Mh(),c=b_();function l(v,_){var E=0;v.length!==_.length&&E++;for(var w=Math.min(v.length,_.length),x=0;x0||c>0;){var _=new t;_.update(v),_.update(n),s&&_.update(s),v=_.digest();var E=0;if(l>0){var w=p.length-l;E=Math.min(l,v.length),v.copy(p,w,0,E),l-=E}if(E0){var x=m.length-c,A=Math.min(c,v.length-E);v.copy(m,x,E,E+A),c-=A}}return v.fill(0),{key:p,iv:m}}return d1=e,d1}var cw;function QB(){if(cw)return Wh;cw=1;var r=ig(),t=x_(),e=sr.Buffer,n=__(),s=sa,i=ed(),c=rd(),l=br;function p(w,x,A){s.call(this),this._cache=new v,this._cipher=new i.AES(x),this._prev=e.from(A),this._mode=w,this._autopadding=!0}l(p,s),p.prototype._update=function(w){this._cache.add(w);for(var x,A,B=[];x=this._cache.get();)A=this._mode.encrypt(this,x),B.push(A);return e.concat(B)};var m=e.alloc(16,16);p.prototype._final=function(){var w=this._cache.flush();if(this._autopadding)return w=this._mode.encrypt(this,w),this._cipher.scrub(),w;if(!w.equals(m))throw this._cipher.scrub(),new Error("data not multiple of block length")},p.prototype.setAutoPadding=function(w){return this._autopadding=!!w,this};function v(){this.cache=e.allocUnsafe(0)}v.prototype.add=function(w){this.cache=e.concat([this.cache,w])},v.prototype.get=function(){if(this.cache.length>15){var w=this.cache.slice(0,16);return this.cache=this.cache.slice(16),w}return null},v.prototype.flush=function(){for(var w=16-this.cache.length,x=e.allocUnsafe(w),A=-1;++A16)return x=this.cache.slice(0,16),this.cache=this.cache.slice(16),x}else if(this.cache.length>=16)return x=this.cache.slice(0,16),this.cache=this.cache.slice(16),x;return null},m.prototype.flush=function(){if(this.cache.length)return this.cache};function v(w){var x=w[15];if(x<1||x>16)throw new Error("unable to decrypt data");for(var A=-1;++A0?o:a},i.min=function(o,a){return o.cmp(a)<0?o:a},i.prototype._init=function(o,a,f){if(typeof o=="number")return this._initNumber(o,a,f);if(typeof o=="object")return this._initArray(o,a,f);a==="hex"&&(a=16),n(a===(a|0)&&a>=2&&a<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h=0;h-=3)S=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[g]|=S<>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);else if(f==="le")for(h=0,g=0;h>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);return this.strip()};function l(d,o){var a=d.charCodeAt(o);return a>=65&&a<=70?a-55:a>=97&&a<=102?a-87:a-48&15}function p(d,o,a){var f=l(d,a);return a-1>=o&&(f|=l(d,a-1)<<4),f}i.prototype._parseHex=function(o,a,f){this.length=Math.ceil((o.length-a)/6),this.words=new Array(this.length);for(var h=0;h=a;h-=2)I=p(o,a,h)<=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8;else{var y=o.length-a;for(h=y%2===0?a+1:a;h=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8}this.strip()};function m(d,o,a,f){for(var h=0,g=Math.min(d.length,a),S=o;S=49?h+=I-49+10:I>=17?h+=I-17+10:h+=I}return h}i.prototype._parseBase=function(o,a,f){this.words=[0],this.length=1;for(var h=0,g=1;g<=67108863;g*=a)h++;h--,g=g/a|0;for(var S=o.length-f,I=S%h,y=Math.min(S,S-I)+f,u=0,b=f;b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var v=["","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"],_=[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],E=[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];i.prototype.toString=function(o,a){o=o||10,a=a|0||1;var f;if(o===16||o==="hex"){f="";for(var h=0,g=0,S=0;S>>24-h&16777215,g!==0||S!==this.length-1?f=v[6-y.length]+y+f:f=y+f,h+=2,h>=26&&(h-=26,S--)}for(g!==0&&(f=g.toString(16)+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var u=_[o],b=E[o];f="";var D=this.clone();for(D.negative=0;!D.isZero();){var Z=D.modn(b).toString(o);D=D.idivn(b),D.isZero()?f=Z+f:f=v[u-Z.length]+Z+f}for(this.isZero()&&(f="0"+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,a){return n(typeof c<"u"),this.toArrayLike(c,o,a)},i.prototype.toArray=function(o,a){return this.toArrayLike(Array,o,a)},i.prototype.toArrayLike=function(o,a,f){var h=this.byteLength(),g=f||Math.max(1,h);n(h<=g,"byte array longer than desired length"),n(g>0,"Requested array length <= 0"),this.strip();var S=a==="le",I=new o(g),y,u,b=this.clone();if(S){for(u=0;!b.isZero();u++)y=b.andln(255),b.iushrn(8),I[u]=y;for(;u=4096&&(f+=13,a>>>=13),a>=64&&(f+=7,a>>>=7),a>=8&&(f+=4,a>>>=4),a>=2&&(f+=2,a>>>=2),f+a},i.prototype._zeroBits=function(o){if(o===0)return 26;var a=o,f=0;return a&8191||(f+=13,a>>>=13),a&127||(f+=7,a>>>=7),a&15||(f+=4,a>>>=4),a&3||(f+=2,a>>>=2),a&1||f++,f},i.prototype.bitLength=function(){var o=this.words[this.length-1],a=this._countBits(o);return(this.length-1)*26+a};function w(d){for(var o=new Array(d.bitLength()),a=0;a>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,a=0;ao.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var a;this.length>o.length?a=o:a=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var a,f;this.length>o.length?(a=this,f=o):(a=o,f=this);for(var h=0;ho.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var a=Math.ceil(o/26)|0,f=o%26;this._expand(a),f>0&&a--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-f),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,a){n(typeof o=="number"&&o>=0);var f=o/26|0,h=o%26;return this._expand(f+1),a?this.words[f]=this.words[f]|1<o.length?(f=this,h=o):(f=o,h=this);for(var g=0,S=0;S>>26;for(;g!==0&&S>>26;if(this.length=f.length,g!==0)this.words[this.length]=g,this.length++;else if(f!==this)for(;So.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var a=this.iadd(o);return o.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,g;f>0?(h=this,g=o):(h=o,g=this);for(var S=0,I=0;I>26,this.words[I]=a&67108863;for(;S!==0&&I>26,this.words[I]=a&67108863;if(S===0&&I>>26,D=y&67108863,Z=Math.min(u,o.length-1),F=Math.max(0,u-d.length+1);F<=Z;F++){var q=u-F|0;h=d.words[q]|0,g=o.words[F]|0,S=h*g+D,b+=S/67108864|0,D=S&67108863}a.words[u]=D|0,y=b|0}return y!==0?a.words[u]=y|0:a.length--,a.strip()}var A=function(o,a,f){var h=o.words,g=a.words,S=f.words,I=0,y,u,b,D=h[0]|0,Z=D&8191,F=D>>>13,q=h[1]|0,it=q&8191,at=q>>>13,Bt=h[2]|0,yt=Bt&8191,pt=Bt>>>13,Ft=h[3]|0,lt=Ft&8191,ct=Ft>>>13,Tt=h[4]|0,kt=Tt&8191,k=Tt>>>13,T=h[5]|0,L=T&8191,j=T>>>13,rt=h[6]|0,Q=rt&8191,ot=rt>>>13,qt=h[7]|0,It=qt&8191,xt=qt>>>13,Qt=h[8]|0,Ct=Qt&8191,Dt=Qt>>>13,Se=h[9]|0,te=Se&8191,Ut=Se>>>13,Te=g[0]|0,J=Te&8191,X=Te>>>13,st=g[1]|0,N=st&8191,$=st>>>13,gt=g[2]|0,ft=gt&8191,mt=gt>>>13,vt=g[3]|0,At=vt&8191,_t=vt>>>13,Gt=g[4]|0,Rt=Gt&8191,wt=Gt>>>13,se=g[5]|0,Lt=se&8191,Et=se>>>13,de=g[6]|0,Pt=de&8191,Mt=de>>>13,K=g[7]|0,Y=K&8191,V=K>>>13,U=g[8]|0,W=U&8191,et=U>>>13,dt=g[9]|0,ut=dt&8191,ht=dt>>>13;f.negative=o.negative^a.negative,f.length=19,y=Math.imul(Z,J),u=Math.imul(Z,X),u=u+Math.imul(F,J)|0,b=Math.imul(F,X);var zt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(zt>>>26)|0,zt&=67108863,y=Math.imul(it,J),u=Math.imul(it,X),u=u+Math.imul(at,J)|0,b=Math.imul(at,X),y=y+Math.imul(Z,N)|0,u=u+Math.imul(Z,$)|0,u=u+Math.imul(F,N)|0,b=b+Math.imul(F,$)|0;var Wt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,y=Math.imul(yt,J),u=Math.imul(yt,X),u=u+Math.imul(pt,J)|0,b=Math.imul(pt,X),y=y+Math.imul(it,N)|0,u=u+Math.imul(it,$)|0,u=u+Math.imul(at,N)|0,b=b+Math.imul(at,$)|0,y=y+Math.imul(Z,ft)|0,u=u+Math.imul(Z,mt)|0,u=u+Math.imul(F,ft)|0,b=b+Math.imul(F,mt)|0;var ye=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ye>>>26)|0,ye&=67108863,y=Math.imul(lt,J),u=Math.imul(lt,X),u=u+Math.imul(ct,J)|0,b=Math.imul(ct,X),y=y+Math.imul(yt,N)|0,u=u+Math.imul(yt,$)|0,u=u+Math.imul(pt,N)|0,b=b+Math.imul(pt,$)|0,y=y+Math.imul(it,ft)|0,u=u+Math.imul(it,mt)|0,u=u+Math.imul(at,ft)|0,b=b+Math.imul(at,mt)|0,y=y+Math.imul(Z,At)|0,u=u+Math.imul(Z,_t)|0,u=u+Math.imul(F,At)|0,b=b+Math.imul(F,_t)|0;var Yt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,y=Math.imul(kt,J),u=Math.imul(kt,X),u=u+Math.imul(k,J)|0,b=Math.imul(k,X),y=y+Math.imul(lt,N)|0,u=u+Math.imul(lt,$)|0,u=u+Math.imul(ct,N)|0,b=b+Math.imul(ct,$)|0,y=y+Math.imul(yt,ft)|0,u=u+Math.imul(yt,mt)|0,u=u+Math.imul(pt,ft)|0,b=b+Math.imul(pt,mt)|0,y=y+Math.imul(it,At)|0,u=u+Math.imul(it,_t)|0,u=u+Math.imul(at,At)|0,b=b+Math.imul(at,_t)|0,y=y+Math.imul(Z,Rt)|0,u=u+Math.imul(Z,wt)|0,u=u+Math.imul(F,Rt)|0,b=b+Math.imul(F,wt)|0;var pe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(pe>>>26)|0,pe&=67108863,y=Math.imul(L,J),u=Math.imul(L,X),u=u+Math.imul(j,J)|0,b=Math.imul(j,X),y=y+Math.imul(kt,N)|0,u=u+Math.imul(kt,$)|0,u=u+Math.imul(k,N)|0,b=b+Math.imul(k,$)|0,y=y+Math.imul(lt,ft)|0,u=u+Math.imul(lt,mt)|0,u=u+Math.imul(ct,ft)|0,b=b+Math.imul(ct,mt)|0,y=y+Math.imul(yt,At)|0,u=u+Math.imul(yt,_t)|0,u=u+Math.imul(pt,At)|0,b=b+Math.imul(pt,_t)|0,y=y+Math.imul(it,Rt)|0,u=u+Math.imul(it,wt)|0,u=u+Math.imul(at,Rt)|0,b=b+Math.imul(at,wt)|0,y=y+Math.imul(Z,Lt)|0,u=u+Math.imul(Z,Et)|0,u=u+Math.imul(F,Lt)|0,b=b+Math.imul(F,Et)|0;var ve=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ve>>>26)|0,ve&=67108863,y=Math.imul(Q,J),u=Math.imul(Q,X),u=u+Math.imul(ot,J)|0,b=Math.imul(ot,X),y=y+Math.imul(L,N)|0,u=u+Math.imul(L,$)|0,u=u+Math.imul(j,N)|0,b=b+Math.imul(j,$)|0,y=y+Math.imul(kt,ft)|0,u=u+Math.imul(kt,mt)|0,u=u+Math.imul(k,ft)|0,b=b+Math.imul(k,mt)|0,y=y+Math.imul(lt,At)|0,u=u+Math.imul(lt,_t)|0,u=u+Math.imul(ct,At)|0,b=b+Math.imul(ct,_t)|0,y=y+Math.imul(yt,Rt)|0,u=u+Math.imul(yt,wt)|0,u=u+Math.imul(pt,Rt)|0,b=b+Math.imul(pt,wt)|0,y=y+Math.imul(it,Lt)|0,u=u+Math.imul(it,Et)|0,u=u+Math.imul(at,Lt)|0,b=b+Math.imul(at,Et)|0,y=y+Math.imul(Z,Pt)|0,u=u+Math.imul(Z,Mt)|0,u=u+Math.imul(F,Pt)|0,b=b+Math.imul(F,Mt)|0;var ge=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ge>>>26)|0,ge&=67108863,y=Math.imul(It,J),u=Math.imul(It,X),u=u+Math.imul(xt,J)|0,b=Math.imul(xt,X),y=y+Math.imul(Q,N)|0,u=u+Math.imul(Q,$)|0,u=u+Math.imul(ot,N)|0,b=b+Math.imul(ot,$)|0,y=y+Math.imul(L,ft)|0,u=u+Math.imul(L,mt)|0,u=u+Math.imul(j,ft)|0,b=b+Math.imul(j,mt)|0,y=y+Math.imul(kt,At)|0,u=u+Math.imul(kt,_t)|0,u=u+Math.imul(k,At)|0,b=b+Math.imul(k,_t)|0,y=y+Math.imul(lt,Rt)|0,u=u+Math.imul(lt,wt)|0,u=u+Math.imul(ct,Rt)|0,b=b+Math.imul(ct,wt)|0,y=y+Math.imul(yt,Lt)|0,u=u+Math.imul(yt,Et)|0,u=u+Math.imul(pt,Lt)|0,b=b+Math.imul(pt,Et)|0,y=y+Math.imul(it,Pt)|0,u=u+Math.imul(it,Mt)|0,u=u+Math.imul(at,Pt)|0,b=b+Math.imul(at,Mt)|0,y=y+Math.imul(Z,Y)|0,u=u+Math.imul(Z,V)|0,u=u+Math.imul(F,Y)|0,b=b+Math.imul(F,V)|0;var ie=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ie>>>26)|0,ie&=67108863,y=Math.imul(Ct,J),u=Math.imul(Ct,X),u=u+Math.imul(Dt,J)|0,b=Math.imul(Dt,X),y=y+Math.imul(It,N)|0,u=u+Math.imul(It,$)|0,u=u+Math.imul(xt,N)|0,b=b+Math.imul(xt,$)|0,y=y+Math.imul(Q,ft)|0,u=u+Math.imul(Q,mt)|0,u=u+Math.imul(ot,ft)|0,b=b+Math.imul(ot,mt)|0,y=y+Math.imul(L,At)|0,u=u+Math.imul(L,_t)|0,u=u+Math.imul(j,At)|0,b=b+Math.imul(j,_t)|0,y=y+Math.imul(kt,Rt)|0,u=u+Math.imul(kt,wt)|0,u=u+Math.imul(k,Rt)|0,b=b+Math.imul(k,wt)|0,y=y+Math.imul(lt,Lt)|0,u=u+Math.imul(lt,Et)|0,u=u+Math.imul(ct,Lt)|0,b=b+Math.imul(ct,Et)|0,y=y+Math.imul(yt,Pt)|0,u=u+Math.imul(yt,Mt)|0,u=u+Math.imul(pt,Pt)|0,b=b+Math.imul(pt,Mt)|0,y=y+Math.imul(it,Y)|0,u=u+Math.imul(it,V)|0,u=u+Math.imul(at,Y)|0,b=b+Math.imul(at,V)|0,y=y+Math.imul(Z,W)|0,u=u+Math.imul(Z,et)|0,u=u+Math.imul(F,W)|0,b=b+Math.imul(F,et)|0;var ue=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ue>>>26)|0,ue&=67108863,y=Math.imul(te,J),u=Math.imul(te,X),u=u+Math.imul(Ut,J)|0,b=Math.imul(Ut,X),y=y+Math.imul(Ct,N)|0,u=u+Math.imul(Ct,$)|0,u=u+Math.imul(Dt,N)|0,b=b+Math.imul(Dt,$)|0,y=y+Math.imul(It,ft)|0,u=u+Math.imul(It,mt)|0,u=u+Math.imul(xt,ft)|0,b=b+Math.imul(xt,mt)|0,y=y+Math.imul(Q,At)|0,u=u+Math.imul(Q,_t)|0,u=u+Math.imul(ot,At)|0,b=b+Math.imul(ot,_t)|0,y=y+Math.imul(L,Rt)|0,u=u+Math.imul(L,wt)|0,u=u+Math.imul(j,Rt)|0,b=b+Math.imul(j,wt)|0,y=y+Math.imul(kt,Lt)|0,u=u+Math.imul(kt,Et)|0,u=u+Math.imul(k,Lt)|0,b=b+Math.imul(k,Et)|0,y=y+Math.imul(lt,Pt)|0,u=u+Math.imul(lt,Mt)|0,u=u+Math.imul(ct,Pt)|0,b=b+Math.imul(ct,Mt)|0,y=y+Math.imul(yt,Y)|0,u=u+Math.imul(yt,V)|0,u=u+Math.imul(pt,Y)|0,b=b+Math.imul(pt,V)|0,y=y+Math.imul(it,W)|0,u=u+Math.imul(it,et)|0,u=u+Math.imul(at,W)|0,b=b+Math.imul(at,et)|0,y=y+Math.imul(Z,ut)|0,u=u+Math.imul(Z,ht)|0,u=u+Math.imul(F,ut)|0,b=b+Math.imul(F,ht)|0;var fe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(fe>>>26)|0,fe&=67108863,y=Math.imul(te,N),u=Math.imul(te,$),u=u+Math.imul(Ut,N)|0,b=Math.imul(Ut,$),y=y+Math.imul(Ct,ft)|0,u=u+Math.imul(Ct,mt)|0,u=u+Math.imul(Dt,ft)|0,b=b+Math.imul(Dt,mt)|0,y=y+Math.imul(It,At)|0,u=u+Math.imul(It,_t)|0,u=u+Math.imul(xt,At)|0,b=b+Math.imul(xt,_t)|0,y=y+Math.imul(Q,Rt)|0,u=u+Math.imul(Q,wt)|0,u=u+Math.imul(ot,Rt)|0,b=b+Math.imul(ot,wt)|0,y=y+Math.imul(L,Lt)|0,u=u+Math.imul(L,Et)|0,u=u+Math.imul(j,Lt)|0,b=b+Math.imul(j,Et)|0,y=y+Math.imul(kt,Pt)|0,u=u+Math.imul(kt,Mt)|0,u=u+Math.imul(k,Pt)|0,b=b+Math.imul(k,Mt)|0,y=y+Math.imul(lt,Y)|0,u=u+Math.imul(lt,V)|0,u=u+Math.imul(ct,Y)|0,b=b+Math.imul(ct,V)|0,y=y+Math.imul(yt,W)|0,u=u+Math.imul(yt,et)|0,u=u+Math.imul(pt,W)|0,b=b+Math.imul(pt,et)|0,y=y+Math.imul(it,ut)|0,u=u+Math.imul(it,ht)|0,u=u+Math.imul(at,ut)|0,b=b+Math.imul(at,ht)|0;var ce=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ce>>>26)|0,ce&=67108863,y=Math.imul(te,ft),u=Math.imul(te,mt),u=u+Math.imul(Ut,ft)|0,b=Math.imul(Ut,mt),y=y+Math.imul(Ct,At)|0,u=u+Math.imul(Ct,_t)|0,u=u+Math.imul(Dt,At)|0,b=b+Math.imul(Dt,_t)|0,y=y+Math.imul(It,Rt)|0,u=u+Math.imul(It,wt)|0,u=u+Math.imul(xt,Rt)|0,b=b+Math.imul(xt,wt)|0,y=y+Math.imul(Q,Lt)|0,u=u+Math.imul(Q,Et)|0,u=u+Math.imul(ot,Lt)|0,b=b+Math.imul(ot,Et)|0,y=y+Math.imul(L,Pt)|0,u=u+Math.imul(L,Mt)|0,u=u+Math.imul(j,Pt)|0,b=b+Math.imul(j,Mt)|0,y=y+Math.imul(kt,Y)|0,u=u+Math.imul(kt,V)|0,u=u+Math.imul(k,Y)|0,b=b+Math.imul(k,V)|0,y=y+Math.imul(lt,W)|0,u=u+Math.imul(lt,et)|0,u=u+Math.imul(ct,W)|0,b=b+Math.imul(ct,et)|0,y=y+Math.imul(yt,ut)|0,u=u+Math.imul(yt,ht)|0,u=u+Math.imul(pt,ut)|0,b=b+Math.imul(pt,ht)|0;var Kt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,y=Math.imul(te,At),u=Math.imul(te,_t),u=u+Math.imul(Ut,At)|0,b=Math.imul(Ut,_t),y=y+Math.imul(Ct,Rt)|0,u=u+Math.imul(Ct,wt)|0,u=u+Math.imul(Dt,Rt)|0,b=b+Math.imul(Dt,wt)|0,y=y+Math.imul(It,Lt)|0,u=u+Math.imul(It,Et)|0,u=u+Math.imul(xt,Lt)|0,b=b+Math.imul(xt,Et)|0,y=y+Math.imul(Q,Pt)|0,u=u+Math.imul(Q,Mt)|0,u=u+Math.imul(ot,Pt)|0,b=b+Math.imul(ot,Mt)|0,y=y+Math.imul(L,Y)|0,u=u+Math.imul(L,V)|0,u=u+Math.imul(j,Y)|0,b=b+Math.imul(j,V)|0,y=y+Math.imul(kt,W)|0,u=u+Math.imul(kt,et)|0,u=u+Math.imul(k,W)|0,b=b+Math.imul(k,et)|0,y=y+Math.imul(lt,ut)|0,u=u+Math.imul(lt,ht)|0,u=u+Math.imul(ct,ut)|0,b=b+Math.imul(ct,ht)|0;var oe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(oe>>>26)|0,oe&=67108863,y=Math.imul(te,Rt),u=Math.imul(te,wt),u=u+Math.imul(Ut,Rt)|0,b=Math.imul(Ut,wt),y=y+Math.imul(Ct,Lt)|0,u=u+Math.imul(Ct,Et)|0,u=u+Math.imul(Dt,Lt)|0,b=b+Math.imul(Dt,Et)|0,y=y+Math.imul(It,Pt)|0,u=u+Math.imul(It,Mt)|0,u=u+Math.imul(xt,Pt)|0,b=b+Math.imul(xt,Mt)|0,y=y+Math.imul(Q,Y)|0,u=u+Math.imul(Q,V)|0,u=u+Math.imul(ot,Y)|0,b=b+Math.imul(ot,V)|0,y=y+Math.imul(L,W)|0,u=u+Math.imul(L,et)|0,u=u+Math.imul(j,W)|0,b=b+Math.imul(j,et)|0,y=y+Math.imul(kt,ut)|0,u=u+Math.imul(kt,ht)|0,u=u+Math.imul(k,ut)|0,b=b+Math.imul(k,ht)|0;var Jt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,y=Math.imul(te,Lt),u=Math.imul(te,Et),u=u+Math.imul(Ut,Lt)|0,b=Math.imul(Ut,Et),y=y+Math.imul(Ct,Pt)|0,u=u+Math.imul(Ct,Mt)|0,u=u+Math.imul(Dt,Pt)|0,b=b+Math.imul(Dt,Mt)|0,y=y+Math.imul(It,Y)|0,u=u+Math.imul(It,V)|0,u=u+Math.imul(xt,Y)|0,b=b+Math.imul(xt,V)|0,y=y+Math.imul(Q,W)|0,u=u+Math.imul(Q,et)|0,u=u+Math.imul(ot,W)|0,b=b+Math.imul(ot,et)|0,y=y+Math.imul(L,ut)|0,u=u+Math.imul(L,ht)|0,u=u+Math.imul(j,ut)|0,b=b+Math.imul(j,ht)|0;var le=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(le>>>26)|0,le&=67108863,y=Math.imul(te,Pt),u=Math.imul(te,Mt),u=u+Math.imul(Ut,Pt)|0,b=Math.imul(Ut,Mt),y=y+Math.imul(Ct,Y)|0,u=u+Math.imul(Ct,V)|0,u=u+Math.imul(Dt,Y)|0,b=b+Math.imul(Dt,V)|0,y=y+Math.imul(It,W)|0,u=u+Math.imul(It,et)|0,u=u+Math.imul(xt,W)|0,b=b+Math.imul(xt,et)|0,y=y+Math.imul(Q,ut)|0,u=u+Math.imul(Q,ht)|0,u=u+Math.imul(ot,ut)|0,b=b+Math.imul(ot,ht)|0;var ae=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ae>>>26)|0,ae&=67108863,y=Math.imul(te,Y),u=Math.imul(te,V),u=u+Math.imul(Ut,Y)|0,b=Math.imul(Ut,V),y=y+Math.imul(Ct,W)|0,u=u+Math.imul(Ct,et)|0,u=u+Math.imul(Dt,W)|0,b=b+Math.imul(Dt,et)|0,y=y+Math.imul(It,ut)|0,u=u+Math.imul(It,ht)|0,u=u+Math.imul(xt,ut)|0,b=b+Math.imul(xt,ht)|0;var ne=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ne>>>26)|0,ne&=67108863,y=Math.imul(te,W),u=Math.imul(te,et),u=u+Math.imul(Ut,W)|0,b=Math.imul(Ut,et),y=y+Math.imul(Ct,ut)|0,u=u+Math.imul(Ct,ht)|0,u=u+Math.imul(Dt,ut)|0,b=b+Math.imul(Dt,ht)|0;var Ot=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,y=Math.imul(te,ut),u=Math.imul(te,ht),u=u+Math.imul(Ut,ut)|0,b=Math.imul(Ut,ht);var Nt=(I+y|0)+((u&8191)<<13)|0;return I=(b+(u>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,S[0]=zt,S[1]=Wt,S[2]=ye,S[3]=Yt,S[4]=pe,S[5]=ve,S[6]=ge,S[7]=ie,S[8]=ue,S[9]=fe,S[10]=ce,S[11]=Kt,S[12]=oe,S[13]=Jt,S[14]=le,S[15]=ae,S[16]=ne,S[17]=Ot,S[18]=Nt,I!==0&&(S[19]=I,f.length++),f};Math.imul||(A=x);function B(d,o,a){a.negative=o.negative^d.negative,a.length=d.length+o.length;for(var f=0,h=0,g=0;g>>26)|0,h+=S>>>26,S&=67108863}a.words[g]=I,f=S,S=h}return f!==0?a.words[g]=f:a.length--,a.strip()}function P(d,o,a){var f=new R;return f.mulp(d,o,a)}i.prototype.mulTo=function(o,a){var f,h=this.length+o.length;return this.length===10&&o.length===10?f=A(this,o,a):h<63?f=x(this,o,a):h<1024?f=B(this,o,a):f=P(this,o,a),f};function R(d,o){this.x=d,this.y=o}R.prototype.makeRBT=function(o){for(var a=new Array(o),f=i.prototype._countBits(o)-1,h=0;h>=1;return h},R.prototype.permute=function(o,a,f,h,g,S){for(var I=0;I>>1)g++;return 1<>>13,f[2*S+1]=g&8191,g=g>>>13;for(S=2*a;S>=26,a+=h/67108864|0,a+=g>>>26,this.words[f]=g&67108863}return a!==0&&(this.words[f]=a,this.length++),this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var a=w(o);if(a.length===0)return new i(1);for(var f=this,h=0;h=0);var a=o%26,f=(o-a)/26,h=67108863>>>26-a<<26-a,g;if(a!==0){var S=0;for(g=0;g>>26-a}S&&(this.words[g]=S,this.length++)}if(f!==0){for(g=this.length-1;g>=0;g--)this.words[g+f]=this.words[g];for(g=0;g=0);var h;a?h=(a-a%26)/26:h=0;var g=o%26,S=Math.min((o-g)/26,this.length),I=67108863^67108863>>>g<S)for(this.length-=S,u=0;u=0&&(b!==0||u>=h);u--){var D=this.words[u]|0;this.words[u]=b<<26-g|D>>>g,b=D&I}return y&&b!==0&&(y.words[y.length++]=b),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,a,f){return n(this.negative===0),this.iushrn(o,a,f)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var a=o%26,f=(o-a)/26,h=1<=0);var a=o%26,f=(o-a)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(a!==0&&f++,this.length=Math.min(f,this.length),a!==0){var h=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},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(y/67108864|0),this.words[g+f]=S&67108863}for(;g>26,this.words[g+f]=S&67108863;if(I===0)return this.strip();for(n(I===-1),I=0,g=0;g>26,this.words[g]=S&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,a){var f=this.length-o.length,h=this.clone(),g=o,S=g.words[g.length-1]|0,I=this._countBits(S);f=26-I,f!==0&&(g=g.ushln(f),h.iushln(f),S=g.words[g.length-1]|0);var y=h.length-g.length,u;if(a!=="mod"){u=new i(null),u.length=y+1,u.words=new Array(u.length);for(var b=0;b=0;Z--){var F=(h.words[g.length+Z]|0)*67108864+(h.words[g.length+Z-1]|0);for(F=Math.min(F/S|0,67108863),h._ishlnsubmul(g,F,Z);h.negative!==0;)F--,h.negative=0,h._ishlnsubmul(g,1,Z),h.isZero()||(h.negative^=1);u&&(u.words[Z]=F)}return u&&u.strip(),h.strip(),a!=="div"&&f!==0&&h.iushrn(f),{div:u||null,mod:h}},i.prototype.divmod=function(o,a,f){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,g,S;return this.negative!==0&&o.negative===0?(S=this.neg().divmod(o,a),a!=="mod"&&(h=S.div.neg()),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.iadd(o)),{div:h,mod:g}):this.negative===0&&o.negative!==0?(S=this.divmod(o.neg(),a),a!=="mod"&&(h=S.div.neg()),{div:h,mod:S.mod}):this.negative&o.negative?(S=this.neg().divmod(o.neg(),a),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.isub(o)),{div:S.div,mod:g}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?a==="div"?{div:this.divn(o.words[0]),mod:null}:a==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,a)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var a=this.divmod(o);if(a.mod.isZero())return a.div;var f=a.div.negative!==0?a.mod.isub(o):a.mod,h=o.ushrn(1),g=o.andln(1),S=f.cmp(h);return S<0||g===1&&S===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var a=(1<<26)%o,f=0,h=this.length-1;h>=0;h--)f=(a*f+(this.words[h]|0))%o;return f},i.prototype.idivn=function(o){n(o<=67108863);for(var a=0,f=this.length-1;f>=0;f--){var h=(this.words[f]|0)+a*67108864;this.words[f]=h/o|0,a=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=new i(0),I=new i(1),y=0;a.isEven()&&f.isEven();)a.iushrn(1),f.iushrn(1),++y;for(var u=f.clone(),b=a.clone();!a.isZero();){for(var D=0,Z=1;!(a.words[0]&Z)&&D<26;++D,Z<<=1);if(D>0)for(a.iushrn(D);D-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(u),g.isub(b)),h.iushrn(1),g.iushrn(1);for(var F=0,q=1;!(f.words[0]&q)&&F<26;++F,q<<=1);if(F>0)for(f.iushrn(F);F-- >0;)(S.isOdd()||I.isOdd())&&(S.iadd(u),I.isub(b)),S.iushrn(1),I.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(S),g.isub(I)):(f.isub(a),S.isub(h),I.isub(g))}return{a:S,b:I,gcd:f.iushln(y)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=f.clone();a.cmpn(1)>0&&f.cmpn(1)>0;){for(var I=0,y=1;!(a.words[0]&y)&&I<26;++I,y<<=1);if(I>0)for(a.iushrn(I);I-- >0;)h.isOdd()&&h.iadd(S),h.iushrn(1);for(var u=0,b=1;!(f.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(f.iushrn(u);u-- >0;)g.isOdd()&&g.iadd(S),g.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(g)):(f.isub(a),g.isub(h))}var D;return a.cmpn(1)===0?D=h:D=g,D.cmpn(0)<0&&D.iadd(o),D},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var a=this.clone(),f=o.clone();a.negative=0,f.negative=0;for(var h=0;a.isEven()&&f.isEven();h++)a.iushrn(1),f.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;f.isEven();)f.iushrn(1);var g=a.cmp(f);if(g<0){var S=a;a=f,f=S}else if(g===0||f.cmpn(1)===0)break;a.isub(f)}while(!0);return f.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var a=o%26,f=(o-a)/26,h=1<>>26,I&=67108863,this.words[S]=I}return g!==0&&(this.words[S]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var a=o<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this.strip();var f;if(this.length>1)f=1;else{a&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;f=h===o?0:ho.length)return 1;if(this.length=0;f--){var h=this.words[f]|0,g=o.words[f]|0;if(h!==g){hg&&(a=1);break}}return a},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new G(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var C={k256:null,p224:null,p192:null,p25519:null};function O(d,o){this.name=d,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},O.prototype.ireduce=function(o){var a=o,f;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),f=a.bitLength();while(f>this.n);var h=f0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},O.prototype.split=function(o,a){o.iushrn(this.n,0,a)},O.prototype.imulK=function(o){return o.imul(this.k)};function z(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(z,O),z.prototype.split=function(o,a){for(var f=4194303,h=Math.min(o.length,9),g=0;g>>22,S=I}S>>>=22,o.words[g-10]=S,S===0&&o.length>10?o.length-=10:o.length-=9},z.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var a=0,f=0;f>>=26,o.words[f]=g,a=h}return a!==0&&(o.words[o.length++]=a),o},i._prime=function(o){if(C[o])return C[o];var a;if(o==="k256")a=new z;else if(o==="p224")a=new H;else if(o==="p192")a=new tt;else if(o==="p25519")a=new nt;else throw new Error("Unknown prime "+o);return C[o]=a,a};function G(d){if(typeof d=="string"){var o=i._prime(d);this.m=o.p,this.prime=o}else n(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}G.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},G.prototype._verify2=function(o,a){n((o.negative|a.negative)===0,"red works only with positives"),n(o.red&&o.red===a.red,"red works only with red numbers")},G.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},G.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},G.prototype.add=function(o,a){this._verify2(o,a);var f=o.add(a);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},G.prototype.iadd=function(o,a){this._verify2(o,a);var f=o.iadd(a);return f.cmp(this.m)>=0&&f.isub(this.m),f},G.prototype.sub=function(o,a){this._verify2(o,a);var f=o.sub(a);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},G.prototype.isub=function(o,a){this._verify2(o,a);var f=o.isub(a);return f.cmpn(0)<0&&f.iadd(this.m),f},G.prototype.shl=function(o,a){return this._verify1(o),this.imod(o.ushln(a))},G.prototype.imul=function(o,a){return this._verify2(o,a),this.imod(o.imul(a))},G.prototype.mul=function(o,a){return this._verify2(o,a),this.imod(o.mul(a))},G.prototype.isqr=function(o){return this.imul(o,o.clone())},G.prototype.sqr=function(o){return this.mul(o,o)},G.prototype.sqrt=function(o){if(o.isZero())return o.clone();var a=this.m.andln(3);if(n(a%2===1),a===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(o,f)}for(var h=this.m.subn(1),g=0;!h.isZero()&&h.andln(1)===0;)g++,h.iushrn(1);n(!h.isZero());var S=new i(1).toRed(this),I=S.redNeg(),y=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,y).cmp(I)!==0;)u.redIAdd(I);for(var b=this.pow(u,h),D=this.pow(o,h.addn(1).iushrn(1)),Z=this.pow(o,h),F=g;Z.cmp(S)!==0;){for(var q=Z,it=0;q.cmp(S)!==0;it++)q=q.redSqr();n(it=0;g--){for(var b=a.words[g],D=u-1;D>=0;D--){var Z=b>>D&1;if(S!==h[0]&&(S=this.sqr(S)),Z===0&&I===0){y=0;continue}I<<=1,I|=Z,y++,!(y!==f&&(g!==0||D!==0))&&(S=this.mul(S,h[I]),y=0,I=0)}u=26}return S},G.prototype.convertTo=function(o){var a=o.umod(this.m);return a===o?a.clone():a},G.prototype.convertFrom=function(o){var a=o.clone();return a.red=null,a},i.mont=function(o){return new M(o)};function M(d){G.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(M,G),M.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},M.prototype.convertFrom=function(o){var a=this.imod(o.mul(this.rinv));return a.red=null,a},M.prototype.imul=function(o,a){if(o.isZero()||a.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.mul=function(o,a){if(o.isZero()||a.isZero())return new i(0)._forceRed(this);var f=o.mul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.invm=function(o){var a=this.imod(o._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(r,Re)}(z0)),z0.exports}var q0={exports:{}};q0.exports;var vw;function nP(){return vw||(vw=1,function(r){(function(t,e){function n(d,o){if(!d)throw new Error(o||"Assertion failed")}function s(d,o){d.super_=o;var a=function(){};a.prototype=o.prototype,d.prototype=new a,d.prototype.constructor=d}function i(d,o,a){if(i.isBN(d))return d;this.negative=0,this.words=null,this.length=0,this.red=null,d!==null&&((o==="le"||o==="be")&&(a=o,o=10),this._init(d||0,o||10,a||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=yr.Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,a){return o.cmp(a)>0?o:a},i.min=function(o,a){return o.cmp(a)<0?o:a},i.prototype._init=function(o,a,f){if(typeof o=="number")return this._initNumber(o,a,f);if(typeof o=="object")return this._initArray(o,a,f);a==="hex"&&(a=16),n(a===(a|0)&&a>=2&&a<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h=0;h-=3)S=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[g]|=S<>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);else if(f==="le")for(h=0,g=0;h>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);return this.strip()};function l(d,o){var a=d.charCodeAt(o);return a>=65&&a<=70?a-55:a>=97&&a<=102?a-87:a-48&15}function p(d,o,a){var f=l(d,a);return a-1>=o&&(f|=l(d,a-1)<<4),f}i.prototype._parseHex=function(o,a,f){this.length=Math.ceil((o.length-a)/6),this.words=new Array(this.length);for(var h=0;h=a;h-=2)I=p(o,a,h)<=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8;else{var y=o.length-a;for(h=y%2===0?a+1:a;h=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8}this.strip()};function m(d,o,a,f){for(var h=0,g=Math.min(d.length,a),S=o;S=49?h+=I-49+10:I>=17?h+=I-17+10:h+=I}return h}i.prototype._parseBase=function(o,a,f){this.words=[0],this.length=1;for(var h=0,g=1;g<=67108863;g*=a)h++;h--,g=g/a|0;for(var S=o.length-f,I=S%h,y=Math.min(S,S-I)+f,u=0,b=f;b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var v=["","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"],_=[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],E=[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];i.prototype.toString=function(o,a){o=o||10,a=a|0||1;var f;if(o===16||o==="hex"){f="";for(var h=0,g=0,S=0;S>>24-h&16777215,g!==0||S!==this.length-1?f=v[6-y.length]+y+f:f=y+f,h+=2,h>=26&&(h-=26,S--)}for(g!==0&&(f=g.toString(16)+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var u=_[o],b=E[o];f="";var D=this.clone();for(D.negative=0;!D.isZero();){var Z=D.modn(b).toString(o);D=D.idivn(b),D.isZero()?f=Z+f:f=v[u-Z.length]+Z+f}for(this.isZero()&&(f="0"+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,a){return n(typeof c<"u"),this.toArrayLike(c,o,a)},i.prototype.toArray=function(o,a){return this.toArrayLike(Array,o,a)},i.prototype.toArrayLike=function(o,a,f){var h=this.byteLength(),g=f||Math.max(1,h);n(h<=g,"byte array longer than desired length"),n(g>0,"Requested array length <= 0"),this.strip();var S=a==="le",I=new o(g),y,u,b=this.clone();if(S){for(u=0;!b.isZero();u++)y=b.andln(255),b.iushrn(8),I[u]=y;for(;u=4096&&(f+=13,a>>>=13),a>=64&&(f+=7,a>>>=7),a>=8&&(f+=4,a>>>=4),a>=2&&(f+=2,a>>>=2),f+a},i.prototype._zeroBits=function(o){if(o===0)return 26;var a=o,f=0;return a&8191||(f+=13,a>>>=13),a&127||(f+=7,a>>>=7),a&15||(f+=4,a>>>=4),a&3||(f+=2,a>>>=2),a&1||f++,f},i.prototype.bitLength=function(){var o=this.words[this.length-1],a=this._countBits(o);return(this.length-1)*26+a};function w(d){for(var o=new Array(d.bitLength()),a=0;a>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,a=0;ao.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var a;this.length>o.length?a=o:a=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var a,f;this.length>o.length?(a=this,f=o):(a=o,f=this);for(var h=0;ho.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var a=Math.ceil(o/26)|0,f=o%26;this._expand(a),f>0&&a--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-f),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,a){n(typeof o=="number"&&o>=0);var f=o/26|0,h=o%26;return this._expand(f+1),a?this.words[f]=this.words[f]|1<o.length?(f=this,h=o):(f=o,h=this);for(var g=0,S=0;S>>26;for(;g!==0&&S>>26;if(this.length=f.length,g!==0)this.words[this.length]=g,this.length++;else if(f!==this)for(;So.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var a=this.iadd(o);return o.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,g;f>0?(h=this,g=o):(h=o,g=this);for(var S=0,I=0;I>26,this.words[I]=a&67108863;for(;S!==0&&I>26,this.words[I]=a&67108863;if(S===0&&I>>26,D=y&67108863,Z=Math.min(u,o.length-1),F=Math.max(0,u-d.length+1);F<=Z;F++){var q=u-F|0;h=d.words[q]|0,g=o.words[F]|0,S=h*g+D,b+=S/67108864|0,D=S&67108863}a.words[u]=D|0,y=b|0}return y!==0?a.words[u]=y|0:a.length--,a.strip()}var A=function(o,a,f){var h=o.words,g=a.words,S=f.words,I=0,y,u,b,D=h[0]|0,Z=D&8191,F=D>>>13,q=h[1]|0,it=q&8191,at=q>>>13,Bt=h[2]|0,yt=Bt&8191,pt=Bt>>>13,Ft=h[3]|0,lt=Ft&8191,ct=Ft>>>13,Tt=h[4]|0,kt=Tt&8191,k=Tt>>>13,T=h[5]|0,L=T&8191,j=T>>>13,rt=h[6]|0,Q=rt&8191,ot=rt>>>13,qt=h[7]|0,It=qt&8191,xt=qt>>>13,Qt=h[8]|0,Ct=Qt&8191,Dt=Qt>>>13,Se=h[9]|0,te=Se&8191,Ut=Se>>>13,Te=g[0]|0,J=Te&8191,X=Te>>>13,st=g[1]|0,N=st&8191,$=st>>>13,gt=g[2]|0,ft=gt&8191,mt=gt>>>13,vt=g[3]|0,At=vt&8191,_t=vt>>>13,Gt=g[4]|0,Rt=Gt&8191,wt=Gt>>>13,se=g[5]|0,Lt=se&8191,Et=se>>>13,de=g[6]|0,Pt=de&8191,Mt=de>>>13,K=g[7]|0,Y=K&8191,V=K>>>13,U=g[8]|0,W=U&8191,et=U>>>13,dt=g[9]|0,ut=dt&8191,ht=dt>>>13;f.negative=o.negative^a.negative,f.length=19,y=Math.imul(Z,J),u=Math.imul(Z,X),u=u+Math.imul(F,J)|0,b=Math.imul(F,X);var zt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(zt>>>26)|0,zt&=67108863,y=Math.imul(it,J),u=Math.imul(it,X),u=u+Math.imul(at,J)|0,b=Math.imul(at,X),y=y+Math.imul(Z,N)|0,u=u+Math.imul(Z,$)|0,u=u+Math.imul(F,N)|0,b=b+Math.imul(F,$)|0;var Wt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,y=Math.imul(yt,J),u=Math.imul(yt,X),u=u+Math.imul(pt,J)|0,b=Math.imul(pt,X),y=y+Math.imul(it,N)|0,u=u+Math.imul(it,$)|0,u=u+Math.imul(at,N)|0,b=b+Math.imul(at,$)|0,y=y+Math.imul(Z,ft)|0,u=u+Math.imul(Z,mt)|0,u=u+Math.imul(F,ft)|0,b=b+Math.imul(F,mt)|0;var ye=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ye>>>26)|0,ye&=67108863,y=Math.imul(lt,J),u=Math.imul(lt,X),u=u+Math.imul(ct,J)|0,b=Math.imul(ct,X),y=y+Math.imul(yt,N)|0,u=u+Math.imul(yt,$)|0,u=u+Math.imul(pt,N)|0,b=b+Math.imul(pt,$)|0,y=y+Math.imul(it,ft)|0,u=u+Math.imul(it,mt)|0,u=u+Math.imul(at,ft)|0,b=b+Math.imul(at,mt)|0,y=y+Math.imul(Z,At)|0,u=u+Math.imul(Z,_t)|0,u=u+Math.imul(F,At)|0,b=b+Math.imul(F,_t)|0;var Yt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,y=Math.imul(kt,J),u=Math.imul(kt,X),u=u+Math.imul(k,J)|0,b=Math.imul(k,X),y=y+Math.imul(lt,N)|0,u=u+Math.imul(lt,$)|0,u=u+Math.imul(ct,N)|0,b=b+Math.imul(ct,$)|0,y=y+Math.imul(yt,ft)|0,u=u+Math.imul(yt,mt)|0,u=u+Math.imul(pt,ft)|0,b=b+Math.imul(pt,mt)|0,y=y+Math.imul(it,At)|0,u=u+Math.imul(it,_t)|0,u=u+Math.imul(at,At)|0,b=b+Math.imul(at,_t)|0,y=y+Math.imul(Z,Rt)|0,u=u+Math.imul(Z,wt)|0,u=u+Math.imul(F,Rt)|0,b=b+Math.imul(F,wt)|0;var pe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(pe>>>26)|0,pe&=67108863,y=Math.imul(L,J),u=Math.imul(L,X),u=u+Math.imul(j,J)|0,b=Math.imul(j,X),y=y+Math.imul(kt,N)|0,u=u+Math.imul(kt,$)|0,u=u+Math.imul(k,N)|0,b=b+Math.imul(k,$)|0,y=y+Math.imul(lt,ft)|0,u=u+Math.imul(lt,mt)|0,u=u+Math.imul(ct,ft)|0,b=b+Math.imul(ct,mt)|0,y=y+Math.imul(yt,At)|0,u=u+Math.imul(yt,_t)|0,u=u+Math.imul(pt,At)|0,b=b+Math.imul(pt,_t)|0,y=y+Math.imul(it,Rt)|0,u=u+Math.imul(it,wt)|0,u=u+Math.imul(at,Rt)|0,b=b+Math.imul(at,wt)|0,y=y+Math.imul(Z,Lt)|0,u=u+Math.imul(Z,Et)|0,u=u+Math.imul(F,Lt)|0,b=b+Math.imul(F,Et)|0;var ve=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ve>>>26)|0,ve&=67108863,y=Math.imul(Q,J),u=Math.imul(Q,X),u=u+Math.imul(ot,J)|0,b=Math.imul(ot,X),y=y+Math.imul(L,N)|0,u=u+Math.imul(L,$)|0,u=u+Math.imul(j,N)|0,b=b+Math.imul(j,$)|0,y=y+Math.imul(kt,ft)|0,u=u+Math.imul(kt,mt)|0,u=u+Math.imul(k,ft)|0,b=b+Math.imul(k,mt)|0,y=y+Math.imul(lt,At)|0,u=u+Math.imul(lt,_t)|0,u=u+Math.imul(ct,At)|0,b=b+Math.imul(ct,_t)|0,y=y+Math.imul(yt,Rt)|0,u=u+Math.imul(yt,wt)|0,u=u+Math.imul(pt,Rt)|0,b=b+Math.imul(pt,wt)|0,y=y+Math.imul(it,Lt)|0,u=u+Math.imul(it,Et)|0,u=u+Math.imul(at,Lt)|0,b=b+Math.imul(at,Et)|0,y=y+Math.imul(Z,Pt)|0,u=u+Math.imul(Z,Mt)|0,u=u+Math.imul(F,Pt)|0,b=b+Math.imul(F,Mt)|0;var ge=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ge>>>26)|0,ge&=67108863,y=Math.imul(It,J),u=Math.imul(It,X),u=u+Math.imul(xt,J)|0,b=Math.imul(xt,X),y=y+Math.imul(Q,N)|0,u=u+Math.imul(Q,$)|0,u=u+Math.imul(ot,N)|0,b=b+Math.imul(ot,$)|0,y=y+Math.imul(L,ft)|0,u=u+Math.imul(L,mt)|0,u=u+Math.imul(j,ft)|0,b=b+Math.imul(j,mt)|0,y=y+Math.imul(kt,At)|0,u=u+Math.imul(kt,_t)|0,u=u+Math.imul(k,At)|0,b=b+Math.imul(k,_t)|0,y=y+Math.imul(lt,Rt)|0,u=u+Math.imul(lt,wt)|0,u=u+Math.imul(ct,Rt)|0,b=b+Math.imul(ct,wt)|0,y=y+Math.imul(yt,Lt)|0,u=u+Math.imul(yt,Et)|0,u=u+Math.imul(pt,Lt)|0,b=b+Math.imul(pt,Et)|0,y=y+Math.imul(it,Pt)|0,u=u+Math.imul(it,Mt)|0,u=u+Math.imul(at,Pt)|0,b=b+Math.imul(at,Mt)|0,y=y+Math.imul(Z,Y)|0,u=u+Math.imul(Z,V)|0,u=u+Math.imul(F,Y)|0,b=b+Math.imul(F,V)|0;var ie=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ie>>>26)|0,ie&=67108863,y=Math.imul(Ct,J),u=Math.imul(Ct,X),u=u+Math.imul(Dt,J)|0,b=Math.imul(Dt,X),y=y+Math.imul(It,N)|0,u=u+Math.imul(It,$)|0,u=u+Math.imul(xt,N)|0,b=b+Math.imul(xt,$)|0,y=y+Math.imul(Q,ft)|0,u=u+Math.imul(Q,mt)|0,u=u+Math.imul(ot,ft)|0,b=b+Math.imul(ot,mt)|0,y=y+Math.imul(L,At)|0,u=u+Math.imul(L,_t)|0,u=u+Math.imul(j,At)|0,b=b+Math.imul(j,_t)|0,y=y+Math.imul(kt,Rt)|0,u=u+Math.imul(kt,wt)|0,u=u+Math.imul(k,Rt)|0,b=b+Math.imul(k,wt)|0,y=y+Math.imul(lt,Lt)|0,u=u+Math.imul(lt,Et)|0,u=u+Math.imul(ct,Lt)|0,b=b+Math.imul(ct,Et)|0,y=y+Math.imul(yt,Pt)|0,u=u+Math.imul(yt,Mt)|0,u=u+Math.imul(pt,Pt)|0,b=b+Math.imul(pt,Mt)|0,y=y+Math.imul(it,Y)|0,u=u+Math.imul(it,V)|0,u=u+Math.imul(at,Y)|0,b=b+Math.imul(at,V)|0,y=y+Math.imul(Z,W)|0,u=u+Math.imul(Z,et)|0,u=u+Math.imul(F,W)|0,b=b+Math.imul(F,et)|0;var ue=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ue>>>26)|0,ue&=67108863,y=Math.imul(te,J),u=Math.imul(te,X),u=u+Math.imul(Ut,J)|0,b=Math.imul(Ut,X),y=y+Math.imul(Ct,N)|0,u=u+Math.imul(Ct,$)|0,u=u+Math.imul(Dt,N)|0,b=b+Math.imul(Dt,$)|0,y=y+Math.imul(It,ft)|0,u=u+Math.imul(It,mt)|0,u=u+Math.imul(xt,ft)|0,b=b+Math.imul(xt,mt)|0,y=y+Math.imul(Q,At)|0,u=u+Math.imul(Q,_t)|0,u=u+Math.imul(ot,At)|0,b=b+Math.imul(ot,_t)|0,y=y+Math.imul(L,Rt)|0,u=u+Math.imul(L,wt)|0,u=u+Math.imul(j,Rt)|0,b=b+Math.imul(j,wt)|0,y=y+Math.imul(kt,Lt)|0,u=u+Math.imul(kt,Et)|0,u=u+Math.imul(k,Lt)|0,b=b+Math.imul(k,Et)|0,y=y+Math.imul(lt,Pt)|0,u=u+Math.imul(lt,Mt)|0,u=u+Math.imul(ct,Pt)|0,b=b+Math.imul(ct,Mt)|0,y=y+Math.imul(yt,Y)|0,u=u+Math.imul(yt,V)|0,u=u+Math.imul(pt,Y)|0,b=b+Math.imul(pt,V)|0,y=y+Math.imul(it,W)|0,u=u+Math.imul(it,et)|0,u=u+Math.imul(at,W)|0,b=b+Math.imul(at,et)|0,y=y+Math.imul(Z,ut)|0,u=u+Math.imul(Z,ht)|0,u=u+Math.imul(F,ut)|0,b=b+Math.imul(F,ht)|0;var fe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(fe>>>26)|0,fe&=67108863,y=Math.imul(te,N),u=Math.imul(te,$),u=u+Math.imul(Ut,N)|0,b=Math.imul(Ut,$),y=y+Math.imul(Ct,ft)|0,u=u+Math.imul(Ct,mt)|0,u=u+Math.imul(Dt,ft)|0,b=b+Math.imul(Dt,mt)|0,y=y+Math.imul(It,At)|0,u=u+Math.imul(It,_t)|0,u=u+Math.imul(xt,At)|0,b=b+Math.imul(xt,_t)|0,y=y+Math.imul(Q,Rt)|0,u=u+Math.imul(Q,wt)|0,u=u+Math.imul(ot,Rt)|0,b=b+Math.imul(ot,wt)|0,y=y+Math.imul(L,Lt)|0,u=u+Math.imul(L,Et)|0,u=u+Math.imul(j,Lt)|0,b=b+Math.imul(j,Et)|0,y=y+Math.imul(kt,Pt)|0,u=u+Math.imul(kt,Mt)|0,u=u+Math.imul(k,Pt)|0,b=b+Math.imul(k,Mt)|0,y=y+Math.imul(lt,Y)|0,u=u+Math.imul(lt,V)|0,u=u+Math.imul(ct,Y)|0,b=b+Math.imul(ct,V)|0,y=y+Math.imul(yt,W)|0,u=u+Math.imul(yt,et)|0,u=u+Math.imul(pt,W)|0,b=b+Math.imul(pt,et)|0,y=y+Math.imul(it,ut)|0,u=u+Math.imul(it,ht)|0,u=u+Math.imul(at,ut)|0,b=b+Math.imul(at,ht)|0;var ce=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ce>>>26)|0,ce&=67108863,y=Math.imul(te,ft),u=Math.imul(te,mt),u=u+Math.imul(Ut,ft)|0,b=Math.imul(Ut,mt),y=y+Math.imul(Ct,At)|0,u=u+Math.imul(Ct,_t)|0,u=u+Math.imul(Dt,At)|0,b=b+Math.imul(Dt,_t)|0,y=y+Math.imul(It,Rt)|0,u=u+Math.imul(It,wt)|0,u=u+Math.imul(xt,Rt)|0,b=b+Math.imul(xt,wt)|0,y=y+Math.imul(Q,Lt)|0,u=u+Math.imul(Q,Et)|0,u=u+Math.imul(ot,Lt)|0,b=b+Math.imul(ot,Et)|0,y=y+Math.imul(L,Pt)|0,u=u+Math.imul(L,Mt)|0,u=u+Math.imul(j,Pt)|0,b=b+Math.imul(j,Mt)|0,y=y+Math.imul(kt,Y)|0,u=u+Math.imul(kt,V)|0,u=u+Math.imul(k,Y)|0,b=b+Math.imul(k,V)|0,y=y+Math.imul(lt,W)|0,u=u+Math.imul(lt,et)|0,u=u+Math.imul(ct,W)|0,b=b+Math.imul(ct,et)|0,y=y+Math.imul(yt,ut)|0,u=u+Math.imul(yt,ht)|0,u=u+Math.imul(pt,ut)|0,b=b+Math.imul(pt,ht)|0;var Kt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,y=Math.imul(te,At),u=Math.imul(te,_t),u=u+Math.imul(Ut,At)|0,b=Math.imul(Ut,_t),y=y+Math.imul(Ct,Rt)|0,u=u+Math.imul(Ct,wt)|0,u=u+Math.imul(Dt,Rt)|0,b=b+Math.imul(Dt,wt)|0,y=y+Math.imul(It,Lt)|0,u=u+Math.imul(It,Et)|0,u=u+Math.imul(xt,Lt)|0,b=b+Math.imul(xt,Et)|0,y=y+Math.imul(Q,Pt)|0,u=u+Math.imul(Q,Mt)|0,u=u+Math.imul(ot,Pt)|0,b=b+Math.imul(ot,Mt)|0,y=y+Math.imul(L,Y)|0,u=u+Math.imul(L,V)|0,u=u+Math.imul(j,Y)|0,b=b+Math.imul(j,V)|0,y=y+Math.imul(kt,W)|0,u=u+Math.imul(kt,et)|0,u=u+Math.imul(k,W)|0,b=b+Math.imul(k,et)|0,y=y+Math.imul(lt,ut)|0,u=u+Math.imul(lt,ht)|0,u=u+Math.imul(ct,ut)|0,b=b+Math.imul(ct,ht)|0;var oe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(oe>>>26)|0,oe&=67108863,y=Math.imul(te,Rt),u=Math.imul(te,wt),u=u+Math.imul(Ut,Rt)|0,b=Math.imul(Ut,wt),y=y+Math.imul(Ct,Lt)|0,u=u+Math.imul(Ct,Et)|0,u=u+Math.imul(Dt,Lt)|0,b=b+Math.imul(Dt,Et)|0,y=y+Math.imul(It,Pt)|0,u=u+Math.imul(It,Mt)|0,u=u+Math.imul(xt,Pt)|0,b=b+Math.imul(xt,Mt)|0,y=y+Math.imul(Q,Y)|0,u=u+Math.imul(Q,V)|0,u=u+Math.imul(ot,Y)|0,b=b+Math.imul(ot,V)|0,y=y+Math.imul(L,W)|0,u=u+Math.imul(L,et)|0,u=u+Math.imul(j,W)|0,b=b+Math.imul(j,et)|0,y=y+Math.imul(kt,ut)|0,u=u+Math.imul(kt,ht)|0,u=u+Math.imul(k,ut)|0,b=b+Math.imul(k,ht)|0;var Jt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,y=Math.imul(te,Lt),u=Math.imul(te,Et),u=u+Math.imul(Ut,Lt)|0,b=Math.imul(Ut,Et),y=y+Math.imul(Ct,Pt)|0,u=u+Math.imul(Ct,Mt)|0,u=u+Math.imul(Dt,Pt)|0,b=b+Math.imul(Dt,Mt)|0,y=y+Math.imul(It,Y)|0,u=u+Math.imul(It,V)|0,u=u+Math.imul(xt,Y)|0,b=b+Math.imul(xt,V)|0,y=y+Math.imul(Q,W)|0,u=u+Math.imul(Q,et)|0,u=u+Math.imul(ot,W)|0,b=b+Math.imul(ot,et)|0,y=y+Math.imul(L,ut)|0,u=u+Math.imul(L,ht)|0,u=u+Math.imul(j,ut)|0,b=b+Math.imul(j,ht)|0;var le=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(le>>>26)|0,le&=67108863,y=Math.imul(te,Pt),u=Math.imul(te,Mt),u=u+Math.imul(Ut,Pt)|0,b=Math.imul(Ut,Mt),y=y+Math.imul(Ct,Y)|0,u=u+Math.imul(Ct,V)|0,u=u+Math.imul(Dt,Y)|0,b=b+Math.imul(Dt,V)|0,y=y+Math.imul(It,W)|0,u=u+Math.imul(It,et)|0,u=u+Math.imul(xt,W)|0,b=b+Math.imul(xt,et)|0,y=y+Math.imul(Q,ut)|0,u=u+Math.imul(Q,ht)|0,u=u+Math.imul(ot,ut)|0,b=b+Math.imul(ot,ht)|0;var ae=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ae>>>26)|0,ae&=67108863,y=Math.imul(te,Y),u=Math.imul(te,V),u=u+Math.imul(Ut,Y)|0,b=Math.imul(Ut,V),y=y+Math.imul(Ct,W)|0,u=u+Math.imul(Ct,et)|0,u=u+Math.imul(Dt,W)|0,b=b+Math.imul(Dt,et)|0,y=y+Math.imul(It,ut)|0,u=u+Math.imul(It,ht)|0,u=u+Math.imul(xt,ut)|0,b=b+Math.imul(xt,ht)|0;var ne=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ne>>>26)|0,ne&=67108863,y=Math.imul(te,W),u=Math.imul(te,et),u=u+Math.imul(Ut,W)|0,b=Math.imul(Ut,et),y=y+Math.imul(Ct,ut)|0,u=u+Math.imul(Ct,ht)|0,u=u+Math.imul(Dt,ut)|0,b=b+Math.imul(Dt,ht)|0;var Ot=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,y=Math.imul(te,ut),u=Math.imul(te,ht),u=u+Math.imul(Ut,ut)|0,b=Math.imul(Ut,ht);var Nt=(I+y|0)+((u&8191)<<13)|0;return I=(b+(u>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,S[0]=zt,S[1]=Wt,S[2]=ye,S[3]=Yt,S[4]=pe,S[5]=ve,S[6]=ge,S[7]=ie,S[8]=ue,S[9]=fe,S[10]=ce,S[11]=Kt,S[12]=oe,S[13]=Jt,S[14]=le,S[15]=ae,S[16]=ne,S[17]=Ot,S[18]=Nt,I!==0&&(S[19]=I,f.length++),f};Math.imul||(A=x);function B(d,o,a){a.negative=o.negative^d.negative,a.length=d.length+o.length;for(var f=0,h=0,g=0;g>>26)|0,h+=S>>>26,S&=67108863}a.words[g]=I,f=S,S=h}return f!==0?a.words[g]=f:a.length--,a.strip()}function P(d,o,a){var f=new R;return f.mulp(d,o,a)}i.prototype.mulTo=function(o,a){var f,h=this.length+o.length;return this.length===10&&o.length===10?f=A(this,o,a):h<63?f=x(this,o,a):h<1024?f=B(this,o,a):f=P(this,o,a),f};function R(d,o){this.x=d,this.y=o}R.prototype.makeRBT=function(o){for(var a=new Array(o),f=i.prototype._countBits(o)-1,h=0;h>=1;return h},R.prototype.permute=function(o,a,f,h,g,S){for(var I=0;I>>1)g++;return 1<>>13,f[2*S+1]=g&8191,g=g>>>13;for(S=2*a;S>=26,a+=h/67108864|0,a+=g>>>26,this.words[f]=g&67108863}return a!==0&&(this.words[f]=a,this.length++),this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var a=w(o);if(a.length===0)return new i(1);for(var f=this,h=0;h=0);var a=o%26,f=(o-a)/26,h=67108863>>>26-a<<26-a,g;if(a!==0){var S=0;for(g=0;g>>26-a}S&&(this.words[g]=S,this.length++)}if(f!==0){for(g=this.length-1;g>=0;g--)this.words[g+f]=this.words[g];for(g=0;g=0);var h;a?h=(a-a%26)/26:h=0;var g=o%26,S=Math.min((o-g)/26,this.length),I=67108863^67108863>>>g<S)for(this.length-=S,u=0;u=0&&(b!==0||u>=h);u--){var D=this.words[u]|0;this.words[u]=b<<26-g|D>>>g,b=D&I}return y&&b!==0&&(y.words[y.length++]=b),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,a,f){return n(this.negative===0),this.iushrn(o,a,f)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var a=o%26,f=(o-a)/26,h=1<=0);var a=o%26,f=(o-a)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(a!==0&&f++,this.length=Math.min(f,this.length),a!==0){var h=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},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(y/67108864|0),this.words[g+f]=S&67108863}for(;g>26,this.words[g+f]=S&67108863;if(I===0)return this.strip();for(n(I===-1),I=0,g=0;g>26,this.words[g]=S&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,a){var f=this.length-o.length,h=this.clone(),g=o,S=g.words[g.length-1]|0,I=this._countBits(S);f=26-I,f!==0&&(g=g.ushln(f),h.iushln(f),S=g.words[g.length-1]|0);var y=h.length-g.length,u;if(a!=="mod"){u=new i(null),u.length=y+1,u.words=new Array(u.length);for(var b=0;b=0;Z--){var F=(h.words[g.length+Z]|0)*67108864+(h.words[g.length+Z-1]|0);for(F=Math.min(F/S|0,67108863),h._ishlnsubmul(g,F,Z);h.negative!==0;)F--,h.negative=0,h._ishlnsubmul(g,1,Z),h.isZero()||(h.negative^=1);u&&(u.words[Z]=F)}return u&&u.strip(),h.strip(),a!=="div"&&f!==0&&h.iushrn(f),{div:u||null,mod:h}},i.prototype.divmod=function(o,a,f){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,g,S;return this.negative!==0&&o.negative===0?(S=this.neg().divmod(o,a),a!=="mod"&&(h=S.div.neg()),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.iadd(o)),{div:h,mod:g}):this.negative===0&&o.negative!==0?(S=this.divmod(o.neg(),a),a!=="mod"&&(h=S.div.neg()),{div:h,mod:S.mod}):this.negative&o.negative?(S=this.neg().divmod(o.neg(),a),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.isub(o)),{div:S.div,mod:g}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?a==="div"?{div:this.divn(o.words[0]),mod:null}:a==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,a)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var a=this.divmod(o);if(a.mod.isZero())return a.div;var f=a.div.negative!==0?a.mod.isub(o):a.mod,h=o.ushrn(1),g=o.andln(1),S=f.cmp(h);return S<0||g===1&&S===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var a=(1<<26)%o,f=0,h=this.length-1;h>=0;h--)f=(a*f+(this.words[h]|0))%o;return f},i.prototype.idivn=function(o){n(o<=67108863);for(var a=0,f=this.length-1;f>=0;f--){var h=(this.words[f]|0)+a*67108864;this.words[f]=h/o|0,a=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=new i(0),I=new i(1),y=0;a.isEven()&&f.isEven();)a.iushrn(1),f.iushrn(1),++y;for(var u=f.clone(),b=a.clone();!a.isZero();){for(var D=0,Z=1;!(a.words[0]&Z)&&D<26;++D,Z<<=1);if(D>0)for(a.iushrn(D);D-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(u),g.isub(b)),h.iushrn(1),g.iushrn(1);for(var F=0,q=1;!(f.words[0]&q)&&F<26;++F,q<<=1);if(F>0)for(f.iushrn(F);F-- >0;)(S.isOdd()||I.isOdd())&&(S.iadd(u),I.isub(b)),S.iushrn(1),I.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(S),g.isub(I)):(f.isub(a),S.isub(h),I.isub(g))}return{a:S,b:I,gcd:f.iushln(y)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=f.clone();a.cmpn(1)>0&&f.cmpn(1)>0;){for(var I=0,y=1;!(a.words[0]&y)&&I<26;++I,y<<=1);if(I>0)for(a.iushrn(I);I-- >0;)h.isOdd()&&h.iadd(S),h.iushrn(1);for(var u=0,b=1;!(f.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(f.iushrn(u);u-- >0;)g.isOdd()&&g.iadd(S),g.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(g)):(f.isub(a),g.isub(h))}var D;return a.cmpn(1)===0?D=h:D=g,D.cmpn(0)<0&&D.iadd(o),D},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var a=this.clone(),f=o.clone();a.negative=0,f.negative=0;for(var h=0;a.isEven()&&f.isEven();h++)a.iushrn(1),f.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;f.isEven();)f.iushrn(1);var g=a.cmp(f);if(g<0){var S=a;a=f,f=S}else if(g===0||f.cmpn(1)===0)break;a.isub(f)}while(!0);return f.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var a=o%26,f=(o-a)/26,h=1<>>26,I&=67108863,this.words[S]=I}return g!==0&&(this.words[S]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var a=o<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this.strip();var f;if(this.length>1)f=1;else{a&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;f=h===o?0:ho.length)return 1;if(this.length=0;f--){var h=this.words[f]|0,g=o.words[f]|0;if(h!==g){hg&&(a=1);break}}return a},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new G(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var C={k256:null,p224:null,p192:null,p25519:null};function O(d,o){this.name=d,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},O.prototype.ireduce=function(o){var a=o,f;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),f=a.bitLength();while(f>this.n);var h=f0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},O.prototype.split=function(o,a){o.iushrn(this.n,0,a)},O.prototype.imulK=function(o){return o.imul(this.k)};function z(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(z,O),z.prototype.split=function(o,a){for(var f=4194303,h=Math.min(o.length,9),g=0;g>>22,S=I}S>>>=22,o.words[g-10]=S,S===0&&o.length>10?o.length-=10:o.length-=9},z.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var a=0,f=0;f>>=26,o.words[f]=g,a=h}return a!==0&&(o.words[o.length++]=a),o},i._prime=function(o){if(C[o])return C[o];var a;if(o==="k256")a=new z;else if(o==="p224")a=new H;else if(o==="p192")a=new tt;else if(o==="p25519")a=new nt;else throw new Error("Unknown prime "+o);return C[o]=a,a};function G(d){if(typeof d=="string"){var o=i._prime(d);this.m=o.p,this.prime=o}else n(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}G.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},G.prototype._verify2=function(o,a){n((o.negative|a.negative)===0,"red works only with positives"),n(o.red&&o.red===a.red,"red works only with red numbers")},G.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},G.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},G.prototype.add=function(o,a){this._verify2(o,a);var f=o.add(a);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},G.prototype.iadd=function(o,a){this._verify2(o,a);var f=o.iadd(a);return f.cmp(this.m)>=0&&f.isub(this.m),f},G.prototype.sub=function(o,a){this._verify2(o,a);var f=o.sub(a);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},G.prototype.isub=function(o,a){this._verify2(o,a);var f=o.isub(a);return f.cmpn(0)<0&&f.iadd(this.m),f},G.prototype.shl=function(o,a){return this._verify1(o),this.imod(o.ushln(a))},G.prototype.imul=function(o,a){return this._verify2(o,a),this.imod(o.imul(a))},G.prototype.mul=function(o,a){return this._verify2(o,a),this.imod(o.mul(a))},G.prototype.isqr=function(o){return this.imul(o,o.clone())},G.prototype.sqr=function(o){return this.mul(o,o)},G.prototype.sqrt=function(o){if(o.isZero())return o.clone();var a=this.m.andln(3);if(n(a%2===1),a===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(o,f)}for(var h=this.m.subn(1),g=0;!h.isZero()&&h.andln(1)===0;)g++,h.iushrn(1);n(!h.isZero());var S=new i(1).toRed(this),I=S.redNeg(),y=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,y).cmp(I)!==0;)u.redIAdd(I);for(var b=this.pow(u,h),D=this.pow(o,h.addn(1).iushrn(1)),Z=this.pow(o,h),F=g;Z.cmp(S)!==0;){for(var q=Z,it=0;q.cmp(S)!==0;it++)q=q.redSqr();n(it=0;g--){for(var b=a.words[g],D=u-1;D>=0;D--){var Z=b>>D&1;if(S!==h[0]&&(S=this.sqr(S)),Z===0&&I===0){y=0;continue}I<<=1,I|=Z,y++,!(y!==f&&(g!==0||D!==0))&&(S=this.mul(S,h[I]),y=0,I=0)}u=26}return S},G.prototype.convertTo=function(o){var a=o.umod(this.m);return a===o?a.clone():a},G.prototype.convertFrom=function(o){var a=o.clone();return a.red=null,a},i.mont=function(o){return new M(o)};function M(d){G.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(M,G),M.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},M.prototype.convertFrom=function(o){var a=this.imod(o.mul(this.rinv));return a.red=null,a},M.prototype.imul=function(o,a){if(o.isZero()||a.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.mul=function(o,a){if(o.isZero()||a.isZero())return new i(0)._forceRed(this);var f=o.mul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.invm=function(o){var a=this.imod(o._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(r,Re)}(q0)),q0.exports}var Jh={exports:{}},gw;function sg(){if(gw)return Jh.exports;gw=1;var r;Jh.exports=function(s){return r||(r=new t(null)),r.generate(s)};function t(n){this.rand=n}if(Jh.exports.Rand=t,t.prototype.generate=function(s){return this._rand(s)},t.prototype._rand=function(s){if(this.rand.getBytes)return this.rand.getBytes(s);for(var i=new Uint8Array(s),c=0;c=0);return l},e.prototype._randrange=function(s,i){var c=i.sub(s);return s.add(this._randbelow(c))},e.prototype.test=function(s,i,c){var l=s.bitLength(),p=r.mont(s),m=new r(1).toRed(p);i||(i=Math.max(1,l/48|0));for(var v=s.subn(1),_=0;!v.testn(_);_++);for(var E=s.shrn(_),w=v.toRed(p),x=!0;i>0;i--){var A=this._randrange(new r(2),v);c&&c(A);var B=A.toRed(p).redPow(E);if(!(B.cmp(m)===0||B.cmp(w)===0)){for(var P=1;P<_;P++){if(B=B.redSqr(),B.cmp(m)===0)return!1;if(B.cmp(w)===0)break}if(P===_)return!1}}return x},e.prototype.getDivisor=function(s,i){var c=s.bitLength(),l=r.mont(s),p=new r(1).toRed(l);i||(i=Math.max(1,c/48|0));for(var m=s.subn(1),v=0;!m.testn(v);v++);for(var _=s.shrn(v),E=m.toRed(l);i>0;i--){var w=this._randrange(new r(2),m),x=s.gcd(w);if(x.cmpn(1)!==0)return x;var A=w.toRed(l).redPow(_);if(!(A.cmp(p)===0||A.cmp(E)===0)){for(var B=1;BP;)C.ishrn(1);if(C.isEven()&&C.iadd(i),C.testn(1)||C.iadd(c),R.cmp(c)){if(!R.cmp(l))for(;C.mod(p).cmp(m);)C.iadd(_)}else for(;C.mod(e).cmp(v);)C.iadd(_);if(O=C.shrn(1),x(O)&&x(C)&&A(O)&&A(C)&&s.test(O)&&s.test(C))return C}}return v1}const iP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},oP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},sP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},aP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},uP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},fP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},cP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},hP={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},lP={modp1:iP,modp2:oP,modp5:sP,modp14:aP,modp15:uP,modp16:fP,modp17:cP,modp18:hP};var g1,ww;function dP(){if(ww)return g1;ww=1;var r=M_(),t=E_(),e=new t,n=new r(24),s=new r(11),i=new r(10),c=new r(3),l=new r(7),p=A_(),m=bf;g1=x;function v(B,P){return P=P||"utf8",Zt.Buffer.isBuffer(B)||(B=new Zt.Buffer(B,P)),this._pub=new r(B),this}function _(B,P){return P=P||"utf8",Zt.Buffer.isBuffer(B)||(B=new Zt.Buffer(B,P)),this._priv=new r(B),this}var E={};function w(B,P){var R=P.toString("hex"),C=[R,B.toString(16)].join("_");if(C in E)return E[C];var O=0;if(B.isEven()||!p.simpleSieve||!p.fermatTest(B)||!e.test(B))return O+=1,R==="02"||R==="05"?O+=8:O+=4,E[C]=O,O;e.test(B.shrn(1))||(O+=2);var z;switch(R){case"02":B.mod(n).cmp(s)&&(O+=8);break;case"05":z=B.mod(i),z.cmp(c)&&z.cmp(l)&&(O+=8);break;default:O+=4}return E[C]=O,O}function x(B,P,R){this.setGenerator(P),this.__prime=new r(B),this._prime=r.mont(this.__prime),this._primeLen=B.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,R?(this.setPublicKey=v,this.setPrivateKey=_):this._primeCode=8}Object.defineProperty(x.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=w(this.__prime,this.__gen)),this._primeCode}}),x.prototype.generateKeys=function(){return this._priv||(this._priv=new r(m(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},x.prototype.computeSecret=function(B){B=new r(B),B=B.toRed(this._prime);var P=B.redPow(this._priv).fromRed(),R=new Zt.Buffer(P.toArray()),C=this.getPrime();if(R.length=0||!l.umod(i.prime1)||!l.umod(i.prime2));return l}function s(i,c){var l=e(c),p=c.modulus.byteLength(),m=new r(i).mul(l.blinder).umod(c.modulus),v=m.toRed(r.mont(c.prime1)),_=m.toRed(r.mont(c.prime2)),E=c.coefficient,w=c.prime1,x=c.prime2,A=v.redPow(c.exponent1).fromRed(),B=_.redPow(c.exponent2).fromRed(),P=A.isub(B).imul(E).umod(w).imul(x);return B.iadd(P).imul(l.unblinder).umod(c.modulus).toArrayLike(Zt.Buffer,"be",p)}return s.getr=n,y1=s,y1}var b1={};const mP="elliptic",vP="6.5.4",gP="EC cryptography",yP="lib/elliptic.js",bP=["lib"],wP={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/"},xP={type:"git",url:"git@github.com:indutny/elliptic"},_P=["EC","Elliptic","curve","Cryptography"],MP="Fedor Indutny ",EP="MIT",AP={url:"https://github.com/indutny/elliptic/issues"},SP="https://github.com/indutny/elliptic",kP={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"},IP={"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"},BP={name:mP,version:vP,description:gP,main:yP,files:bP,scripts:wP,repository:xP,keywords:_P,author:MP,license:EP,bugs:AP,homepage:SP,devDependencies:kP,dependencies:IP};var w1={},F0={exports:{}};F0.exports;var Mw;function Is(){return Mw||(Mw=1,function(r){(function(t,e){function n(d,o){if(!d)throw new Error(o||"Assertion failed")}function s(d,o){d.super_=o;var a=function(){};a.prototype=o.prototype,d.prototype=new a,d.prototype.constructor=d}function i(d,o,a){if(i.isBN(d))return d;this.negative=0,this.words=null,this.length=0,this.red=null,d!==null&&((o==="le"||o==="be")&&(a=o,o=10),this._init(d||0,o||10,a||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=yr.Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,a){return o.cmp(a)>0?o:a},i.min=function(o,a){return o.cmp(a)<0?o:a},i.prototype._init=function(o,a,f){if(typeof o=="number")return this._initNumber(o,a,f);if(typeof o=="object")return this._initArray(o,a,f);a==="hex"&&(a=16),n(a===(a|0)&&a>=2&&a<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h=0;h-=3)S=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[g]|=S<>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);else if(f==="le")for(h=0,g=0;h>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);return this.strip()};function l(d,o){var a=d.charCodeAt(o);return a>=65&&a<=70?a-55:a>=97&&a<=102?a-87:a-48&15}function p(d,o,a){var f=l(d,a);return a-1>=o&&(f|=l(d,a-1)<<4),f}i.prototype._parseHex=function(o,a,f){this.length=Math.ceil((o.length-a)/6),this.words=new Array(this.length);for(var h=0;h=a;h-=2)I=p(o,a,h)<=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8;else{var y=o.length-a;for(h=y%2===0?a+1:a;h=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8}this.strip()};function m(d,o,a,f){for(var h=0,g=Math.min(d.length,a),S=o;S=49?h+=I-49+10:I>=17?h+=I-17+10:h+=I}return h}i.prototype._parseBase=function(o,a,f){this.words=[0],this.length=1;for(var h=0,g=1;g<=67108863;g*=a)h++;h--,g=g/a|0;for(var S=o.length-f,I=S%h,y=Math.min(S,S-I)+f,u=0,b=f;b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var v=["","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"],_=[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],E=[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];i.prototype.toString=function(o,a){o=o||10,a=a|0||1;var f;if(o===16||o==="hex"){f="";for(var h=0,g=0,S=0;S>>24-h&16777215,g!==0||S!==this.length-1?f=v[6-y.length]+y+f:f=y+f,h+=2,h>=26&&(h-=26,S--)}for(g!==0&&(f=g.toString(16)+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var u=_[o],b=E[o];f="";var D=this.clone();for(D.negative=0;!D.isZero();){var Z=D.modn(b).toString(o);D=D.idivn(b),D.isZero()?f=Z+f:f=v[u-Z.length]+Z+f}for(this.isZero()&&(f="0"+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,a){return n(typeof c<"u"),this.toArrayLike(c,o,a)},i.prototype.toArray=function(o,a){return this.toArrayLike(Array,o,a)},i.prototype.toArrayLike=function(o,a,f){var h=this.byteLength(),g=f||Math.max(1,h);n(h<=g,"byte array longer than desired length"),n(g>0,"Requested array length <= 0"),this.strip();var S=a==="le",I=new o(g),y,u,b=this.clone();if(S){for(u=0;!b.isZero();u++)y=b.andln(255),b.iushrn(8),I[u]=y;for(;u=4096&&(f+=13,a>>>=13),a>=64&&(f+=7,a>>>=7),a>=8&&(f+=4,a>>>=4),a>=2&&(f+=2,a>>>=2),f+a},i.prototype._zeroBits=function(o){if(o===0)return 26;var a=o,f=0;return a&8191||(f+=13,a>>>=13),a&127||(f+=7,a>>>=7),a&15||(f+=4,a>>>=4),a&3||(f+=2,a>>>=2),a&1||f++,f},i.prototype.bitLength=function(){var o=this.words[this.length-1],a=this._countBits(o);return(this.length-1)*26+a};function w(d){for(var o=new Array(d.bitLength()),a=0;a>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,a=0;ao.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var a;this.length>o.length?a=o:a=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var a,f;this.length>o.length?(a=this,f=o):(a=o,f=this);for(var h=0;ho.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var a=Math.ceil(o/26)|0,f=o%26;this._expand(a),f>0&&a--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-f),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,a){n(typeof o=="number"&&o>=0);var f=o/26|0,h=o%26;return this._expand(f+1),a?this.words[f]=this.words[f]|1<o.length?(f=this,h=o):(f=o,h=this);for(var g=0,S=0;S>>26;for(;g!==0&&S>>26;if(this.length=f.length,g!==0)this.words[this.length]=g,this.length++;else if(f!==this)for(;So.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var a=this.iadd(o);return o.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,g;f>0?(h=this,g=o):(h=o,g=this);for(var S=0,I=0;I>26,this.words[I]=a&67108863;for(;S!==0&&I>26,this.words[I]=a&67108863;if(S===0&&I>>26,D=y&67108863,Z=Math.min(u,o.length-1),F=Math.max(0,u-d.length+1);F<=Z;F++){var q=u-F|0;h=d.words[q]|0,g=o.words[F]|0,S=h*g+D,b+=S/67108864|0,D=S&67108863}a.words[u]=D|0,y=b|0}return y!==0?a.words[u]=y|0:a.length--,a.strip()}var A=function(o,a,f){var h=o.words,g=a.words,S=f.words,I=0,y,u,b,D=h[0]|0,Z=D&8191,F=D>>>13,q=h[1]|0,it=q&8191,at=q>>>13,Bt=h[2]|0,yt=Bt&8191,pt=Bt>>>13,Ft=h[3]|0,lt=Ft&8191,ct=Ft>>>13,Tt=h[4]|0,kt=Tt&8191,k=Tt>>>13,T=h[5]|0,L=T&8191,j=T>>>13,rt=h[6]|0,Q=rt&8191,ot=rt>>>13,qt=h[7]|0,It=qt&8191,xt=qt>>>13,Qt=h[8]|0,Ct=Qt&8191,Dt=Qt>>>13,Se=h[9]|0,te=Se&8191,Ut=Se>>>13,Te=g[0]|0,J=Te&8191,X=Te>>>13,st=g[1]|0,N=st&8191,$=st>>>13,gt=g[2]|0,ft=gt&8191,mt=gt>>>13,vt=g[3]|0,At=vt&8191,_t=vt>>>13,Gt=g[4]|0,Rt=Gt&8191,wt=Gt>>>13,se=g[5]|0,Lt=se&8191,Et=se>>>13,de=g[6]|0,Pt=de&8191,Mt=de>>>13,K=g[7]|0,Y=K&8191,V=K>>>13,U=g[8]|0,W=U&8191,et=U>>>13,dt=g[9]|0,ut=dt&8191,ht=dt>>>13;f.negative=o.negative^a.negative,f.length=19,y=Math.imul(Z,J),u=Math.imul(Z,X),u=u+Math.imul(F,J)|0,b=Math.imul(F,X);var zt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(zt>>>26)|0,zt&=67108863,y=Math.imul(it,J),u=Math.imul(it,X),u=u+Math.imul(at,J)|0,b=Math.imul(at,X),y=y+Math.imul(Z,N)|0,u=u+Math.imul(Z,$)|0,u=u+Math.imul(F,N)|0,b=b+Math.imul(F,$)|0;var Wt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,y=Math.imul(yt,J),u=Math.imul(yt,X),u=u+Math.imul(pt,J)|0,b=Math.imul(pt,X),y=y+Math.imul(it,N)|0,u=u+Math.imul(it,$)|0,u=u+Math.imul(at,N)|0,b=b+Math.imul(at,$)|0,y=y+Math.imul(Z,ft)|0,u=u+Math.imul(Z,mt)|0,u=u+Math.imul(F,ft)|0,b=b+Math.imul(F,mt)|0;var ye=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ye>>>26)|0,ye&=67108863,y=Math.imul(lt,J),u=Math.imul(lt,X),u=u+Math.imul(ct,J)|0,b=Math.imul(ct,X),y=y+Math.imul(yt,N)|0,u=u+Math.imul(yt,$)|0,u=u+Math.imul(pt,N)|0,b=b+Math.imul(pt,$)|0,y=y+Math.imul(it,ft)|0,u=u+Math.imul(it,mt)|0,u=u+Math.imul(at,ft)|0,b=b+Math.imul(at,mt)|0,y=y+Math.imul(Z,At)|0,u=u+Math.imul(Z,_t)|0,u=u+Math.imul(F,At)|0,b=b+Math.imul(F,_t)|0;var Yt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,y=Math.imul(kt,J),u=Math.imul(kt,X),u=u+Math.imul(k,J)|0,b=Math.imul(k,X),y=y+Math.imul(lt,N)|0,u=u+Math.imul(lt,$)|0,u=u+Math.imul(ct,N)|0,b=b+Math.imul(ct,$)|0,y=y+Math.imul(yt,ft)|0,u=u+Math.imul(yt,mt)|0,u=u+Math.imul(pt,ft)|0,b=b+Math.imul(pt,mt)|0,y=y+Math.imul(it,At)|0,u=u+Math.imul(it,_t)|0,u=u+Math.imul(at,At)|0,b=b+Math.imul(at,_t)|0,y=y+Math.imul(Z,Rt)|0,u=u+Math.imul(Z,wt)|0,u=u+Math.imul(F,Rt)|0,b=b+Math.imul(F,wt)|0;var pe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(pe>>>26)|0,pe&=67108863,y=Math.imul(L,J),u=Math.imul(L,X),u=u+Math.imul(j,J)|0,b=Math.imul(j,X),y=y+Math.imul(kt,N)|0,u=u+Math.imul(kt,$)|0,u=u+Math.imul(k,N)|0,b=b+Math.imul(k,$)|0,y=y+Math.imul(lt,ft)|0,u=u+Math.imul(lt,mt)|0,u=u+Math.imul(ct,ft)|0,b=b+Math.imul(ct,mt)|0,y=y+Math.imul(yt,At)|0,u=u+Math.imul(yt,_t)|0,u=u+Math.imul(pt,At)|0,b=b+Math.imul(pt,_t)|0,y=y+Math.imul(it,Rt)|0,u=u+Math.imul(it,wt)|0,u=u+Math.imul(at,Rt)|0,b=b+Math.imul(at,wt)|0,y=y+Math.imul(Z,Lt)|0,u=u+Math.imul(Z,Et)|0,u=u+Math.imul(F,Lt)|0,b=b+Math.imul(F,Et)|0;var ve=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ve>>>26)|0,ve&=67108863,y=Math.imul(Q,J),u=Math.imul(Q,X),u=u+Math.imul(ot,J)|0,b=Math.imul(ot,X),y=y+Math.imul(L,N)|0,u=u+Math.imul(L,$)|0,u=u+Math.imul(j,N)|0,b=b+Math.imul(j,$)|0,y=y+Math.imul(kt,ft)|0,u=u+Math.imul(kt,mt)|0,u=u+Math.imul(k,ft)|0,b=b+Math.imul(k,mt)|0,y=y+Math.imul(lt,At)|0,u=u+Math.imul(lt,_t)|0,u=u+Math.imul(ct,At)|0,b=b+Math.imul(ct,_t)|0,y=y+Math.imul(yt,Rt)|0,u=u+Math.imul(yt,wt)|0,u=u+Math.imul(pt,Rt)|0,b=b+Math.imul(pt,wt)|0,y=y+Math.imul(it,Lt)|0,u=u+Math.imul(it,Et)|0,u=u+Math.imul(at,Lt)|0,b=b+Math.imul(at,Et)|0,y=y+Math.imul(Z,Pt)|0,u=u+Math.imul(Z,Mt)|0,u=u+Math.imul(F,Pt)|0,b=b+Math.imul(F,Mt)|0;var ge=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ge>>>26)|0,ge&=67108863,y=Math.imul(It,J),u=Math.imul(It,X),u=u+Math.imul(xt,J)|0,b=Math.imul(xt,X),y=y+Math.imul(Q,N)|0,u=u+Math.imul(Q,$)|0,u=u+Math.imul(ot,N)|0,b=b+Math.imul(ot,$)|0,y=y+Math.imul(L,ft)|0,u=u+Math.imul(L,mt)|0,u=u+Math.imul(j,ft)|0,b=b+Math.imul(j,mt)|0,y=y+Math.imul(kt,At)|0,u=u+Math.imul(kt,_t)|0,u=u+Math.imul(k,At)|0,b=b+Math.imul(k,_t)|0,y=y+Math.imul(lt,Rt)|0,u=u+Math.imul(lt,wt)|0,u=u+Math.imul(ct,Rt)|0,b=b+Math.imul(ct,wt)|0,y=y+Math.imul(yt,Lt)|0,u=u+Math.imul(yt,Et)|0,u=u+Math.imul(pt,Lt)|0,b=b+Math.imul(pt,Et)|0,y=y+Math.imul(it,Pt)|0,u=u+Math.imul(it,Mt)|0,u=u+Math.imul(at,Pt)|0,b=b+Math.imul(at,Mt)|0,y=y+Math.imul(Z,Y)|0,u=u+Math.imul(Z,V)|0,u=u+Math.imul(F,Y)|0,b=b+Math.imul(F,V)|0;var ie=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ie>>>26)|0,ie&=67108863,y=Math.imul(Ct,J),u=Math.imul(Ct,X),u=u+Math.imul(Dt,J)|0,b=Math.imul(Dt,X),y=y+Math.imul(It,N)|0,u=u+Math.imul(It,$)|0,u=u+Math.imul(xt,N)|0,b=b+Math.imul(xt,$)|0,y=y+Math.imul(Q,ft)|0,u=u+Math.imul(Q,mt)|0,u=u+Math.imul(ot,ft)|0,b=b+Math.imul(ot,mt)|0,y=y+Math.imul(L,At)|0,u=u+Math.imul(L,_t)|0,u=u+Math.imul(j,At)|0,b=b+Math.imul(j,_t)|0,y=y+Math.imul(kt,Rt)|0,u=u+Math.imul(kt,wt)|0,u=u+Math.imul(k,Rt)|0,b=b+Math.imul(k,wt)|0,y=y+Math.imul(lt,Lt)|0,u=u+Math.imul(lt,Et)|0,u=u+Math.imul(ct,Lt)|0,b=b+Math.imul(ct,Et)|0,y=y+Math.imul(yt,Pt)|0,u=u+Math.imul(yt,Mt)|0,u=u+Math.imul(pt,Pt)|0,b=b+Math.imul(pt,Mt)|0,y=y+Math.imul(it,Y)|0,u=u+Math.imul(it,V)|0,u=u+Math.imul(at,Y)|0,b=b+Math.imul(at,V)|0,y=y+Math.imul(Z,W)|0,u=u+Math.imul(Z,et)|0,u=u+Math.imul(F,W)|0,b=b+Math.imul(F,et)|0;var ue=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ue>>>26)|0,ue&=67108863,y=Math.imul(te,J),u=Math.imul(te,X),u=u+Math.imul(Ut,J)|0,b=Math.imul(Ut,X),y=y+Math.imul(Ct,N)|0,u=u+Math.imul(Ct,$)|0,u=u+Math.imul(Dt,N)|0,b=b+Math.imul(Dt,$)|0,y=y+Math.imul(It,ft)|0,u=u+Math.imul(It,mt)|0,u=u+Math.imul(xt,ft)|0,b=b+Math.imul(xt,mt)|0,y=y+Math.imul(Q,At)|0,u=u+Math.imul(Q,_t)|0,u=u+Math.imul(ot,At)|0,b=b+Math.imul(ot,_t)|0,y=y+Math.imul(L,Rt)|0,u=u+Math.imul(L,wt)|0,u=u+Math.imul(j,Rt)|0,b=b+Math.imul(j,wt)|0,y=y+Math.imul(kt,Lt)|0,u=u+Math.imul(kt,Et)|0,u=u+Math.imul(k,Lt)|0,b=b+Math.imul(k,Et)|0,y=y+Math.imul(lt,Pt)|0,u=u+Math.imul(lt,Mt)|0,u=u+Math.imul(ct,Pt)|0,b=b+Math.imul(ct,Mt)|0,y=y+Math.imul(yt,Y)|0,u=u+Math.imul(yt,V)|0,u=u+Math.imul(pt,Y)|0,b=b+Math.imul(pt,V)|0,y=y+Math.imul(it,W)|0,u=u+Math.imul(it,et)|0,u=u+Math.imul(at,W)|0,b=b+Math.imul(at,et)|0,y=y+Math.imul(Z,ut)|0,u=u+Math.imul(Z,ht)|0,u=u+Math.imul(F,ut)|0,b=b+Math.imul(F,ht)|0;var fe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(fe>>>26)|0,fe&=67108863,y=Math.imul(te,N),u=Math.imul(te,$),u=u+Math.imul(Ut,N)|0,b=Math.imul(Ut,$),y=y+Math.imul(Ct,ft)|0,u=u+Math.imul(Ct,mt)|0,u=u+Math.imul(Dt,ft)|0,b=b+Math.imul(Dt,mt)|0,y=y+Math.imul(It,At)|0,u=u+Math.imul(It,_t)|0,u=u+Math.imul(xt,At)|0,b=b+Math.imul(xt,_t)|0,y=y+Math.imul(Q,Rt)|0,u=u+Math.imul(Q,wt)|0,u=u+Math.imul(ot,Rt)|0,b=b+Math.imul(ot,wt)|0,y=y+Math.imul(L,Lt)|0,u=u+Math.imul(L,Et)|0,u=u+Math.imul(j,Lt)|0,b=b+Math.imul(j,Et)|0,y=y+Math.imul(kt,Pt)|0,u=u+Math.imul(kt,Mt)|0,u=u+Math.imul(k,Pt)|0,b=b+Math.imul(k,Mt)|0,y=y+Math.imul(lt,Y)|0,u=u+Math.imul(lt,V)|0,u=u+Math.imul(ct,Y)|0,b=b+Math.imul(ct,V)|0,y=y+Math.imul(yt,W)|0,u=u+Math.imul(yt,et)|0,u=u+Math.imul(pt,W)|0,b=b+Math.imul(pt,et)|0,y=y+Math.imul(it,ut)|0,u=u+Math.imul(it,ht)|0,u=u+Math.imul(at,ut)|0,b=b+Math.imul(at,ht)|0;var ce=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ce>>>26)|0,ce&=67108863,y=Math.imul(te,ft),u=Math.imul(te,mt),u=u+Math.imul(Ut,ft)|0,b=Math.imul(Ut,mt),y=y+Math.imul(Ct,At)|0,u=u+Math.imul(Ct,_t)|0,u=u+Math.imul(Dt,At)|0,b=b+Math.imul(Dt,_t)|0,y=y+Math.imul(It,Rt)|0,u=u+Math.imul(It,wt)|0,u=u+Math.imul(xt,Rt)|0,b=b+Math.imul(xt,wt)|0,y=y+Math.imul(Q,Lt)|0,u=u+Math.imul(Q,Et)|0,u=u+Math.imul(ot,Lt)|0,b=b+Math.imul(ot,Et)|0,y=y+Math.imul(L,Pt)|0,u=u+Math.imul(L,Mt)|0,u=u+Math.imul(j,Pt)|0,b=b+Math.imul(j,Mt)|0,y=y+Math.imul(kt,Y)|0,u=u+Math.imul(kt,V)|0,u=u+Math.imul(k,Y)|0,b=b+Math.imul(k,V)|0,y=y+Math.imul(lt,W)|0,u=u+Math.imul(lt,et)|0,u=u+Math.imul(ct,W)|0,b=b+Math.imul(ct,et)|0,y=y+Math.imul(yt,ut)|0,u=u+Math.imul(yt,ht)|0,u=u+Math.imul(pt,ut)|0,b=b+Math.imul(pt,ht)|0;var Kt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,y=Math.imul(te,At),u=Math.imul(te,_t),u=u+Math.imul(Ut,At)|0,b=Math.imul(Ut,_t),y=y+Math.imul(Ct,Rt)|0,u=u+Math.imul(Ct,wt)|0,u=u+Math.imul(Dt,Rt)|0,b=b+Math.imul(Dt,wt)|0,y=y+Math.imul(It,Lt)|0,u=u+Math.imul(It,Et)|0,u=u+Math.imul(xt,Lt)|0,b=b+Math.imul(xt,Et)|0,y=y+Math.imul(Q,Pt)|0,u=u+Math.imul(Q,Mt)|0,u=u+Math.imul(ot,Pt)|0,b=b+Math.imul(ot,Mt)|0,y=y+Math.imul(L,Y)|0,u=u+Math.imul(L,V)|0,u=u+Math.imul(j,Y)|0,b=b+Math.imul(j,V)|0,y=y+Math.imul(kt,W)|0,u=u+Math.imul(kt,et)|0,u=u+Math.imul(k,W)|0,b=b+Math.imul(k,et)|0,y=y+Math.imul(lt,ut)|0,u=u+Math.imul(lt,ht)|0,u=u+Math.imul(ct,ut)|0,b=b+Math.imul(ct,ht)|0;var oe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(oe>>>26)|0,oe&=67108863,y=Math.imul(te,Rt),u=Math.imul(te,wt),u=u+Math.imul(Ut,Rt)|0,b=Math.imul(Ut,wt),y=y+Math.imul(Ct,Lt)|0,u=u+Math.imul(Ct,Et)|0,u=u+Math.imul(Dt,Lt)|0,b=b+Math.imul(Dt,Et)|0,y=y+Math.imul(It,Pt)|0,u=u+Math.imul(It,Mt)|0,u=u+Math.imul(xt,Pt)|0,b=b+Math.imul(xt,Mt)|0,y=y+Math.imul(Q,Y)|0,u=u+Math.imul(Q,V)|0,u=u+Math.imul(ot,Y)|0,b=b+Math.imul(ot,V)|0,y=y+Math.imul(L,W)|0,u=u+Math.imul(L,et)|0,u=u+Math.imul(j,W)|0,b=b+Math.imul(j,et)|0,y=y+Math.imul(kt,ut)|0,u=u+Math.imul(kt,ht)|0,u=u+Math.imul(k,ut)|0,b=b+Math.imul(k,ht)|0;var Jt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,y=Math.imul(te,Lt),u=Math.imul(te,Et),u=u+Math.imul(Ut,Lt)|0,b=Math.imul(Ut,Et),y=y+Math.imul(Ct,Pt)|0,u=u+Math.imul(Ct,Mt)|0,u=u+Math.imul(Dt,Pt)|0,b=b+Math.imul(Dt,Mt)|0,y=y+Math.imul(It,Y)|0,u=u+Math.imul(It,V)|0,u=u+Math.imul(xt,Y)|0,b=b+Math.imul(xt,V)|0,y=y+Math.imul(Q,W)|0,u=u+Math.imul(Q,et)|0,u=u+Math.imul(ot,W)|0,b=b+Math.imul(ot,et)|0,y=y+Math.imul(L,ut)|0,u=u+Math.imul(L,ht)|0,u=u+Math.imul(j,ut)|0,b=b+Math.imul(j,ht)|0;var le=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(le>>>26)|0,le&=67108863,y=Math.imul(te,Pt),u=Math.imul(te,Mt),u=u+Math.imul(Ut,Pt)|0,b=Math.imul(Ut,Mt),y=y+Math.imul(Ct,Y)|0,u=u+Math.imul(Ct,V)|0,u=u+Math.imul(Dt,Y)|0,b=b+Math.imul(Dt,V)|0,y=y+Math.imul(It,W)|0,u=u+Math.imul(It,et)|0,u=u+Math.imul(xt,W)|0,b=b+Math.imul(xt,et)|0,y=y+Math.imul(Q,ut)|0,u=u+Math.imul(Q,ht)|0,u=u+Math.imul(ot,ut)|0,b=b+Math.imul(ot,ht)|0;var ae=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ae>>>26)|0,ae&=67108863,y=Math.imul(te,Y),u=Math.imul(te,V),u=u+Math.imul(Ut,Y)|0,b=Math.imul(Ut,V),y=y+Math.imul(Ct,W)|0,u=u+Math.imul(Ct,et)|0,u=u+Math.imul(Dt,W)|0,b=b+Math.imul(Dt,et)|0,y=y+Math.imul(It,ut)|0,u=u+Math.imul(It,ht)|0,u=u+Math.imul(xt,ut)|0,b=b+Math.imul(xt,ht)|0;var ne=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ne>>>26)|0,ne&=67108863,y=Math.imul(te,W),u=Math.imul(te,et),u=u+Math.imul(Ut,W)|0,b=Math.imul(Ut,et),y=y+Math.imul(Ct,ut)|0,u=u+Math.imul(Ct,ht)|0,u=u+Math.imul(Dt,ut)|0,b=b+Math.imul(Dt,ht)|0;var Ot=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,y=Math.imul(te,ut),u=Math.imul(te,ht),u=u+Math.imul(Ut,ut)|0,b=Math.imul(Ut,ht);var Nt=(I+y|0)+((u&8191)<<13)|0;return I=(b+(u>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,S[0]=zt,S[1]=Wt,S[2]=ye,S[3]=Yt,S[4]=pe,S[5]=ve,S[6]=ge,S[7]=ie,S[8]=ue,S[9]=fe,S[10]=ce,S[11]=Kt,S[12]=oe,S[13]=Jt,S[14]=le,S[15]=ae,S[16]=ne,S[17]=Ot,S[18]=Nt,I!==0&&(S[19]=I,f.length++),f};Math.imul||(A=x);function B(d,o,a){a.negative=o.negative^d.negative,a.length=d.length+o.length;for(var f=0,h=0,g=0;g>>26)|0,h+=S>>>26,S&=67108863}a.words[g]=I,f=S,S=h}return f!==0?a.words[g]=f:a.length--,a.strip()}function P(d,o,a){var f=new R;return f.mulp(d,o,a)}i.prototype.mulTo=function(o,a){var f,h=this.length+o.length;return this.length===10&&o.length===10?f=A(this,o,a):h<63?f=x(this,o,a):h<1024?f=B(this,o,a):f=P(this,o,a),f};function R(d,o){this.x=d,this.y=o}R.prototype.makeRBT=function(o){for(var a=new Array(o),f=i.prototype._countBits(o)-1,h=0;h>=1;return h},R.prototype.permute=function(o,a,f,h,g,S){for(var I=0;I>>1)g++;return 1<>>13,f[2*S+1]=g&8191,g=g>>>13;for(S=2*a;S>=26,a+=h/67108864|0,a+=g>>>26,this.words[f]=g&67108863}return a!==0&&(this.words[f]=a,this.length++),this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var a=w(o);if(a.length===0)return new i(1);for(var f=this,h=0;h=0);var a=o%26,f=(o-a)/26,h=67108863>>>26-a<<26-a,g;if(a!==0){var S=0;for(g=0;g>>26-a}S&&(this.words[g]=S,this.length++)}if(f!==0){for(g=this.length-1;g>=0;g--)this.words[g+f]=this.words[g];for(g=0;g=0);var h;a?h=(a-a%26)/26:h=0;var g=o%26,S=Math.min((o-g)/26,this.length),I=67108863^67108863>>>g<S)for(this.length-=S,u=0;u=0&&(b!==0||u>=h);u--){var D=this.words[u]|0;this.words[u]=b<<26-g|D>>>g,b=D&I}return y&&b!==0&&(y.words[y.length++]=b),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,a,f){return n(this.negative===0),this.iushrn(o,a,f)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var a=o%26,f=(o-a)/26,h=1<=0);var a=o%26,f=(o-a)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(a!==0&&f++,this.length=Math.min(f,this.length),a!==0){var h=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},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(y/67108864|0),this.words[g+f]=S&67108863}for(;g>26,this.words[g+f]=S&67108863;if(I===0)return this.strip();for(n(I===-1),I=0,g=0;g>26,this.words[g]=S&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,a){var f=this.length-o.length,h=this.clone(),g=o,S=g.words[g.length-1]|0,I=this._countBits(S);f=26-I,f!==0&&(g=g.ushln(f),h.iushln(f),S=g.words[g.length-1]|0);var y=h.length-g.length,u;if(a!=="mod"){u=new i(null),u.length=y+1,u.words=new Array(u.length);for(var b=0;b=0;Z--){var F=(h.words[g.length+Z]|0)*67108864+(h.words[g.length+Z-1]|0);for(F=Math.min(F/S|0,67108863),h._ishlnsubmul(g,F,Z);h.negative!==0;)F--,h.negative=0,h._ishlnsubmul(g,1,Z),h.isZero()||(h.negative^=1);u&&(u.words[Z]=F)}return u&&u.strip(),h.strip(),a!=="div"&&f!==0&&h.iushrn(f),{div:u||null,mod:h}},i.prototype.divmod=function(o,a,f){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,g,S;return this.negative!==0&&o.negative===0?(S=this.neg().divmod(o,a),a!=="mod"&&(h=S.div.neg()),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.iadd(o)),{div:h,mod:g}):this.negative===0&&o.negative!==0?(S=this.divmod(o.neg(),a),a!=="mod"&&(h=S.div.neg()),{div:h,mod:S.mod}):this.negative&o.negative?(S=this.neg().divmod(o.neg(),a),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.isub(o)),{div:S.div,mod:g}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?a==="div"?{div:this.divn(o.words[0]),mod:null}:a==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,a)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var a=this.divmod(o);if(a.mod.isZero())return a.div;var f=a.div.negative!==0?a.mod.isub(o):a.mod,h=o.ushrn(1),g=o.andln(1),S=f.cmp(h);return S<0||g===1&&S===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var a=(1<<26)%o,f=0,h=this.length-1;h>=0;h--)f=(a*f+(this.words[h]|0))%o;return f},i.prototype.idivn=function(o){n(o<=67108863);for(var a=0,f=this.length-1;f>=0;f--){var h=(this.words[f]|0)+a*67108864;this.words[f]=h/o|0,a=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=new i(0),I=new i(1),y=0;a.isEven()&&f.isEven();)a.iushrn(1),f.iushrn(1),++y;for(var u=f.clone(),b=a.clone();!a.isZero();){for(var D=0,Z=1;!(a.words[0]&Z)&&D<26;++D,Z<<=1);if(D>0)for(a.iushrn(D);D-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(u),g.isub(b)),h.iushrn(1),g.iushrn(1);for(var F=0,q=1;!(f.words[0]&q)&&F<26;++F,q<<=1);if(F>0)for(f.iushrn(F);F-- >0;)(S.isOdd()||I.isOdd())&&(S.iadd(u),I.isub(b)),S.iushrn(1),I.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(S),g.isub(I)):(f.isub(a),S.isub(h),I.isub(g))}return{a:S,b:I,gcd:f.iushln(y)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=f.clone();a.cmpn(1)>0&&f.cmpn(1)>0;){for(var I=0,y=1;!(a.words[0]&y)&&I<26;++I,y<<=1);if(I>0)for(a.iushrn(I);I-- >0;)h.isOdd()&&h.iadd(S),h.iushrn(1);for(var u=0,b=1;!(f.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(f.iushrn(u);u-- >0;)g.isOdd()&&g.iadd(S),g.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(g)):(f.isub(a),g.isub(h))}var D;return a.cmpn(1)===0?D=h:D=g,D.cmpn(0)<0&&D.iadd(o),D},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var a=this.clone(),f=o.clone();a.negative=0,f.negative=0;for(var h=0;a.isEven()&&f.isEven();h++)a.iushrn(1),f.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;f.isEven();)f.iushrn(1);var g=a.cmp(f);if(g<0){var S=a;a=f,f=S}else if(g===0||f.cmpn(1)===0)break;a.isub(f)}while(!0);return f.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var a=o%26,f=(o-a)/26,h=1<>>26,I&=67108863,this.words[S]=I}return g!==0&&(this.words[S]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var a=o<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this.strip();var f;if(this.length>1)f=1;else{a&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;f=h===o?0:ho.length)return 1;if(this.length=0;f--){var h=this.words[f]|0,g=o.words[f]|0;if(h!==g){hg&&(a=1);break}}return a},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new G(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var C={k256:null,p224:null,p192:null,p25519:null};function O(d,o){this.name=d,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},O.prototype.ireduce=function(o){var a=o,f;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),f=a.bitLength();while(f>this.n);var h=f0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},O.prototype.split=function(o,a){o.iushrn(this.n,0,a)},O.prototype.imulK=function(o){return o.imul(this.k)};function z(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(z,O),z.prototype.split=function(o,a){for(var f=4194303,h=Math.min(o.length,9),g=0;g>>22,S=I}S>>>=22,o.words[g-10]=S,S===0&&o.length>10?o.length-=10:o.length-=9},z.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var a=0,f=0;f>>=26,o.words[f]=g,a=h}return a!==0&&(o.words[o.length++]=a),o},i._prime=function(o){if(C[o])return C[o];var a;if(o==="k256")a=new z;else if(o==="p224")a=new H;else if(o==="p192")a=new tt;else if(o==="p25519")a=new nt;else throw new Error("Unknown prime "+o);return C[o]=a,a};function G(d){if(typeof d=="string"){var o=i._prime(d);this.m=o.p,this.prime=o}else n(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}G.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},G.prototype._verify2=function(o,a){n((o.negative|a.negative)===0,"red works only with positives"),n(o.red&&o.red===a.red,"red works only with red numbers")},G.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},G.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},G.prototype.add=function(o,a){this._verify2(o,a);var f=o.add(a);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},G.prototype.iadd=function(o,a){this._verify2(o,a);var f=o.iadd(a);return f.cmp(this.m)>=0&&f.isub(this.m),f},G.prototype.sub=function(o,a){this._verify2(o,a);var f=o.sub(a);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},G.prototype.isub=function(o,a){this._verify2(o,a);var f=o.isub(a);return f.cmpn(0)<0&&f.iadd(this.m),f},G.prototype.shl=function(o,a){return this._verify1(o),this.imod(o.ushln(a))},G.prototype.imul=function(o,a){return this._verify2(o,a),this.imod(o.imul(a))},G.prototype.mul=function(o,a){return this._verify2(o,a),this.imod(o.mul(a))},G.prototype.isqr=function(o){return this.imul(o,o.clone())},G.prototype.sqr=function(o){return this.mul(o,o)},G.prototype.sqrt=function(o){if(o.isZero())return o.clone();var a=this.m.andln(3);if(n(a%2===1),a===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(o,f)}for(var h=this.m.subn(1),g=0;!h.isZero()&&h.andln(1)===0;)g++,h.iushrn(1);n(!h.isZero());var S=new i(1).toRed(this),I=S.redNeg(),y=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,y).cmp(I)!==0;)u.redIAdd(I);for(var b=this.pow(u,h),D=this.pow(o,h.addn(1).iushrn(1)),Z=this.pow(o,h),F=g;Z.cmp(S)!==0;){for(var q=Z,it=0;q.cmp(S)!==0;it++)q=q.redSqr();n(it=0;g--){for(var b=a.words[g],D=u-1;D>=0;D--){var Z=b>>D&1;if(S!==h[0]&&(S=this.sqr(S)),Z===0&&I===0){y=0;continue}I<<=1,I|=Z,y++,!(y!==f&&(g!==0||D!==0))&&(S=this.mul(S,h[I]),y=0,I=0)}u=26}return S},G.prototype.convertTo=function(o){var a=o.umod(this.m);return a===o?a.clone():a},G.prototype.convertFrom=function(o){var a=o.clone();return a.red=null,a},i.mont=function(o){return new M(o)};function M(d){G.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(M,G),M.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},M.prototype.convertFrom=function(o){var a=this.imod(o.mul(this.rinv));return a.red=null,a},M.prototype.imul=function(o,a){if(o.isZero()||a.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.mul=function(o,a){if(o.isZero()||a.isZero())return new i(0)._forceRed(this);var f=o.mul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.invm=function(o){var a=this.imod(o._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(r,Re)}(F0)),F0.exports}var x1={},Ew;function S_(){return Ew||(Ew=1,function(r){var t=r;function e(i,c){if(Array.isArray(i))return i.slice();if(!i)return[];var l=[];if(typeof i!="string"){for(var p=0;p>8,_=m&255;v?l.push(v,_):l.push(_)}return l}t.toArray=e;function n(i){return i.length===1?"0"+i:i}t.zero2=n;function s(i){for(var c="",l=0;l(x>>1)-1?P=(x>>1)-R:P=R,A.isubn(P)):P=0,w[B]=P,A.iushrn(1)}return w}t.getNAF=i;function c(v,_){var E=[[],[]];v=v.clone(),_=_.clone();for(var w=0,x=0,A;v.cmpn(-w)>0||_.cmpn(-x)>0;){var B=v.andln(3)+w&3,P=_.andln(3)+x&3;B===3&&(B=-1),P===3&&(P=-1);var R;B&1?(A=v.andln(7)+w&7,(A===3||A===5)&&P===2?R=-B:R=B):R=0,E[0].push(R);var C;P&1?(A=_.andln(7)+x&7,(A===3||A===5)&&B===2?C=-P:C=P):C=0,E[1].push(C),2*w===R+1&&(w=1-w),2*x===C+1&&(x=1-x),v.iushrn(1),_.iushrn(1)}return E}t.getJSF=c;function l(v,_,E){var w="_"+_;v.prototype[_]=function(){return this[w]!==void 0?this[w]:this[w]=E.call(this)}}t.cachedProperty=l;function p(v){return typeof v=="string"?t.toArray(v,"hex"):v}t.parseBytes=p;function m(v){return new e(v,"hex","le")}t.intFromLE=m}(w1)),w1}var _1={},M1,Sw;function nd(){if(Sw)return M1;Sw=1;var r=Is(),t=Wi(),e=t.getNAF,n=t.getJSF,s=t.assert;function i(l,p){this.type=l,this.p=new r(p.p,16),this.red=p.prime?r.red(p.prime):r.mont(this.p),this.zero=new r(0).toRed(this.red),this.one=new r(1).toRed(this.red),this.two=new r(2).toRed(this.red),this.n=p.n&&new r(p.n,16),this.g=p.g&&this.pointFromJSON(p.g,p.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 m=this.n&&this.p.div(this.n);!m||m.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}M1=i,i.prototype.point=function(){throw new Error("Not implemented")},i.prototype.validate=function(){throw new Error("Not implemented")},i.prototype._fixedNafMul=function(p,m){s(p.precomputed);var v=p._getDoubles(),_=e(m,1,this._bitLength),E=(1<=x;B--)A=(A<<1)+_[B];w.push(A)}for(var P=this.jpoint(null,null,null),R=this.jpoint(null,null,null),C=E;C>0;C--){for(x=0;x=0;A--){for(var B=0;A>=0&&w[A]===0;A--)B++;if(A>=0&&B++,x=x.dblp(B),A<0)break;var P=w[A];s(P!==0),p.type==="affine"?P>0?x=x.mixedAdd(E[P-1>>1]):x=x.mixedAdd(E[-P-1>>1].neg()):P>0?x=x.add(E[P-1>>1]):x=x.add(E[-P-1>>1].neg())}return p.type==="affine"?x.toP():x},i.prototype._wnafMulAdd=function(p,m,v,_,E){var w=this._wnafT1,x=this._wnafT2,A=this._wnafT3,B=0,P,R,C;for(P=0;P<_;P++){C=m[P];var O=C._getNAFPoints(p);w[P]=O.wnd,x[P]=O.points}for(P=_-1;P>=1;P-=2){var z=P-1,H=P;if(w[z]!==1||w[H]!==1){A[z]=e(v[z],w[z],this._bitLength),A[H]=e(v[H],w[H],this._bitLength),B=Math.max(A[z].length,B),B=Math.max(A[H].length,B);continue}var tt=[m[z],null,null,m[H]];m[z].y.cmp(m[H].y)===0?(tt[1]=m[z].add(m[H]),tt[2]=m[z].toJ().mixedAdd(m[H].neg())):m[z].y.cmp(m[H].y.redNeg())===0?(tt[1]=m[z].toJ().mixedAdd(m[H]),tt[2]=m[z].add(m[H].neg())):(tt[1]=m[z].toJ().mixedAdd(m[H]),tt[2]=m[z].toJ().mixedAdd(m[H].neg()));var nt=[-3,-1,-5,-7,0,7,5,1,3],G=n(v[z],v[H]);for(B=Math.max(G[0].length,B),A[z]=new Array(B),A[H]=new Array(B),R=0;R=0;P--){for(var f=0;P>=0;){var h=!0;for(R=0;R<_;R++)a[R]=A[R][P]|0,a[R]!==0&&(h=!1);if(!h)break;f++,P--}if(P>=0&&f++,o=o.dblp(f),P<0)break;for(R=0;R<_;R++){var g=a[R];g!==0&&(g>0?C=x[R][g-1>>1]:g<0&&(C=x[R][-g-1>>1].neg()),C.type==="affine"?o=o.mixedAdd(C):o=o.add(C))}}for(P=0;P<_;P++)x[P]=null;return E?o:o.toP()};function c(l,p){this.curve=l,this.type=p,this.precomputed=null}return i.BasePoint=c,c.prototype.eq=function(){throw new Error("Not implemented")},c.prototype.validate=function(){return this.curve.validate(this)},i.prototype.decodePoint=function(p,m){p=t.toArray(p,m);var v=this.p.byteLength();if((p[0]===4||p[0]===6||p[0]===7)&&p.length-1===2*v){p[0]===6?s(p[p.length-1]%2===0):p[0]===7&&s(p[p.length-1]%2===1);var _=this.point(p.slice(1,1+v),p.slice(1+v,1+2*v));return _}else if((p[0]===2||p[0]===3)&&p.length-1===v)return this.pointFromX(p.slice(1,1+v),p[0]===3);throw new Error("Unknown point format")},c.prototype.encodeCompressed=function(p){return this.encode(p,!0)},c.prototype._encode=function(p){var m=this.curve.p.byteLength(),v=this.getX().toArray("be",m);return p?[this.getY().isEven()?2:3].concat(v):[4].concat(v,this.getY().toArray("be",m))},c.prototype.encode=function(p,m){return t.encode(this._encode(m),p)},c.prototype.precompute=function(p){if(this.precomputed)return this;var m={doubles:null,naf:null,beta:null};return m.naf=this._getNAFPoints(8),m.doubles=this._getDoubles(4,p),m.beta=this._getBeta(),this.precomputed=m,this},c.prototype._hasDoubles=function(p){if(!this.precomputed)return!1;var m=this.precomputed.doubles;return m?m.points.length>=Math.ceil((p.bitLength()+1)/m.step):!1},c.prototype._getDoubles=function(p,m){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var v=[this],_=this,E=0;E=0&&(z=P,H=R),C.negative&&(C=C.neg(),O=O.neg()),z.negative&&(z=z.neg(),H=H.neg()),[{a:C,b:O},{a:z,b:H}]},i.prototype._endoSplit=function(m){var v=this.endo.basis,_=v[0],E=v[1],w=E.b.mul(m).divRound(this.n),x=_.b.neg().mul(m).divRound(this.n),A=w.mul(_.a),B=x.mul(E.a),P=w.mul(_.b),R=x.mul(E.b),C=m.sub(A).sub(B),O=P.add(R).neg();return{k1:C,k2:O}},i.prototype.pointFromX=function(m,v){m=new t(m,16),m.red||(m=m.toRed(this.red));var _=m.redSqr().redMul(m).redIAdd(m.redMul(this.a)).redIAdd(this.b),E=_.redSqrt();if(E.redSqr().redSub(_).cmp(this.zero)!==0)throw new Error("invalid point");var w=E.fromRed().isOdd();return(v&&!w||!v&&w)&&(E=E.redNeg()),this.point(m,E)},i.prototype.validate=function(m){if(m.inf)return!0;var v=m.x,_=m.y,E=this.a.redMul(v),w=v.redSqr().redMul(v).redIAdd(E).redIAdd(this.b);return _.redSqr().redISub(w).cmpn(0)===0},i.prototype._endoWnafMulAdd=function(m,v,_){for(var E=this._endoWnafT1,w=this._endoWnafT2,x=0;x":""},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(m){if(this.inf)return m;if(m.inf)return this;if(this.eq(m))return this.dbl();if(this.neg().eq(m))return this.curve.point(null,null);if(this.x.cmp(m.x)===0)return this.curve.point(null,null);var v=this.y.redSub(m.y);v.cmpn(0)!==0&&(v=v.redMul(this.x.redSub(m.x).redInvm()));var _=v.redSqr().redISub(this.x).redISub(m.x),E=v.redMul(this.x.redSub(_)).redISub(this.y);return this.curve.point(_,E)},c.prototype.dbl=function(){if(this.inf)return this;var m=this.y.redAdd(this.y);if(m.cmpn(0)===0)return this.curve.point(null,null);var v=this.curve.a,_=this.x.redSqr(),E=m.redInvm(),w=_.redAdd(_).redIAdd(_).redIAdd(v).redMul(E),x=w.redSqr().redISub(this.x.redAdd(this.x)),A=w.redMul(this.x.redSub(x)).redISub(this.y);return this.curve.point(x,A)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(m){return m=new t(m,16),this.isInfinity()?this:this._hasDoubles(m)?this.curve._fixedNafMul(this,m):this.curve.endo?this.curve._endoWnafMulAdd([this],[m]):this.curve._wnafMul(this,m)},c.prototype.mulAdd=function(m,v,_){var E=[this,v],w=[m,_];return this.curve.endo?this.curve._endoWnafMulAdd(E,w):this.curve._wnafMulAdd(1,E,w,2)},c.prototype.jmulAdd=function(m,v,_){var E=[this,v],w=[m,_];return this.curve.endo?this.curve._endoWnafMulAdd(E,w,!0):this.curve._wnafMulAdd(1,E,w,2,!0)},c.prototype.eq=function(m){return this===m||this.inf===m.inf&&(this.inf||this.x.cmp(m.x)===0&&this.y.cmp(m.y)===0)},c.prototype.neg=function(m){if(this.inf)return this;var v=this.curve.point(this.x,this.y.redNeg());if(m&&this.precomputed){var _=this.precomputed,E=function(w){return w.neg()};v.precomputed={naf:_.naf&&{wnd:_.naf.wnd,points:_.naf.points.map(E)},doubles:_.doubles&&{step:_.doubles.step,points:_.doubles.points.map(E)}}}return v},c.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var m=this.curve.jpoint(this.x,this.y,this.curve.one);return m};function l(p,m,v,_){n.BasePoint.call(this,p,"jacobian"),m===null&&v===null&&_===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new t(0)):(this.x=new t(m,16),this.y=new t(v,16),this.z=new t(_,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}return e(l,n.BasePoint),i.prototype.jpoint=function(m,v,_){return new l(this,m,v,_)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var m=this.z.redInvm(),v=m.redSqr(),_=this.x.redMul(v),E=this.y.redMul(v).redMul(m);return this.curve.point(_,E)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(m){if(this.isInfinity())return m;if(m.isInfinity())return this;var v=m.z.redSqr(),_=this.z.redSqr(),E=this.x.redMul(v),w=m.x.redMul(_),x=this.y.redMul(v.redMul(m.z)),A=m.y.redMul(_.redMul(this.z)),B=E.redSub(w),P=x.redSub(A);if(B.cmpn(0)===0)return P.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var R=B.redSqr(),C=R.redMul(B),O=E.redMul(R),z=P.redSqr().redIAdd(C).redISub(O).redISub(O),H=P.redMul(O.redISub(z)).redISub(x.redMul(C)),tt=this.z.redMul(m.z).redMul(B);return this.curve.jpoint(z,H,tt)},l.prototype.mixedAdd=function(m){if(this.isInfinity())return m.toJ();if(m.isInfinity())return this;var v=this.z.redSqr(),_=this.x,E=m.x.redMul(v),w=this.y,x=m.y.redMul(v).redMul(this.z),A=_.redSub(E),B=w.redSub(x);if(A.cmpn(0)===0)return B.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var P=A.redSqr(),R=P.redMul(A),C=_.redMul(P),O=B.redSqr().redIAdd(R).redISub(C).redISub(C),z=B.redMul(C.redISub(O)).redISub(w.redMul(R)),H=this.z.redMul(A);return this.curve.jpoint(O,z,H)},l.prototype.dblp=function(m){if(m===0)return this;if(this.isInfinity())return this;if(!m)return this.dbl();var v;if(this.curve.zeroA||this.curve.threeA){var _=this;for(v=0;v=0)return!1;if(_.redIAdd(w),this.x.cmp(_)===0)return!0}},l.prototype.inspect=function(){return this.isInfinity()?"":""},l.prototype.isInfinity=function(){return this.z.cmpn(0)===0},E1}var A1,Iw;function RP(){if(Iw)return A1;Iw=1;var r=Is(),t=br,e=nd(),n=Wi();function s(c){e.call(this,"mont",c),this.a=new r(c.a,16).toRed(this.red),this.b=new r(c.b,16).toRed(this.red),this.i4=new r(4).toRed(this.red).redInvm(),this.two=new r(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}t(s,e),A1=s,s.prototype.validate=function(l){var p=l.normalize().x,m=p.redSqr(),v=m.redMul(p).redAdd(m.redMul(this.a)).redAdd(p),_=v.redSqrt();return _.redSqr().cmp(v)===0};function i(c,l,p){e.BasePoint.call(this,c,"projective"),l===null&&p===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new r(l,16),this.z=new r(p,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}return t(i,e.BasePoint),s.prototype.decodePoint=function(l,p){return this.point(n.toArray(l,p),1)},s.prototype.point=function(l,p){return new i(this,l,p)},s.prototype.pointFromJSON=function(l){return i.fromJSON(this,l)},i.prototype.precompute=function(){},i.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},i.fromJSON=function(l,p){return new i(l,p[0],p[1]||l.one)},i.prototype.inspect=function(){return this.isInfinity()?"":""},i.prototype.isInfinity=function(){return this.z.cmpn(0)===0},i.prototype.dbl=function(){var l=this.x.redAdd(this.z),p=l.redSqr(),m=this.x.redSub(this.z),v=m.redSqr(),_=p.redSub(v),E=p.redMul(v),w=_.redMul(v.redAdd(this.curve.a24.redMul(_)));return this.curve.point(E,w)},i.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.diffAdd=function(l,p){var m=this.x.redAdd(this.z),v=this.x.redSub(this.z),_=l.x.redAdd(l.z),E=l.x.redSub(l.z),w=E.redMul(m),x=_.redMul(v),A=p.z.redMul(w.redAdd(x).redSqr()),B=p.x.redMul(w.redISub(x).redSqr());return this.curve.point(A,B)},i.prototype.mul=function(l){for(var p=l.clone(),m=this,v=this.curve.point(null,null),_=this,E=[];p.cmpn(0)!==0;p.iushrn(1))E.push(p.andln(1));for(var w=E.length-1;w>=0;w--)E[w]===0?(m=m.diffAdd(v,_),v=v.dbl()):(v=m.diffAdd(v,_),m=m.dbl());return v},i.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},i.prototype.eq=function(l){return this.getX().cmp(l.getX())===0},i.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},i.prototype.getX=function(){return this.normalize(),this.x.fromRed()},A1}var S1,Bw;function CP(){if(Bw)return S1;Bw=1;var r=Wi(),t=Is(),e=br,n=nd(),s=r.assert;function i(l){this.twisted=(l.a|0)!==1,this.mOneA=this.twisted&&(l.a|0)===-1,this.extended=this.mOneA,n.call(this,"edwards",l),this.a=new t(l.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new t(l.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new t(l.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),s(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(l.c|0)===1}e(i,n),S1=i,i.prototype._mulA=function(p){return this.mOneA?p.redNeg():this.a.redMul(p)},i.prototype._mulC=function(p){return this.oneC?p:this.c.redMul(p)},i.prototype.jpoint=function(p,m,v,_){return this.point(p,m,v,_)},i.prototype.pointFromX=function(p,m){p=new t(p,16),p.red||(p=p.toRed(this.red));var v=p.redSqr(),_=this.c2.redSub(this.a.redMul(v)),E=this.one.redSub(this.c2.redMul(this.d).redMul(v)),w=_.redMul(E.redInvm()),x=w.redSqrt();if(x.redSqr().redSub(w).cmp(this.zero)!==0)throw new Error("invalid point");var A=x.fromRed().isOdd();return(m&&!A||!m&&A)&&(x=x.redNeg()),this.point(p,x)},i.prototype.pointFromY=function(p,m){p=new t(p,16),p.red||(p=p.toRed(this.red));var v=p.redSqr(),_=v.redSub(this.c2),E=v.redMul(this.d).redMul(this.c2).redSub(this.a),w=_.redMul(E.redInvm());if(w.cmp(this.zero)===0){if(m)throw new Error("invalid point");return this.point(this.zero,p)}var x=w.redSqrt();if(x.redSqr().redSub(w).cmp(this.zero)!==0)throw new Error("invalid point");return x.fromRed().isOdd()!==m&&(x=x.redNeg()),this.point(x,p)},i.prototype.validate=function(p){if(p.isInfinity())return!0;p.normalize();var m=p.x.redSqr(),v=p.y.redSqr(),_=m.redMul(this.a).redAdd(v),E=this.c2.redMul(this.one.redAdd(this.d.redMul(m).redMul(v)));return _.cmp(E)===0};function c(l,p,m,v,_){n.BasePoint.call(this,l,"projective"),p===null&&m===null&&v===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 t(p,16),this.y=new t(m,16),this.z=v?new t(v,16):this.curve.one,this.t=_&&new t(_,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()))))}return e(c,n.BasePoint),i.prototype.pointFromJSON=function(p){return c.fromJSON(this,p)},i.prototype.point=function(p,m,v,_){return new c(this,p,m,v,_)},c.fromJSON=function(p,m){return new c(p,m[0],m[1],m[2])},c.prototype.inspect=function(){return this.isInfinity()?"":""},c.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},c.prototype._extDbl=function(){var p=this.x.redSqr(),m=this.y.redSqr(),v=this.z.redSqr();v=v.redIAdd(v);var _=this.curve._mulA(p),E=this.x.redAdd(this.y).redSqr().redISub(p).redISub(m),w=_.redAdd(m),x=w.redSub(v),A=_.redSub(m),B=E.redMul(x),P=w.redMul(A),R=E.redMul(A),C=x.redMul(w);return this.curve.point(B,P,C,R)},c.prototype._projDbl=function(){var p=this.x.redAdd(this.y).redSqr(),m=this.x.redSqr(),v=this.y.redSqr(),_,E,w,x,A,B;if(this.curve.twisted){x=this.curve._mulA(m);var P=x.redAdd(v);this.zOne?(_=p.redSub(m).redSub(v).redMul(P.redSub(this.curve.two)),E=P.redMul(x.redSub(v)),w=P.redSqr().redSub(P).redSub(P)):(A=this.z.redSqr(),B=P.redSub(A).redISub(A),_=p.redSub(m).redISub(v).redMul(B),E=P.redMul(x.redSub(v)),w=P.redMul(B))}else x=m.redAdd(v),A=this.curve._mulC(this.z).redSqr(),B=x.redSub(A).redSub(A),_=this.curve._mulC(p.redISub(x)).redMul(B),E=this.curve._mulC(x).redMul(m.redISub(v)),w=x.redMul(B);return this.curve.point(_,E,w)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(p){var m=this.y.redSub(this.x).redMul(p.y.redSub(p.x)),v=this.y.redAdd(this.x).redMul(p.y.redAdd(p.x)),_=this.t.redMul(this.curve.dd).redMul(p.t),E=this.z.redMul(p.z.redAdd(p.z)),w=v.redSub(m),x=E.redSub(_),A=E.redAdd(_),B=v.redAdd(m),P=w.redMul(x),R=A.redMul(B),C=w.redMul(B),O=x.redMul(A);return this.curve.point(P,R,O,C)},c.prototype._projAdd=function(p){var m=this.z.redMul(p.z),v=m.redSqr(),_=this.x.redMul(p.x),E=this.y.redMul(p.y),w=this.curve.d.redMul(_).redMul(E),x=v.redSub(w),A=v.redAdd(w),B=this.x.redAdd(this.y).redMul(p.x.redAdd(p.y)).redISub(_).redISub(E),P=m.redMul(x).redMul(B),R,C;return this.curve.twisted?(R=m.redMul(A).redMul(E.redSub(this.curve._mulA(_))),C=x.redMul(A)):(R=m.redMul(A).redMul(E.redSub(_)),C=this.curve._mulC(x).redMul(A)),this.curve.point(P,R,C)},c.prototype.add=function(p){return this.isInfinity()?p:p.isInfinity()?this:this.curve.extended?this._extAdd(p):this._projAdd(p)},c.prototype.mul=function(p){return this._hasDoubles(p)?this.curve._fixedNafMul(this,p):this.curve._wnafMul(this,p)},c.prototype.mulAdd=function(p,m,v){return this.curve._wnafMulAdd(1,[this,m],[p,v],2,!1)},c.prototype.jmulAdd=function(p,m,v){return this.curve._wnafMulAdd(1,[this,m],[p,v],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var p=this.z.redInvm();return this.x=this.x.redMul(p),this.y=this.y.redMul(p),this.t&&(this.t=this.t.redMul(p)),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(p){return this===p||this.getX().cmp(p.getX())===0&&this.getY().cmp(p.getY())===0},c.prototype.eqXToP=function(p){var m=p.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(m)===0)return!0;for(var v=p.clone(),_=this.curve.redN.redMul(this.z);;){if(v.iadd(this.curve.n),v.cmp(this.curve.p)>=0)return!1;if(m.redIAdd(_),this.x.cmp(m)===0)return!0}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add,S1}var Pw;function k_(){return Pw||(Pw=1,function(r){var t=r;t.base=nd(),t.short=PP(),t.mont=RP(),t.edwards=CP()}(_1)),_1}var k1={},Eh={},fr={},TP=Zi,LP=br;fr.inherits=LP;function OP(r,t){return(r.charCodeAt(t)&64512)!==55296||t<0||t+1>=r.length?!1:(r.charCodeAt(t+1)&64512)===56320}function UP(r,t){if(Array.isArray(r))return r.slice();if(!r)return[];var e=[];if(typeof r=="string")if(t){if(t==="hex")for(r=r.replace(/[^a-z0-9]+/ig,""),r.length%2!==0&&(r="0"+r),s=0;s>6|192,e[n++]=i&63|128):OP(r,s)?(i=65536+((i&1023)<<10)+(r.charCodeAt(++s)&1023),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}else for(s=0;s>>24|r>>>8&65280|r<<8&16711680|(r&255)<<24;return t>>>0}fr.htonl=I_;function DP(r,t){for(var e="",n=0;n>>0}return i}fr.join32=zP;function qP(r,t){for(var e=new Array(r.length*4),n=0,s=0;n>>24,e[s+1]=i>>>16&255,e[s+2]=i>>>8&255,e[s+3]=i&255):(e[s+3]=i>>>24,e[s+2]=i>>>16&255,e[s+1]=i>>>8&255,e[s]=i&255)}return e}fr.split32=qP;function FP(r,t){return r>>>t|r<<32-t}fr.rotr32=FP;function jP(r,t){return r<>>32-t}fr.rotl32=jP;function KP(r,t){return r+t>>>0}fr.sum32=KP;function $P(r,t,e){return r+t+e>>>0}fr.sum32_3=$P;function HP(r,t,e,n){return r+t+e+n>>>0}fr.sum32_4=HP;function VP(r,t,e,n,s){return r+t+e+n+s>>>0}fr.sum32_5=VP;function ZP(r,t,e,n){var s=r[t],i=r[t+1],c=n+i>>>0,l=(c>>0,r[t+1]=c}fr.sum64=ZP;function WP(r,t,e,n){var s=t+n>>>0,i=(s>>0}fr.sum64_hi=WP;function GP(r,t,e,n){var s=t+n;return s>>>0}fr.sum64_lo=GP;function YP(r,t,e,n,s,i,c,l){var p=0,m=t;m=m+n>>>0,p+=m>>0,p+=m>>0,p+=m>>0}fr.sum64_4_hi=YP;function XP(r,t,e,n,s,i,c,l){var p=t+n+i+l;return p>>>0}fr.sum64_4_lo=XP;function JP(r,t,e,n,s,i,c,l,p,m){var v=0,_=t;_=_+n>>>0,v+=_>>0,v+=_>>0,v+=_>>0,v+=_>>0}fr.sum64_5_hi=JP;function QP(r,t,e,n,s,i,c,l,p,m){var v=t+n+i+l+m;return v>>>0}fr.sum64_5_lo=QP;function tR(r,t,e){var n=t<<32-e|r>>>e;return n>>>0}fr.rotr64_hi=tR;function eR(r,t,e){var n=r<<32-e|t>>>e;return n>>>0}fr.rotr64_lo=eR;function rR(r,t,e){return r>>>e}fr.shr64_hi=rR;function nR(r,t,e){var n=r<<32-e|t>>>e;return n>>>0}fr.shr64_lo=nR;var xf={},Rw=fr,iR=Zi;function id(){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}xf.BlockHash=id;id.prototype.update=function(t,e){if(t=Rw.toArray(t,e),this.pending?this.pending=this.pending.concat(t):this.pending=t,this.pendingTotal+=t.length,this.pending.length>=this._delta8){t=this.pending;var n=t.length%this._delta8;this.pending=t.slice(t.length-n,t.length),this.pending.length===0&&(this.pending=null),t=Rw.join32(t,0,t.length-n,this.endian);for(var s=0;s>>24&255,s[i++]=t>>>16&255,s[i++]=t>>>8&255,s[i++]=t&255}else for(s[i++]=t&255,s[i++]=t>>>8&255,s[i++]=t>>>16&255,s[i++]=t>>>24&255,s[i++]=0,s[i++]=0,s[i++]=0,s[i++]=0,c=8;c>>3}Xo.g0_256=fR;function cR(r){return zo(r,17)^zo(r,19)^r>>>10}Xo.g1_256=cR;var tf=fr,hR=xf,lR=Xo,I1=tf.rotl32,Hf=tf.sum32,dR=tf.sum32_5,pR=lR.ft_1,L_=hR.BlockHash,mR=[1518500249,1859775393,2400959708,3395469782];function Vo(){if(!(this instanceof Vo))return new Vo;L_.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}tf.inherits(Vo,L_);var vR=Vo;Vo.blockSize=512;Vo.outSize=160;Vo.hmacStrength=80;Vo.padLength=64;Vo.prototype._update=function(t,e){for(var n=this.W,s=0;s<16;s++)n[s]=t[e+s];for(;sthis.blockSize&&(t=new this.Hash().update(t).digest()),nC(t.length<=this.blockSize);for(var e=t.length;e=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(i,c,l)}return C1=n,n.prototype._init=function(i,c,l){var p=i.concat(c).concat(l);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var m=0;m=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(i.concat(l||[])),this._reseed=1},n.prototype.generate=function(i,c,l,p){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof c!="string"&&(p=l,l=c,c=null),l&&(l=t.toArray(l,p||"hex"),this._update(l));for(var m=[];m.length"},T1}var L1,zw;function fC(){if(zw)return L1;zw=1;var r=Is(),t=Wi(),e=t.assert;function n(p,m){if(p instanceof n)return p;this._importDER(p,m)||(e(p.r&&p.s,"Signature without r or s"),this.r=new r(p.r,16),this.s=new r(p.s,16),p.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=p.recoveryParam)}L1=n;function s(){this.place=0}function i(p,m){var v=p[m.place++];if(!(v&128))return v;var _=v&15;if(_===0||_>4)return!1;for(var E=0,w=0,x=m.place;w<_;w++,x++)E<<=8,E|=p[x],E>>>=0;return E<=127?!1:(m.place=x,E)}function c(p){for(var m=0,v=p.length-1;!p[m]&&!(p[m+1]&128)&&m>>3);for(p.push(v|128);--v;)p.push(m>>>(v<<3)&255);p.push(m)}return n.prototype.toDER=function(m){var v=this.r.toArray(),_=this.s.toArray();for(v[0]&128&&(v=[0].concat(v)),_[0]&128&&(_=[0].concat(_)),v=c(v),_=c(_);!_[0]&&!(_[1]&128);)_=_.slice(1);var E=[2];l(E,v.length),E=E.concat(v),E.push(2),l(E,_.length);var w=E.concat(_),x=[48];return l(x,w.length),x=x.concat(w),t.encode(x,m)},L1}var O1,qw;function cC(){if(qw)return O1;qw=1;var r=Is(),t=aC(),e=Wi(),n=ug(),s=sg(),i=e.assert,c=uC(),l=fC();function p(m){if(!(this instanceof p))return new p(m);typeof m=="string"&&(i(Object.prototype.hasOwnProperty.call(n,m),"Unknown curve "+m),m=n[m]),m instanceof n.PresetCurve&&(m={curve:m}),this.curve=m.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=m.curve.g,this.g.precompute(m.curve.n.bitLength()+1),this.hash=m.hash||m.curve.hash}return O1=p,p.prototype.keyPair=function(v){return new c(this,v)},p.prototype.keyFromPrivate=function(v,_){return c.fromPrivate(this,v,_)},p.prototype.keyFromPublic=function(v,_){return c.fromPublic(this,v,_)},p.prototype.genKeyPair=function(v){v||(v={});for(var _=new t({hash:this.hash,pers:v.pers,persEnc:v.persEnc||"utf8",entropy:v.entropy||s(this.hash.hmacStrength),entropyEnc:v.entropy&&v.entropyEnc||"utf8",nonce:this.n.toArray()}),E=this.n.byteLength(),w=this.n.sub(new r(2));;){var x=new r(_.generate(E));if(!(x.cmp(w)>0))return x.iaddn(1),this.keyFromPrivate(x)}},p.prototype._truncateToN=function(v,_){var E=v.byteLength()*8-this.n.bitLength();return E>0&&(v=v.ushrn(E)),!_&&v.cmp(this.n)>=0?v.sub(this.n):v},p.prototype.sign=function(v,_,E,w){typeof E=="object"&&(w=E,E=null),w||(w={}),_=this.keyFromPrivate(_,E),v=this._truncateToN(new r(v,16));for(var x=this.n.byteLength(),A=_.getPrivate().toArray("be",x),B=v.toArray("be",x),P=new t({hash:this.hash,entropy:A,nonce:B,pers:w.pers,persEnc:w.persEnc||"utf8"}),R=this.n.sub(new r(1)),C=0;;C++){var O=w.k?w.k(C):new r(P.generate(this.n.byteLength()));if(O=this._truncateToN(O,!0),!(O.cmpn(1)<=0||O.cmp(R)>=0)){var z=this.g.mul(O);if(!z.isInfinity()){var H=z.getX(),tt=H.umod(this.n);if(tt.cmpn(0)!==0){var nt=O.invm(this.n).mul(tt.mul(_.getPrivate()).iadd(v));if(nt=nt.umod(this.n),nt.cmpn(0)!==0){var G=(z.getY().isOdd()?1:0)|(H.cmp(tt)!==0?2:0);return w.canonical&&nt.cmp(this.nh)>0&&(nt=this.n.sub(nt),G^=1),new l({r:tt,s:nt,recoveryParam:G})}}}}}},p.prototype.verify=function(v,_,E,w){v=this._truncateToN(new r(v,16)),E=this.keyFromPublic(E,w),_=new l(_,"hex");var x=_.r,A=_.s;if(x.cmpn(1)<0||x.cmp(this.n)>=0||A.cmpn(1)<0||A.cmp(this.n)>=0)return!1;var B=A.invm(this.n),P=B.mul(v).umod(this.n),R=B.mul(x).umod(this.n),C;return this.curve._maxwellTrick?(C=this.g.jmulAdd(P,E.getPublic(),R),C.isInfinity()?!1:C.eqXToP(x)):(C=this.g.mulAdd(P,E.getPublic(),R),C.isInfinity()?!1:C.getX().umod(this.n).cmp(x)===0)},p.prototype.recoverPubKey=function(m,v,_,E){i((3&_)===_,"The recovery param is more than two bits"),v=new l(v,E);var w=this.n,x=new r(m),A=v.r,B=v.s,P=_&1,R=_>>1;if(A.cmp(this.curve.p.umod(this.curve.n))>=0&&R)throw new Error("Unable to find sencond key candinate");R?A=this.curve.pointFromX(A.add(this.curve.n),P):A=this.curve.pointFromX(A,P);var C=v.r.invm(w),O=w.sub(x).mul(C).umod(w),z=B.mul(C).umod(w);return this.g.mulAdd(O,A,z)},p.prototype.getKeyRecoveryParam=function(m,v,_,E){if(v=new l(v,E),v.recoveryParam!==null)return v.recoveryParam;for(var w=0;w<4;w++){var x;try{x=this.recoverPubKey(m,v,w)}catch{continue}if(x.eq(_))return w}throw new Error("Unable to find valid recovery factor")},O1}var U1,Fw;function hC(){if(Fw)return U1;Fw=1;var r=Wi(),t=r.assert,e=r.parseBytes,n=r.cachedProperty;function s(i,c){this.eddsa=i,this._secret=e(c.secret),i.isPoint(c.pub)?this._pub=c.pub:this._pubBytes=e(c.pub)}return s.fromPublic=function(c,l){return l instanceof s?l:new s(c,{pub:l})},s.fromSecret=function(c,l){return l instanceof s?l:new s(c,{secret:l})},s.prototype.secret=function(){return this._secret},n(s,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),n(s,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),n(s,"privBytes",function(){var c=this.eddsa,l=this.hash(),p=c.encodingLength-1,m=l.slice(0,c.encodingLength);return m[0]&=248,m[p]&=127,m[p]|=64,m}),n(s,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),n(s,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),n(s,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),s.prototype.sign=function(c){return t(this._secret,"KeyPair can only verify"),this.eddsa.sign(c,this)},s.prototype.verify=function(c,l){return this.eddsa.verify(c,l,this)},s.prototype.getSecret=function(c){return t(this._secret,"KeyPair is public only"),r.encode(this.secret(),c)},s.prototype.getPublic=function(c){return r.encode(this.pubBytes(),c)},U1=s,U1}var N1,jw;function lC(){if(jw)return N1;jw=1;var r=Is(),t=Wi(),e=t.assert,n=t.cachedProperty,s=t.parseBytes;function i(c,l){this.eddsa=c,typeof l!="object"&&(l=s(l)),Array.isArray(l)&&(l={R:l.slice(0,c.encodingLength),S:l.slice(c.encodingLength)}),e(l.R&&l.S,"Signature without R or S"),c.isPoint(l.R)&&(this._R=l.R),l.S instanceof r&&(this._S=l.S),this._Rencoded=Array.isArray(l.R)?l.R:l.Rencoded,this._Sencoded=Array.isArray(l.S)?l.S:l.Sencoded}return n(i,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),n(i,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),n(i,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),n(i,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),i.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},i.prototype.toHex=function(){return t.encode(this.toBytes(),"hex").toUpperCase()},N1=i,N1}var D1,Kw;function dC(){if(Kw)return D1;Kw=1;var r=Eh,t=ug(),e=Wi(),n=e.assert,s=e.parseBytes,i=hC(),c=lC();function l(p){if(n(p==="ed25519","only tested with ed25519 so far"),!(this instanceof l))return new l(p);p=t[p].curve,this.curve=p,this.g=p.g,this.g.precompute(p.n.bitLength()+1),this.pointClass=p.point().constructor,this.encodingLength=Math.ceil(p.n.bitLength()/8),this.hash=r.sha512}return D1=l,l.prototype.sign=function(m,v){m=s(m);var _=this.keyFromSecret(v),E=this.hashInt(_.messagePrefix(),m),w=this.g.mul(E),x=this.encodePoint(w),A=this.hashInt(x,_.pubBytes(),m).mul(_.priv()),B=E.add(A).umod(this.curve.n);return this.makeSignature({R:w,S:B,Rencoded:x})},l.prototype.verify=function(m,v,_){m=s(m),v=this.makeSignature(v);var E=this.keyFromPublic(_),w=this.hashInt(v.Rencoded(),E.pubBytes(),m),x=this.g.mul(v.S()),A=v.R().add(E.pub().mul(w));return A.eq(x)},l.prototype.hashInt=function(){for(var m=this.hash(),v=0;v0?o:a},i.min=function(o,a){return o.cmp(a)<0?o:a},i.prototype._init=function(o,a,f){if(typeof o=="number")return this._initNumber(o,a,f);if(typeof o=="object")return this._initArray(o,a,f);a==="hex"&&(a=16),n(a===(a|0)&&a>=2&&a<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h=0;h-=3)S=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[g]|=S<>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);else if(f==="le")for(h=0,g=0;h>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);return this.strip()};function l(d,o){var a=d.charCodeAt(o);return a>=65&&a<=70?a-55:a>=97&&a<=102?a-87:a-48&15}function p(d,o,a){var f=l(d,a);return a-1>=o&&(f|=l(d,a-1)<<4),f}i.prototype._parseHex=function(o,a,f){this.length=Math.ceil((o.length-a)/6),this.words=new Array(this.length);for(var h=0;h=a;h-=2)I=p(o,a,h)<=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8;else{var y=o.length-a;for(h=y%2===0?a+1:a;h=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8}this.strip()};function m(d,o,a,f){for(var h=0,g=Math.min(d.length,a),S=o;S=49?h+=I-49+10:I>=17?h+=I-17+10:h+=I}return h}i.prototype._parseBase=function(o,a,f){this.words=[0],this.length=1;for(var h=0,g=1;g<=67108863;g*=a)h++;h--,g=g/a|0;for(var S=o.length-f,I=S%h,y=Math.min(S,S-I)+f,u=0,b=f;b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var v=["","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"],_=[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],E=[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];i.prototype.toString=function(o,a){o=o||10,a=a|0||1;var f;if(o===16||o==="hex"){f="";for(var h=0,g=0,S=0;S>>24-h&16777215,g!==0||S!==this.length-1?f=v[6-y.length]+y+f:f=y+f,h+=2,h>=26&&(h-=26,S--)}for(g!==0&&(f=g.toString(16)+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var u=_[o],b=E[o];f="";var D=this.clone();for(D.negative=0;!D.isZero();){var Z=D.modn(b).toString(o);D=D.idivn(b),D.isZero()?f=Z+f:f=v[u-Z.length]+Z+f}for(this.isZero()&&(f="0"+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,a){return n(typeof c<"u"),this.toArrayLike(c,o,a)},i.prototype.toArray=function(o,a){return this.toArrayLike(Array,o,a)},i.prototype.toArrayLike=function(o,a,f){var h=this.byteLength(),g=f||Math.max(1,h);n(h<=g,"byte array longer than desired length"),n(g>0,"Requested array length <= 0"),this.strip();var S=a==="le",I=new o(g),y,u,b=this.clone();if(S){for(u=0;!b.isZero();u++)y=b.andln(255),b.iushrn(8),I[u]=y;for(;u=4096&&(f+=13,a>>>=13),a>=64&&(f+=7,a>>>=7),a>=8&&(f+=4,a>>>=4),a>=2&&(f+=2,a>>>=2),f+a},i.prototype._zeroBits=function(o){if(o===0)return 26;var a=o,f=0;return a&8191||(f+=13,a>>>=13),a&127||(f+=7,a>>>=7),a&15||(f+=4,a>>>=4),a&3||(f+=2,a>>>=2),a&1||f++,f},i.prototype.bitLength=function(){var o=this.words[this.length-1],a=this._countBits(o);return(this.length-1)*26+a};function w(d){for(var o=new Array(d.bitLength()),a=0;a>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,a=0;ao.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var a;this.length>o.length?a=o:a=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var a,f;this.length>o.length?(a=this,f=o):(a=o,f=this);for(var h=0;ho.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var a=Math.ceil(o/26)|0,f=o%26;this._expand(a),f>0&&a--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-f),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,a){n(typeof o=="number"&&o>=0);var f=o/26|0,h=o%26;return this._expand(f+1),a?this.words[f]=this.words[f]|1<o.length?(f=this,h=o):(f=o,h=this);for(var g=0,S=0;S>>26;for(;g!==0&&S>>26;if(this.length=f.length,g!==0)this.words[this.length]=g,this.length++;else if(f!==this)for(;So.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var a=this.iadd(o);return o.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,g;f>0?(h=this,g=o):(h=o,g=this);for(var S=0,I=0;I>26,this.words[I]=a&67108863;for(;S!==0&&I>26,this.words[I]=a&67108863;if(S===0&&I>>26,D=y&67108863,Z=Math.min(u,o.length-1),F=Math.max(0,u-d.length+1);F<=Z;F++){var q=u-F|0;h=d.words[q]|0,g=o.words[F]|0,S=h*g+D,b+=S/67108864|0,D=S&67108863}a.words[u]=D|0,y=b|0}return y!==0?a.words[u]=y|0:a.length--,a.strip()}var A=function(o,a,f){var h=o.words,g=a.words,S=f.words,I=0,y,u,b,D=h[0]|0,Z=D&8191,F=D>>>13,q=h[1]|0,it=q&8191,at=q>>>13,Bt=h[2]|0,yt=Bt&8191,pt=Bt>>>13,Ft=h[3]|0,lt=Ft&8191,ct=Ft>>>13,Tt=h[4]|0,kt=Tt&8191,k=Tt>>>13,T=h[5]|0,L=T&8191,j=T>>>13,rt=h[6]|0,Q=rt&8191,ot=rt>>>13,qt=h[7]|0,It=qt&8191,xt=qt>>>13,Qt=h[8]|0,Ct=Qt&8191,Dt=Qt>>>13,Se=h[9]|0,te=Se&8191,Ut=Se>>>13,Te=g[0]|0,J=Te&8191,X=Te>>>13,st=g[1]|0,N=st&8191,$=st>>>13,gt=g[2]|0,ft=gt&8191,mt=gt>>>13,vt=g[3]|0,At=vt&8191,_t=vt>>>13,Gt=g[4]|0,Rt=Gt&8191,wt=Gt>>>13,se=g[5]|0,Lt=se&8191,Et=se>>>13,de=g[6]|0,Pt=de&8191,Mt=de>>>13,K=g[7]|0,Y=K&8191,V=K>>>13,U=g[8]|0,W=U&8191,et=U>>>13,dt=g[9]|0,ut=dt&8191,ht=dt>>>13;f.negative=o.negative^a.negative,f.length=19,y=Math.imul(Z,J),u=Math.imul(Z,X),u=u+Math.imul(F,J)|0,b=Math.imul(F,X);var zt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(zt>>>26)|0,zt&=67108863,y=Math.imul(it,J),u=Math.imul(it,X),u=u+Math.imul(at,J)|0,b=Math.imul(at,X),y=y+Math.imul(Z,N)|0,u=u+Math.imul(Z,$)|0,u=u+Math.imul(F,N)|0,b=b+Math.imul(F,$)|0;var Wt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,y=Math.imul(yt,J),u=Math.imul(yt,X),u=u+Math.imul(pt,J)|0,b=Math.imul(pt,X),y=y+Math.imul(it,N)|0,u=u+Math.imul(it,$)|0,u=u+Math.imul(at,N)|0,b=b+Math.imul(at,$)|0,y=y+Math.imul(Z,ft)|0,u=u+Math.imul(Z,mt)|0,u=u+Math.imul(F,ft)|0,b=b+Math.imul(F,mt)|0;var ye=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ye>>>26)|0,ye&=67108863,y=Math.imul(lt,J),u=Math.imul(lt,X),u=u+Math.imul(ct,J)|0,b=Math.imul(ct,X),y=y+Math.imul(yt,N)|0,u=u+Math.imul(yt,$)|0,u=u+Math.imul(pt,N)|0,b=b+Math.imul(pt,$)|0,y=y+Math.imul(it,ft)|0,u=u+Math.imul(it,mt)|0,u=u+Math.imul(at,ft)|0,b=b+Math.imul(at,mt)|0,y=y+Math.imul(Z,At)|0,u=u+Math.imul(Z,_t)|0,u=u+Math.imul(F,At)|0,b=b+Math.imul(F,_t)|0;var Yt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,y=Math.imul(kt,J),u=Math.imul(kt,X),u=u+Math.imul(k,J)|0,b=Math.imul(k,X),y=y+Math.imul(lt,N)|0,u=u+Math.imul(lt,$)|0,u=u+Math.imul(ct,N)|0,b=b+Math.imul(ct,$)|0,y=y+Math.imul(yt,ft)|0,u=u+Math.imul(yt,mt)|0,u=u+Math.imul(pt,ft)|0,b=b+Math.imul(pt,mt)|0,y=y+Math.imul(it,At)|0,u=u+Math.imul(it,_t)|0,u=u+Math.imul(at,At)|0,b=b+Math.imul(at,_t)|0,y=y+Math.imul(Z,Rt)|0,u=u+Math.imul(Z,wt)|0,u=u+Math.imul(F,Rt)|0,b=b+Math.imul(F,wt)|0;var pe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(pe>>>26)|0,pe&=67108863,y=Math.imul(L,J),u=Math.imul(L,X),u=u+Math.imul(j,J)|0,b=Math.imul(j,X),y=y+Math.imul(kt,N)|0,u=u+Math.imul(kt,$)|0,u=u+Math.imul(k,N)|0,b=b+Math.imul(k,$)|0,y=y+Math.imul(lt,ft)|0,u=u+Math.imul(lt,mt)|0,u=u+Math.imul(ct,ft)|0,b=b+Math.imul(ct,mt)|0,y=y+Math.imul(yt,At)|0,u=u+Math.imul(yt,_t)|0,u=u+Math.imul(pt,At)|0,b=b+Math.imul(pt,_t)|0,y=y+Math.imul(it,Rt)|0,u=u+Math.imul(it,wt)|0,u=u+Math.imul(at,Rt)|0,b=b+Math.imul(at,wt)|0,y=y+Math.imul(Z,Lt)|0,u=u+Math.imul(Z,Et)|0,u=u+Math.imul(F,Lt)|0,b=b+Math.imul(F,Et)|0;var ve=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ve>>>26)|0,ve&=67108863,y=Math.imul(Q,J),u=Math.imul(Q,X),u=u+Math.imul(ot,J)|0,b=Math.imul(ot,X),y=y+Math.imul(L,N)|0,u=u+Math.imul(L,$)|0,u=u+Math.imul(j,N)|0,b=b+Math.imul(j,$)|0,y=y+Math.imul(kt,ft)|0,u=u+Math.imul(kt,mt)|0,u=u+Math.imul(k,ft)|0,b=b+Math.imul(k,mt)|0,y=y+Math.imul(lt,At)|0,u=u+Math.imul(lt,_t)|0,u=u+Math.imul(ct,At)|0,b=b+Math.imul(ct,_t)|0,y=y+Math.imul(yt,Rt)|0,u=u+Math.imul(yt,wt)|0,u=u+Math.imul(pt,Rt)|0,b=b+Math.imul(pt,wt)|0,y=y+Math.imul(it,Lt)|0,u=u+Math.imul(it,Et)|0,u=u+Math.imul(at,Lt)|0,b=b+Math.imul(at,Et)|0,y=y+Math.imul(Z,Pt)|0,u=u+Math.imul(Z,Mt)|0,u=u+Math.imul(F,Pt)|0,b=b+Math.imul(F,Mt)|0;var ge=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ge>>>26)|0,ge&=67108863,y=Math.imul(It,J),u=Math.imul(It,X),u=u+Math.imul(xt,J)|0,b=Math.imul(xt,X),y=y+Math.imul(Q,N)|0,u=u+Math.imul(Q,$)|0,u=u+Math.imul(ot,N)|0,b=b+Math.imul(ot,$)|0,y=y+Math.imul(L,ft)|0,u=u+Math.imul(L,mt)|0,u=u+Math.imul(j,ft)|0,b=b+Math.imul(j,mt)|0,y=y+Math.imul(kt,At)|0,u=u+Math.imul(kt,_t)|0,u=u+Math.imul(k,At)|0,b=b+Math.imul(k,_t)|0,y=y+Math.imul(lt,Rt)|0,u=u+Math.imul(lt,wt)|0,u=u+Math.imul(ct,Rt)|0,b=b+Math.imul(ct,wt)|0,y=y+Math.imul(yt,Lt)|0,u=u+Math.imul(yt,Et)|0,u=u+Math.imul(pt,Lt)|0,b=b+Math.imul(pt,Et)|0,y=y+Math.imul(it,Pt)|0,u=u+Math.imul(it,Mt)|0,u=u+Math.imul(at,Pt)|0,b=b+Math.imul(at,Mt)|0,y=y+Math.imul(Z,Y)|0,u=u+Math.imul(Z,V)|0,u=u+Math.imul(F,Y)|0,b=b+Math.imul(F,V)|0;var ie=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ie>>>26)|0,ie&=67108863,y=Math.imul(Ct,J),u=Math.imul(Ct,X),u=u+Math.imul(Dt,J)|0,b=Math.imul(Dt,X),y=y+Math.imul(It,N)|0,u=u+Math.imul(It,$)|0,u=u+Math.imul(xt,N)|0,b=b+Math.imul(xt,$)|0,y=y+Math.imul(Q,ft)|0,u=u+Math.imul(Q,mt)|0,u=u+Math.imul(ot,ft)|0,b=b+Math.imul(ot,mt)|0,y=y+Math.imul(L,At)|0,u=u+Math.imul(L,_t)|0,u=u+Math.imul(j,At)|0,b=b+Math.imul(j,_t)|0,y=y+Math.imul(kt,Rt)|0,u=u+Math.imul(kt,wt)|0,u=u+Math.imul(k,Rt)|0,b=b+Math.imul(k,wt)|0,y=y+Math.imul(lt,Lt)|0,u=u+Math.imul(lt,Et)|0,u=u+Math.imul(ct,Lt)|0,b=b+Math.imul(ct,Et)|0,y=y+Math.imul(yt,Pt)|0,u=u+Math.imul(yt,Mt)|0,u=u+Math.imul(pt,Pt)|0,b=b+Math.imul(pt,Mt)|0,y=y+Math.imul(it,Y)|0,u=u+Math.imul(it,V)|0,u=u+Math.imul(at,Y)|0,b=b+Math.imul(at,V)|0,y=y+Math.imul(Z,W)|0,u=u+Math.imul(Z,et)|0,u=u+Math.imul(F,W)|0,b=b+Math.imul(F,et)|0;var ue=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ue>>>26)|0,ue&=67108863,y=Math.imul(te,J),u=Math.imul(te,X),u=u+Math.imul(Ut,J)|0,b=Math.imul(Ut,X),y=y+Math.imul(Ct,N)|0,u=u+Math.imul(Ct,$)|0,u=u+Math.imul(Dt,N)|0,b=b+Math.imul(Dt,$)|0,y=y+Math.imul(It,ft)|0,u=u+Math.imul(It,mt)|0,u=u+Math.imul(xt,ft)|0,b=b+Math.imul(xt,mt)|0,y=y+Math.imul(Q,At)|0,u=u+Math.imul(Q,_t)|0,u=u+Math.imul(ot,At)|0,b=b+Math.imul(ot,_t)|0,y=y+Math.imul(L,Rt)|0,u=u+Math.imul(L,wt)|0,u=u+Math.imul(j,Rt)|0,b=b+Math.imul(j,wt)|0,y=y+Math.imul(kt,Lt)|0,u=u+Math.imul(kt,Et)|0,u=u+Math.imul(k,Lt)|0,b=b+Math.imul(k,Et)|0,y=y+Math.imul(lt,Pt)|0,u=u+Math.imul(lt,Mt)|0,u=u+Math.imul(ct,Pt)|0,b=b+Math.imul(ct,Mt)|0,y=y+Math.imul(yt,Y)|0,u=u+Math.imul(yt,V)|0,u=u+Math.imul(pt,Y)|0,b=b+Math.imul(pt,V)|0,y=y+Math.imul(it,W)|0,u=u+Math.imul(it,et)|0,u=u+Math.imul(at,W)|0,b=b+Math.imul(at,et)|0,y=y+Math.imul(Z,ut)|0,u=u+Math.imul(Z,ht)|0,u=u+Math.imul(F,ut)|0,b=b+Math.imul(F,ht)|0;var fe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(fe>>>26)|0,fe&=67108863,y=Math.imul(te,N),u=Math.imul(te,$),u=u+Math.imul(Ut,N)|0,b=Math.imul(Ut,$),y=y+Math.imul(Ct,ft)|0,u=u+Math.imul(Ct,mt)|0,u=u+Math.imul(Dt,ft)|0,b=b+Math.imul(Dt,mt)|0,y=y+Math.imul(It,At)|0,u=u+Math.imul(It,_t)|0,u=u+Math.imul(xt,At)|0,b=b+Math.imul(xt,_t)|0,y=y+Math.imul(Q,Rt)|0,u=u+Math.imul(Q,wt)|0,u=u+Math.imul(ot,Rt)|0,b=b+Math.imul(ot,wt)|0,y=y+Math.imul(L,Lt)|0,u=u+Math.imul(L,Et)|0,u=u+Math.imul(j,Lt)|0,b=b+Math.imul(j,Et)|0,y=y+Math.imul(kt,Pt)|0,u=u+Math.imul(kt,Mt)|0,u=u+Math.imul(k,Pt)|0,b=b+Math.imul(k,Mt)|0,y=y+Math.imul(lt,Y)|0,u=u+Math.imul(lt,V)|0,u=u+Math.imul(ct,Y)|0,b=b+Math.imul(ct,V)|0,y=y+Math.imul(yt,W)|0,u=u+Math.imul(yt,et)|0,u=u+Math.imul(pt,W)|0,b=b+Math.imul(pt,et)|0,y=y+Math.imul(it,ut)|0,u=u+Math.imul(it,ht)|0,u=u+Math.imul(at,ut)|0,b=b+Math.imul(at,ht)|0;var ce=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ce>>>26)|0,ce&=67108863,y=Math.imul(te,ft),u=Math.imul(te,mt),u=u+Math.imul(Ut,ft)|0,b=Math.imul(Ut,mt),y=y+Math.imul(Ct,At)|0,u=u+Math.imul(Ct,_t)|0,u=u+Math.imul(Dt,At)|0,b=b+Math.imul(Dt,_t)|0,y=y+Math.imul(It,Rt)|0,u=u+Math.imul(It,wt)|0,u=u+Math.imul(xt,Rt)|0,b=b+Math.imul(xt,wt)|0,y=y+Math.imul(Q,Lt)|0,u=u+Math.imul(Q,Et)|0,u=u+Math.imul(ot,Lt)|0,b=b+Math.imul(ot,Et)|0,y=y+Math.imul(L,Pt)|0,u=u+Math.imul(L,Mt)|0,u=u+Math.imul(j,Pt)|0,b=b+Math.imul(j,Mt)|0,y=y+Math.imul(kt,Y)|0,u=u+Math.imul(kt,V)|0,u=u+Math.imul(k,Y)|0,b=b+Math.imul(k,V)|0,y=y+Math.imul(lt,W)|0,u=u+Math.imul(lt,et)|0,u=u+Math.imul(ct,W)|0,b=b+Math.imul(ct,et)|0,y=y+Math.imul(yt,ut)|0,u=u+Math.imul(yt,ht)|0,u=u+Math.imul(pt,ut)|0,b=b+Math.imul(pt,ht)|0;var Kt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,y=Math.imul(te,At),u=Math.imul(te,_t),u=u+Math.imul(Ut,At)|0,b=Math.imul(Ut,_t),y=y+Math.imul(Ct,Rt)|0,u=u+Math.imul(Ct,wt)|0,u=u+Math.imul(Dt,Rt)|0,b=b+Math.imul(Dt,wt)|0,y=y+Math.imul(It,Lt)|0,u=u+Math.imul(It,Et)|0,u=u+Math.imul(xt,Lt)|0,b=b+Math.imul(xt,Et)|0,y=y+Math.imul(Q,Pt)|0,u=u+Math.imul(Q,Mt)|0,u=u+Math.imul(ot,Pt)|0,b=b+Math.imul(ot,Mt)|0,y=y+Math.imul(L,Y)|0,u=u+Math.imul(L,V)|0,u=u+Math.imul(j,Y)|0,b=b+Math.imul(j,V)|0,y=y+Math.imul(kt,W)|0,u=u+Math.imul(kt,et)|0,u=u+Math.imul(k,W)|0,b=b+Math.imul(k,et)|0,y=y+Math.imul(lt,ut)|0,u=u+Math.imul(lt,ht)|0,u=u+Math.imul(ct,ut)|0,b=b+Math.imul(ct,ht)|0;var oe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(oe>>>26)|0,oe&=67108863,y=Math.imul(te,Rt),u=Math.imul(te,wt),u=u+Math.imul(Ut,Rt)|0,b=Math.imul(Ut,wt),y=y+Math.imul(Ct,Lt)|0,u=u+Math.imul(Ct,Et)|0,u=u+Math.imul(Dt,Lt)|0,b=b+Math.imul(Dt,Et)|0,y=y+Math.imul(It,Pt)|0,u=u+Math.imul(It,Mt)|0,u=u+Math.imul(xt,Pt)|0,b=b+Math.imul(xt,Mt)|0,y=y+Math.imul(Q,Y)|0,u=u+Math.imul(Q,V)|0,u=u+Math.imul(ot,Y)|0,b=b+Math.imul(ot,V)|0,y=y+Math.imul(L,W)|0,u=u+Math.imul(L,et)|0,u=u+Math.imul(j,W)|0,b=b+Math.imul(j,et)|0,y=y+Math.imul(kt,ut)|0,u=u+Math.imul(kt,ht)|0,u=u+Math.imul(k,ut)|0,b=b+Math.imul(k,ht)|0;var Jt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,y=Math.imul(te,Lt),u=Math.imul(te,Et),u=u+Math.imul(Ut,Lt)|0,b=Math.imul(Ut,Et),y=y+Math.imul(Ct,Pt)|0,u=u+Math.imul(Ct,Mt)|0,u=u+Math.imul(Dt,Pt)|0,b=b+Math.imul(Dt,Mt)|0,y=y+Math.imul(It,Y)|0,u=u+Math.imul(It,V)|0,u=u+Math.imul(xt,Y)|0,b=b+Math.imul(xt,V)|0,y=y+Math.imul(Q,W)|0,u=u+Math.imul(Q,et)|0,u=u+Math.imul(ot,W)|0,b=b+Math.imul(ot,et)|0,y=y+Math.imul(L,ut)|0,u=u+Math.imul(L,ht)|0,u=u+Math.imul(j,ut)|0,b=b+Math.imul(j,ht)|0;var le=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(le>>>26)|0,le&=67108863,y=Math.imul(te,Pt),u=Math.imul(te,Mt),u=u+Math.imul(Ut,Pt)|0,b=Math.imul(Ut,Mt),y=y+Math.imul(Ct,Y)|0,u=u+Math.imul(Ct,V)|0,u=u+Math.imul(Dt,Y)|0,b=b+Math.imul(Dt,V)|0,y=y+Math.imul(It,W)|0,u=u+Math.imul(It,et)|0,u=u+Math.imul(xt,W)|0,b=b+Math.imul(xt,et)|0,y=y+Math.imul(Q,ut)|0,u=u+Math.imul(Q,ht)|0,u=u+Math.imul(ot,ut)|0,b=b+Math.imul(ot,ht)|0;var ae=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ae>>>26)|0,ae&=67108863,y=Math.imul(te,Y),u=Math.imul(te,V),u=u+Math.imul(Ut,Y)|0,b=Math.imul(Ut,V),y=y+Math.imul(Ct,W)|0,u=u+Math.imul(Ct,et)|0,u=u+Math.imul(Dt,W)|0,b=b+Math.imul(Dt,et)|0,y=y+Math.imul(It,ut)|0,u=u+Math.imul(It,ht)|0,u=u+Math.imul(xt,ut)|0,b=b+Math.imul(xt,ht)|0;var ne=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ne>>>26)|0,ne&=67108863,y=Math.imul(te,W),u=Math.imul(te,et),u=u+Math.imul(Ut,W)|0,b=Math.imul(Ut,et),y=y+Math.imul(Ct,ut)|0,u=u+Math.imul(Ct,ht)|0,u=u+Math.imul(Dt,ut)|0,b=b+Math.imul(Dt,ht)|0;var Ot=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,y=Math.imul(te,ut),u=Math.imul(te,ht),u=u+Math.imul(Ut,ut)|0,b=Math.imul(Ut,ht);var Nt=(I+y|0)+((u&8191)<<13)|0;return I=(b+(u>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,S[0]=zt,S[1]=Wt,S[2]=ye,S[3]=Yt,S[4]=pe,S[5]=ve,S[6]=ge,S[7]=ie,S[8]=ue,S[9]=fe,S[10]=ce,S[11]=Kt,S[12]=oe,S[13]=Jt,S[14]=le,S[15]=ae,S[16]=ne,S[17]=Ot,S[18]=Nt,I!==0&&(S[19]=I,f.length++),f};Math.imul||(A=x);function B(d,o,a){a.negative=o.negative^d.negative,a.length=d.length+o.length;for(var f=0,h=0,g=0;g>>26)|0,h+=S>>>26,S&=67108863}a.words[g]=I,f=S,S=h}return f!==0?a.words[g]=f:a.length--,a.strip()}function P(d,o,a){var f=new R;return f.mulp(d,o,a)}i.prototype.mulTo=function(o,a){var f,h=this.length+o.length;return this.length===10&&o.length===10?f=A(this,o,a):h<63?f=x(this,o,a):h<1024?f=B(this,o,a):f=P(this,o,a),f};function R(d,o){this.x=d,this.y=o}R.prototype.makeRBT=function(o){for(var a=new Array(o),f=i.prototype._countBits(o)-1,h=0;h>=1;return h},R.prototype.permute=function(o,a,f,h,g,S){for(var I=0;I>>1)g++;return 1<>>13,f[2*S+1]=g&8191,g=g>>>13;for(S=2*a;S>=26,a+=h/67108864|0,a+=g>>>26,this.words[f]=g&67108863}return a!==0&&(this.words[f]=a,this.length++),this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var a=w(o);if(a.length===0)return new i(1);for(var f=this,h=0;h=0);var a=o%26,f=(o-a)/26,h=67108863>>>26-a<<26-a,g;if(a!==0){var S=0;for(g=0;g>>26-a}S&&(this.words[g]=S,this.length++)}if(f!==0){for(g=this.length-1;g>=0;g--)this.words[g+f]=this.words[g];for(g=0;g=0);var h;a?h=(a-a%26)/26:h=0;var g=o%26,S=Math.min((o-g)/26,this.length),I=67108863^67108863>>>g<S)for(this.length-=S,u=0;u=0&&(b!==0||u>=h);u--){var D=this.words[u]|0;this.words[u]=b<<26-g|D>>>g,b=D&I}return y&&b!==0&&(y.words[y.length++]=b),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,a,f){return n(this.negative===0),this.iushrn(o,a,f)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var a=o%26,f=(o-a)/26,h=1<=0);var a=o%26,f=(o-a)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(a!==0&&f++,this.length=Math.min(f,this.length),a!==0){var h=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},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(y/67108864|0),this.words[g+f]=S&67108863}for(;g>26,this.words[g+f]=S&67108863;if(I===0)return this.strip();for(n(I===-1),I=0,g=0;g>26,this.words[g]=S&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,a){var f=this.length-o.length,h=this.clone(),g=o,S=g.words[g.length-1]|0,I=this._countBits(S);f=26-I,f!==0&&(g=g.ushln(f),h.iushln(f),S=g.words[g.length-1]|0);var y=h.length-g.length,u;if(a!=="mod"){u=new i(null),u.length=y+1,u.words=new Array(u.length);for(var b=0;b=0;Z--){var F=(h.words[g.length+Z]|0)*67108864+(h.words[g.length+Z-1]|0);for(F=Math.min(F/S|0,67108863),h._ishlnsubmul(g,F,Z);h.negative!==0;)F--,h.negative=0,h._ishlnsubmul(g,1,Z),h.isZero()||(h.negative^=1);u&&(u.words[Z]=F)}return u&&u.strip(),h.strip(),a!=="div"&&f!==0&&h.iushrn(f),{div:u||null,mod:h}},i.prototype.divmod=function(o,a,f){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,g,S;return this.negative!==0&&o.negative===0?(S=this.neg().divmod(o,a),a!=="mod"&&(h=S.div.neg()),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.iadd(o)),{div:h,mod:g}):this.negative===0&&o.negative!==0?(S=this.divmod(o.neg(),a),a!=="mod"&&(h=S.div.neg()),{div:h,mod:S.mod}):this.negative&o.negative?(S=this.neg().divmod(o.neg(),a),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.isub(o)),{div:S.div,mod:g}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?a==="div"?{div:this.divn(o.words[0]),mod:null}:a==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,a)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var a=this.divmod(o);if(a.mod.isZero())return a.div;var f=a.div.negative!==0?a.mod.isub(o):a.mod,h=o.ushrn(1),g=o.andln(1),S=f.cmp(h);return S<0||g===1&&S===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var a=(1<<26)%o,f=0,h=this.length-1;h>=0;h--)f=(a*f+(this.words[h]|0))%o;return f},i.prototype.idivn=function(o){n(o<=67108863);for(var a=0,f=this.length-1;f>=0;f--){var h=(this.words[f]|0)+a*67108864;this.words[f]=h/o|0,a=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=new i(0),I=new i(1),y=0;a.isEven()&&f.isEven();)a.iushrn(1),f.iushrn(1),++y;for(var u=f.clone(),b=a.clone();!a.isZero();){for(var D=0,Z=1;!(a.words[0]&Z)&&D<26;++D,Z<<=1);if(D>0)for(a.iushrn(D);D-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(u),g.isub(b)),h.iushrn(1),g.iushrn(1);for(var F=0,q=1;!(f.words[0]&q)&&F<26;++F,q<<=1);if(F>0)for(f.iushrn(F);F-- >0;)(S.isOdd()||I.isOdd())&&(S.iadd(u),I.isub(b)),S.iushrn(1),I.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(S),g.isub(I)):(f.isub(a),S.isub(h),I.isub(g))}return{a:S,b:I,gcd:f.iushln(y)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=f.clone();a.cmpn(1)>0&&f.cmpn(1)>0;){for(var I=0,y=1;!(a.words[0]&y)&&I<26;++I,y<<=1);if(I>0)for(a.iushrn(I);I-- >0;)h.isOdd()&&h.iadd(S),h.iushrn(1);for(var u=0,b=1;!(f.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(f.iushrn(u);u-- >0;)g.isOdd()&&g.iadd(S),g.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(g)):(f.isub(a),g.isub(h))}var D;return a.cmpn(1)===0?D=h:D=g,D.cmpn(0)<0&&D.iadd(o),D},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var a=this.clone(),f=o.clone();a.negative=0,f.negative=0;for(var h=0;a.isEven()&&f.isEven();h++)a.iushrn(1),f.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;f.isEven();)f.iushrn(1);var g=a.cmp(f);if(g<0){var S=a;a=f,f=S}else if(g===0||f.cmpn(1)===0)break;a.isub(f)}while(!0);return f.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var a=o%26,f=(o-a)/26,h=1<>>26,I&=67108863,this.words[S]=I}return g!==0&&(this.words[S]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var a=o<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this.strip();var f;if(this.length>1)f=1;else{a&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;f=h===o?0:ho.length)return 1;if(this.length=0;f--){var h=this.words[f]|0,g=o.words[f]|0;if(h!==g){hg&&(a=1);break}}return a},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new G(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var C={k256:null,p224:null,p192:null,p25519:null};function O(d,o){this.name=d,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},O.prototype.ireduce=function(o){var a=o,f;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),f=a.bitLength();while(f>this.n);var h=f0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},O.prototype.split=function(o,a){o.iushrn(this.n,0,a)},O.prototype.imulK=function(o){return o.imul(this.k)};function z(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(z,O),z.prototype.split=function(o,a){for(var f=4194303,h=Math.min(o.length,9),g=0;g>>22,S=I}S>>>=22,o.words[g-10]=S,S===0&&o.length>10?o.length-=10:o.length-=9},z.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var a=0,f=0;f>>=26,o.words[f]=g,a=h}return a!==0&&(o.words[o.length++]=a),o},i._prime=function(o){if(C[o])return C[o];var a;if(o==="k256")a=new z;else if(o==="p224")a=new H;else if(o==="p192")a=new tt;else if(o==="p25519")a=new nt;else throw new Error("Unknown prime "+o);return C[o]=a,a};function G(d){if(typeof d=="string"){var o=i._prime(d);this.m=o.p,this.prime=o}else n(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}G.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},G.prototype._verify2=function(o,a){n((o.negative|a.negative)===0,"red works only with positives"),n(o.red&&o.red===a.red,"red works only with red numbers")},G.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},G.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},G.prototype.add=function(o,a){this._verify2(o,a);var f=o.add(a);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},G.prototype.iadd=function(o,a){this._verify2(o,a);var f=o.iadd(a);return f.cmp(this.m)>=0&&f.isub(this.m),f},G.prototype.sub=function(o,a){this._verify2(o,a);var f=o.sub(a);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},G.prototype.isub=function(o,a){this._verify2(o,a);var f=o.isub(a);return f.cmpn(0)<0&&f.iadd(this.m),f},G.prototype.shl=function(o,a){return this._verify1(o),this.imod(o.ushln(a))},G.prototype.imul=function(o,a){return this._verify2(o,a),this.imod(o.imul(a))},G.prototype.mul=function(o,a){return this._verify2(o,a),this.imod(o.mul(a))},G.prototype.isqr=function(o){return this.imul(o,o.clone())},G.prototype.sqr=function(o){return this.mul(o,o)},G.prototype.sqrt=function(o){if(o.isZero())return o.clone();var a=this.m.andln(3);if(n(a%2===1),a===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(o,f)}for(var h=this.m.subn(1),g=0;!h.isZero()&&h.andln(1)===0;)g++,h.iushrn(1);n(!h.isZero());var S=new i(1).toRed(this),I=S.redNeg(),y=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,y).cmp(I)!==0;)u.redIAdd(I);for(var b=this.pow(u,h),D=this.pow(o,h.addn(1).iushrn(1)),Z=this.pow(o,h),F=g;Z.cmp(S)!==0;){for(var q=Z,it=0;q.cmp(S)!==0;it++)q=q.redSqr();n(it=0;g--){for(var b=a.words[g],D=u-1;D>=0;D--){var Z=b>>D&1;if(S!==h[0]&&(S=this.sqr(S)),Z===0&&I===0){y=0;continue}I<<=1,I|=Z,y++,!(y!==f&&(g!==0||D!==0))&&(S=this.mul(S,h[I]),y=0,I=0)}u=26}return S},G.prototype.convertTo=function(o){var a=o.umod(this.m);return a===o?a.clone():a},G.prototype.convertFrom=function(o){var a=o.clone();return a.red=null,a},i.mont=function(o){return new M(o)};function M(d){G.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(M,G),M.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},M.prototype.convertFrom=function(o){var a=this.imod(o.mul(this.rinv));return a.red=null,a},M.prototype.imul=function(o,a){if(o.isZero()||a.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.mul=function(o,a){if(o.isZero()||a.isZero())return new i(0)._forceRed(this);var f=o.mul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.invm=function(o){var a=this.imod(o._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(r,Re)}(j0)),j0.exports}var q1={},F1={},j1,Vw;function cg(){if(Vw)return j1;Vw=1;var r=yr,t=r.Buffer,e={},n;for(n in r)r.hasOwnProperty(n)&&(n==="SlowBuffer"||n==="Buffer"||(e[n]=r[n]));var s=e.Buffer={};for(n in t)t.hasOwnProperty(n)&&(n==="allocUnsafe"||n==="allocUnsafeSlow"||(s[n]=t[n]));if(e.Buffer.prototype=t.prototype,(!s.from||s.from===Uint8Array.from)&&(s.from=function(i,c,l){if(typeof i=="number")throw new TypeError('The "value" argument must not be of type number. Received type '+typeof i);if(i&&typeof i.length>"u")throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof i);return t(i,c,l)}),s.alloc||(s.alloc=function(i,c,l){if(typeof i!="number")throw new TypeError('The "size" argument must be of type number. Received type '+typeof i);if(i<0||i>=2*(1<<30))throw new RangeError('The value "'+i+'" is invalid for option "size"');var p=t(i);return!c||c.length===0?p.fill(0):typeof l=="string"?p.fill(c,l):p.fill(c),p}),!e.kStringMaxLength)try{e.kStringMaxLength=Zt.process.binding("buffer").kStringMaxLength}catch{}return e.constants||(e.constants={MAX_LENGTH:e.kMaxLength},e.kStringMaxLength&&(e.constants.MAX_STRING_LENGTH=e.kStringMaxLength)),j1=e,j1}var K1={},Zw;function hg(){if(Zw)return K1;Zw=1;const r=br;function t(n){this._reporterState={obj:null,path:[],options:n||{},errors:[]}}K1.Reporter=t,t.prototype.isError=function(s){return s instanceof e},t.prototype.save=function(){const s=this._reporterState;return{obj:s.obj,pathLen:s.path.length}},t.prototype.restore=function(s){const i=this._reporterState;i.obj=s.obj,i.path=i.path.slice(0,s.pathLen)},t.prototype.enterKey=function(s){return this._reporterState.path.push(s)},t.prototype.exitKey=function(s){const i=this._reporterState;i.path=i.path.slice(0,s-1)},t.prototype.leaveKey=function(s,i,c){const l=this._reporterState;this.exitKey(s),l.obj!==null&&(l.obj[i]=c)},t.prototype.path=function(){return this._reporterState.path.join("/")},t.prototype.enterObject=function(){const s=this._reporterState,i=s.obj;return s.obj={},i},t.prototype.leaveObject=function(s){const i=this._reporterState,c=i.obj;return i.obj=s,c},t.prototype.error=function(s){let i;const c=this._reporterState,l=s instanceof e;if(l?i=s:i=new e(c.path.map(function(p){return"["+JSON.stringify(p)+"]"}).join(""),s.message||s,s.stack),!c.options.partial)throw i;return l||c.errors.push(i),i},t.prototype.wrapResult=function(s){const i=this._reporterState;return i.options.partial?{result:this.isError(s)?null:s,errors:i.errors}:s};function e(n,s){this.path=n,this.rethrow(s)}return r(e,Error),e.prototype.rethrow=function(s){if(this.message=s+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,e),!this.stack)try{throw new Error(this.message)}catch(i){this.stack=i.stack}return this},K1}var t0={},Ww;function Uc(){if(Ww)return t0;Ww=1;const r=br,t=hg().Reporter,e=cg().Buffer;function n(i,c){if(t.call(this,c),!e.isBuffer(i)){this.error("Input not Buffer");return}this.base=i,this.offset=0,this.length=i.length}r(n,t),t0.DecoderBuffer=n,n.isDecoderBuffer=function(c){return c instanceof n?!0:typeof c=="object"&&e.isBuffer(c.base)&&c.constructor.name==="DecoderBuffer"&&typeof c.offset=="number"&&typeof c.length=="number"&&typeof c.save=="function"&&typeof c.restore=="function"&&typeof c.isEmpty=="function"&&typeof c.readUInt8=="function"&&typeof c.skip=="function"&&typeof c.raw=="function"},n.prototype.save=function(){return{offset:this.offset,reporter:t.prototype.save.call(this)}},n.prototype.restore=function(c){const l=new n(this.base);return l.offset=c.offset,l.length=this.offset,this.offset=c.offset,t.prototype.restore.call(this,c.reporter),l},n.prototype.isEmpty=function(){return this.offset===this.length},n.prototype.readUInt8=function(c){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(c||"DecoderBuffer overrun")},n.prototype.skip=function(c,l){if(!(this.offset+c<=this.length))return this.error(l||"DecoderBuffer overrun");const p=new n(this.base);return p._reporterState=this._reporterState,p.offset=this.offset,p.length=this.offset+c,this.offset+=c,p},n.prototype.raw=function(c){return this.base.slice(c?c.offset:this.offset,this.length)};function s(i,c){if(Array.isArray(i))this.length=0,this.value=i.map(function(l){return s.isEncoderBuffer(l)||(l=new s(l,c)),this.length+=l.length,l},this);else if(typeof i=="number"){if(!(0<=i&&i<=255))return c.error("non-byte EncoderBuffer value");this.value=i,this.length=1}else if(typeof i=="string")this.value=i,this.length=e.byteLength(i);else if(e.isBuffer(i))this.value=i,this.length=i.length;else return c.error("Unsupported type: "+typeof i)}return t0.EncoderBuffer=s,s.isEncoderBuffer=function(c){return c instanceof s?!0:typeof c=="object"&&c.constructor.name==="EncoderBuffer"&&typeof c.length=="number"&&typeof c.join=="function"},s.prototype.join=function(c,l){return c||(c=e.alloc(this.length)),l||(l=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(p){p.join(c,l),l+=p.length}):(typeof this.value=="number"?c[l]=this.value:typeof this.value=="string"?c.write(this.value,l):e.isBuffer(this.value)&&this.value.copy(c,l),l+=this.length)),c},t0}var $1,Gw;function lg(){if(Gw)return $1;Gw=1;const r=hg().Reporter,t=Uc().EncoderBuffer,e=Uc().DecoderBuffer,n=Zi,s=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],i=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(s),c=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function l(m,v,_){const E={};this._baseState=E,E.name=_,E.enc=m,E.parent=v||null,E.children=null,E.tag=null,E.args=null,E.reverseArgs=null,E.choice=null,E.optional=!1,E.any=!1,E.obj=!1,E.use=null,E.useDecoder=null,E.key=null,E.default=null,E.explicit=null,E.implicit=null,E.contains=null,E.parent||(E.children=[],this._wrap())}$1=l;const p=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];return l.prototype.clone=function(){const v=this._baseState,_={};p.forEach(function(w){_[w]=v[w]});const E=new this.constructor(_.parent);return E._baseState=_,E},l.prototype._wrap=function(){const v=this._baseState;i.forEach(function(_){this[_]=function(){const w=new this.constructor(this);return v.children.push(w),w[_].apply(w,arguments)}},this)},l.prototype._init=function(v){const _=this._baseState;n(_.parent===null),v.call(this),_.children=_.children.filter(function(E){return E._baseState.parent===this},this),n.equal(_.children.length,1,"Root node can have only one child")},l.prototype._useArgs=function(v){const _=this._baseState,E=v.filter(function(w){return w instanceof this.constructor},this);v=v.filter(function(w){return!(w instanceof this.constructor)},this),E.length!==0&&(n(_.children===null),_.children=E,E.forEach(function(w){w._baseState.parent=this},this)),v.length!==0&&(n(_.args===null),_.args=v,_.reverseArgs=v.map(function(w){if(typeof w!="object"||w.constructor!==Object)return w;const x={};return Object.keys(w).forEach(function(A){A==(A|0)&&(A|=0);const B=w[A];x[B]=A}),x}))},c.forEach(function(m){l.prototype[m]=function(){const _=this._baseState;throw new Error(m+" not implemented for encoding: "+_.enc)}}),s.forEach(function(m){l.prototype[m]=function(){const _=this._baseState,E=Array.prototype.slice.call(arguments);return n(_.tag===null),_.tag=m,this._useArgs(E),this}}),l.prototype.use=function(v){n(v);const _=this._baseState;return n(_.use===null),_.use=v,this},l.prototype.optional=function(){const v=this._baseState;return v.optional=!0,this},l.prototype.def=function(v){const _=this._baseState;return n(_.default===null),_.default=v,_.optional=!0,this},l.prototype.explicit=function(v){const _=this._baseState;return n(_.explicit===null&&_.implicit===null),_.explicit=v,this},l.prototype.implicit=function(v){const _=this._baseState;return n(_.explicit===null&&_.implicit===null),_.implicit=v,this},l.prototype.obj=function(){const v=this._baseState,_=Array.prototype.slice.call(arguments);return v.obj=!0,_.length!==0&&this._useArgs(_),this},l.prototype.key=function(v){const _=this._baseState;return n(_.key===null),_.key=v,this},l.prototype.any=function(){const v=this._baseState;return v.any=!0,this},l.prototype.choice=function(v){const _=this._baseState;return n(_.choice===null),_.choice=v,this._useArgs(Object.keys(v).map(function(E){return v[E]})),this},l.prototype.contains=function(v){const _=this._baseState;return n(_.use===null),_.contains=v,this},l.prototype._decode=function(v,_){const E=this._baseState;if(E.parent===null)return v.wrapResult(E.children[0]._decode(v,_));let w=E.default,x=!0,A=null;if(E.key!==null&&(A=v.enterKey(E.key)),E.optional){let P=null;if(E.explicit!==null?P=E.explicit:E.implicit!==null?P=E.implicit:E.tag!==null&&(P=E.tag),P===null&&!E.any){const R=v.save();try{E.choice===null?this._decodeGeneric(E.tag,v,_):this._decodeChoice(v,_),x=!0}catch{x=!1}v.restore(R)}else if(x=this._peekTag(v,P,E.any),v.isError(x))return x}let B;if(E.obj&&x&&(B=v.enterObject()),x){if(E.explicit!==null){const R=this._decodeTag(v,E.explicit);if(v.isError(R))return R;v=R}const P=v.offset;if(E.use===null&&E.choice===null){let R;E.any&&(R=v.save());const C=this._decodeTag(v,E.implicit!==null?E.implicit:E.tag,E.any);if(v.isError(C))return C;E.any?w=v.raw(R):v=C}if(_&&_.track&&E.tag!==null&&_.track(v.path(),P,v.length,"tagged"),_&&_.track&&E.tag!==null&&_.track(v.path(),v.offset,v.length,"content"),E.any||(E.choice===null?w=this._decodeGeneric(E.tag,v,_):w=this._decodeChoice(v,_)),v.isError(w))return w;if(!E.any&&E.choice===null&&E.children!==null&&E.children.forEach(function(C){C._decode(v,_)}),E.contains&&(E.tag==="octstr"||E.tag==="bitstr")){const R=new e(w);w=this._getUse(E.contains,v._reporterState.obj)._decode(R,_)}}return E.obj&&x&&(w=v.leaveObject(B)),E.key!==null&&(w!==null||x===!0)?v.leaveKey(A,E.key,w):A!==null&&v.exitKey(A),w},l.prototype._decodeGeneric=function(v,_,E){const w=this._baseState;return v==="seq"||v==="set"?null:v==="seqof"||v==="setof"?this._decodeList(_,v,w.args[0],E):/str$/.test(v)?this._decodeStr(_,v,E):v==="objid"&&w.args?this._decodeObjid(_,w.args[0],w.args[1],E):v==="objid"?this._decodeObjid(_,null,null,E):v==="gentime"||v==="utctime"?this._decodeTime(_,v,E):v==="null_"?this._decodeNull(_,E):v==="bool"?this._decodeBool(_,E):v==="objDesc"?this._decodeStr(_,v,E):v==="int"||v==="enum"?this._decodeInt(_,w.args&&w.args[0],E):w.use!==null?this._getUse(w.use,_._reporterState.obj)._decode(_,E):_.error("unknown tag: "+v)},l.prototype._getUse=function(v,_){const E=this._baseState;return E.useDecoder=this._use(v,_),n(E.useDecoder._baseState.parent===null),E.useDecoder=E.useDecoder._baseState.children[0],E.implicit!==E.useDecoder._baseState.implicit&&(E.useDecoder=E.useDecoder.clone(),E.useDecoder._baseState.implicit=E.implicit),E.useDecoder},l.prototype._decodeChoice=function(v,_){const E=this._baseState;let w=null,x=!1;return Object.keys(E.choice).some(function(A){const B=v.save(),P=E.choice[A];try{const R=P._decode(v,_);if(v.isError(R))return!1;w={type:A,value:R},x=!0}catch{return v.restore(B),!1}return!0},this),x?w:v.error("Choice not matched")},l.prototype._createEncoderBuffer=function(v){return new t(v,this.reporter)},l.prototype._encode=function(v,_,E){const w=this._baseState;if(w.default!==null&&w.default===v)return;const x=this._encodeValue(v,_,E);if(x!==void 0&&!this._skipDefault(x,_,E))return x},l.prototype._encodeValue=function(v,_,E){const w=this._baseState;if(w.parent===null)return w.children[0]._encode(v,_||new r);let x=null;if(this.reporter=_,w.optional&&v===void 0)if(w.default!==null)v=w.default;else return;let A=null,B=!1;if(w.any)x=this._createEncoderBuffer(v);else if(w.choice)x=this._encodeChoice(v,_);else if(w.contains)A=this._getUse(w.contains,E)._encode(v,_),B=!0;else if(w.children)A=w.children.map(function(P){if(P._baseState.tag==="null_")return P._encode(null,_,v);if(P._baseState.key===null)return _.error("Child should have a key");const R=_.enterKey(P._baseState.key);if(typeof v!="object")return _.error("Child expected, but input is not object");const C=P._encode(v[P._baseState.key],_,v);return _.leaveKey(R),C},this).filter(function(P){return P}),A=this._createEncoderBuffer(A);else if(w.tag==="seqof"||w.tag==="setof"){if(!(w.args&&w.args.length===1))return _.error("Too many args for : "+w.tag);if(!Array.isArray(v))return _.error("seqof/setof, but data is not Array");const P=this.clone();P._baseState.implicit=null,A=this._createEncoderBuffer(v.map(function(R){const C=this._baseState;return this._getUse(C.args[0],v)._encode(R,_)},P))}else w.use!==null?x=this._getUse(w.use,E)._encode(v,_):(A=this._encodePrimitive(w.tag,v),B=!0);if(!w.any&&w.choice===null){const P=w.implicit!==null?w.implicit:w.tag,R=w.implicit===null?"universal":"context";P===null?w.use===null&&_.error("Tag could be omitted only for .use()"):w.use===null&&(x=this._encodeComposite(P,B,R,A))}return w.explicit!==null&&(x=this._encodeComposite(w.explicit,!1,"context",x)),x},l.prototype._encodeChoice=function(v,_){const E=this._baseState,w=E.choice[v.type];return w||n(!1,v.type+" not found in "+JSON.stringify(Object.keys(E.choice))),w._encode(v.value,_)},l.prototype._encodePrimitive=function(v,_){const E=this._baseState;if(/str$/.test(v))return this._encodeStr(_,v);if(v==="objid"&&E.args)return this._encodeObjid(_,E.reverseArgs[0],E.args[1]);if(v==="objid")return this._encodeObjid(_,null,null);if(v==="gentime"||v==="utctime")return this._encodeTime(_,v);if(v==="null_")return this._encodeNull();if(v==="int"||v==="enum")return this._encodeInt(_,E.args&&E.reverseArgs[0]);if(v==="bool")return this._encodeBool(_);if(v==="objDesc")return this._encodeStr(_,v);throw new Error("Unsupported tag: "+v)},l.prototype._isNumstr=function(v){return/^[0-9 ]*$/.test(v)},l.prototype._isPrintstr=function(v){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(v)},$1}var H1={},Yw;function dg(){return Yw||(Yw=1,function(r){function t(e){const n={};return Object.keys(e).forEach(function(s){(s|0)==s&&(s=s|0);const i=e[s];n[i]=s}),n}r.tagClass={0:"universal",1:"application",2:"context",3:"private"},r.tagClassByName=t(r.tagClass),r.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"},r.tagByName=t(r.tag)}(H1)),H1}var V1,Xw;function V_(){if(Xw)return V1;Xw=1;const r=br,t=cg().Buffer,e=lg(),n=dg();function s(p){this.enc="der",this.name=p.name,this.entity=p,this.tree=new i,this.tree._init(p.body)}V1=s,s.prototype.encode=function(m,v){return this.tree._encode(m,v).join()};function i(p){e.call(this,"der",p)}r(i,e),i.prototype._encodeComposite=function(m,v,_,E){const w=l(m,v,_,this.reporter);if(E.length<128){const B=t.alloc(2);return B[0]=w,B[1]=E.length,this._createEncoderBuffer([B,E])}let x=1;for(let B=E.length;B>=256;B>>=8)x++;const A=t.alloc(1+1+x);A[0]=w,A[1]=128|x;for(let B=1+x,P=E.length;P>0;B--,P>>=8)A[B]=P&255;return this._createEncoderBuffer([A,E])},i.prototype._encodeStr=function(m,v){if(v==="bitstr")return this._createEncoderBuffer([m.unused|0,m.data]);if(v==="bmpstr"){const _=t.alloc(m.length*2);for(let E=0;E=40)return this.reporter.error("Second objid identifier OOB");m.splice(0,2,m[0]*40+m[1])}let E=0;for(let A=0;A=128;B>>=7)E++}const w=t.alloc(E);let x=w.length-1;for(let A=m.length-1;A>=0;A--){let B=m[A];for(w[x--]=B&127;(B>>=7)>0;)w[x--]=128|B&127}return this._createEncoderBuffer(w)};function c(p){return p<10?"0"+p:p}i.prototype._encodeTime=function(m,v){let _;const E=new Date(m);return v==="gentime"?_=[c(E.getUTCFullYear()),c(E.getUTCMonth()+1),c(E.getUTCDate()),c(E.getUTCHours()),c(E.getUTCMinutes()),c(E.getUTCSeconds()),"Z"].join(""):v==="utctime"?_=[c(E.getUTCFullYear()%100),c(E.getUTCMonth()+1),c(E.getUTCDate()),c(E.getUTCHours()),c(E.getUTCMinutes()),c(E.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+v+" time is not supported yet"),this._encodeStr(_,"octstr")},i.prototype._encodeNull=function(){return this._createEncoderBuffer("")},i.prototype._encodeInt=function(m,v){if(typeof m=="string"){if(!v)return this.reporter.error("String int or enum given, but no values map");if(!v.hasOwnProperty(m))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(m));m=v[m]}if(typeof m!="number"&&!t.isBuffer(m)){const w=m.toArray();!m.sign&&w[0]&128&&w.unshift(0),m=t.from(w)}if(t.isBuffer(m)){let w=m.length;m.length===0&&w++;const x=t.alloc(w);return m.copy(x),m.length===0&&(x[0]=0),this._createEncoderBuffer(x)}if(m<128)return this._createEncoderBuffer(m);if(m<256)return this._createEncoderBuffer([0,m]);let _=1;for(let w=m;w>=256;w>>=8)_++;const E=new Array(_);for(let w=E.length-1;w>=0;w--)E[w]=m&255,m>>=8;return E[0]&128&&E.unshift(0),this._createEncoderBuffer(t.from(E))},i.prototype._encodeBool=function(m){return this._createEncoderBuffer(m?255:0)},i.prototype._use=function(m,v){return typeof m=="function"&&(m=m(v)),m._getEncoder("der").tree},i.prototype._skipDefault=function(m,v,_){const E=this._baseState;let w;if(E.default===null)return!1;const x=m.join();if(E.defaultBuffer===void 0&&(E.defaultBuffer=this._encodeValue(E.default,v,_).join()),x.length!==E.defaultBuffer.length)return!1;for(w=0;w=31?_.error("Multi-octet tag encoding unsupported"):(m||(E|=32),E|=n.tagClassByName[v||"universal"]<<6,E)}return V1}var Z1,Jw;function pC(){if(Jw)return Z1;Jw=1;const r=br,t=V_();function e(n){t.call(this,n),this.enc="pem"}return r(e,t),Z1=e,e.prototype.encode=function(s,i){const l=t.prototype.encode.call(this,s).toString("base64"),p=["-----BEGIN "+i.label+"-----"];for(let m=0;m>6],w=(_&32)===0;if((_&31)===31){let A=_;for(_=0;(A&128)===128;){if(A=m.readUInt8(v),m.isError(A))return A;_<<=7,_|=A&127}}else _&=31;const x=s.tag[_];return{cls:E,primitive:w,tag:_,tagStr:x}}function p(m,v,_){let E=m.readUInt8(_);if(m.isError(E))return E;if(!v&&E===128)return null;if(!(E&128))return E;const w=E&127;if(w>4)return m.error("length octect is too long");E=0;for(let x=0;x0&&C.ishrn(O),C}function x(P,R){P=w(P,R),P=P.mod(R);var C=r.from(P.toArray());if(C.length=0)throw new Error("invalid sig")}return rp=i,rp}var np,d6;function AC(){if(d6)return np;d6=1;var r=sr.Buffer,t=_h,e=V7,n=br,s=MC(),i=EC(),c=c_;Object.keys(c).forEach(function(_){c[_].id=r.from(c[_].id,"hex"),c[_.toLowerCase()]=c[_]});function l(_){e.Writable.call(this);var E=c[_];if(!E)throw new Error("Unknown message digest");this._hashType=E.hash,this._hash=t(E.hash),this._tag=E.id,this._signType=E.sign}n(l,e.Writable),l.prototype._write=function(E,w,x){this._hash.update(E),x()},l.prototype.update=function(E,w){return this._hash.update(typeof E=="string"?r.from(E,w):E),this},l.prototype.sign=function(E,w){this.end();var x=this._hash.digest(),A=s(x,E,this._hashType,this._signType,this._tag);return w?A.toString(w):A};function p(_){e.Writable.call(this);var E=c[_];if(!E)throw new Error("Unknown message digest");this._hash=t(E.hash),this._tag=E.id,this._signType=E.sign}n(p,e.Writable),p.prototype._write=function(E,w,x){this._hash.update(E),x()},p.prototype.update=function(E,w){return this._hash.update(typeof E=="string"?r.from(E,w):E),this},p.prototype.verify=function(E,w,x){var A=typeof w=="string"?r.from(w,x):w;this.end();var B=this._hash.digest();return i(A,B,E,this._signType,this._tag)};function m(_){return new l(_)}function v(_){return new p(_)}return np={Sign:m,Verify:v,createSign:m,createVerify:v},np}var K0={exports:{}};K0.exports;var p6;function SC(){return p6||(p6=1,function(r){(function(t,e){function n(d,o){if(!d)throw new Error(o||"Assertion failed")}function s(d,o){d.super_=o;var a=function(){};a.prototype=o.prototype,d.prototype=new a,d.prototype.constructor=d}function i(d,o,a){if(i.isBN(d))return d;this.negative=0,this.words=null,this.length=0,this.red=null,d!==null&&((o==="le"||o==="be")&&(a=o,o=10),this._init(d||0,o||10,a||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var c;try{typeof window<"u"&&typeof window.Buffer<"u"?c=window.Buffer:c=yr.Buffer}catch{}i.isBN=function(o){return o instanceof i?!0:o!==null&&typeof o=="object"&&o.constructor.wordSize===i.wordSize&&Array.isArray(o.words)},i.max=function(o,a){return o.cmp(a)>0?o:a},i.min=function(o,a){return o.cmp(a)<0?o:a},i.prototype._init=function(o,a,f){if(typeof o=="number")return this._initNumber(o,a,f);if(typeof o=="object")return this._initArray(o,a,f);a==="hex"&&(a=16),n(a===(a|0)&&a>=2&&a<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h=0;h-=3)S=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[g]|=S<>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);else if(f==="le")for(h=0,g=0;h>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);return this.strip()};function l(d,o){var a=d.charCodeAt(o);return a>=65&&a<=70?a-55:a>=97&&a<=102?a-87:a-48&15}function p(d,o,a){var f=l(d,a);return a-1>=o&&(f|=l(d,a-1)<<4),f}i.prototype._parseHex=function(o,a,f){this.length=Math.ceil((o.length-a)/6),this.words=new Array(this.length);for(var h=0;h=a;h-=2)I=p(o,a,h)<=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8;else{var y=o.length-a;for(h=y%2===0?a+1:a;h=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8}this.strip()};function m(d,o,a,f){for(var h=0,g=Math.min(d.length,a),S=o;S=49?h+=I-49+10:I>=17?h+=I-17+10:h+=I}return h}i.prototype._parseBase=function(o,a,f){this.words=[0],this.length=1;for(var h=0,g=1;g<=67108863;g*=a)h++;h--,g=g/a|0;for(var S=o.length-f,I=S%h,y=Math.min(S,S-I)+f,u=0,b=f;b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var v=["","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"],_=[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],E=[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];i.prototype.toString=function(o,a){o=o||10,a=a|0||1;var f;if(o===16||o==="hex"){f="";for(var h=0,g=0,S=0;S>>24-h&16777215,g!==0||S!==this.length-1?f=v[6-y.length]+y+f:f=y+f,h+=2,h>=26&&(h-=26,S--)}for(g!==0&&(f=g.toString(16)+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var u=_[o],b=E[o];f="";var D=this.clone();for(D.negative=0;!D.isZero();){var Z=D.modn(b).toString(o);D=D.idivn(b),D.isZero()?f=Z+f:f=v[u-Z.length]+Z+f}for(this.isZero()&&(f="0"+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,a){return n(typeof c<"u"),this.toArrayLike(c,o,a)},i.prototype.toArray=function(o,a){return this.toArrayLike(Array,o,a)},i.prototype.toArrayLike=function(o,a,f){var h=this.byteLength(),g=f||Math.max(1,h);n(h<=g,"byte array longer than desired length"),n(g>0,"Requested array length <= 0"),this.strip();var S=a==="le",I=new o(g),y,u,b=this.clone();if(S){for(u=0;!b.isZero();u++)y=b.andln(255),b.iushrn(8),I[u]=y;for(;u=4096&&(f+=13,a>>>=13),a>=64&&(f+=7,a>>>=7),a>=8&&(f+=4,a>>>=4),a>=2&&(f+=2,a>>>=2),f+a},i.prototype._zeroBits=function(o){if(o===0)return 26;var a=o,f=0;return a&8191||(f+=13,a>>>=13),a&127||(f+=7,a>>>=7),a&15||(f+=4,a>>>=4),a&3||(f+=2,a>>>=2),a&1||f++,f},i.prototype.bitLength=function(){var o=this.words[this.length-1],a=this._countBits(o);return(this.length-1)*26+a};function w(d){for(var o=new Array(d.bitLength()),a=0;a>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,a=0;ao.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var a;this.length>o.length?a=o:a=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var a,f;this.length>o.length?(a=this,f=o):(a=o,f=this);for(var h=0;ho.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var a=Math.ceil(o/26)|0,f=o%26;this._expand(a),f>0&&a--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-f),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,a){n(typeof o=="number"&&o>=0);var f=o/26|0,h=o%26;return this._expand(f+1),a?this.words[f]=this.words[f]|1<o.length?(f=this,h=o):(f=o,h=this);for(var g=0,S=0;S>>26;for(;g!==0&&S>>26;if(this.length=f.length,g!==0)this.words[this.length]=g,this.length++;else if(f!==this)for(;So.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var a=this.iadd(o);return o.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,g;f>0?(h=this,g=o):(h=o,g=this);for(var S=0,I=0;I>26,this.words[I]=a&67108863;for(;S!==0&&I>26,this.words[I]=a&67108863;if(S===0&&I>>26,D=y&67108863,Z=Math.min(u,o.length-1),F=Math.max(0,u-d.length+1);F<=Z;F++){var q=u-F|0;h=d.words[q]|0,g=o.words[F]|0,S=h*g+D,b+=S/67108864|0,D=S&67108863}a.words[u]=D|0,y=b|0}return y!==0?a.words[u]=y|0:a.length--,a.strip()}var A=function(o,a,f){var h=o.words,g=a.words,S=f.words,I=0,y,u,b,D=h[0]|0,Z=D&8191,F=D>>>13,q=h[1]|0,it=q&8191,at=q>>>13,Bt=h[2]|0,yt=Bt&8191,pt=Bt>>>13,Ft=h[3]|0,lt=Ft&8191,ct=Ft>>>13,Tt=h[4]|0,kt=Tt&8191,k=Tt>>>13,T=h[5]|0,L=T&8191,j=T>>>13,rt=h[6]|0,Q=rt&8191,ot=rt>>>13,qt=h[7]|0,It=qt&8191,xt=qt>>>13,Qt=h[8]|0,Ct=Qt&8191,Dt=Qt>>>13,Se=h[9]|0,te=Se&8191,Ut=Se>>>13,Te=g[0]|0,J=Te&8191,X=Te>>>13,st=g[1]|0,N=st&8191,$=st>>>13,gt=g[2]|0,ft=gt&8191,mt=gt>>>13,vt=g[3]|0,At=vt&8191,_t=vt>>>13,Gt=g[4]|0,Rt=Gt&8191,wt=Gt>>>13,se=g[5]|0,Lt=se&8191,Et=se>>>13,de=g[6]|0,Pt=de&8191,Mt=de>>>13,K=g[7]|0,Y=K&8191,V=K>>>13,U=g[8]|0,W=U&8191,et=U>>>13,dt=g[9]|0,ut=dt&8191,ht=dt>>>13;f.negative=o.negative^a.negative,f.length=19,y=Math.imul(Z,J),u=Math.imul(Z,X),u=u+Math.imul(F,J)|0,b=Math.imul(F,X);var zt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(zt>>>26)|0,zt&=67108863,y=Math.imul(it,J),u=Math.imul(it,X),u=u+Math.imul(at,J)|0,b=Math.imul(at,X),y=y+Math.imul(Z,N)|0,u=u+Math.imul(Z,$)|0,u=u+Math.imul(F,N)|0,b=b+Math.imul(F,$)|0;var Wt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,y=Math.imul(yt,J),u=Math.imul(yt,X),u=u+Math.imul(pt,J)|0,b=Math.imul(pt,X),y=y+Math.imul(it,N)|0,u=u+Math.imul(it,$)|0,u=u+Math.imul(at,N)|0,b=b+Math.imul(at,$)|0,y=y+Math.imul(Z,ft)|0,u=u+Math.imul(Z,mt)|0,u=u+Math.imul(F,ft)|0,b=b+Math.imul(F,mt)|0;var ye=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ye>>>26)|0,ye&=67108863,y=Math.imul(lt,J),u=Math.imul(lt,X),u=u+Math.imul(ct,J)|0,b=Math.imul(ct,X),y=y+Math.imul(yt,N)|0,u=u+Math.imul(yt,$)|0,u=u+Math.imul(pt,N)|0,b=b+Math.imul(pt,$)|0,y=y+Math.imul(it,ft)|0,u=u+Math.imul(it,mt)|0,u=u+Math.imul(at,ft)|0,b=b+Math.imul(at,mt)|0,y=y+Math.imul(Z,At)|0,u=u+Math.imul(Z,_t)|0,u=u+Math.imul(F,At)|0,b=b+Math.imul(F,_t)|0;var Yt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,y=Math.imul(kt,J),u=Math.imul(kt,X),u=u+Math.imul(k,J)|0,b=Math.imul(k,X),y=y+Math.imul(lt,N)|0,u=u+Math.imul(lt,$)|0,u=u+Math.imul(ct,N)|0,b=b+Math.imul(ct,$)|0,y=y+Math.imul(yt,ft)|0,u=u+Math.imul(yt,mt)|0,u=u+Math.imul(pt,ft)|0,b=b+Math.imul(pt,mt)|0,y=y+Math.imul(it,At)|0,u=u+Math.imul(it,_t)|0,u=u+Math.imul(at,At)|0,b=b+Math.imul(at,_t)|0,y=y+Math.imul(Z,Rt)|0,u=u+Math.imul(Z,wt)|0,u=u+Math.imul(F,Rt)|0,b=b+Math.imul(F,wt)|0;var pe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(pe>>>26)|0,pe&=67108863,y=Math.imul(L,J),u=Math.imul(L,X),u=u+Math.imul(j,J)|0,b=Math.imul(j,X),y=y+Math.imul(kt,N)|0,u=u+Math.imul(kt,$)|0,u=u+Math.imul(k,N)|0,b=b+Math.imul(k,$)|0,y=y+Math.imul(lt,ft)|0,u=u+Math.imul(lt,mt)|0,u=u+Math.imul(ct,ft)|0,b=b+Math.imul(ct,mt)|0,y=y+Math.imul(yt,At)|0,u=u+Math.imul(yt,_t)|0,u=u+Math.imul(pt,At)|0,b=b+Math.imul(pt,_t)|0,y=y+Math.imul(it,Rt)|0,u=u+Math.imul(it,wt)|0,u=u+Math.imul(at,Rt)|0,b=b+Math.imul(at,wt)|0,y=y+Math.imul(Z,Lt)|0,u=u+Math.imul(Z,Et)|0,u=u+Math.imul(F,Lt)|0,b=b+Math.imul(F,Et)|0;var ve=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ve>>>26)|0,ve&=67108863,y=Math.imul(Q,J),u=Math.imul(Q,X),u=u+Math.imul(ot,J)|0,b=Math.imul(ot,X),y=y+Math.imul(L,N)|0,u=u+Math.imul(L,$)|0,u=u+Math.imul(j,N)|0,b=b+Math.imul(j,$)|0,y=y+Math.imul(kt,ft)|0,u=u+Math.imul(kt,mt)|0,u=u+Math.imul(k,ft)|0,b=b+Math.imul(k,mt)|0,y=y+Math.imul(lt,At)|0,u=u+Math.imul(lt,_t)|0,u=u+Math.imul(ct,At)|0,b=b+Math.imul(ct,_t)|0,y=y+Math.imul(yt,Rt)|0,u=u+Math.imul(yt,wt)|0,u=u+Math.imul(pt,Rt)|0,b=b+Math.imul(pt,wt)|0,y=y+Math.imul(it,Lt)|0,u=u+Math.imul(it,Et)|0,u=u+Math.imul(at,Lt)|0,b=b+Math.imul(at,Et)|0,y=y+Math.imul(Z,Pt)|0,u=u+Math.imul(Z,Mt)|0,u=u+Math.imul(F,Pt)|0,b=b+Math.imul(F,Mt)|0;var ge=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ge>>>26)|0,ge&=67108863,y=Math.imul(It,J),u=Math.imul(It,X),u=u+Math.imul(xt,J)|0,b=Math.imul(xt,X),y=y+Math.imul(Q,N)|0,u=u+Math.imul(Q,$)|0,u=u+Math.imul(ot,N)|0,b=b+Math.imul(ot,$)|0,y=y+Math.imul(L,ft)|0,u=u+Math.imul(L,mt)|0,u=u+Math.imul(j,ft)|0,b=b+Math.imul(j,mt)|0,y=y+Math.imul(kt,At)|0,u=u+Math.imul(kt,_t)|0,u=u+Math.imul(k,At)|0,b=b+Math.imul(k,_t)|0,y=y+Math.imul(lt,Rt)|0,u=u+Math.imul(lt,wt)|0,u=u+Math.imul(ct,Rt)|0,b=b+Math.imul(ct,wt)|0,y=y+Math.imul(yt,Lt)|0,u=u+Math.imul(yt,Et)|0,u=u+Math.imul(pt,Lt)|0,b=b+Math.imul(pt,Et)|0,y=y+Math.imul(it,Pt)|0,u=u+Math.imul(it,Mt)|0,u=u+Math.imul(at,Pt)|0,b=b+Math.imul(at,Mt)|0,y=y+Math.imul(Z,Y)|0,u=u+Math.imul(Z,V)|0,u=u+Math.imul(F,Y)|0,b=b+Math.imul(F,V)|0;var ie=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ie>>>26)|0,ie&=67108863,y=Math.imul(Ct,J),u=Math.imul(Ct,X),u=u+Math.imul(Dt,J)|0,b=Math.imul(Dt,X),y=y+Math.imul(It,N)|0,u=u+Math.imul(It,$)|0,u=u+Math.imul(xt,N)|0,b=b+Math.imul(xt,$)|0,y=y+Math.imul(Q,ft)|0,u=u+Math.imul(Q,mt)|0,u=u+Math.imul(ot,ft)|0,b=b+Math.imul(ot,mt)|0,y=y+Math.imul(L,At)|0,u=u+Math.imul(L,_t)|0,u=u+Math.imul(j,At)|0,b=b+Math.imul(j,_t)|0,y=y+Math.imul(kt,Rt)|0,u=u+Math.imul(kt,wt)|0,u=u+Math.imul(k,Rt)|0,b=b+Math.imul(k,wt)|0,y=y+Math.imul(lt,Lt)|0,u=u+Math.imul(lt,Et)|0,u=u+Math.imul(ct,Lt)|0,b=b+Math.imul(ct,Et)|0,y=y+Math.imul(yt,Pt)|0,u=u+Math.imul(yt,Mt)|0,u=u+Math.imul(pt,Pt)|0,b=b+Math.imul(pt,Mt)|0,y=y+Math.imul(it,Y)|0,u=u+Math.imul(it,V)|0,u=u+Math.imul(at,Y)|0,b=b+Math.imul(at,V)|0,y=y+Math.imul(Z,W)|0,u=u+Math.imul(Z,et)|0,u=u+Math.imul(F,W)|0,b=b+Math.imul(F,et)|0;var ue=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ue>>>26)|0,ue&=67108863,y=Math.imul(te,J),u=Math.imul(te,X),u=u+Math.imul(Ut,J)|0,b=Math.imul(Ut,X),y=y+Math.imul(Ct,N)|0,u=u+Math.imul(Ct,$)|0,u=u+Math.imul(Dt,N)|0,b=b+Math.imul(Dt,$)|0,y=y+Math.imul(It,ft)|0,u=u+Math.imul(It,mt)|0,u=u+Math.imul(xt,ft)|0,b=b+Math.imul(xt,mt)|0,y=y+Math.imul(Q,At)|0,u=u+Math.imul(Q,_t)|0,u=u+Math.imul(ot,At)|0,b=b+Math.imul(ot,_t)|0,y=y+Math.imul(L,Rt)|0,u=u+Math.imul(L,wt)|0,u=u+Math.imul(j,Rt)|0,b=b+Math.imul(j,wt)|0,y=y+Math.imul(kt,Lt)|0,u=u+Math.imul(kt,Et)|0,u=u+Math.imul(k,Lt)|0,b=b+Math.imul(k,Et)|0,y=y+Math.imul(lt,Pt)|0,u=u+Math.imul(lt,Mt)|0,u=u+Math.imul(ct,Pt)|0,b=b+Math.imul(ct,Mt)|0,y=y+Math.imul(yt,Y)|0,u=u+Math.imul(yt,V)|0,u=u+Math.imul(pt,Y)|0,b=b+Math.imul(pt,V)|0,y=y+Math.imul(it,W)|0,u=u+Math.imul(it,et)|0,u=u+Math.imul(at,W)|0,b=b+Math.imul(at,et)|0,y=y+Math.imul(Z,ut)|0,u=u+Math.imul(Z,ht)|0,u=u+Math.imul(F,ut)|0,b=b+Math.imul(F,ht)|0;var fe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(fe>>>26)|0,fe&=67108863,y=Math.imul(te,N),u=Math.imul(te,$),u=u+Math.imul(Ut,N)|0,b=Math.imul(Ut,$),y=y+Math.imul(Ct,ft)|0,u=u+Math.imul(Ct,mt)|0,u=u+Math.imul(Dt,ft)|0,b=b+Math.imul(Dt,mt)|0,y=y+Math.imul(It,At)|0,u=u+Math.imul(It,_t)|0,u=u+Math.imul(xt,At)|0,b=b+Math.imul(xt,_t)|0,y=y+Math.imul(Q,Rt)|0,u=u+Math.imul(Q,wt)|0,u=u+Math.imul(ot,Rt)|0,b=b+Math.imul(ot,wt)|0,y=y+Math.imul(L,Lt)|0,u=u+Math.imul(L,Et)|0,u=u+Math.imul(j,Lt)|0,b=b+Math.imul(j,Et)|0,y=y+Math.imul(kt,Pt)|0,u=u+Math.imul(kt,Mt)|0,u=u+Math.imul(k,Pt)|0,b=b+Math.imul(k,Mt)|0,y=y+Math.imul(lt,Y)|0,u=u+Math.imul(lt,V)|0,u=u+Math.imul(ct,Y)|0,b=b+Math.imul(ct,V)|0,y=y+Math.imul(yt,W)|0,u=u+Math.imul(yt,et)|0,u=u+Math.imul(pt,W)|0,b=b+Math.imul(pt,et)|0,y=y+Math.imul(it,ut)|0,u=u+Math.imul(it,ht)|0,u=u+Math.imul(at,ut)|0,b=b+Math.imul(at,ht)|0;var ce=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ce>>>26)|0,ce&=67108863,y=Math.imul(te,ft),u=Math.imul(te,mt),u=u+Math.imul(Ut,ft)|0,b=Math.imul(Ut,mt),y=y+Math.imul(Ct,At)|0,u=u+Math.imul(Ct,_t)|0,u=u+Math.imul(Dt,At)|0,b=b+Math.imul(Dt,_t)|0,y=y+Math.imul(It,Rt)|0,u=u+Math.imul(It,wt)|0,u=u+Math.imul(xt,Rt)|0,b=b+Math.imul(xt,wt)|0,y=y+Math.imul(Q,Lt)|0,u=u+Math.imul(Q,Et)|0,u=u+Math.imul(ot,Lt)|0,b=b+Math.imul(ot,Et)|0,y=y+Math.imul(L,Pt)|0,u=u+Math.imul(L,Mt)|0,u=u+Math.imul(j,Pt)|0,b=b+Math.imul(j,Mt)|0,y=y+Math.imul(kt,Y)|0,u=u+Math.imul(kt,V)|0,u=u+Math.imul(k,Y)|0,b=b+Math.imul(k,V)|0,y=y+Math.imul(lt,W)|0,u=u+Math.imul(lt,et)|0,u=u+Math.imul(ct,W)|0,b=b+Math.imul(ct,et)|0,y=y+Math.imul(yt,ut)|0,u=u+Math.imul(yt,ht)|0,u=u+Math.imul(pt,ut)|0,b=b+Math.imul(pt,ht)|0;var Kt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,y=Math.imul(te,At),u=Math.imul(te,_t),u=u+Math.imul(Ut,At)|0,b=Math.imul(Ut,_t),y=y+Math.imul(Ct,Rt)|0,u=u+Math.imul(Ct,wt)|0,u=u+Math.imul(Dt,Rt)|0,b=b+Math.imul(Dt,wt)|0,y=y+Math.imul(It,Lt)|0,u=u+Math.imul(It,Et)|0,u=u+Math.imul(xt,Lt)|0,b=b+Math.imul(xt,Et)|0,y=y+Math.imul(Q,Pt)|0,u=u+Math.imul(Q,Mt)|0,u=u+Math.imul(ot,Pt)|0,b=b+Math.imul(ot,Mt)|0,y=y+Math.imul(L,Y)|0,u=u+Math.imul(L,V)|0,u=u+Math.imul(j,Y)|0,b=b+Math.imul(j,V)|0,y=y+Math.imul(kt,W)|0,u=u+Math.imul(kt,et)|0,u=u+Math.imul(k,W)|0,b=b+Math.imul(k,et)|0,y=y+Math.imul(lt,ut)|0,u=u+Math.imul(lt,ht)|0,u=u+Math.imul(ct,ut)|0,b=b+Math.imul(ct,ht)|0;var oe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(oe>>>26)|0,oe&=67108863,y=Math.imul(te,Rt),u=Math.imul(te,wt),u=u+Math.imul(Ut,Rt)|0,b=Math.imul(Ut,wt),y=y+Math.imul(Ct,Lt)|0,u=u+Math.imul(Ct,Et)|0,u=u+Math.imul(Dt,Lt)|0,b=b+Math.imul(Dt,Et)|0,y=y+Math.imul(It,Pt)|0,u=u+Math.imul(It,Mt)|0,u=u+Math.imul(xt,Pt)|0,b=b+Math.imul(xt,Mt)|0,y=y+Math.imul(Q,Y)|0,u=u+Math.imul(Q,V)|0,u=u+Math.imul(ot,Y)|0,b=b+Math.imul(ot,V)|0,y=y+Math.imul(L,W)|0,u=u+Math.imul(L,et)|0,u=u+Math.imul(j,W)|0,b=b+Math.imul(j,et)|0,y=y+Math.imul(kt,ut)|0,u=u+Math.imul(kt,ht)|0,u=u+Math.imul(k,ut)|0,b=b+Math.imul(k,ht)|0;var Jt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,y=Math.imul(te,Lt),u=Math.imul(te,Et),u=u+Math.imul(Ut,Lt)|0,b=Math.imul(Ut,Et),y=y+Math.imul(Ct,Pt)|0,u=u+Math.imul(Ct,Mt)|0,u=u+Math.imul(Dt,Pt)|0,b=b+Math.imul(Dt,Mt)|0,y=y+Math.imul(It,Y)|0,u=u+Math.imul(It,V)|0,u=u+Math.imul(xt,Y)|0,b=b+Math.imul(xt,V)|0,y=y+Math.imul(Q,W)|0,u=u+Math.imul(Q,et)|0,u=u+Math.imul(ot,W)|0,b=b+Math.imul(ot,et)|0,y=y+Math.imul(L,ut)|0,u=u+Math.imul(L,ht)|0,u=u+Math.imul(j,ut)|0,b=b+Math.imul(j,ht)|0;var le=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(le>>>26)|0,le&=67108863,y=Math.imul(te,Pt),u=Math.imul(te,Mt),u=u+Math.imul(Ut,Pt)|0,b=Math.imul(Ut,Mt),y=y+Math.imul(Ct,Y)|0,u=u+Math.imul(Ct,V)|0,u=u+Math.imul(Dt,Y)|0,b=b+Math.imul(Dt,V)|0,y=y+Math.imul(It,W)|0,u=u+Math.imul(It,et)|0,u=u+Math.imul(xt,W)|0,b=b+Math.imul(xt,et)|0,y=y+Math.imul(Q,ut)|0,u=u+Math.imul(Q,ht)|0,u=u+Math.imul(ot,ut)|0,b=b+Math.imul(ot,ht)|0;var ae=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ae>>>26)|0,ae&=67108863,y=Math.imul(te,Y),u=Math.imul(te,V),u=u+Math.imul(Ut,Y)|0,b=Math.imul(Ut,V),y=y+Math.imul(Ct,W)|0,u=u+Math.imul(Ct,et)|0,u=u+Math.imul(Dt,W)|0,b=b+Math.imul(Dt,et)|0,y=y+Math.imul(It,ut)|0,u=u+Math.imul(It,ht)|0,u=u+Math.imul(xt,ut)|0,b=b+Math.imul(xt,ht)|0;var ne=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ne>>>26)|0,ne&=67108863,y=Math.imul(te,W),u=Math.imul(te,et),u=u+Math.imul(Ut,W)|0,b=Math.imul(Ut,et),y=y+Math.imul(Ct,ut)|0,u=u+Math.imul(Ct,ht)|0,u=u+Math.imul(Dt,ut)|0,b=b+Math.imul(Dt,ht)|0;var Ot=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,y=Math.imul(te,ut),u=Math.imul(te,ht),u=u+Math.imul(Ut,ut)|0,b=Math.imul(Ut,ht);var Nt=(I+y|0)+((u&8191)<<13)|0;return I=(b+(u>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,S[0]=zt,S[1]=Wt,S[2]=ye,S[3]=Yt,S[4]=pe,S[5]=ve,S[6]=ge,S[7]=ie,S[8]=ue,S[9]=fe,S[10]=ce,S[11]=Kt,S[12]=oe,S[13]=Jt,S[14]=le,S[15]=ae,S[16]=ne,S[17]=Ot,S[18]=Nt,I!==0&&(S[19]=I,f.length++),f};Math.imul||(A=x);function B(d,o,a){a.negative=o.negative^d.negative,a.length=d.length+o.length;for(var f=0,h=0,g=0;g>>26)|0,h+=S>>>26,S&=67108863}a.words[g]=I,f=S,S=h}return f!==0?a.words[g]=f:a.length--,a.strip()}function P(d,o,a){var f=new R;return f.mulp(d,o,a)}i.prototype.mulTo=function(o,a){var f,h=this.length+o.length;return this.length===10&&o.length===10?f=A(this,o,a):h<63?f=x(this,o,a):h<1024?f=B(this,o,a):f=P(this,o,a),f};function R(d,o){this.x=d,this.y=o}R.prototype.makeRBT=function(o){for(var a=new Array(o),f=i.prototype._countBits(o)-1,h=0;h>=1;return h},R.prototype.permute=function(o,a,f,h,g,S){for(var I=0;I>>1)g++;return 1<>>13,f[2*S+1]=g&8191,g=g>>>13;for(S=2*a;S>=26,a+=h/67108864|0,a+=g>>>26,this.words[f]=g&67108863}return a!==0&&(this.words[f]=a,this.length++),this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var a=w(o);if(a.length===0)return new i(1);for(var f=this,h=0;h=0);var a=o%26,f=(o-a)/26,h=67108863>>>26-a<<26-a,g;if(a!==0){var S=0;for(g=0;g>>26-a}S&&(this.words[g]=S,this.length++)}if(f!==0){for(g=this.length-1;g>=0;g--)this.words[g+f]=this.words[g];for(g=0;g=0);var h;a?h=(a-a%26)/26:h=0;var g=o%26,S=Math.min((o-g)/26,this.length),I=67108863^67108863>>>g<S)for(this.length-=S,u=0;u=0&&(b!==0||u>=h);u--){var D=this.words[u]|0;this.words[u]=b<<26-g|D>>>g,b=D&I}return y&&b!==0&&(y.words[y.length++]=b),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,a,f){return n(this.negative===0),this.iushrn(o,a,f)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var a=o%26,f=(o-a)/26,h=1<=0);var a=o%26,f=(o-a)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(a!==0&&f++,this.length=Math.min(f,this.length),a!==0){var h=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},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(y/67108864|0),this.words[g+f]=S&67108863}for(;g>26,this.words[g+f]=S&67108863;if(I===0)return this.strip();for(n(I===-1),I=0,g=0;g>26,this.words[g]=S&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,a){var f=this.length-o.length,h=this.clone(),g=o,S=g.words[g.length-1]|0,I=this._countBits(S);f=26-I,f!==0&&(g=g.ushln(f),h.iushln(f),S=g.words[g.length-1]|0);var y=h.length-g.length,u;if(a!=="mod"){u=new i(null),u.length=y+1,u.words=new Array(u.length);for(var b=0;b=0;Z--){var F=(h.words[g.length+Z]|0)*67108864+(h.words[g.length+Z-1]|0);for(F=Math.min(F/S|0,67108863),h._ishlnsubmul(g,F,Z);h.negative!==0;)F--,h.negative=0,h._ishlnsubmul(g,1,Z),h.isZero()||(h.negative^=1);u&&(u.words[Z]=F)}return u&&u.strip(),h.strip(),a!=="div"&&f!==0&&h.iushrn(f),{div:u||null,mod:h}},i.prototype.divmod=function(o,a,f){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,g,S;return this.negative!==0&&o.negative===0?(S=this.neg().divmod(o,a),a!=="mod"&&(h=S.div.neg()),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.iadd(o)),{div:h,mod:g}):this.negative===0&&o.negative!==0?(S=this.divmod(o.neg(),a),a!=="mod"&&(h=S.div.neg()),{div:h,mod:S.mod}):this.negative&o.negative?(S=this.neg().divmod(o.neg(),a),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.isub(o)),{div:S.div,mod:g}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?a==="div"?{div:this.divn(o.words[0]),mod:null}:a==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,a)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var a=this.divmod(o);if(a.mod.isZero())return a.div;var f=a.div.negative!==0?a.mod.isub(o):a.mod,h=o.ushrn(1),g=o.andln(1),S=f.cmp(h);return S<0||g===1&&S===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var a=(1<<26)%o,f=0,h=this.length-1;h>=0;h--)f=(a*f+(this.words[h]|0))%o;return f},i.prototype.idivn=function(o){n(o<=67108863);for(var a=0,f=this.length-1;f>=0;f--){var h=(this.words[f]|0)+a*67108864;this.words[f]=h/o|0,a=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=new i(0),I=new i(1),y=0;a.isEven()&&f.isEven();)a.iushrn(1),f.iushrn(1),++y;for(var u=f.clone(),b=a.clone();!a.isZero();){for(var D=0,Z=1;!(a.words[0]&Z)&&D<26;++D,Z<<=1);if(D>0)for(a.iushrn(D);D-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(u),g.isub(b)),h.iushrn(1),g.iushrn(1);for(var F=0,q=1;!(f.words[0]&q)&&F<26;++F,q<<=1);if(F>0)for(f.iushrn(F);F-- >0;)(S.isOdd()||I.isOdd())&&(S.iadd(u),I.isub(b)),S.iushrn(1),I.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(S),g.isub(I)):(f.isub(a),S.isub(h),I.isub(g))}return{a:S,b:I,gcd:f.iushln(y)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=f.clone();a.cmpn(1)>0&&f.cmpn(1)>0;){for(var I=0,y=1;!(a.words[0]&y)&&I<26;++I,y<<=1);if(I>0)for(a.iushrn(I);I-- >0;)h.isOdd()&&h.iadd(S),h.iushrn(1);for(var u=0,b=1;!(f.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(f.iushrn(u);u-- >0;)g.isOdd()&&g.iadd(S),g.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(g)):(f.isub(a),g.isub(h))}var D;return a.cmpn(1)===0?D=h:D=g,D.cmpn(0)<0&&D.iadd(o),D},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var a=this.clone(),f=o.clone();a.negative=0,f.negative=0;for(var h=0;a.isEven()&&f.isEven();h++)a.iushrn(1),f.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;f.isEven();)f.iushrn(1);var g=a.cmp(f);if(g<0){var S=a;a=f,f=S}else if(g===0||f.cmpn(1)===0)break;a.isub(f)}while(!0);return f.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var a=o%26,f=(o-a)/26,h=1<>>26,I&=67108863,this.words[S]=I}return g!==0&&(this.words[S]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var a=o<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this.strip();var f;if(this.length>1)f=1;else{a&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;f=h===o?0:ho.length)return 1;if(this.length=0;f--){var h=this.words[f]|0,g=o.words[f]|0;if(h!==g){hg&&(a=1);break}}return a},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new G(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var C={k256:null,p224:null,p192:null,p25519:null};function O(d,o){this.name=d,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},O.prototype.ireduce=function(o){var a=o,f;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),f=a.bitLength();while(f>this.n);var h=f0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},O.prototype.split=function(o,a){o.iushrn(this.n,0,a)},O.prototype.imulK=function(o){return o.imul(this.k)};function z(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(z,O),z.prototype.split=function(o,a){for(var f=4194303,h=Math.min(o.length,9),g=0;g>>22,S=I}S>>>=22,o.words[g-10]=S,S===0&&o.length>10?o.length-=10:o.length-=9},z.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var a=0,f=0;f>>=26,o.words[f]=g,a=h}return a!==0&&(o.words[o.length++]=a),o},i._prime=function(o){if(C[o])return C[o];var a;if(o==="k256")a=new z;else if(o==="p224")a=new H;else if(o==="p192")a=new tt;else if(o==="p25519")a=new nt;else throw new Error("Unknown prime "+o);return C[o]=a,a};function G(d){if(typeof d=="string"){var o=i._prime(d);this.m=o.p,this.prime=o}else n(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}G.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},G.prototype._verify2=function(o,a){n((o.negative|a.negative)===0,"red works only with positives"),n(o.red&&o.red===a.red,"red works only with red numbers")},G.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},G.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},G.prototype.add=function(o,a){this._verify2(o,a);var f=o.add(a);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},G.prototype.iadd=function(o,a){this._verify2(o,a);var f=o.iadd(a);return f.cmp(this.m)>=0&&f.isub(this.m),f},G.prototype.sub=function(o,a){this._verify2(o,a);var f=o.sub(a);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},G.prototype.isub=function(o,a){this._verify2(o,a);var f=o.isub(a);return f.cmpn(0)<0&&f.iadd(this.m),f},G.prototype.shl=function(o,a){return this._verify1(o),this.imod(o.ushln(a))},G.prototype.imul=function(o,a){return this._verify2(o,a),this.imod(o.imul(a))},G.prototype.mul=function(o,a){return this._verify2(o,a),this.imod(o.mul(a))},G.prototype.isqr=function(o){return this.imul(o,o.clone())},G.prototype.sqr=function(o){return this.mul(o,o)},G.prototype.sqrt=function(o){if(o.isZero())return o.clone();var a=this.m.andln(3);if(n(a%2===1),a===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(o,f)}for(var h=this.m.subn(1),g=0;!h.isZero()&&h.andln(1)===0;)g++,h.iushrn(1);n(!h.isZero());var S=new i(1).toRed(this),I=S.redNeg(),y=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,y).cmp(I)!==0;)u.redIAdd(I);for(var b=this.pow(u,h),D=this.pow(o,h.addn(1).iushrn(1)),Z=this.pow(o,h),F=g;Z.cmp(S)!==0;){for(var q=Z,it=0;q.cmp(S)!==0;it++)q=q.redSqr();n(it=0;g--){for(var b=a.words[g],D=u-1;D>=0;D--){var Z=b>>D&1;if(S!==h[0]&&(S=this.sqr(S)),Z===0&&I===0){y=0;continue}I<<=1,I|=Z,y++,!(y!==f&&(g!==0||D!==0))&&(S=this.mul(S,h[I]),y=0,I=0)}u=26}return S},G.prototype.convertTo=function(o){var a=o.umod(this.m);return a===o?a.clone():a},G.prototype.convertFrom=function(o){var a=o.clone();return a.red=null,a},i.mont=function(o){return new M(o)};function M(d){G.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(M,G),M.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},M.prototype.convertFrom=function(o){var a=this.imod(o.mul(this.rinv));return a.red=null,a},M.prototype.imul=function(o,a){if(o.isZero()||a.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.mul=function(o,a){if(o.isZero()||a.isZero())return new i(0)._forceRed(this);var f=o.mul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.invm=function(o){var a=this.imod(o._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(r,Re)}(K0)),K0.exports}var ip,m6;function kC(){if(m6)return ip;m6=1;var r=fg(),t=SC();ip=function(c){return new n(c)};var e={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}};e.p224=e.secp224r1,e.p256=e.secp256r1=e.prime256v1,e.p192=e.secp192r1=e.prime192v1,e.p384=e.secp384r1,e.p521=e.secp521r1;function n(i){this.curveType=e[i],this.curveType||(this.curveType={name:i}),this.curve=new r.ec(this.curveType.name),this.keys=void 0}n.prototype.generateKeys=function(i,c){return this.keys=this.curve.genKeyPair(),this.getPublicKey(i,c)},n.prototype.computeSecret=function(i,c,l){c=c||"utf8",Zt.Buffer.isBuffer(i)||(i=new Zt.Buffer(i,c));var p=this.curve.keyFromPublic(i).getPublic(),m=p.mul(this.keys.getPrivate()).getX();return s(m,l,this.curveType.byteLength)},n.prototype.getPublicKey=function(i,c){var l=this.keys.getPublic(c==="compressed",!0);return c==="hybrid"&&(l[l.length-1]%2?l[0]=7:l[0]=6),s(l,i)},n.prototype.getPrivateKey=function(i){return s(this.keys.getPrivate(),i)},n.prototype.setPublicKey=function(i,c){return c=c||"utf8",Zt.Buffer.isBuffer(i)||(i=new Zt.Buffer(i,c)),this.keys._importPublic(i),this},n.prototype.setPrivateKey=function(i,c){c=c||"utf8",Zt.Buffer.isBuffer(i)||(i=new Zt.Buffer(i,c));var l=new t(i);return l=l.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(l),this};function s(i,c,l){Array.isArray(i)||(i=i.toArray());var p=new Zt.Buffer(i);if(l&&p.length0?o:a},i.min=function(o,a){return o.cmp(a)<0?o:a},i.prototype._init=function(o,a,f){if(typeof o=="number")return this._initNumber(o,a,f);if(typeof o=="object")return this._initArray(o,a,f);a==="hex"&&(a=16),n(a===(a|0)&&a>=2&&a<=36),o=o.toString().replace(/\s+/g,"");var h=0;o[0]==="-"&&(h++,this.negative=1),h=0;h-=3)S=o[h]|o[h-1]<<8|o[h-2]<<16,this.words[g]|=S<>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);else if(f==="le")for(h=0,g=0;h>>26-I&67108863,I+=24,I>=26&&(I-=26,g++);return this.strip()};function l(d,o){var a=d.charCodeAt(o);return a>=65&&a<=70?a-55:a>=97&&a<=102?a-87:a-48&15}function p(d,o,a){var f=l(d,a);return a-1>=o&&(f|=l(d,a-1)<<4),f}i.prototype._parseHex=function(o,a,f){this.length=Math.ceil((o.length-a)/6),this.words=new Array(this.length);for(var h=0;h=a;h-=2)I=p(o,a,h)<=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8;else{var y=o.length-a;for(h=y%2===0?a+1:a;h=18?(g-=18,S+=1,this.words[S]|=I>>>26):g+=8}this.strip()};function m(d,o,a,f){for(var h=0,g=Math.min(d.length,a),S=o;S=49?h+=I-49+10:I>=17?h+=I-17+10:h+=I}return h}i.prototype._parseBase=function(o,a,f){this.words=[0],this.length=1;for(var h=0,g=1;g<=67108863;g*=a)h++;h--,g=g/a|0;for(var S=o.length-f,I=S%h,y=Math.min(S,S-I)+f,u=0,b=f;b1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},i.prototype.inspect=function(){return(this.red?""};var v=["","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"],_=[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],E=[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];i.prototype.toString=function(o,a){o=o||10,a=a|0||1;var f;if(o===16||o==="hex"){f="";for(var h=0,g=0,S=0;S>>24-h&16777215,g!==0||S!==this.length-1?f=v[6-y.length]+y+f:f=y+f,h+=2,h>=26&&(h-=26,S--)}for(g!==0&&(f=g.toString(16)+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}if(o===(o|0)&&o>=2&&o<=36){var u=_[o],b=E[o];f="";var D=this.clone();for(D.negative=0;!D.isZero();){var Z=D.modn(b).toString(o);D=D.idivn(b),D.isZero()?f=Z+f:f=v[u-Z.length]+Z+f}for(this.isZero()&&(f="0"+f);f.length%a!==0;)f="0"+f;return this.negative!==0&&(f="-"+f),f}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var o=this.words[0];return this.length===2?o+=this.words[1]*67108864:this.length===3&&this.words[2]===1?o+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-o:o},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(o,a){return n(typeof c<"u"),this.toArrayLike(c,o,a)},i.prototype.toArray=function(o,a){return this.toArrayLike(Array,o,a)},i.prototype.toArrayLike=function(o,a,f){var h=this.byteLength(),g=f||Math.max(1,h);n(h<=g,"byte array longer than desired length"),n(g>0,"Requested array length <= 0"),this.strip();var S=a==="le",I=new o(g),y,u,b=this.clone();if(S){for(u=0;!b.isZero();u++)y=b.andln(255),b.iushrn(8),I[u]=y;for(;u=4096&&(f+=13,a>>>=13),a>=64&&(f+=7,a>>>=7),a>=8&&(f+=4,a>>>=4),a>=2&&(f+=2,a>>>=2),f+a},i.prototype._zeroBits=function(o){if(o===0)return 26;var a=o,f=0;return a&8191||(f+=13,a>>>=13),a&127||(f+=7,a>>>=7),a&15||(f+=4,a>>>=4),a&3||(f+=2,a>>>=2),a&1||f++,f},i.prototype.bitLength=function(){var o=this.words[this.length-1],a=this._countBits(o);return(this.length-1)*26+a};function w(d){for(var o=new Array(d.bitLength()),a=0;a>>h}return o}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var o=0,a=0;ao.length?this.clone().ior(o):o.clone().ior(this)},i.prototype.uor=function(o){return this.length>o.length?this.clone().iuor(o):o.clone().iuor(this)},i.prototype.iuand=function(o){var a;this.length>o.length?a=o:a=this;for(var f=0;fo.length?this.clone().iand(o):o.clone().iand(this)},i.prototype.uand=function(o){return this.length>o.length?this.clone().iuand(o):o.clone().iuand(this)},i.prototype.iuxor=function(o){var a,f;this.length>o.length?(a=this,f=o):(a=o,f=this);for(var h=0;ho.length?this.clone().ixor(o):o.clone().ixor(this)},i.prototype.uxor=function(o){return this.length>o.length?this.clone().iuxor(o):o.clone().iuxor(this)},i.prototype.inotn=function(o){n(typeof o=="number"&&o>=0);var a=Math.ceil(o/26)|0,f=o%26;this._expand(a),f>0&&a--;for(var h=0;h0&&(this.words[h]=~this.words[h]&67108863>>26-f),this.strip()},i.prototype.notn=function(o){return this.clone().inotn(o)},i.prototype.setn=function(o,a){n(typeof o=="number"&&o>=0);var f=o/26|0,h=o%26;return this._expand(f+1),a?this.words[f]=this.words[f]|1<o.length?(f=this,h=o):(f=o,h=this);for(var g=0,S=0;S>>26;for(;g!==0&&S>>26;if(this.length=f.length,g!==0)this.words[this.length]=g,this.length++;else if(f!==this)for(;So.length?this.clone().iadd(o):o.clone().iadd(this)},i.prototype.isub=function(o){if(o.negative!==0){o.negative=0;var a=this.iadd(o);return o.negative=1,a._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(o),this.negative=1,this._normSign();var f=this.cmp(o);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;var h,g;f>0?(h=this,g=o):(h=o,g=this);for(var S=0,I=0;I>26,this.words[I]=a&67108863;for(;S!==0&&I>26,this.words[I]=a&67108863;if(S===0&&I>>26,D=y&67108863,Z=Math.min(u,o.length-1),F=Math.max(0,u-d.length+1);F<=Z;F++){var q=u-F|0;h=d.words[q]|0,g=o.words[F]|0,S=h*g+D,b+=S/67108864|0,D=S&67108863}a.words[u]=D|0,y=b|0}return y!==0?a.words[u]=y|0:a.length--,a.strip()}var A=function(o,a,f){var h=o.words,g=a.words,S=f.words,I=0,y,u,b,D=h[0]|0,Z=D&8191,F=D>>>13,q=h[1]|0,it=q&8191,at=q>>>13,Bt=h[2]|0,yt=Bt&8191,pt=Bt>>>13,Ft=h[3]|0,lt=Ft&8191,ct=Ft>>>13,Tt=h[4]|0,kt=Tt&8191,k=Tt>>>13,T=h[5]|0,L=T&8191,j=T>>>13,rt=h[6]|0,Q=rt&8191,ot=rt>>>13,qt=h[7]|0,It=qt&8191,xt=qt>>>13,Qt=h[8]|0,Ct=Qt&8191,Dt=Qt>>>13,Se=h[9]|0,te=Se&8191,Ut=Se>>>13,Te=g[0]|0,J=Te&8191,X=Te>>>13,st=g[1]|0,N=st&8191,$=st>>>13,gt=g[2]|0,ft=gt&8191,mt=gt>>>13,vt=g[3]|0,At=vt&8191,_t=vt>>>13,Gt=g[4]|0,Rt=Gt&8191,wt=Gt>>>13,se=g[5]|0,Lt=se&8191,Et=se>>>13,de=g[6]|0,Pt=de&8191,Mt=de>>>13,K=g[7]|0,Y=K&8191,V=K>>>13,U=g[8]|0,W=U&8191,et=U>>>13,dt=g[9]|0,ut=dt&8191,ht=dt>>>13;f.negative=o.negative^a.negative,f.length=19,y=Math.imul(Z,J),u=Math.imul(Z,X),u=u+Math.imul(F,J)|0,b=Math.imul(F,X);var zt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(zt>>>26)|0,zt&=67108863,y=Math.imul(it,J),u=Math.imul(it,X),u=u+Math.imul(at,J)|0,b=Math.imul(at,X),y=y+Math.imul(Z,N)|0,u=u+Math.imul(Z,$)|0,u=u+Math.imul(F,N)|0,b=b+Math.imul(F,$)|0;var Wt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,y=Math.imul(yt,J),u=Math.imul(yt,X),u=u+Math.imul(pt,J)|0,b=Math.imul(pt,X),y=y+Math.imul(it,N)|0,u=u+Math.imul(it,$)|0,u=u+Math.imul(at,N)|0,b=b+Math.imul(at,$)|0,y=y+Math.imul(Z,ft)|0,u=u+Math.imul(Z,mt)|0,u=u+Math.imul(F,ft)|0,b=b+Math.imul(F,mt)|0;var ye=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ye>>>26)|0,ye&=67108863,y=Math.imul(lt,J),u=Math.imul(lt,X),u=u+Math.imul(ct,J)|0,b=Math.imul(ct,X),y=y+Math.imul(yt,N)|0,u=u+Math.imul(yt,$)|0,u=u+Math.imul(pt,N)|0,b=b+Math.imul(pt,$)|0,y=y+Math.imul(it,ft)|0,u=u+Math.imul(it,mt)|0,u=u+Math.imul(at,ft)|0,b=b+Math.imul(at,mt)|0,y=y+Math.imul(Z,At)|0,u=u+Math.imul(Z,_t)|0,u=u+Math.imul(F,At)|0,b=b+Math.imul(F,_t)|0;var Yt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,y=Math.imul(kt,J),u=Math.imul(kt,X),u=u+Math.imul(k,J)|0,b=Math.imul(k,X),y=y+Math.imul(lt,N)|0,u=u+Math.imul(lt,$)|0,u=u+Math.imul(ct,N)|0,b=b+Math.imul(ct,$)|0,y=y+Math.imul(yt,ft)|0,u=u+Math.imul(yt,mt)|0,u=u+Math.imul(pt,ft)|0,b=b+Math.imul(pt,mt)|0,y=y+Math.imul(it,At)|0,u=u+Math.imul(it,_t)|0,u=u+Math.imul(at,At)|0,b=b+Math.imul(at,_t)|0,y=y+Math.imul(Z,Rt)|0,u=u+Math.imul(Z,wt)|0,u=u+Math.imul(F,Rt)|0,b=b+Math.imul(F,wt)|0;var pe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(pe>>>26)|0,pe&=67108863,y=Math.imul(L,J),u=Math.imul(L,X),u=u+Math.imul(j,J)|0,b=Math.imul(j,X),y=y+Math.imul(kt,N)|0,u=u+Math.imul(kt,$)|0,u=u+Math.imul(k,N)|0,b=b+Math.imul(k,$)|0,y=y+Math.imul(lt,ft)|0,u=u+Math.imul(lt,mt)|0,u=u+Math.imul(ct,ft)|0,b=b+Math.imul(ct,mt)|0,y=y+Math.imul(yt,At)|0,u=u+Math.imul(yt,_t)|0,u=u+Math.imul(pt,At)|0,b=b+Math.imul(pt,_t)|0,y=y+Math.imul(it,Rt)|0,u=u+Math.imul(it,wt)|0,u=u+Math.imul(at,Rt)|0,b=b+Math.imul(at,wt)|0,y=y+Math.imul(Z,Lt)|0,u=u+Math.imul(Z,Et)|0,u=u+Math.imul(F,Lt)|0,b=b+Math.imul(F,Et)|0;var ve=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ve>>>26)|0,ve&=67108863,y=Math.imul(Q,J),u=Math.imul(Q,X),u=u+Math.imul(ot,J)|0,b=Math.imul(ot,X),y=y+Math.imul(L,N)|0,u=u+Math.imul(L,$)|0,u=u+Math.imul(j,N)|0,b=b+Math.imul(j,$)|0,y=y+Math.imul(kt,ft)|0,u=u+Math.imul(kt,mt)|0,u=u+Math.imul(k,ft)|0,b=b+Math.imul(k,mt)|0,y=y+Math.imul(lt,At)|0,u=u+Math.imul(lt,_t)|0,u=u+Math.imul(ct,At)|0,b=b+Math.imul(ct,_t)|0,y=y+Math.imul(yt,Rt)|0,u=u+Math.imul(yt,wt)|0,u=u+Math.imul(pt,Rt)|0,b=b+Math.imul(pt,wt)|0,y=y+Math.imul(it,Lt)|0,u=u+Math.imul(it,Et)|0,u=u+Math.imul(at,Lt)|0,b=b+Math.imul(at,Et)|0,y=y+Math.imul(Z,Pt)|0,u=u+Math.imul(Z,Mt)|0,u=u+Math.imul(F,Pt)|0,b=b+Math.imul(F,Mt)|0;var ge=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ge>>>26)|0,ge&=67108863,y=Math.imul(It,J),u=Math.imul(It,X),u=u+Math.imul(xt,J)|0,b=Math.imul(xt,X),y=y+Math.imul(Q,N)|0,u=u+Math.imul(Q,$)|0,u=u+Math.imul(ot,N)|0,b=b+Math.imul(ot,$)|0,y=y+Math.imul(L,ft)|0,u=u+Math.imul(L,mt)|0,u=u+Math.imul(j,ft)|0,b=b+Math.imul(j,mt)|0,y=y+Math.imul(kt,At)|0,u=u+Math.imul(kt,_t)|0,u=u+Math.imul(k,At)|0,b=b+Math.imul(k,_t)|0,y=y+Math.imul(lt,Rt)|0,u=u+Math.imul(lt,wt)|0,u=u+Math.imul(ct,Rt)|0,b=b+Math.imul(ct,wt)|0,y=y+Math.imul(yt,Lt)|0,u=u+Math.imul(yt,Et)|0,u=u+Math.imul(pt,Lt)|0,b=b+Math.imul(pt,Et)|0,y=y+Math.imul(it,Pt)|0,u=u+Math.imul(it,Mt)|0,u=u+Math.imul(at,Pt)|0,b=b+Math.imul(at,Mt)|0,y=y+Math.imul(Z,Y)|0,u=u+Math.imul(Z,V)|0,u=u+Math.imul(F,Y)|0,b=b+Math.imul(F,V)|0;var ie=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ie>>>26)|0,ie&=67108863,y=Math.imul(Ct,J),u=Math.imul(Ct,X),u=u+Math.imul(Dt,J)|0,b=Math.imul(Dt,X),y=y+Math.imul(It,N)|0,u=u+Math.imul(It,$)|0,u=u+Math.imul(xt,N)|0,b=b+Math.imul(xt,$)|0,y=y+Math.imul(Q,ft)|0,u=u+Math.imul(Q,mt)|0,u=u+Math.imul(ot,ft)|0,b=b+Math.imul(ot,mt)|0,y=y+Math.imul(L,At)|0,u=u+Math.imul(L,_t)|0,u=u+Math.imul(j,At)|0,b=b+Math.imul(j,_t)|0,y=y+Math.imul(kt,Rt)|0,u=u+Math.imul(kt,wt)|0,u=u+Math.imul(k,Rt)|0,b=b+Math.imul(k,wt)|0,y=y+Math.imul(lt,Lt)|0,u=u+Math.imul(lt,Et)|0,u=u+Math.imul(ct,Lt)|0,b=b+Math.imul(ct,Et)|0,y=y+Math.imul(yt,Pt)|0,u=u+Math.imul(yt,Mt)|0,u=u+Math.imul(pt,Pt)|0,b=b+Math.imul(pt,Mt)|0,y=y+Math.imul(it,Y)|0,u=u+Math.imul(it,V)|0,u=u+Math.imul(at,Y)|0,b=b+Math.imul(at,V)|0,y=y+Math.imul(Z,W)|0,u=u+Math.imul(Z,et)|0,u=u+Math.imul(F,W)|0,b=b+Math.imul(F,et)|0;var ue=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ue>>>26)|0,ue&=67108863,y=Math.imul(te,J),u=Math.imul(te,X),u=u+Math.imul(Ut,J)|0,b=Math.imul(Ut,X),y=y+Math.imul(Ct,N)|0,u=u+Math.imul(Ct,$)|0,u=u+Math.imul(Dt,N)|0,b=b+Math.imul(Dt,$)|0,y=y+Math.imul(It,ft)|0,u=u+Math.imul(It,mt)|0,u=u+Math.imul(xt,ft)|0,b=b+Math.imul(xt,mt)|0,y=y+Math.imul(Q,At)|0,u=u+Math.imul(Q,_t)|0,u=u+Math.imul(ot,At)|0,b=b+Math.imul(ot,_t)|0,y=y+Math.imul(L,Rt)|0,u=u+Math.imul(L,wt)|0,u=u+Math.imul(j,Rt)|0,b=b+Math.imul(j,wt)|0,y=y+Math.imul(kt,Lt)|0,u=u+Math.imul(kt,Et)|0,u=u+Math.imul(k,Lt)|0,b=b+Math.imul(k,Et)|0,y=y+Math.imul(lt,Pt)|0,u=u+Math.imul(lt,Mt)|0,u=u+Math.imul(ct,Pt)|0,b=b+Math.imul(ct,Mt)|0,y=y+Math.imul(yt,Y)|0,u=u+Math.imul(yt,V)|0,u=u+Math.imul(pt,Y)|0,b=b+Math.imul(pt,V)|0,y=y+Math.imul(it,W)|0,u=u+Math.imul(it,et)|0,u=u+Math.imul(at,W)|0,b=b+Math.imul(at,et)|0,y=y+Math.imul(Z,ut)|0,u=u+Math.imul(Z,ht)|0,u=u+Math.imul(F,ut)|0,b=b+Math.imul(F,ht)|0;var fe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(fe>>>26)|0,fe&=67108863,y=Math.imul(te,N),u=Math.imul(te,$),u=u+Math.imul(Ut,N)|0,b=Math.imul(Ut,$),y=y+Math.imul(Ct,ft)|0,u=u+Math.imul(Ct,mt)|0,u=u+Math.imul(Dt,ft)|0,b=b+Math.imul(Dt,mt)|0,y=y+Math.imul(It,At)|0,u=u+Math.imul(It,_t)|0,u=u+Math.imul(xt,At)|0,b=b+Math.imul(xt,_t)|0,y=y+Math.imul(Q,Rt)|0,u=u+Math.imul(Q,wt)|0,u=u+Math.imul(ot,Rt)|0,b=b+Math.imul(ot,wt)|0,y=y+Math.imul(L,Lt)|0,u=u+Math.imul(L,Et)|0,u=u+Math.imul(j,Lt)|0,b=b+Math.imul(j,Et)|0,y=y+Math.imul(kt,Pt)|0,u=u+Math.imul(kt,Mt)|0,u=u+Math.imul(k,Pt)|0,b=b+Math.imul(k,Mt)|0,y=y+Math.imul(lt,Y)|0,u=u+Math.imul(lt,V)|0,u=u+Math.imul(ct,Y)|0,b=b+Math.imul(ct,V)|0,y=y+Math.imul(yt,W)|0,u=u+Math.imul(yt,et)|0,u=u+Math.imul(pt,W)|0,b=b+Math.imul(pt,et)|0,y=y+Math.imul(it,ut)|0,u=u+Math.imul(it,ht)|0,u=u+Math.imul(at,ut)|0,b=b+Math.imul(at,ht)|0;var ce=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ce>>>26)|0,ce&=67108863,y=Math.imul(te,ft),u=Math.imul(te,mt),u=u+Math.imul(Ut,ft)|0,b=Math.imul(Ut,mt),y=y+Math.imul(Ct,At)|0,u=u+Math.imul(Ct,_t)|0,u=u+Math.imul(Dt,At)|0,b=b+Math.imul(Dt,_t)|0,y=y+Math.imul(It,Rt)|0,u=u+Math.imul(It,wt)|0,u=u+Math.imul(xt,Rt)|0,b=b+Math.imul(xt,wt)|0,y=y+Math.imul(Q,Lt)|0,u=u+Math.imul(Q,Et)|0,u=u+Math.imul(ot,Lt)|0,b=b+Math.imul(ot,Et)|0,y=y+Math.imul(L,Pt)|0,u=u+Math.imul(L,Mt)|0,u=u+Math.imul(j,Pt)|0,b=b+Math.imul(j,Mt)|0,y=y+Math.imul(kt,Y)|0,u=u+Math.imul(kt,V)|0,u=u+Math.imul(k,Y)|0,b=b+Math.imul(k,V)|0,y=y+Math.imul(lt,W)|0,u=u+Math.imul(lt,et)|0,u=u+Math.imul(ct,W)|0,b=b+Math.imul(ct,et)|0,y=y+Math.imul(yt,ut)|0,u=u+Math.imul(yt,ht)|0,u=u+Math.imul(pt,ut)|0,b=b+Math.imul(pt,ht)|0;var Kt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,y=Math.imul(te,At),u=Math.imul(te,_t),u=u+Math.imul(Ut,At)|0,b=Math.imul(Ut,_t),y=y+Math.imul(Ct,Rt)|0,u=u+Math.imul(Ct,wt)|0,u=u+Math.imul(Dt,Rt)|0,b=b+Math.imul(Dt,wt)|0,y=y+Math.imul(It,Lt)|0,u=u+Math.imul(It,Et)|0,u=u+Math.imul(xt,Lt)|0,b=b+Math.imul(xt,Et)|0,y=y+Math.imul(Q,Pt)|0,u=u+Math.imul(Q,Mt)|0,u=u+Math.imul(ot,Pt)|0,b=b+Math.imul(ot,Mt)|0,y=y+Math.imul(L,Y)|0,u=u+Math.imul(L,V)|0,u=u+Math.imul(j,Y)|0,b=b+Math.imul(j,V)|0,y=y+Math.imul(kt,W)|0,u=u+Math.imul(kt,et)|0,u=u+Math.imul(k,W)|0,b=b+Math.imul(k,et)|0,y=y+Math.imul(lt,ut)|0,u=u+Math.imul(lt,ht)|0,u=u+Math.imul(ct,ut)|0,b=b+Math.imul(ct,ht)|0;var oe=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(oe>>>26)|0,oe&=67108863,y=Math.imul(te,Rt),u=Math.imul(te,wt),u=u+Math.imul(Ut,Rt)|0,b=Math.imul(Ut,wt),y=y+Math.imul(Ct,Lt)|0,u=u+Math.imul(Ct,Et)|0,u=u+Math.imul(Dt,Lt)|0,b=b+Math.imul(Dt,Et)|0,y=y+Math.imul(It,Pt)|0,u=u+Math.imul(It,Mt)|0,u=u+Math.imul(xt,Pt)|0,b=b+Math.imul(xt,Mt)|0,y=y+Math.imul(Q,Y)|0,u=u+Math.imul(Q,V)|0,u=u+Math.imul(ot,Y)|0,b=b+Math.imul(ot,V)|0,y=y+Math.imul(L,W)|0,u=u+Math.imul(L,et)|0,u=u+Math.imul(j,W)|0,b=b+Math.imul(j,et)|0,y=y+Math.imul(kt,ut)|0,u=u+Math.imul(kt,ht)|0,u=u+Math.imul(k,ut)|0,b=b+Math.imul(k,ht)|0;var Jt=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,y=Math.imul(te,Lt),u=Math.imul(te,Et),u=u+Math.imul(Ut,Lt)|0,b=Math.imul(Ut,Et),y=y+Math.imul(Ct,Pt)|0,u=u+Math.imul(Ct,Mt)|0,u=u+Math.imul(Dt,Pt)|0,b=b+Math.imul(Dt,Mt)|0,y=y+Math.imul(It,Y)|0,u=u+Math.imul(It,V)|0,u=u+Math.imul(xt,Y)|0,b=b+Math.imul(xt,V)|0,y=y+Math.imul(Q,W)|0,u=u+Math.imul(Q,et)|0,u=u+Math.imul(ot,W)|0,b=b+Math.imul(ot,et)|0,y=y+Math.imul(L,ut)|0,u=u+Math.imul(L,ht)|0,u=u+Math.imul(j,ut)|0,b=b+Math.imul(j,ht)|0;var le=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(le>>>26)|0,le&=67108863,y=Math.imul(te,Pt),u=Math.imul(te,Mt),u=u+Math.imul(Ut,Pt)|0,b=Math.imul(Ut,Mt),y=y+Math.imul(Ct,Y)|0,u=u+Math.imul(Ct,V)|0,u=u+Math.imul(Dt,Y)|0,b=b+Math.imul(Dt,V)|0,y=y+Math.imul(It,W)|0,u=u+Math.imul(It,et)|0,u=u+Math.imul(xt,W)|0,b=b+Math.imul(xt,et)|0,y=y+Math.imul(Q,ut)|0,u=u+Math.imul(Q,ht)|0,u=u+Math.imul(ot,ut)|0,b=b+Math.imul(ot,ht)|0;var ae=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ae>>>26)|0,ae&=67108863,y=Math.imul(te,Y),u=Math.imul(te,V),u=u+Math.imul(Ut,Y)|0,b=Math.imul(Ut,V),y=y+Math.imul(Ct,W)|0,u=u+Math.imul(Ct,et)|0,u=u+Math.imul(Dt,W)|0,b=b+Math.imul(Dt,et)|0,y=y+Math.imul(It,ut)|0,u=u+Math.imul(It,ht)|0,u=u+Math.imul(xt,ut)|0,b=b+Math.imul(xt,ht)|0;var ne=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(ne>>>26)|0,ne&=67108863,y=Math.imul(te,W),u=Math.imul(te,et),u=u+Math.imul(Ut,W)|0,b=Math.imul(Ut,et),y=y+Math.imul(Ct,ut)|0,u=u+Math.imul(Ct,ht)|0,u=u+Math.imul(Dt,ut)|0,b=b+Math.imul(Dt,ht)|0;var Ot=(I+y|0)+((u&8191)<<13)|0;I=(b+(u>>>13)|0)+(Ot>>>26)|0,Ot&=67108863,y=Math.imul(te,ut),u=Math.imul(te,ht),u=u+Math.imul(Ut,ut)|0,b=Math.imul(Ut,ht);var Nt=(I+y|0)+((u&8191)<<13)|0;return I=(b+(u>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,S[0]=zt,S[1]=Wt,S[2]=ye,S[3]=Yt,S[4]=pe,S[5]=ve,S[6]=ge,S[7]=ie,S[8]=ue,S[9]=fe,S[10]=ce,S[11]=Kt,S[12]=oe,S[13]=Jt,S[14]=le,S[15]=ae,S[16]=ne,S[17]=Ot,S[18]=Nt,I!==0&&(S[19]=I,f.length++),f};Math.imul||(A=x);function B(d,o,a){a.negative=o.negative^d.negative,a.length=d.length+o.length;for(var f=0,h=0,g=0;g>>26)|0,h+=S>>>26,S&=67108863}a.words[g]=I,f=S,S=h}return f!==0?a.words[g]=f:a.length--,a.strip()}function P(d,o,a){var f=new R;return f.mulp(d,o,a)}i.prototype.mulTo=function(o,a){var f,h=this.length+o.length;return this.length===10&&o.length===10?f=A(this,o,a):h<63?f=x(this,o,a):h<1024?f=B(this,o,a):f=P(this,o,a),f};function R(d,o){this.x=d,this.y=o}R.prototype.makeRBT=function(o){for(var a=new Array(o),f=i.prototype._countBits(o)-1,h=0;h>=1;return h},R.prototype.permute=function(o,a,f,h,g,S){for(var I=0;I>>1)g++;return 1<>>13,f[2*S+1]=g&8191,g=g>>>13;for(S=2*a;S>=26,a+=h/67108864|0,a+=g>>>26,this.words[f]=g&67108863}return a!==0&&(this.words[f]=a,this.length++),this},i.prototype.muln=function(o){return this.clone().imuln(o)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(o){var a=w(o);if(a.length===0)return new i(1);for(var f=this,h=0;h=0);var a=o%26,f=(o-a)/26,h=67108863>>>26-a<<26-a,g;if(a!==0){var S=0;for(g=0;g>>26-a}S&&(this.words[g]=S,this.length++)}if(f!==0){for(g=this.length-1;g>=0;g--)this.words[g+f]=this.words[g];for(g=0;g=0);var h;a?h=(a-a%26)/26:h=0;var g=o%26,S=Math.min((o-g)/26,this.length),I=67108863^67108863>>>g<S)for(this.length-=S,u=0;u=0&&(b!==0||u>=h);u--){var D=this.words[u]|0;this.words[u]=b<<26-g|D>>>g,b=D&I}return y&&b!==0&&(y.words[y.length++]=b),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(o,a,f){return n(this.negative===0),this.iushrn(o,a,f)},i.prototype.shln=function(o){return this.clone().ishln(o)},i.prototype.ushln=function(o){return this.clone().iushln(o)},i.prototype.shrn=function(o){return this.clone().ishrn(o)},i.prototype.ushrn=function(o){return this.clone().iushrn(o)},i.prototype.testn=function(o){n(typeof o=="number"&&o>=0);var a=o%26,f=(o-a)/26,h=1<=0);var a=o%26,f=(o-a)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=f)return this;if(a!==0&&f++,this.length=Math.min(f,this.length),a!==0){var h=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},i.prototype.isubn=function(o){if(n(typeof o=="number"),n(o<67108864),o<0)return this.iaddn(-o);if(this.negative!==0)return this.negative=0,this.iaddn(o),this.negative=1,this;if(this.words[0]-=o,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var a=0;a>26)-(y/67108864|0),this.words[g+f]=S&67108863}for(;g>26,this.words[g+f]=S&67108863;if(I===0)return this.strip();for(n(I===-1),I=0,g=0;g>26,this.words[g]=S&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(o,a){var f=this.length-o.length,h=this.clone(),g=o,S=g.words[g.length-1]|0,I=this._countBits(S);f=26-I,f!==0&&(g=g.ushln(f),h.iushln(f),S=g.words[g.length-1]|0);var y=h.length-g.length,u;if(a!=="mod"){u=new i(null),u.length=y+1,u.words=new Array(u.length);for(var b=0;b=0;Z--){var F=(h.words[g.length+Z]|0)*67108864+(h.words[g.length+Z-1]|0);for(F=Math.min(F/S|0,67108863),h._ishlnsubmul(g,F,Z);h.negative!==0;)F--,h.negative=0,h._ishlnsubmul(g,1,Z),h.isZero()||(h.negative^=1);u&&(u.words[Z]=F)}return u&&u.strip(),h.strip(),a!=="div"&&f!==0&&h.iushrn(f),{div:u||null,mod:h}},i.prototype.divmod=function(o,a,f){if(n(!o.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var h,g,S;return this.negative!==0&&o.negative===0?(S=this.neg().divmod(o,a),a!=="mod"&&(h=S.div.neg()),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.iadd(o)),{div:h,mod:g}):this.negative===0&&o.negative!==0?(S=this.divmod(o.neg(),a),a!=="mod"&&(h=S.div.neg()),{div:h,mod:S.mod}):this.negative&o.negative?(S=this.neg().divmod(o.neg(),a),a!=="div"&&(g=S.mod.neg(),f&&g.negative!==0&&g.isub(o)),{div:S.div,mod:g}):o.length>this.length||this.cmp(o)<0?{div:new i(0),mod:this}:o.length===1?a==="div"?{div:this.divn(o.words[0]),mod:null}:a==="mod"?{div:null,mod:new i(this.modn(o.words[0]))}:{div:this.divn(o.words[0]),mod:new i(this.modn(o.words[0]))}:this._wordDiv(o,a)},i.prototype.div=function(o){return this.divmod(o,"div",!1).div},i.prototype.mod=function(o){return this.divmod(o,"mod",!1).mod},i.prototype.umod=function(o){return this.divmod(o,"mod",!0).mod},i.prototype.divRound=function(o){var a=this.divmod(o);if(a.mod.isZero())return a.div;var f=a.div.negative!==0?a.mod.isub(o):a.mod,h=o.ushrn(1),g=o.andln(1),S=f.cmp(h);return S<0||g===1&&S===0?a.div:a.div.negative!==0?a.div.isubn(1):a.div.iaddn(1)},i.prototype.modn=function(o){n(o<=67108863);for(var a=(1<<26)%o,f=0,h=this.length-1;h>=0;h--)f=(a*f+(this.words[h]|0))%o;return f},i.prototype.idivn=function(o){n(o<=67108863);for(var a=0,f=this.length-1;f>=0;f--){var h=(this.words[f]|0)+a*67108864;this.words[f]=h/o|0,a=h%o}return this.strip()},i.prototype.divn=function(o){return this.clone().idivn(o)},i.prototype.egcd=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=new i(0),I=new i(1),y=0;a.isEven()&&f.isEven();)a.iushrn(1),f.iushrn(1),++y;for(var u=f.clone(),b=a.clone();!a.isZero();){for(var D=0,Z=1;!(a.words[0]&Z)&&D<26;++D,Z<<=1);if(D>0)for(a.iushrn(D);D-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(u),g.isub(b)),h.iushrn(1),g.iushrn(1);for(var F=0,q=1;!(f.words[0]&q)&&F<26;++F,q<<=1);if(F>0)for(f.iushrn(F);F-- >0;)(S.isOdd()||I.isOdd())&&(S.iadd(u),I.isub(b)),S.iushrn(1),I.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(S),g.isub(I)):(f.isub(a),S.isub(h),I.isub(g))}return{a:S,b:I,gcd:f.iushln(y)}},i.prototype._invmp=function(o){n(o.negative===0),n(!o.isZero());var a=this,f=o.clone();a.negative!==0?a=a.umod(o):a=a.clone();for(var h=new i(1),g=new i(0),S=f.clone();a.cmpn(1)>0&&f.cmpn(1)>0;){for(var I=0,y=1;!(a.words[0]&y)&&I<26;++I,y<<=1);if(I>0)for(a.iushrn(I);I-- >0;)h.isOdd()&&h.iadd(S),h.iushrn(1);for(var u=0,b=1;!(f.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(f.iushrn(u);u-- >0;)g.isOdd()&&g.iadd(S),g.iushrn(1);a.cmp(f)>=0?(a.isub(f),h.isub(g)):(f.isub(a),g.isub(h))}var D;return a.cmpn(1)===0?D=h:D=g,D.cmpn(0)<0&&D.iadd(o),D},i.prototype.gcd=function(o){if(this.isZero())return o.abs();if(o.isZero())return this.abs();var a=this.clone(),f=o.clone();a.negative=0,f.negative=0;for(var h=0;a.isEven()&&f.isEven();h++)a.iushrn(1),f.iushrn(1);do{for(;a.isEven();)a.iushrn(1);for(;f.isEven();)f.iushrn(1);var g=a.cmp(f);if(g<0){var S=a;a=f,f=S}else if(g===0||f.cmpn(1)===0)break;a.isub(f)}while(!0);return f.iushln(h)},i.prototype.invm=function(o){return this.egcd(o).a.umod(o)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(o){return this.words[0]&o},i.prototype.bincn=function(o){n(typeof o=="number");var a=o%26,f=(o-a)/26,h=1<>>26,I&=67108863,this.words[S]=I}return g!==0&&(this.words[S]=g,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(o){var a=o<0;if(this.negative!==0&&!a)return-1;if(this.negative===0&&a)return 1;this.strip();var f;if(this.length>1)f=1;else{a&&(o=-o),n(o<=67108863,"Number is too big");var h=this.words[0]|0;f=h===o?0:ho.length)return 1;if(this.length=0;f--){var h=this.words[f]|0,g=o.words[f]|0;if(h!==g){hg&&(a=1);break}}return a},i.prototype.gtn=function(o){return this.cmpn(o)===1},i.prototype.gt=function(o){return this.cmp(o)===1},i.prototype.gten=function(o){return this.cmpn(o)>=0},i.prototype.gte=function(o){return this.cmp(o)>=0},i.prototype.ltn=function(o){return this.cmpn(o)===-1},i.prototype.lt=function(o){return this.cmp(o)===-1},i.prototype.lten=function(o){return this.cmpn(o)<=0},i.prototype.lte=function(o){return this.cmp(o)<=0},i.prototype.eqn=function(o){return this.cmpn(o)===0},i.prototype.eq=function(o){return this.cmp(o)===0},i.red=function(o){return new G(o)},i.prototype.toRed=function(o){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),o.convertTo(this)._forceRed(o)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(o){return this.red=o,this},i.prototype.forceRed=function(o){return n(!this.red,"Already a number in reduction context"),this._forceRed(o)},i.prototype.redAdd=function(o){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,o)},i.prototype.redIAdd=function(o){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,o)},i.prototype.redSub=function(o){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,o)},i.prototype.redISub=function(o){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,o)},i.prototype.redShl=function(o){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,o)},i.prototype.redMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.mul(this,o)},i.prototype.redIMul=function(o){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,o),this.red.imul(this,o)},i.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(o){return n(this.red&&!o.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,o)};var C={k256:null,p224:null,p192:null,p25519:null};function O(d,o){this.name=d,this.p=new i(o,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var o=new i(null);return o.words=new Array(Math.ceil(this.n/13)),o},O.prototype.ireduce=function(o){var a=o,f;do this.split(a,this.tmp),a=this.imulK(a),a=a.iadd(this.tmp),f=a.bitLength();while(f>this.n);var h=f0?a.isub(this.p):a.strip!==void 0?a.strip():a._strip(),a},O.prototype.split=function(o,a){o.iushrn(this.n,0,a)},O.prototype.imulK=function(o){return o.imul(this.k)};function z(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(z,O),z.prototype.split=function(o,a){for(var f=4194303,h=Math.min(o.length,9),g=0;g>>22,S=I}S>>>=22,o.words[g-10]=S,S===0&&o.length>10?o.length-=10:o.length-=9},z.prototype.imulK=function(o){o.words[o.length]=0,o.words[o.length+1]=0,o.length+=2;for(var a=0,f=0;f>>=26,o.words[f]=g,a=h}return a!==0&&(o.words[o.length++]=a),o},i._prime=function(o){if(C[o])return C[o];var a;if(o==="k256")a=new z;else if(o==="p224")a=new H;else if(o==="p192")a=new tt;else if(o==="p25519")a=new nt;else throw new Error("Unknown prime "+o);return C[o]=a,a};function G(d){if(typeof d=="string"){var o=i._prime(d);this.m=o.p,this.prime=o}else n(d.gtn(1),"modulus must be greater than 1"),this.m=d,this.prime=null}G.prototype._verify1=function(o){n(o.negative===0,"red works only with positives"),n(o.red,"red works only with red numbers")},G.prototype._verify2=function(o,a){n((o.negative|a.negative)===0,"red works only with positives"),n(o.red&&o.red===a.red,"red works only with red numbers")},G.prototype.imod=function(o){return this.prime?this.prime.ireduce(o)._forceRed(this):o.umod(this.m)._forceRed(this)},G.prototype.neg=function(o){return o.isZero()?o.clone():this.m.sub(o)._forceRed(this)},G.prototype.add=function(o,a){this._verify2(o,a);var f=o.add(a);return f.cmp(this.m)>=0&&f.isub(this.m),f._forceRed(this)},G.prototype.iadd=function(o,a){this._verify2(o,a);var f=o.iadd(a);return f.cmp(this.m)>=0&&f.isub(this.m),f},G.prototype.sub=function(o,a){this._verify2(o,a);var f=o.sub(a);return f.cmpn(0)<0&&f.iadd(this.m),f._forceRed(this)},G.prototype.isub=function(o,a){this._verify2(o,a);var f=o.isub(a);return f.cmpn(0)<0&&f.iadd(this.m),f},G.prototype.shl=function(o,a){return this._verify1(o),this.imod(o.ushln(a))},G.prototype.imul=function(o,a){return this._verify2(o,a),this.imod(o.imul(a))},G.prototype.mul=function(o,a){return this._verify2(o,a),this.imod(o.mul(a))},G.prototype.isqr=function(o){return this.imul(o,o.clone())},G.prototype.sqr=function(o){return this.mul(o,o)},G.prototype.sqrt=function(o){if(o.isZero())return o.clone();var a=this.m.andln(3);if(n(a%2===1),a===3){var f=this.m.add(new i(1)).iushrn(2);return this.pow(o,f)}for(var h=this.m.subn(1),g=0;!h.isZero()&&h.andln(1)===0;)g++,h.iushrn(1);n(!h.isZero());var S=new i(1).toRed(this),I=S.redNeg(),y=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,y).cmp(I)!==0;)u.redIAdd(I);for(var b=this.pow(u,h),D=this.pow(o,h.addn(1).iushrn(1)),Z=this.pow(o,h),F=g;Z.cmp(S)!==0;){for(var q=Z,it=0;q.cmp(S)!==0;it++)q=q.redSqr();n(it=0;g--){for(var b=a.words[g],D=u-1;D>=0;D--){var Z=b>>D&1;if(S!==h[0]&&(S=this.sqr(S)),Z===0&&I===0){y=0;continue}I<<=1,I|=Z,y++,!(y!==f&&(g!==0||D!==0))&&(S=this.mul(S,h[I]),y=0,I=0)}u=26}return S},G.prototype.convertTo=function(o){var a=o.umod(this.m);return a===o?a.clone():a},G.prototype.convertFrom=function(o){var a=o.clone();return a.red=null,a},i.mont=function(o){return new M(o)};function M(d){G.call(this,d),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(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)}s(M,G),M.prototype.convertTo=function(o){return this.imod(o.ushln(this.shift))},M.prototype.convertFrom=function(o){var a=this.imod(o.mul(this.rinv));return a.red=null,a},M.prototype.imul=function(o,a){if(o.isZero()||a.isZero())return o.words[0]=0,o.length=1,o;var f=o.imul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.mul=function(o,a){if(o.isZero()||a.isZero())return new i(0)._forceRed(this);var f=o.mul(a),h=f.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),g=f.isub(h).iushrn(this.shift),S=g;return g.cmp(this.m)>=0?S=g.isub(this.m):g.cmpn(0)<0&&(S=g.iadd(this.m)),S._forceRed(this)},M.prototype.invm=function(o){var a=this.imod(o._invmp(this.m).mul(this.r2));return a._forceRed(this)}})(r,Re)}($0)),$0.exports}var up,b6;function t9(){if(b6)return up;b6=1;var r=pg(),t=sr.Buffer;function e(n,s){return t.from(n.toRed(r.mont(s.modulus)).redPow(new r(s.publicExponent)).fromRed().toArray())}return up=e,up}var fp,w6;function IC(){if(w6)return fp;w6=1;var r=od(),t=bf,e=_h,n=J_(),s=Q_(),i=pg(),c=t9(),l=ag(),p=sr.Buffer;fp=function(w,x,A){var B;w.padding?B=w.padding:A?B=1:B=4;var P=r(w),R;if(B===4)R=m(P,x);else if(B===1)R=v(P,x,A);else if(B===3){if(R=new i(x),R.cmp(P.modulus)>=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return A?l(R,P):c(R,P)};function m(E,w){var x=E.modulus.byteLength(),A=w.length,B=e("sha1").update(p.alloc(0)).digest(),P=B.length,R=2*P;if(A>x-R-2)throw new Error("message too long");var C=p.alloc(x-A-R-2),O=x-P-1,z=t(P),H=s(p.concat([B,C,p.alloc(1,1),w],O),n(z,O)),tt=s(z,n(H,P));return new i(p.concat([p.alloc(1),tt,H],x))}function v(E,w,x){var A=w.length,B=E.modulus.byteLength();if(A>B-11)throw new Error("message too long");var P;return x?P=p.alloc(B-A-3,255):P=_(B-A-3),new i(p.concat([p.from([0,x?1:2]),P,p.alloc(1),w],B))}function _(E){for(var w=p.allocUnsafe(E),x=0,A=t(E*2),B=0,P;xP||new n(w).cmp(B.modulus)>=0)throw new Error("decryption error");var R;x?R=c(new n(w),B):R=s(w,B);var C=l.alloc(P-R.length);if(R=l.concat([C,R],P),A===4)return p(B,R);if(A===1)return m(B,R,x);if(A===3)return R;throw new Error("unknown padding")};function p(_,E){var w=_.modulus.byteLength(),x=i("sha1").update(l.alloc(0)).digest(),A=x.length;if(E[0]!==0)throw new Error("decryption error");var B=E.slice(1,A+1),P=E.slice(A+1),R=e(B,t(P,A)),C=e(P,t(R,w-A-1));if(v(x,C.slice(0,A)))throw new Error("decryption error");for(var O=A;C[O]===0;)O++;if(C[O++]!==1)throw new Error("decryption error");return C.slice(O)}function m(_,E,w){for(var x=E.slice(0,2),A=2,B=0;E[A++]!==0;)if(A>=E.length){B++;break}var P=E.slice(2,A-1);if((x.toString("hex")!=="0002"&&!w||x.toString("hex")!=="0001"&&w)&&B++,P.length<8&&B++,B)throw new Error("decryption error");return E.slice(A)}function v(_,E){_=l.from(_),E=l.from(E);var w=0,x=_.length;_.length!==E.length&&(w++,x=Math.min(_.length,E.length));for(var A=-1;++Ac||E<0)throw new TypeError("offset must be a uint32");if(E>s||E>w)throw new RangeError("offset out of range")}function p(E,w,x){if(typeof E!="number"||E!==E)throw new TypeError("size must be a number");if(E>c||E<0)throw new TypeError("size must be a uint32");if(E+w>x||E>s)throw new RangeError("buffer too small")}i&&i.getRandomValues||!Zt.process.browser?(du.randomFill=m,du.randomFillSync=_):(du.randomFill=r,du.randomFillSync=r);function m(E,w,x,A){if(!n.isBuffer(E)&&!(E instanceof Re.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof w=="function")A=w,w=0,x=E.length;else if(typeof x=="function")A=x,x=E.length-w;else if(typeof A!="function")throw new TypeError('"cb" argument must be a function');return l(w,E.length),p(x,w,E.length),v(E,w,x,A)}function v(E,w,x,A){if(Zt.process.browser){var B=E.buffer,P=new Uint8Array(B,w,x);if(i.getRandomValues(P),A){Zt.process.nextTick(function(){A(null,E)});return}return E}if(A){e(x,function(C,O){if(C)return A(C);O.copy(E,w),A(null,E)});return}var R=e(x);return R.copy(E,w),E}function _(E,w,x){if(typeof w>"u"&&(w=0),!n.isBuffer(E)&&!(E instanceof Re.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return l(w,E.length),x===void 0&&(x=E.length-w),p(x,w,E.length),v(E,w,x)}return du}var E6;function e9(){if(E6)return Je;E6=1,Je.randomBytes=Je.rng=Je.pseudoRandomBytes=Je.prng=bf,Je.createHash=Je.Hash=_h,Je.createHmac=Je.Hmac=f_();var r=NB(),t=Object.keys(r),e=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(t);Je.getHashes=function(){return e};var n=m_();Je.pbkdf2=n.pbkdf2,Je.pbkdf2Sync=n.pbkdf2Sync;var s=rP();Je.Cipher=s.Cipher,Je.createCipher=s.createCipher,Je.Cipheriv=s.Cipheriv,Je.createCipheriv=s.createCipheriv,Je.Decipher=s.Decipher,Je.createDecipher=s.createDecipher,Je.Decipheriv=s.Decipheriv,Je.createDecipheriv=s.createDecipheriv,Je.getCiphers=s.getCiphers,Je.listCiphers=s.listCiphers;var i=pP();Je.DiffieHellmanGroup=i.DiffieHellmanGroup,Je.createDiffieHellmanGroup=i.createDiffieHellmanGroup,Je.getDiffieHellman=i.getDiffieHellman,Je.createDiffieHellman=i.createDiffieHellman,Je.DiffieHellman=i.DiffieHellman;var c=AC();Je.createSign=c.createSign,Je.Sign=c.Sign,Je.createVerify=c.createVerify,Je.Verify=c.Verify,Je.createECDH=kC();var l=PC();Je.publicEncrypt=l.publicEncrypt,Je.privateEncrypt=l.privateEncrypt,Je.publicDecrypt=l.publicDecrypt,Je.privateDecrypt=l.privateDecrypt;var p=RC();return Je.randomFill=p.randomFill,Je.randomFillSync=p.randomFillSync,Je.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join(` +`))},Je.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},Je}var CC=function(r){return function(t,e){var n=xe.useRef(!1);r(function(){return function(){n.current=!1}},[]),r(function(){if(!n.current)n.current=!0;else return t()},e)}},f2=function(r){return typeof r=="function"},TC=function(r){return typeof r>"u"},LC=!1;const OC=LC;function UC(r){OC&&(f2(r)||console.error("useMemoizedFn expected parameter is a function, got ".concat(typeof r)));var t=xe.useRef(r);t.current=xe.useMemo(function(){return r},[r]);var e=xe.useRef();return e.current||(e.current=function(){for(var n=[],s=0;s{},emptyCart:()=>{},removeFromCart:()=>{},referrerKey:void 0}),KC=({children:r,referrerKey:t}={})=>{const[e={},n]=jC("bonfida-widget-cart",{defaultValue:{}}),s=p=>{n({...e,[p.domain]:p})},i=p=>{const m={...e};delete m[p],n(m)},c=()=>n({}),l=!Object.values(e).length;return St.jsx(Ah.Provider,{value:{cart:e,addToCart:s,removeFromCart:i,isCartEmpty:l,emptyCart:c,referrerKey:t},children:r})},sd=xe.createContext({status:null,setStatus:()=>{},setError:()=>{}}),$C=({children:r})=>{const[t,e]=xe.useState(null),n=s=>{e({status:"error",message:s})};return St.jsx(sd.Provider,{value:{status:t,setStatus:e,setError:n},children:r})},mg=xe.createContext({connection:null});function vg(){return xe.useContext(mg)}const HC=({children:r})=>{const{connection:t}=eI();return St.jsx(mg.Provider,{value:{connection:t},children:r})},VC=({children:r,connection:t})=>t?t?St.jsx(mg.Provider,{value:{connection:t},children:r}):St.jsx(St.Fragment,{children:r}):St.jsx(HC,{children:r}),ZC={publicKey:null,wallets:[],wallet:null,connect:async()=>{},select:()=>{},connecting:!1,connected:!1,disconnect:async()=>{},visible:!1,setVisible:()=>{},connection:null,signAllTransactions:async r=>r},gg=xe.createContext(ZC);function ad(){return xe.useContext(gg)}const WC=({children:r})=>{const t=rI(),{connection:e}=vg(),{visible:n,setVisible:s}=nI(),i={visible:n,setVisible:s,connection:e,...t};return St.jsx(gg.Provider,{value:i,children:r})},GC=({children:r,passthroughWallet:t})=>{const{connection:e}=vg();return t?t?St.jsx(gg.Provider,{value:{...t,connection:e},children:r}):St.jsx(St.Fragment,{children:r}):St.jsx(WC,{children:r})},YC=({children:r,endpoint:t,connection:e,passthroughWallet:n})=>{const s=xe.useMemo(()=>t&&!e?({children:c})=>St.jsx(yI,{endpoint:t,children:c}):xe.Fragment,[t,e]),i=xe.useMemo(()=>n?xe.Fragment:({children:c})=>St.jsx(iI,{wallets:[new oI],autoConnect:!0,children:c}),[n]);return St.jsx(s,{children:St.jsx(i,{children:St.jsx(sI,{children:St.jsx(VC,{connection:e,children:St.jsx(GC,{passthroughWallet:n,children:r})})})})})};function Nc(){return Nc=Object.assign||function(r){for(var t=1;t{const t=r.decode.bind(r),e=r.encode.bind(r);return{decode:t,encode:e}},fT=r=>t=>{const e=$7(r,t),{encode:n,decode:s}=xg(e),i=e;return i.decode=(c,l)=>{const p=s(c,l);return aI(Zt.Buffer.from(p))},i.encode=(c,l,p)=>{const m=uI(c,r);return n(m,l,p)},i},cT=fT(8),hT=r=>{const t=$l(r),{encode:e,decode:n}=xg(t),s=t;return s.decode=(i,c)=>!!n(i,c),s.encode=(i,c,l)=>{const p=Number(i);return e(p,c,l)},s},S6=r=>{const t=$7(32,r),{encode:e,decode:n}=xg(t),s=t;return s.decode=(i,c)=>{const l=n(i,c);return new Ne(l)},s.encode=(i,c,l)=>{const p=i.toBuffer();return e(p,c,l)},s};class lT extends Error{constructor(t){super(t)}}class dT extends lT{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var ul;(function(r){r[r.InitializeMint=0]="InitializeMint",r[r.InitializeAccount=1]="InitializeAccount",r[r.InitializeMultisig=2]="InitializeMultisig",r[r.Transfer=3]="Transfer",r[r.Approve=4]="Approve",r[r.Revoke=5]="Revoke",r[r.SetAuthority=6]="SetAuthority",r[r.MintTo=7]="MintTo",r[r.Burn=8]="Burn",r[r.CloseAccount=9]="CloseAccount",r[r.FreezeAccount=10]="FreezeAccount",r[r.ThawAccount=11]="ThawAccount",r[r.TransferChecked=12]="TransferChecked",r[r.ApproveChecked=13]="ApproveChecked",r[r.MintToChecked=14]="MintToChecked",r[r.BurnChecked=15]="BurnChecked",r[r.InitializeAccount2=16]="InitializeAccount2",r[r.SyncNative=17]="SyncNative",r[r.InitializeAccount3=18]="InitializeAccount3",r[r.InitializeMultisig2=19]="InitializeMultisig2",r[r.InitializeMint2=20]="InitializeMint2",r[r.GetAccountDataSize=21]="GetAccountDataSize",r[r.InitializeImmutableOwner=22]="InitializeImmutableOwner",r[r.AmountToUiAmount=23]="AmountToUiAmount",r[r.UiAmountToAmount=24]="UiAmountToAmount",r[r.InitializeMintCloseAuthority=25]="InitializeMintCloseAuthority",r[r.TransferFeeExtension=26]="TransferFeeExtension",r[r.ConfidentialTransferExtension=27]="ConfidentialTransferExtension",r[r.DefaultAccountStateExtension=28]="DefaultAccountStateExtension",r[r.Reallocate=29]="Reallocate",r[r.MemoTransferExtension=30]="MemoTransferExtension",r[r.CreateNativeMint=31]="CreateNativeMint",r[r.InitializeNonTransferableMint=32]="InitializeNonTransferableMint",r[r.InterestBearingMintExtension=33]="InterestBearingMintExtension",r[r.CpiGuardExtension=34]="CpiGuardExtension",r[r.InitializePermanentDelegate=35]="InitializePermanentDelegate"})(ul||(ul={}));function pT(r,t,e){if(e.length){r.push({pubkey:t,isSigner:!1,isWritable:!1});for(const n of e)r.push({pubkey:n instanceof Ne?n:n.publicKey,isSigner:!0,isWritable:!1})}else r.push({pubkey:t,isSigner:!0,isWritable:!1});return r}const k6=Xv([$l("instruction")]);function mT(r,t,e,n=[],s=Sh){const i=pT([{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:t,isSigner:!1,isWritable:!0}],e,n),c=Zt.Buffer.alloc(k6.span);return k6.encode({instruction:ul.CloseAccount},c),new gh({keys:i,programId:s,data:c})}const vT=Xv([bb("mintAuthorityOption"),S6("mintAuthority"),cT("supply"),$l("decimals"),hT("isInitialized"),bb("freezeAuthorityOption"),S6("freezeAuthority")]);vT.span;function n9(r,t,e=!1,n=Sh,s=bg){if(!e&&!Ne.isOnCurve(t.toBuffer()))throw new dT;const[i]=Ne.findProgramAddressSync([t.toBuffer(),n.toBuffer(),r.toBuffer()],s);return i}function gT(r,t,e,n,s=Sh,i=bg){return yT(r,t,e,n,Zt.Buffer.alloc(0),s,i)}function yT(r,t,e,n,s,i=Sh,c=bg){const l=[{pubkey:r,isSigner:!0,isWritable:!0},{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:e,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!1,isWritable:!1},{pubkey:Hl.programId,isSigner:!1,isWritable:!1},{pubkey:i,isSigner:!1,isWritable:!1}];return new gh({keys:l,programId:c,data:s})}const I6=Xv([$l("instruction")]);function bT(r,t=Sh){const e=[{pubkey:r,isSigner:!1,isWritable:!0}],n=Zt.Buffer.alloc(I6.span);return I6.encode({instruction:ul.SyncNative},n),new gh({keys:e,programId:t,data:n})}const wT="logger/5.7.0";let B6=!1,P6=!1;const H0={debug:1,default:2,info:2,warning:3,error:4,off:5};let R6=H0.default,hp=null;function xT(){try{const r=[];if(["NFD","NFC","NFKD","NFKC"].forEach(t=>{try{if("test".normalize(t)!=="test")throw new Error("bad normalize")}catch{r.push(t)}}),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}const C6=xT();var c2;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(c2||(c2={}));var ro;(function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED",r.ACTION_REJECTED="ACTION_REJECTED"})(ro||(ro={}));const T6="0123456789abcdef";class Qr{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const n=t.toLowerCase();H0[n]==null&&this.throwArgumentError("invalid log level name","logLevel",t),!(R6>H0[n])&&console.log.apply(console,e)}debug(...t){this._log(Qr.levels.DEBUG,t)}info(...t){this._log(Qr.levels.INFO,t)}warn(...t){this._log(Qr.levels.WARNING,t)}makeError(t,e,n){if(P6)return this.makeError("censored error",e,{});e||(e=Qr.errors.UNKNOWN_ERROR),n||(n={});const s=[];Object.keys(n).forEach(p=>{const m=n[p];try{if(m instanceof Uint8Array){let v="";for(let _=0;_>4],v+=T6[m[_]&15];s.push(p+"=Uint8Array(0x"+v+")")}else s.push(p+"="+JSON.stringify(m))}catch{s.push(p+"="+JSON.stringify(n[p].toString()))}}),s.push(`code=${e}`),s.push(`version=${this.version}`);const i=t;let c="";switch(e){case ro.NUMERIC_FAULT:{c="NUMERIC_FAULT";const p=t;switch(p){case"overflow":case"underflow":case"division-by-zero":c+="-"+p;break;case"negative-power":case"negative-width":c+="-unsupported";break;case"unbound-bitwise-result":c+="-unbound-result";break}break}case ro.CALL_EXCEPTION:case ro.INSUFFICIENT_FUNDS:case ro.MISSING_NEW:case ro.NONCE_EXPIRED:case ro.REPLACEMENT_UNDERPRICED:case ro.TRANSACTION_REPLACED:case ro.UNPREDICTABLE_GAS_LIMIT:c=e;break}c&&(t+=" [ See: https://links.ethers.org/v5-errors-"+c+" ]"),s.length&&(t+=" ("+s.join(", ")+")");const l=new Error(t);return l.reason=i,l.code=e,Object.keys(n).forEach(function(p){l[p]=n[p]}),l}throwError(t,e,n){throw this.makeError(t,e,n)}throwArgumentError(t,e,n){return this.throwError(t,Qr.errors.INVALID_ARGUMENT,{argument:e,value:n})}assert(t,e,n,s){t||this.throwError(e,n,s)}assertArgument(t,e,n,s){t||this.throwArgumentError(e,n,s)}checkNormalize(t){C6&&this.throwError("platform missing String.prototype.normalize",Qr.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:C6})}checkSafeUint53(t,e){typeof t=="number"&&(e==null&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,Qr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,Qr.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,n){n?n=": "+n:n="",te&&this.throwError("too many arguments"+n,Qr.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){(t===Object||t==null)&&this.throwError("missing new",Qr.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",Qr.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):(t===Object||t==null)&&this.throwError("missing new",Qr.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return hp||(hp=new Qr(wT)),hp}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",Qr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),B6){if(!t)return;this.globalLogger().throwError("error censorship permanent",Qr.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}P6=!!t,B6=!!e}static setLogLevel(t){const e=H0[t.toLowerCase()];if(e==null){Qr.globalLogger().warn("invalid log level - "+t);return}R6=e}static from(t){return new Qr(t)}}Qr.errors=ro;Qr.levels=c2;const _T="bytes/5.7.0",lp=new Qr(_T);function MT(r){return!!r.toHexString}function V0(r){return r.slice||(r.slice=function(){const t=Array.prototype.slice.call(arguments);return V0(new Uint8Array(Array.prototype.slice.apply(r,t)))}),r}function L6(r){return typeof r=="number"&&r==r&&r%1===0}function ET(r){if(r==null)return!1;if(r.constructor===Uint8Array)return!0;if(typeof r=="string"||!L6(r.length)||r.length<0)return!1;for(let t=0;t=256)return!1}return!0}function AT(r,t){if(t||(t={}),typeof r=="number"){lp.checkSafeUint53(r,"invalid arrayify value");const e=[];for(;r;)e.unshift(r&255),r=parseInt(String(r/256));return e.length===0&&e.push(0),V0(new Uint8Array(e))}if(t.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),MT(r)&&(r=r.toHexString()),ST(r)){let e=r.substring(2);e.length%2&&(t.hexPad==="left"?e="0"+e:t.hexPad==="right"?e+="0":lp.throwArgumentError("hex data is odd-length","value",r));const n=[];for(let s=0;s= 0 and <= "+t,r)}function PT(r,t){t===void 0&&(t=0),_g(t,"offset");var e=r[t],n=r[t+7];(e===void 0||n===void 0)&&i9(t,r.length-8);var s=r[t+4]+r[t+5]*Math.pow(2,8)+r[t+6]*Math.pow(2,16)+(n<<24);return(BigInt(s)<0&&v[v.length-1])&&(x[0]===6||x[0]===2)){l=0;continue}if(x[0]===3&&(!v||x[1]>v[0]&&x[1]0&&m[m.length-1])&&(w[0]===6||w[0]===2)){c=0;continue}if(w[0]===3&&(!m||w[1]>m[0]&&w[1]=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),e=0;e>>0,C=new Uint8Array(R);B!==P;){for(var O=w[B],z=0,H=R-1;(O!==0||z>>0,C[H]=O%c>>>0,O=O/c>>>0;if(O!==0)throw new Error("Non-zero carry");A=z,B++}for(var tt=R-A;tt!==R&&C[tt]===0;)tt++;for(var nt=l.repeat(x);tt>>0,R=new Uint8Array(P);w[x];){var C=t[w.charCodeAt(x)];if(C===255)return;for(var O=0,z=P-1;(C!==0||O>>0,R[z]=C%256>>>0,C=C/256>>>0;if(C!==0)throw new Error("Non-zero carry");B=O,x++}for(var H=P-B;H!==P&&R[H]===0;)H++;var tt=e0.allocUnsafe(A+(P-H));tt.fill(0,0,A);for(var nt=A;H!==P;)tt[nt++]=R[H++];return tt}function E(w){var x=_(w);if(x)return x;throw new Error("Non-base"+c+" character")}return{encode:v,decodeUnsafe:_,decode:E}}var UT=OT,NT=UT,DT="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",zT=NT(DT);const Ou=Yv(zT);var Mg={exports:{}};const qT=/[\p{Lu}]/u,FT=/[\p{Ll}]/u,z6=/^[\p{Lu}](?![\p{Lu}])/gu,o9=/([\p{Alpha}\p{N}_]|$)/u,s9=/[_.\- ]+/,jT=new RegExp("^"+s9.source),q6=new RegExp(s9.source+o9.source,"gu"),F6=new RegExp("\\d+"+o9.source,"gu"),KT=(r,t,e)=>{let n=!1,s=!1,i=!1;for(let c=0;c(z6.lastIndex=0,r.replace(z6,e=>t(e))),HT=(r,t)=>(q6.lastIndex=0,F6.lastIndex=0,r.replace(q6,(e,n)=>t(n)).replace(F6,e=>t(e))),a9=(r,t)=>{if(!(typeof r=="string"||Array.isArray(r)))throw new TypeError("Expected the input to be `string | string[]`");if(t={pascalCase:!1,preserveConsecutiveUppercase:!1,...t},Array.isArray(r)?r=r.map(i=>i.trim()).filter(i=>i.length).join("-"):r=r.trim(),r.length===0)return"";const e=t.locale===!1?i=>i.toLowerCase():i=>i.toLocaleLowerCase(t.locale),n=t.locale===!1?i=>i.toUpperCase():i=>i.toLocaleUpperCase(t.locale);return r.length===1?t.pascalCase?n(r):e(r):(r!==e(r)&&(r=KT(r,e,n)),r=r.replace(jT,""),t.preserveConsecutiveUppercase?r=$T(r,e):r=e(r),t.pascalCase&&(r=n(r.charAt(0))+r.slice(1)),HT(r,n))};Mg.exports=a9;Mg.exports.default=a9;var Eg=Mg.exports;const Dr=Yv(Eg);var Ze={},Pe={};let Rr=class{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}};Pe.Layout=Rr;function Ag(r,t){return t.property?r+"["+t.property+"]":r}Pe.nameWithProperty=Ag;function VT(r,t){if(typeof r!="function")throw new TypeError("Class must be constructor");if(r.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Rr))throw new TypeError("layout must be a Layout");if(t.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");r.layout_=t,t.boundConstructor_=r,t.makeDestinationObject=()=>new r,Object.defineProperty(r.prototype,"encode",{value:function(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(r,"decode",{value:function(e,n){return t.decode(e,n)},writable:!0})}Pe.bindConstructorLayout=VT;let ei=class extends Rr{isCount(){throw new Error("ExternalLayout is abstract")}};class u9 extends ei{constructor(t,e){if(t===void 0&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e){e===void 0&&(e=0);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}let Sg=class extends ei{constructor(t,e,n){if(!(t instanceof Rr))throw new TypeError("layout must be a Layout");if(e===void 0)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof Jo||this.layout instanceof Bs}decode(t,e){return e===void 0&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return n===void 0&&(n=0),this.layout.encode(t,e,n+this.offset)}},Jo=class extends Rr{constructor(t,e){if(super(t,e),6c+s.encode(l,e,n+c),0);return this.count instanceof ei&&this.count.encode(t.length,e,n),i}}let p9=class extends Rr{constructor(t,e,n){if(!(Array.isArray(t)&&t.reduce((i,c)=>i&&c instanceof Rr,!0)))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const i of t)if(0>i.span&&i.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let s=-1;try{s=t.reduce((i,c)=>i+c.getSpan(),0)}catch{}super(s,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;try{n=this.fields.reduce((s,i)=>{const c=i.getSpan(t,e);return e+=c,s+c},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e){e===void 0&&(e=0);const n=this.makeDestinationObject();for(const s of this.fields)if(s.property!==void 0&&(n[s.property]=s.decode(t,e)),e+=s.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){n===void 0&&(n=0);const s=n;let i=0,c=0;for(const l of this.fields){let p=l.span;if(c=0p&&(p=l.getSpan(e,n)))}i=n,n+=p}return i+c-s}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?e=-1:0<=e&&(e+=n.span)}}},kg=class{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}},fl=class extends kg{constructor(t,e){if(!(t instanceof ei&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}},Ig=class extends Rr{constructor(t,e,n){const s=t instanceof Jo||t instanceof Bs;if(s)t=new fl(new Sg(t));else if(t instanceof ei&&t.isCount())t=new fl(t);else if(!(t instanceof kg))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof Rr))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&s&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=s,this.defaultLayout=e,this.registry={};let c=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(l){return c(l)},this.configGetSourceVariant=function(l){c=l.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){e===void 0&&(e=0);let n;const s=this.discriminator,i=s.decode(t,e);let c=this.registry[i];if(c===void 0){let l=0;c=this.defaultLayout,this.usesPrefixDiscriminator&&(l=s.layout.span),n=this.makeDestinationObject(),n[s.property]=i,n[c.property]=this.defaultLayout.decode(t,e+l)}else n=c.decode(t,e);return n}encode(t,e,n){n===void 0&&(n=0);const s=this.getSourceVariant(t);if(s===void 0){const i=this.discriminator,c=this.defaultLayout;let l=0;return this.usesPrefixDiscriminator&&(l=i.layout.span),i.encode(t[i.property],e,n),l+c.encode(t[c.property],e,n+l)}return s.encode(t,e,n)}addVariant(t,e,n){const s=new m9(this,t,e,n);return this.registry[t]=s,s}getVariant(t,e){let n=t;return Zt.Buffer.isBuffer(t)&&(e===void 0&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}},m9=class extends Rr{constructor(t,e,n,s){if(!(t instanceof Ig))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&s===void 0&&(s=n,n=null),n){if(!(n instanceof Rr))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof s!="string")throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,s),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(e===void 0&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let s=0;return this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+s):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){n===void 0&&(n=0);let s=0;if(this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=s;if(this.layout&&(this.layout.encode(t[this.property],e,n+s),i+=this.layout.getSpan(e,n+s),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}};function Mu(r){return 0>r&&(r+=4294967296),r}class Bg extends Rr{constructor(t,e,n){if(!(t instanceof Jo||t instanceof Bs))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof e=="string"&&n===void 0&&(n=e,e=void 0),4=e)throw new TypeError("bits must be positive integer");const s=8*t.span,i=t.fields.reduce((c,l)=>c+l.bits,0);if(e+i>s)throw new Error("bits too long for span remainder ("+(s-i)+" of "+s+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(!Number.isInteger(t)||t!==Mu(t&this.valueMask))throw new TypeError(Ag("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=Mu(t<n&&(n=this.length.decode(t,e)),n}decode(t,e){e===void 0&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let s=this.length;if(this.length instanceof ei&&(s=t.length),!(Zt.Buffer.isBuffer(t)&&s===t.length))throw new TypeError(Ag("Blob.encode",this)+" requires (length "+s+") Buffer as src");if(n+s>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,s,"hex"),this.length instanceof ei&&this.length.encode(s,e,n),s}};class y9 extends Rr{constructor(t){super(-1,t)}getSpan(t,e){if(!Zt.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");e===void 0&&(e=0);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");return s.copy(e,n),e[n+i]=0,i+1}}class b9 extends Rr{constructor(t,e){if(typeof t=="string"&&e===void 0&&(e=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e){if(!Zt.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");return e===void 0&&(e=0),t.length-e}decode(t,e,n){e===void 0&&(e=0);let s=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return s.copy(e,n),i}}class w9 extends Rr{constructor(t,e){super(0,e),this.value=t}decode(t,e,n){return this.value}encode(t,e,n){return 0}}Pe.ExternalLayout=ei;Pe.GreedyCount=u9;Pe.OffsetLayout=Sg;Pe.UInt=Jo;Pe.UIntBE=Bs;Pe.Int=su;Pe.IntBE=Ef;Pe.Float=f9;Pe.FloatBE=c9;Pe.Double=h9;Pe.DoubleBE=l9;Pe.Sequence=d9;Pe.Structure=p9;Pe.UnionDiscriminator=kg;Pe.UnionLayoutDiscriminator=fl;Pe.Union=Ig;Pe.VariantLayout=m9;Pe.BitStructure=Bg;Pe.BitField=Ec;Pe.Boolean=v9;Pe.Blob=g9;Pe.CString=y9;Pe.UTF8=b9;Pe.Constant=w9;Pe.greedy=(r,t)=>new u9(r,t);Pe.offset=(r,t,e)=>new Sg(r,t,e);Pe.u8=r=>new Jo(1,r);Pe.u16=r=>new Jo(2,r);Pe.u24=r=>new Jo(3,r);Pe.u32=r=>new Jo(4,r);Pe.u40=r=>new Jo(5,r);Pe.u48=r=>new Jo(6,r);Pe.nu64=r=>new ZT(r);Pe.u16be=r=>new Bs(2,r);Pe.u24be=r=>new Bs(3,r);Pe.u32be=r=>new Bs(4,r);Pe.u40be=r=>new Bs(5,r);Pe.u48be=r=>new Bs(6,r);Pe.nu64be=r=>new WT(r);Pe.s8=r=>new su(1,r);Pe.s16=r=>new su(2,r);Pe.s24=r=>new su(3,r);Pe.s32=r=>new su(4,r);Pe.s40=r=>new su(5,r);Pe.s48=r=>new su(6,r);Pe.ns64=r=>new GT(r);Pe.s16be=r=>new Ef(2,r);Pe.s24be=r=>new Ef(3,r);Pe.s32be=r=>new Ef(4,r);Pe.s40be=r=>new Ef(5,r);Pe.s48be=r=>new Ef(6,r);Pe.ns64be=r=>new YT(r);Pe.f32=r=>new f9(r);Pe.f32be=r=>new c9(r);Pe.f64=r=>new h9(r);Pe.f64be=r=>new l9(r);Pe.struct=(r,t,e)=>new p9(r,t,e);Pe.bits=(r,t,e)=>new Bg(r,t,e);Pe.seq=(r,t,e)=>new d9(r,t,e);Pe.union=(r,t,e)=>new Ig(r,t,e);Pe.unionLayoutDiscriminator=(r,t)=>new fl(r,t);Pe.blob=(r,t)=>new g9(r,t);Pe.cstr=r=>new y9(r);Pe.utf8=(r,t)=>new b9(r,t);Pe.const=(r,t)=>new w9(r,t);(function(r){var t=Re&&Re.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(r,"__esModule",{value:!0}),r.map=r.array=r.rustEnum=r.str=r.vecU8=r.tagged=r.vec=r.bool=r.option=r.publicKey=r.i256=r.u256=r.i128=r.u128=r.i64=r.u64=r.struct=r.f64=r.f32=r.i32=r.u32=r.i16=r.u16=r.i8=r.u8=void 0;const e=Pe,n=rg,s=t(Kl);var i=Pe;Object.defineProperty(r,"u8",{enumerable:!0,get:function(){return i.u8}}),Object.defineProperty(r,"i8",{enumerable:!0,get:function(){return i.s8}}),Object.defineProperty(r,"u16",{enumerable:!0,get:function(){return i.u16}}),Object.defineProperty(r,"i16",{enumerable:!0,get:function(){return i.s16}}),Object.defineProperty(r,"u32",{enumerable:!0,get:function(){return i.u32}}),Object.defineProperty(r,"i32",{enumerable:!0,get:function(){return i.s32}}),Object.defineProperty(r,"f32",{enumerable:!0,get:function(){return i.f32}}),Object.defineProperty(r,"f64",{enumerable:!0,get:function(){return i.f64}}),Object.defineProperty(r,"struct",{enumerable:!0,get:function(){return i.struct}});class c extends e.Layout{constructor(a,f,h){super(a,h),this.blob=(0,e.blob)(a),this.signed=f}decode(a,f=0){const h=new s.default(this.blob.decode(a,f),10,"le");return this.signed?h.fromTwos(this.span*8).clone():h}encode(a,f,h=0){return this.signed&&(a=a.toTwos(this.span*8)),this.blob.encode(a.toArrayLike(Zt.Buffer,"le",this.span),f,h)}}function l(o){return new c(8,!1,o)}r.u64=l;function p(o){return new c(8,!0,o)}r.i64=p;function m(o){return new c(16,!1,o)}r.u128=m;function v(o){return new c(16,!0,o)}r.i128=v;function _(o){return new c(32,!1,o)}r.u256=_;function E(o){return new c(32,!0,o)}r.i256=E;class w extends e.Layout{constructor(a,f,h,g){super(a.span,g),this.layout=a,this.decoder=f,this.encoder=h}decode(a,f){return this.decoder(this.layout.decode(a,f))}encode(a,f,h){return this.layout.encode(this.encoder(a),f,h)}getSpan(a,f){return this.layout.getSpan(a,f)}}function x(o){return new w((0,e.blob)(32),a=>new n.PublicKey(a),a=>a.toBuffer(),o)}r.publicKey=x;class A extends e.Layout{constructor(a,f){super(-1,f),this.layout=a,this.discriminator=(0,e.u8)()}encode(a,f,h=0){return a==null?this.discriminator.encode(0,f,h):(this.discriminator.encode(1,f,h),this.layout.encode(a,f,h+1)+1)}decode(a,f=0){const h=this.discriminator.decode(a,f);if(h===0)return null;if(h===1)return this.layout.decode(a,f+1);throw new Error("Invalid option "+this.property)}getSpan(a,f=0){const h=this.discriminator.decode(a,f);if(h===0)return 1;if(h===1)return this.layout.getSpan(a,f+1)+1;throw new Error("Invalid option "+this.property)}}function B(o,a){return new A(o,a)}r.option=B;function P(o){return new w((0,e.u8)(),R,C,o)}r.bool=P;function R(o){if(o===0)return!1;if(o===1)return!0;throw new Error("Invalid bool: "+o)}function C(o){return o?1:0}function O(o,a){const f=(0,e.u32)("length"),h=(0,e.struct)([f,(0,e.seq)(o,(0,e.offset)(f,-f.span),"values")]);return new w(h,({values:g})=>g,g=>({values:g}),a)}r.vec=O;function z(o,a,f){const h=(0,e.struct)([l("tag"),a.replicate("data")]);function g({tag:S,data:I}){if(!S.eq(o))throw new Error("Invalid tag, expected: "+o.toString("hex")+", got: "+S.toString("hex"));return I}return new w(h,g,S=>({tag:o,data:S}),f)}r.tagged=z;function H(o){const a=(0,e.u32)("length"),f=(0,e.struct)([a,(0,e.blob)((0,e.offset)(a,-a.span),"data")]);return new w(f,({data:h})=>h,h=>({data:h}),o)}r.vecU8=H;function tt(o){return new w(H(),a=>a.toString("utf-8"),a=>Zt.Buffer.from(a,"utf-8"),o)}r.str=tt;function nt(o,a,f){const h=(0,e.union)(f??(0,e.u8)(),a);return o.forEach((g,S)=>h.addVariant(S,g,g.property)),h}r.rustEnum=nt;function G(o,a,f){const h=(0,e.struct)([(0,e.seq)(o,a,"values")]);return new w(h,({values:g})=>g,g=>({values:g}),f)}r.array=G;class M extends e.Layout{constructor(a,f,h){super(a.span+f.span,h),this.keyLayout=a,this.valueLayout=f}decode(a,f){f=f||0;const h=this.keyLayout.decode(a,f),g=this.valueLayout.decode(a,f+this.keyLayout.getSpan(a,f));return[h,g]}encode(a,f,h){h=h||0;const g=this.keyLayout.encode(a[0],f,h),S=this.valueLayout.encode(a[1],f,h+g);return g+S}getSpan(a,f){return this.keyLayout.getSpan(a,f)+this.valueLayout.getSpan(a,f)}}function d(o,a,f){const h=(0,e.u32)("length"),g=(0,e.struct)([h,(0,e.seq)(new M(o,a),(0,e.offset)(h,-h.span),"values")]);return new w(g,({values:S})=>new Map(S),S=>({values:Array.from(S.entries())}),f)}r.map=d})(Ze);/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */const XT=4,j6=0,K6=1,JT=2;function Af(r){let t=r.length;for(;--t>=0;)r[t]=0}const QT=0,x9=1,tL=2,eL=3,rL=258,Pg=29,kh=256,Dc=kh+1+Pg,Uu=30,Rg=19,_9=2*Dc+1,Ia=15,vp=16,nL=7,Cg=256,M9=16,E9=17,A9=18,l2=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]),Z0=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]),iL=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),S9=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),oL=512,hs=new Array((Dc+2)*2);Af(hs);const Ac=new Array(Uu*2);Af(Ac);const zc=new Array(oL);Af(zc);const qc=new Array(rL-eL+1);Af(qc);const Tg=new Array(Pg);Af(Tg);const cl=new Array(Uu);Af(cl);function gp(r,t,e,n,s){this.static_tree=r,this.extra_bits=t,this.extra_base=e,this.elems=n,this.max_length=s,this.has_stree=r&&r.length}let k9,I9,B9;function yp(r,t){this.dyn_tree=r,this.max_code=0,this.stat_desc=t}const P9=r=>r<256?zc[r]:zc[256+(r>>>7)],Fc=(r,t)=>{r.pending_buf[r.pending++]=t&255,r.pending_buf[r.pending++]=t>>>8&255},oi=(r,t,e)=>{r.bi_valid>vp-e?(r.bi_buf|=t<>vp-r.bi_valid,r.bi_valid+=e-vp):(r.bi_buf|=t<{oi(r,e[t*2],e[t*2+1])},R9=(r,t)=>{let e=0;do e|=r&1,r>>>=1,e<<=1;while(--t>0);return e>>>1},sL=r=>{r.bi_valid===16?(Fc(r,r.bi_buf),r.bi_buf=0,r.bi_valid=0):r.bi_valid>=8&&(r.pending_buf[r.pending++]=r.bi_buf&255,r.bi_buf>>=8,r.bi_valid-=8)},aL=(r,t)=>{const e=t.dyn_tree,n=t.max_code,s=t.stat_desc.static_tree,i=t.stat_desc.has_stree,c=t.stat_desc.extra_bits,l=t.stat_desc.extra_base,p=t.stat_desc.max_length;let m,v,_,E,w,x,A=0;for(E=0;E<=Ia;E++)r.bl_count[E]=0;for(e[r.heap[r.heap_max]*2+1]=0,m=r.heap_max+1;m<_9;m++)v=r.heap[m],E=e[e[v*2+1]*2+1]+1,E>p&&(E=p,A++),e[v*2+1]=E,!(v>n)&&(r.bl_count[E]++,w=0,v>=l&&(w=c[v-l]),x=e[v*2],r.opt_len+=x*(E+w),i&&(r.static_len+=x*(s[v*2+1]+w)));if(A!==0){do{for(E=p-1;r.bl_count[E]===0;)E--;r.bl_count[E]--,r.bl_count[E+1]+=2,r.bl_count[p]--,A-=2}while(A>0);for(E=p;E!==0;E--)for(v=r.bl_count[E];v!==0;)_=r.heap[--m],!(_>n)&&(e[_*2+1]!==E&&(r.opt_len+=(E-e[_*2+1])*e[_*2],e[_*2+1]=E),v--)}},C9=(r,t,e)=>{const n=new Array(Ia+1);let s=0,i,c;for(i=1;i<=Ia;i++)s=s+e[i-1]<<1,n[i]=s;for(c=0;c<=t;c++){let l=r[c*2+1];l!==0&&(r[c*2]=R9(n[l]++,l))}},uL=()=>{let r,t,e,n,s;const i=new Array(Ia+1);for(e=0,n=0;n>=7;n{let t;for(t=0;t{r.bi_valid>8?Fc(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},$6=(r,t,e,n)=>{const s=t*2,i=e*2;return r[s]{const n=r.heap[e];let s=e<<1;for(;s<=r.heap_len&&(s{let n,s,i=0,c,l;if(r.sym_next!==0)do n=r.pending_buf[r.sym_buf+i++]&255,n+=(r.pending_buf[r.sym_buf+i++]&255)<<8,s=r.pending_buf[r.sym_buf+i++],n===0?Do(r,s,t):(c=qc[s],Do(r,c+kh+1,t),l=l2[c],l!==0&&(s-=Tg[c],oi(r,s,l)),n--,c=P9(n),Do(r,c,e),l=Z0[c],l!==0&&(n-=cl[c],oi(r,n,l)));while(i{const e=t.dyn_tree,n=t.stat_desc.static_tree,s=t.stat_desc.has_stree,i=t.stat_desc.elems;let c,l,p=-1,m;for(r.heap_len=0,r.heap_max=_9,c=0;c>1;c>=1;c--)bp(r,e,c);m=i;do c=r.heap[1],r.heap[1]=r.heap[r.heap_len--],bp(r,e,1),l=r.heap[1],r.heap[--r.heap_max]=c,r.heap[--r.heap_max]=l,e[m*2]=e[c*2]+e[l*2],r.depth[m]=(r.depth[c]>=r.depth[l]?r.depth[c]:r.depth[l])+1,e[c*2+1]=e[l*2+1]=m,r.heap[1]=m++,bp(r,e,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],aL(r,t),C9(e,p,r.bl_count)},V6=(r,t,e)=>{let n,s=-1,i,c=t[0*2+1],l=0,p=7,m=4;for(c===0&&(p=138,m=3),t[(e+1)*2+1]=65535,n=0;n<=e;n++)i=c,c=t[(n+1)*2+1],!(++l{let n,s=-1,i,c=t[0*2+1],l=0,p=7,m=4;for(c===0&&(p=138,m=3),n=0;n<=e;n++)if(i=c,c=t[(n+1)*2+1],!(++l{let t;for(V6(r,r.dyn_ltree,r.l_desc.max_code),V6(r,r.dyn_dtree,r.d_desc.max_code),d2(r,r.bl_desc),t=Rg-1;t>=3&&r.bl_tree[S9[t]*2+1]===0;t--);return r.opt_len+=3*(t+1)+5+5+4,t},cL=(r,t,e,n)=>{let s;for(oi(r,t-257,5),oi(r,e-1,5),oi(r,n-4,4),s=0;s{let t=4093624447,e;for(e=0;e<=31;e++,t>>>=1)if(t&1&&r.dyn_ltree[e*2]!==0)return j6;if(r.dyn_ltree[9*2]!==0||r.dyn_ltree[10*2]!==0||r.dyn_ltree[13*2]!==0)return K6;for(e=32;e{W6||(uL(),W6=!0),r.l_desc=new yp(r.dyn_ltree,k9),r.d_desc=new yp(r.dyn_dtree,I9),r.bl_desc=new yp(r.bl_tree,B9),r.bi_buf=0,r.bi_valid=0,T9(r)},O9=(r,t,e,n)=>{oi(r,(QT<<1)+(n?1:0),3),L9(r),Fc(r,e),Fc(r,~e),e&&r.pending_buf.set(r.window.subarray(t,t+e),r.pending),r.pending+=e},dL=r=>{oi(r,x9<<1,3),Do(r,Cg,hs),sL(r)},pL=(r,t,e,n)=>{let s,i,c=0;r.level>0?(r.strm.data_type===JT&&(r.strm.data_type=hL(r)),d2(r,r.l_desc),d2(r,r.d_desc),c=fL(r),s=r.opt_len+3+7>>>3,i=r.static_len+3+7>>>3,i<=s&&(s=i)):s=i=e+5,e+4<=s&&t!==-1?O9(r,t,e,n):r.strategy===XT||i===s?(oi(r,(x9<<1)+(n?1:0),3),H6(r,hs,Ac)):(oi(r,(tL<<1)+(n?1:0),3),cL(r,r.l_desc.max_code+1,r.d_desc.max_code+1,c+1),H6(r,r.dyn_ltree,r.dyn_dtree)),T9(r),n&&L9(r)},mL=(r,t,e)=>(r.pending_buf[r.sym_buf+r.sym_next++]=t,r.pending_buf[r.sym_buf+r.sym_next++]=t>>8,r.pending_buf[r.sym_buf+r.sym_next++]=e,t===0?r.dyn_ltree[e*2]++:(r.matches++,t--,r.dyn_ltree[(qc[e]+kh+1)*2]++,r.dyn_dtree[P9(t)*2]++),r.sym_next===r.sym_end);var vL=lL,gL=O9,yL=pL,bL=mL,wL=dL,xL={_tr_init:vL,_tr_stored_block:gL,_tr_flush_block:yL,_tr_tally:bL,_tr_align:wL};const _L=(r,t,e,n)=>{let s=r&65535|0,i=r>>>16&65535|0,c=0;for(;e!==0;){c=e>2e3?2e3:e,e-=c;do s=s+t[n++]|0,i=i+s|0;while(--c);s%=65521,i%=65521}return s|i<<16|0};var jc=_L;const ML=()=>{let r,t=[];for(var e=0;e<256;e++){r=e;for(var n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;t[e]=r}return t},EL=new Uint32Array(ML()),AL=(r,t,e,n)=>{const s=EL,i=n+e;r^=-1;for(let c=n;c>>8^s[(r^t[c])&255];return r^-1};var xn=AL,of={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"},Ih={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:SL,_tr_stored_block:p2,_tr_flush_block:kL,_tr_tally:Gs,_tr_align:IL}=xL,{Z_NO_FLUSH:Ys,Z_PARTIAL_FLUSH:BL,Z_FULL_FLUSH:PL,Z_FINISH:qi,Z_BLOCK:G6,Z_OK:Pn,Z_STREAM_END:Y6,Z_STREAM_ERROR:jo,Z_DATA_ERROR:RL,Z_BUF_ERROR:wp,Z_DEFAULT_COMPRESSION:CL,Z_FILTERED:TL,Z_HUFFMAN_ONLY:r0,Z_RLE:LL,Z_FIXED:OL,Z_DEFAULT_STRATEGY:UL,Z_UNKNOWN:NL,Z_DEFLATED:cd}=Ih,DL=9,zL=15,qL=8,FL=29,jL=256,m2=jL+1+FL,KL=30,$L=19,HL=2*m2+1,VL=15,hr=3,$s=258,Ko=$s+hr+1,ZL=32,sf=42,Lg=57,v2=69,g2=73,y2=91,b2=103,Ba=113,xc=666,Xn=1,Sf=2,Ga=3,kf=4,WL=3,Pa=(r,t)=>(r.msg=of[t],t),X6=r=>r*2-(r>4?9:0),js=r=>{let t=r.length;for(;--t>=0;)r[t]=0},GL=r=>{let t,e,n,s=r.w_size;t=r.hash_size,n=t;do e=r.head[--n],r.head[n]=e>=s?e-s:0;while(--t);t=s,n=t;do e=r.prev[--n],r.prev[n]=e>=s?e-s:0;while(--t)};let YL=(r,t,e)=>(t<{const t=r.state;let e=t.pending;e>r.avail_out&&(e=r.avail_out),e!==0&&(r.output.set(t.pending_buf.subarray(t.pending_out,t.pending_out+e),r.next_out),r.next_out+=e,t.pending_out+=e,r.total_out+=e,r.avail_out-=e,t.pending-=e,t.pending===0&&(t.pending_out=0))},Ai=(r,t)=>{kL(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,t),r.block_start=r.strstart,bi(r.strm)},Er=(r,t)=>{r.pending_buf[r.pending++]=t},Gf=(r,t)=>{r.pending_buf[r.pending++]=t>>>8&255,r.pending_buf[r.pending++]=t&255},w2=(r,t,e,n)=>{let s=r.avail_in;return s>n&&(s=n),s===0?0:(r.avail_in-=s,t.set(r.input.subarray(r.next_in,r.next_in+s),e),r.state.wrap===1?r.adler=jc(r.adler,t,s,e):r.state.wrap===2&&(r.adler=xn(r.adler,t,s,e)),r.next_in+=s,r.total_in+=s,s)},U9=(r,t)=>{let e=r.max_chain_length,n=r.strstart,s,i,c=r.prev_length,l=r.nice_match;const p=r.strstart>r.w_size-Ko?r.strstart-(r.w_size-Ko):0,m=r.window,v=r.w_mask,_=r.prev,E=r.strstart+$s;let w=m[n+c-1],x=m[n+c];r.prev_length>=r.good_match&&(e>>=2),l>r.lookahead&&(l=r.lookahead);do if(s=t,!(m[s+c]!==x||m[s+c-1]!==w||m[s]!==m[n]||m[++s]!==m[n+1])){n+=2,s++;do;while(m[++n]===m[++s]&&m[++n]===m[++s]&&m[++n]===m[++s]&&m[++n]===m[++s]&&m[++n]===m[++s]&&m[++n]===m[++s]&&m[++n]===m[++s]&&m[++n]===m[++s]&&nc){if(r.match_start=t,c=i,i>=l)break;w=m[n+c-1],x=m[n+c]}}while((t=_[t&v])>p&&--e!==0);return c<=r.lookahead?c:r.lookahead},af=r=>{const t=r.w_size;let e,n,s;do{if(n=r.window_size-r.lookahead-r.strstart,r.strstart>=t+(t-Ko)&&(r.window.set(r.window.subarray(t,t+t-n),0),r.match_start-=t,r.strstart-=t,r.block_start-=t,r.insert>r.strstart&&(r.insert=r.strstart),GL(r),n+=t),r.strm.avail_in===0)break;if(e=w2(r.strm,r.window,r.strstart+r.lookahead,n),r.lookahead+=e,r.lookahead+r.insert>=hr)for(s=r.strstart-r.insert,r.ins_h=r.window[s],r.ins_h=Xs(r,r.ins_h,r.window[s+1]);r.insert&&(r.ins_h=Xs(r,r.ins_h,r.window[s+hr-1]),r.prev[s&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=s,s++,r.insert--,!(r.lookahead+r.insert{let e=r.pending_buf_size-5>r.w_size?r.w_size:r.pending_buf_size-5,n,s,i,c=0,l=r.strm.avail_in;do{if(n=65535,i=r.bi_valid+42>>3,r.strm.avail_outs+r.strm.avail_in&&(n=s+r.strm.avail_in),n>i&&(n=i),n>8,r.pending_buf[r.pending-2]=~n,r.pending_buf[r.pending-1]=~n>>8,bi(r.strm),s&&(s>n&&(s=n),r.strm.output.set(r.window.subarray(r.block_start,r.block_start+s),r.strm.next_out),r.strm.next_out+=s,r.strm.avail_out-=s,r.strm.total_out+=s,r.block_start+=s,n-=s),n&&(w2(r.strm,r.strm.output,r.strm.next_out,n),r.strm.next_out+=n,r.strm.avail_out-=n,r.strm.total_out+=n)}while(c===0);return l-=r.strm.avail_in,l&&(l>=r.w_size?(r.matches=2,r.window.set(r.strm.input.subarray(r.strm.next_in-r.w_size,r.strm.next_in),0),r.strstart=r.w_size,r.insert=r.strstart):(r.window_size-r.strstart<=l&&(r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,r.insert>r.strstart&&(r.insert=r.strstart)),r.window.set(r.strm.input.subarray(r.strm.next_in-l,r.strm.next_in),r.strstart),r.strstart+=l,r.insert+=l>r.w_size-r.insert?r.w_size-r.insert:l),r.block_start=r.strstart),r.high_wateri&&r.block_start>=r.w_size&&(r.block_start-=r.w_size,r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,i+=r.w_size,r.insert>r.strstart&&(r.insert=r.strstart)),i>r.strm.avail_in&&(i=r.strm.avail_in),i&&(w2(r.strm,r.window,r.strstart,i),r.strstart+=i,r.insert+=i>r.w_size-r.insert?r.w_size-r.insert:i),r.high_water>3,i=r.pending_buf_size-i>65535?65535:r.pending_buf_size-i,e=i>r.w_size?r.w_size:i,s=r.strstart-r.block_start,(s>=e||(s||t===qi)&&t!==Ys&&r.strm.avail_in===0&&s<=i)&&(n=s>i?i:s,c=t===qi&&r.strm.avail_in===0&&n===s?1:0,p2(r,r.block_start,n,c),r.block_start+=n,bi(r.strm)),c?Ga:Xn)},xp=(r,t)=>{let e,n;for(;;){if(r.lookahead=hr&&(r.ins_h=Xs(r,r.ins_h,r.window[r.strstart+hr-1]),e=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),e!==0&&r.strstart-e<=r.w_size-Ko&&(r.match_length=U9(r,e)),r.match_length>=hr)if(n=Gs(r,r.strstart-r.match_start,r.match_length-hr),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=hr){r.match_length--;do r.strstart++,r.ins_h=Xs(r,r.ins_h,r.window[r.strstart+hr-1]),e=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart;while(--r.match_length!==0);r.strstart++}else r.strstart+=r.match_length,r.match_length=0,r.ins_h=r.window[r.strstart],r.ins_h=Xs(r,r.ins_h,r.window[r.strstart+1]);else n=Gs(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(n&&(Ai(r,!1),r.strm.avail_out===0))return Xn}return r.insert=r.strstart{let e,n,s;for(;;){if(r.lookahead=hr&&(r.ins_h=Xs(r,r.ins_h,r.window[r.strstart+hr-1]),e=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),r.prev_length=r.match_length,r.prev_match=r.match_start,r.match_length=hr-1,e!==0&&r.prev_length4096)&&(r.match_length=hr-1)),r.prev_length>=hr&&r.match_length<=r.prev_length){s=r.strstart+r.lookahead-hr,n=Gs(r,r.strstart-1-r.prev_match,r.prev_length-hr),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=s&&(r.ins_h=Xs(r,r.ins_h,r.window[r.strstart+hr-1]),e=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart);while(--r.prev_length!==0);if(r.match_available=0,r.match_length=hr-1,r.strstart++,n&&(Ai(r,!1),r.strm.avail_out===0))return Xn}else if(r.match_available){if(n=Gs(r,0,r.window[r.strstart-1]),n&&Ai(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return Xn}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(n=Gs(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart{let e,n,s,i;const c=r.window;for(;;){if(r.lookahead<=$s){if(af(r),r.lookahead<=$s&&t===Ys)return Xn;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=hr&&r.strstart>0&&(s=r.strstart-1,n=c[s],n===c[++s]&&n===c[++s]&&n===c[++s])){i=r.strstart+$s;do;while(n===c[++s]&&n===c[++s]&&n===c[++s]&&n===c[++s]&&n===c[++s]&&n===c[++s]&&n===c[++s]&&n===c[++s]&&sr.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=hr?(e=Gs(r,1,r.match_length-hr),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(e=Gs(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),e&&(Ai(r,!1),r.strm.avail_out===0))return Xn}return r.insert=0,t===qi?(Ai(r,!0),r.strm.avail_out===0?Ga:kf):r.sym_next&&(Ai(r,!1),r.strm.avail_out===0)?Xn:Sf},JL=(r,t)=>{let e;for(;;){if(r.lookahead===0&&(af(r),r.lookahead===0)){if(t===Ys)return Xn;break}if(r.match_length=0,e=Gs(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,e&&(Ai(r,!1),r.strm.avail_out===0))return Xn}return r.insert=0,t===qi?(Ai(r,!0),r.strm.avail_out===0?Ga:kf):r.sym_next&&(Ai(r,!1),r.strm.avail_out===0)?Xn:Sf};function vo(r,t,e,n,s){this.good_length=r,this.max_lazy=t,this.nice_length=e,this.max_chain=n,this.func=s}const _c=[new vo(0,0,0,0,N9),new vo(4,4,8,4,xp),new vo(4,5,16,8,xp),new vo(4,6,32,32,xp),new vo(4,4,16,16,pu),new vo(8,16,32,32,pu),new vo(8,16,128,128,pu),new vo(8,32,128,256,pu),new vo(32,128,258,1024,pu),new vo(32,258,258,4096,pu)],QL=r=>{r.window_size=2*r.w_size,js(r.head),r.max_lazy_match=_c[r.level].max_lazy,r.good_match=_c[r.level].good_length,r.nice_match=_c[r.level].nice_length,r.max_chain_length=_c[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=hr-1,r.match_available=0,r.ins_h=0};function tO(){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=cd,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(HL*2),this.dyn_dtree=new Uint16Array((2*KL+1)*2),this.bl_tree=new Uint16Array((2*$L+1)*2),js(this.dyn_ltree),js(this.dyn_dtree),js(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(VL+1),this.heap=new Uint16Array(2*m2+1),js(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*m2+1),js(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 Bh=r=>{if(!r)return 1;const t=r.state;return!t||t.strm!==r||t.status!==sf&&t.status!==Lg&&t.status!==v2&&t.status!==g2&&t.status!==y2&&t.status!==b2&&t.status!==Ba&&t.status!==xc?1:0},D9=r=>{if(Bh(r))return Pa(r,jo);r.total_in=r.total_out=0,r.data_type=NL;const t=r.state;return t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap===2?Lg:t.wrap?sf:Ba,r.adler=t.wrap===2?0:1,t.last_flush=-2,SL(t),Pn},z9=r=>{const t=D9(r);return t===Pn&&QL(r.state),t},eO=(r,t)=>Bh(r)||r.state.wrap!==2?jo:(r.state.gzhead=t,Pn),q9=(r,t,e,n,s,i)=>{if(!r)return jo;let c=1;if(t===CL&&(t=6),n<0?(c=0,n=-n):n>15&&(c=2,n-=16),s<1||s>DL||e!==cd||n<8||n>15||t<0||t>9||i<0||i>OL||n===8&&c!==1)return Pa(r,jo);n===8&&(n=9);const l=new tO;return r.state=l,l.strm=r,l.status=sf,l.wrap=c,l.gzhead=null,l.w_bits=n,l.w_size=1<q9(r,t,cd,zL,qL,UL),nO=(r,t)=>{if(Bh(r)||t>G6||t<0)return r?Pa(r,jo):jo;const e=r.state;if(!r.output||r.avail_in!==0&&!r.input||e.status===xc&&t!==qi)return Pa(r,r.avail_out===0?wp:jo);const n=e.last_flush;if(e.last_flush=t,e.pending!==0){if(bi(r),r.avail_out===0)return e.last_flush=-1,Pn}else if(r.avail_in===0&&X6(t)<=X6(n)&&t!==qi)return Pa(r,wp);if(e.status===xc&&r.avail_in!==0)return Pa(r,wp);if(e.status===sf&&e.wrap===0&&(e.status=Ba),e.status===sf){let s=cd+(e.w_bits-8<<4)<<8,i=-1;if(e.strategy>=r0||e.level<2?i=0:e.level<6?i=1:e.level===6?i=2:i=3,s|=i<<6,e.strstart!==0&&(s|=ZL),s+=31-s%31,Gf(e,s),e.strstart!==0&&(Gf(e,r.adler>>>16),Gf(e,r.adler&65535)),r.adler=1,e.status=Ba,bi(r),e.pending!==0)return e.last_flush=-1,Pn}if(e.status===Lg){if(r.adler=0,Er(e,31),Er(e,139),Er(e,8),e.gzhead)Er(e,(e.gzhead.text?1:0)+(e.gzhead.hcrc?2:0)+(e.gzhead.extra?4:0)+(e.gzhead.name?8:0)+(e.gzhead.comment?16:0)),Er(e,e.gzhead.time&255),Er(e,e.gzhead.time>>8&255),Er(e,e.gzhead.time>>16&255),Er(e,e.gzhead.time>>24&255),Er(e,e.level===9?2:e.strategy>=r0||e.level<2?4:0),Er(e,e.gzhead.os&255),e.gzhead.extra&&e.gzhead.extra.length&&(Er(e,e.gzhead.extra.length&255),Er(e,e.gzhead.extra.length>>8&255)),e.gzhead.hcrc&&(r.adler=xn(r.adler,e.pending_buf,e.pending,0)),e.gzindex=0,e.status=v2;else if(Er(e,0),Er(e,0),Er(e,0),Er(e,0),Er(e,0),Er(e,e.level===9?2:e.strategy>=r0||e.level<2?4:0),Er(e,WL),e.status=Ba,bi(r),e.pending!==0)return e.last_flush=-1,Pn}if(e.status===v2){if(e.gzhead.extra){let s=e.pending,i=(e.gzhead.extra.length&65535)-e.gzindex;for(;e.pending+i>e.pending_buf_size;){let l=e.pending_buf_size-e.pending;if(e.pending_buf.set(e.gzhead.extra.subarray(e.gzindex,e.gzindex+l),e.pending),e.pending=e.pending_buf_size,e.gzhead.hcrc&&e.pending>s&&(r.adler=xn(r.adler,e.pending_buf,e.pending-s,s)),e.gzindex+=l,bi(r),e.pending!==0)return e.last_flush=-1,Pn;s=0,i-=l}let c=new Uint8Array(e.gzhead.extra);e.pending_buf.set(c.subarray(e.gzindex,e.gzindex+i),e.pending),e.pending+=i,e.gzhead.hcrc&&e.pending>s&&(r.adler=xn(r.adler,e.pending_buf,e.pending-s,s)),e.gzindex=0}e.status=g2}if(e.status===g2){if(e.gzhead.name){let s=e.pending,i;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>s&&(r.adler=xn(r.adler,e.pending_buf,e.pending-s,s)),bi(r),e.pending!==0)return e.last_flush=-1,Pn;s=0}e.gzindexs&&(r.adler=xn(r.adler,e.pending_buf,e.pending-s,s)),e.gzindex=0}e.status=y2}if(e.status===y2){if(e.gzhead.comment){let s=e.pending,i;do{if(e.pending===e.pending_buf_size){if(e.gzhead.hcrc&&e.pending>s&&(r.adler=xn(r.adler,e.pending_buf,e.pending-s,s)),bi(r),e.pending!==0)return e.last_flush=-1,Pn;s=0}e.gzindexs&&(r.adler=xn(r.adler,e.pending_buf,e.pending-s,s))}e.status=b2}if(e.status===b2){if(e.gzhead.hcrc){if(e.pending+2>e.pending_buf_size&&(bi(r),e.pending!==0))return e.last_flush=-1,Pn;Er(e,r.adler&255),Er(e,r.adler>>8&255),r.adler=0}if(e.status=Ba,bi(r),e.pending!==0)return e.last_flush=-1,Pn}if(r.avail_in!==0||e.lookahead!==0||t!==Ys&&e.status!==xc){let s=e.level===0?N9(e,t):e.strategy===r0?JL(e,t):e.strategy===LL?XL(e,t):_c[e.level].func(e,t);if((s===Ga||s===kf)&&(e.status=xc),s===Xn||s===Ga)return r.avail_out===0&&(e.last_flush=-1),Pn;if(s===Sf&&(t===BL?IL(e):t!==G6&&(p2(e,0,0,!1),t===PL&&(js(e.head),e.lookahead===0&&(e.strstart=0,e.block_start=0,e.insert=0))),bi(r),r.avail_out===0))return e.last_flush=-1,Pn}return t!==qi?Pn:e.wrap<=0?Y6:(e.wrap===2?(Er(e,r.adler&255),Er(e,r.adler>>8&255),Er(e,r.adler>>16&255),Er(e,r.adler>>24&255),Er(e,r.total_in&255),Er(e,r.total_in>>8&255),Er(e,r.total_in>>16&255),Er(e,r.total_in>>24&255)):(Gf(e,r.adler>>>16),Gf(e,r.adler&65535)),bi(r),e.wrap>0&&(e.wrap=-e.wrap),e.pending!==0?Pn:Y6)},iO=r=>{if(Bh(r))return jo;const t=r.state.status;return r.state=null,t===Ba?Pa(r,RL):Pn},oO=(r,t)=>{let e=t.length;if(Bh(r))return jo;const n=r.state,s=n.wrap;if(s===2||s===1&&n.status!==sf||n.lookahead)return jo;if(s===1&&(r.adler=jc(r.adler,t,e,0)),n.wrap=0,e>=n.w_size){s===0&&(js(n.head),n.strstart=0,n.block_start=0,n.insert=0);let p=new Uint8Array(n.w_size);p.set(t.subarray(e-n.w_size,e),0),t=p,e=n.w_size}const i=r.avail_in,c=r.next_in,l=r.input;for(r.avail_in=e,r.next_in=0,r.input=t,af(n);n.lookahead>=hr;){let p=n.strstart,m=n.lookahead-(hr-1);do n.ins_h=Xs(n,n.ins_h,n.window[p+hr-1]),n.prev[p&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=p,p++;while(--m);n.strstart=p,n.lookahead=hr-1,af(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=hr-1,n.match_available=0,r.next_in=c,r.input=l,r.avail_in=i,n.wrap=s,Pn};var sO=rO,aO=q9,uO=z9,fO=D9,cO=eO,hO=nO,lO=iO,dO=oO,pO="pako deflate (from Nodeca project)",Sc={deflateInit:sO,deflateInit2:aO,deflateReset:uO,deflateResetKeep:fO,deflateSetHeader:cO,deflate:hO,deflateEnd:lO,deflateSetDictionary:dO,deflateInfo:pO};const mO=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);var vO=function(r){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(const n in e)mO(e,n)&&(r[n]=e[n])}}return r},gO=r=>{let t=0;for(let n=0,s=r.length;n=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;Kc[254]=Kc[254]=1;var yO=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let t,e,n,s,i,c=r.length,l=0;for(s=0;s>>6,t[i++]=128|e&63):e<65536?(t[i++]=224|e>>>12,t[i++]=128|e>>>6&63,t[i++]=128|e&63):(t[i++]=240|e>>>18,t[i++]=128|e>>>12&63,t[i++]=128|e>>>6&63,t[i++]=128|e&63);return t};const bO=(r,t)=>{if(t<65534&&r.subarray&&F9)return String.fromCharCode.apply(null,r.length===t?r:r.subarray(0,t));let e="";for(let n=0;n{const e=t||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,t));let n,s;const i=new Array(e*2);for(s=0,n=0;n4){i[s++]=65533,n+=l-1;continue}for(c&=l===2?31:l===3?15:7;l>1&&n1){i[s++]=65533;continue}c<65536?i[s++]=c:(c-=65536,i[s++]=55296|c>>10&1023,i[s++]=56320|c&1023)}return bO(i,s)},xO=(r,t)=>{t=t||r.length,t>r.length&&(t=r.length);let e=t-1;for(;e>=0&&(r[e]&192)===128;)e--;return e<0||e===0?t:e+Kc[r[e]]>t?e:t},$c={string2buf:yO,buf2string:wO,utf8border:xO};function _O(){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 j9=_O;const K9=Object.prototype.toString,{Z_NO_FLUSH:MO,Z_SYNC_FLUSH:EO,Z_FULL_FLUSH:AO,Z_FINISH:SO,Z_OK:hl,Z_STREAM_END:kO,Z_DEFAULT_COMPRESSION:IO,Z_DEFAULT_STRATEGY:BO,Z_DEFLATED:PO}=Ih;function Og(r){this.options=hd.assign({level:IO,method:PO,chunkSize:16384,windowBits:15,memLevel:8,strategy:BO},r||{});let t=this.options;t.raw&&t.windowBits>0?t.windowBits=-t.windowBits:t.gzip&&t.windowBits>0&&t.windowBits<16&&(t.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new j9,this.strm.avail_out=0;let e=Sc.deflateInit2(this.strm,t.level,t.method,t.windowBits,t.memLevel,t.strategy);if(e!==hl)throw new Error(of[e]);if(t.header&&Sc.deflateSetHeader(this.strm,t.header),t.dictionary){let n;if(typeof t.dictionary=="string"?n=$c.string2buf(t.dictionary):K9.call(t.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(t.dictionary):n=t.dictionary,e=Sc.deflateSetDictionary(this.strm,n),e!==hl)throw new Error(of[e]);this._dict_set=!0}}Og.prototype.push=function(r,t){const e=this.strm,n=this.options.chunkSize;let s,i;if(this.ended)return!1;for(t===~~t?i=t:i=t===!0?SO:MO,typeof r=="string"?e.input=$c.string2buf(r):K9.call(r)==="[object ArrayBuffer]"?e.input=new Uint8Array(r):e.input=r,e.next_in=0,e.avail_in=e.input.length;;){if(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),(i===EO||i===AO)&&e.avail_out<=6){this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;continue}if(s=Sc.deflate(e,i),s===kO)return e.next_out>0&&this.onData(e.output.subarray(0,e.next_out)),s=Sc.deflateEnd(this.strm),this.onEnd(s),this.ended=!0,s===hl;if(e.avail_out===0){this.onData(e.output);continue}if(i>0&&e.next_out>0){this.onData(e.output.subarray(0,e.next_out)),e.avail_out=0;continue}if(e.avail_in===0)break}return!0};Og.prototype.onData=function(r){this.chunks.push(r)};Og.prototype.onEnd=function(r){r===hl&&(this.result=hd.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};const n0=16209,RO=16191;var CO=function(t,e){let n,s,i,c,l,p,m,v,_,E,w,x,A,B,P,R,C,O,z,H,tt,nt,G,M;const d=t.state;n=t.next_in,G=t.input,s=n+(t.avail_in-5),i=t.next_out,M=t.output,c=i-(e-t.avail_out),l=i+(t.avail_out-257),p=d.dmax,m=d.wsize,v=d.whave,_=d.wnext,E=d.window,w=d.hold,x=d.bits,A=d.lencode,B=d.distcode,P=(1<>>24,w>>>=O,x-=O,O=C>>>16&255,O===0)M[i++]=C&65535;else if(O&16){z=C&65535,O&=15,O&&(x>>=O,x-=O),x<15&&(w+=G[n++]<>>24,w>>>=O,x-=O,O=C>>>16&255,O&16){if(H=C&65535,O&=15,xp){t.msg="invalid distance too far back",d.mode=n0;break t}if(w>>>=O,x-=O,O=i-c,H>O){if(O=H-O,O>v&&d.sane){t.msg="invalid distance too far back",d.mode=n0;break t}if(tt=0,nt=E,_===0){if(tt+=m-O,O2;)M[i++]=nt[tt++],M[i++]=nt[tt++],M[i++]=nt[tt++],z-=3;z&&(M[i++]=nt[tt++],z>1&&(M[i++]=nt[tt++]))}else{tt=i-H;do M[i++]=M[tt++],M[i++]=M[tt++],M[i++]=M[tt++],z-=3;while(z>2);z&&(M[i++]=M[tt++],z>1&&(M[i++]=M[tt++]))}}else if(O&64){t.msg="invalid distance code",d.mode=n0;break t}else{C=B[(C&65535)+(w&(1<>3,n-=z,x-=z<<3,w&=(1<{const p=l.bits;let m=0,v=0,_=0,E=0,w=0,x=0,A=0,B=0,P=0,R=0,C,O,z,H,tt,nt=null,G;const M=new Uint16Array(mu+1),d=new Uint16Array(mu+1);let o=null,a,f,h;for(m=0;m<=mu;m++)M[m]=0;for(v=0;v=1&&M[E]===0;E--);if(w>E&&(w=E),E===0)return s[i++]=1<<24|64<<16|0,s[i++]=1<<24|64<<16|0,l.bits=1,0;for(_=1;_0&&(r===t3||E!==1))return-1;for(d[1]=0,m=1;mJ6||r===e3&&P>Q6)return 1;for(;;){a=m-A,c[v]+1=G?(f=o[c[v]-G],h=nt[c[v]-G]):(f=32+64,h=0),C=1<>A)+O]=a<<24|f<<16|h|0;while(O!==0);for(C=1<>=1;if(C!==0?(R&=C-1,R+=C):R=0,v++,--M[m]===0){if(m===E)break;m=t[e+c[v]]}if(m>w&&(R&H)!==z){for(A===0&&(A=w),tt+=_,x=m-A,B=1<J6||r===e3&&P>Q6)return 1;z=R&H,s[z]=w<<24|x<<16|tt-i|0}}return R!==0&&(s[tt+R]=m-A<<24|64<<16|0),l.bits=w,0};var kc=NO;const DO=0,$9=1,H9=2,{Z_FINISH:r3,Z_BLOCK:zO,Z_TREES:i0,Z_OK:Ya,Z_STREAM_END:qO,Z_NEED_DICT:FO,Z_STREAM_ERROR:$i,Z_DATA_ERROR:V9,Z_MEM_ERROR:Z9,Z_BUF_ERROR:jO,Z_DEFLATED:n3}=Ih,ld=16180,i3=16181,o3=16182,s3=16183,a3=16184,u3=16185,f3=16186,c3=16187,h3=16188,l3=16189,ll=16190,es=16191,Mp=16192,d3=16193,Ep=16194,p3=16195,m3=16196,v3=16197,g3=16198,o0=16199,s0=16200,y3=16201,b3=16202,w3=16203,x3=16204,_3=16205,Ap=16206,M3=16207,E3=16208,qr=16209,W9=16210,G9=16211,KO=852,$O=592,HO=15,VO=HO,A3=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function ZO(){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 au=r=>{if(!r)return 1;const t=r.state;return!t||t.strm!==r||t.modeG9?1:0},Y9=r=>{if(au(r))return $i;const t=r.state;return r.total_in=r.total_out=t.total=0,r.msg="",t.wrap&&(r.adler=t.wrap&1),t.mode=ld,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(KO),t.distcode=t.distdyn=new Int32Array($O),t.sane=1,t.back=-1,Ya},X9=r=>{if(au(r))return $i;const t=r.state;return t.wsize=0,t.whave=0,t.wnext=0,Y9(r)},J9=(r,t)=>{let e;if(au(r))return $i;const n=r.state;return t<0?(e=0,t=-t):(e=(t>>4)+5,t<48&&(t&=15)),t&&(t<8||t>15)?$i:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=e,n.wbits=t,X9(r))},Q9=(r,t)=>{if(!r)return $i;const e=new ZO;r.state=e,e.strm=r,e.window=null,e.mode=ld;const n=J9(r,t);return n!==Ya&&(r.state=null),n},WO=r=>Q9(r,VO);let S3=!0,Sp,kp;const GO=r=>{if(S3){Sp=new Int32Array(512),kp=new Int32Array(32);let t=0;for(;t<144;)r.lens[t++]=8;for(;t<256;)r.lens[t++]=9;for(;t<280;)r.lens[t++]=7;for(;t<288;)r.lens[t++]=8;for(kc($9,r.lens,0,288,Sp,0,r.work,{bits:9}),t=0;t<32;)r.lens[t++]=5;kc(H9,r.lens,0,32,kp,0,r.work,{bits:5}),S3=!1}r.lencode=Sp,r.lenbits=9,r.distcode=kp,r.distbits=5},tM=(r,t,e,n)=>{let s;const i=r.state;return i.window===null&&(i.wsize=1<=i.wsize?(i.window.set(t.subarray(e-i.wsize,e),0),i.wnext=0,i.whave=i.wsize):(s=i.wsize-i.wnext,s>n&&(s=n),i.window.set(t.subarray(e-n,e-n+s),i.wnext),n-=s,n?(i.window.set(t.subarray(e-n,e),0),i.wnext=n,i.whave=i.wsize):(i.wnext+=s,i.wnext===i.wsize&&(i.wnext=0),i.whave{let e,n,s,i,c,l,p,m,v,_,E,w,x,A,B=0,P,R,C,O,z,H,tt,nt;const G=new Uint8Array(4);let M,d;const o=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(au(r)||!r.output||!r.input&&r.avail_in!==0)return $i;e=r.state,e.mode===es&&(e.mode=Mp),c=r.next_out,s=r.output,p=r.avail_out,i=r.next_in,n=r.input,l=r.avail_in,m=e.hold,v=e.bits,_=l,E=p,nt=Ya;t:for(;;)switch(e.mode){case ld:if(e.wrap===0){e.mode=Mp;break}for(;v<16;){if(l===0)break t;l--,m+=n[i++]<>>8&255,e.check=xn(e.check,G,2,0),m=0,v=0,e.mode=i3;break}if(e.head&&(e.head.done=!1),!(e.wrap&1)||(((m&255)<<8)+(m>>8))%31){r.msg="incorrect header check",e.mode=qr;break}if((m&15)!==n3){r.msg="unknown compression method",e.mode=qr;break}if(m>>>=4,v-=4,tt=(m&15)+8,e.wbits===0&&(e.wbits=tt),tt>15||tt>e.wbits){r.msg="invalid window size",e.mode=qr;break}e.dmax=1<>8&1),e.flags&512&&e.wrap&4&&(G[0]=m&255,G[1]=m>>>8&255,e.check=xn(e.check,G,2,0)),m=0,v=0,e.mode=o3;case o3:for(;v<32;){if(l===0)break t;l--,m+=n[i++]<>>8&255,G[2]=m>>>16&255,G[3]=m>>>24&255,e.check=xn(e.check,G,4,0)),m=0,v=0,e.mode=s3;case s3:for(;v<16;){if(l===0)break t;l--,m+=n[i++]<>8),e.flags&512&&e.wrap&4&&(G[0]=m&255,G[1]=m>>>8&255,e.check=xn(e.check,G,2,0)),m=0,v=0,e.mode=a3;case a3:if(e.flags&1024){for(;v<16;){if(l===0)break t;l--,m+=n[i++]<>>8&255,e.check=xn(e.check,G,2,0)),m=0,v=0}else e.head&&(e.head.extra=null);e.mode=u3;case u3:if(e.flags&1024&&(w=e.length,w>l&&(w=l),w&&(e.head&&(tt=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(n.subarray(i,i+w),tt)),e.flags&512&&e.wrap&4&&(e.check=xn(e.check,n,w,i)),l-=w,i+=w,e.length-=w),e.length))break t;e.length=0,e.mode=f3;case f3:if(e.flags&2048){if(l===0)break t;w=0;do tt=n[i+w++],e.head&&tt&&e.length<65536&&(e.head.name+=String.fromCharCode(tt));while(tt&&w>9&1,e.head.done=!0),r.adler=e.check=0,e.mode=es;break;case l3:for(;v<32;){if(l===0)break t;l--,m+=n[i++]<>>=v&7,v-=v&7,e.mode=Ap;break}for(;v<3;){if(l===0)break t;l--,m+=n[i++]<>>=1,v-=1,m&3){case 0:e.mode=d3;break;case 1:if(GO(e),e.mode=o0,t===i0){m>>>=2,v-=2;break t}break;case 2:e.mode=m3;break;case 3:r.msg="invalid block type",e.mode=qr}m>>>=2,v-=2;break;case d3:for(m>>>=v&7,v-=v&7;v<32;){if(l===0)break t;l--,m+=n[i++]<>>16^65535)){r.msg="invalid stored block lengths",e.mode=qr;break}if(e.length=m&65535,m=0,v=0,e.mode=Ep,t===i0)break t;case Ep:e.mode=p3;case p3:if(w=e.length,w){if(w>l&&(w=l),w>p&&(w=p),w===0)break t;s.set(n.subarray(i,i+w),c),l-=w,i+=w,p-=w,c+=w,e.length-=w;break}e.mode=es;break;case m3:for(;v<14;){if(l===0)break t;l--,m+=n[i++]<>>=5,v-=5,e.ndist=(m&31)+1,m>>>=5,v-=5,e.ncode=(m&15)+4,m>>>=4,v-=4,e.nlen>286||e.ndist>30){r.msg="too many length or distance symbols",e.mode=qr;break}e.have=0,e.mode=v3;case v3:for(;e.have>>=3,v-=3}for(;e.have<19;)e.lens[o[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,M={bits:e.lenbits},nt=kc(DO,e.lens,0,19,e.lencode,0,e.work,M),e.lenbits=M.bits,nt){r.msg="invalid code lengths set",e.mode=qr;break}e.have=0,e.mode=g3;case g3:for(;e.have>>24,R=B>>>16&255,C=B&65535,!(P<=v);){if(l===0)break t;l--,m+=n[i++]<>>=P,v-=P,e.lens[e.have++]=C;else{if(C===16){for(d=P+2;v>>=P,v-=P,e.have===0){r.msg="invalid bit length repeat",e.mode=qr;break}tt=e.lens[e.have-1],w=3+(m&3),m>>>=2,v-=2}else if(C===17){for(d=P+3;v>>=P,v-=P,tt=0,w=3+(m&7),m>>>=3,v-=3}else{for(d=P+7;v>>=P,v-=P,tt=0,w=11+(m&127),m>>>=7,v-=7}if(e.have+w>e.nlen+e.ndist){r.msg="invalid bit length repeat",e.mode=qr;break}for(;w--;)e.lens[e.have++]=tt}}if(e.mode===qr)break;if(e.lens[256]===0){r.msg="invalid code -- missing end-of-block",e.mode=qr;break}if(e.lenbits=9,M={bits:e.lenbits},nt=kc($9,e.lens,0,e.nlen,e.lencode,0,e.work,M),e.lenbits=M.bits,nt){r.msg="invalid literal/lengths set",e.mode=qr;break}if(e.distbits=6,e.distcode=e.distdyn,M={bits:e.distbits},nt=kc(H9,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,M),e.distbits=M.bits,nt){r.msg="invalid distances set",e.mode=qr;break}if(e.mode=o0,t===i0)break t;case o0:e.mode=s0;case s0:if(l>=6&&p>=258){r.next_out=c,r.avail_out=p,r.next_in=i,r.avail_in=l,e.hold=m,e.bits=v,CO(r,E),c=r.next_out,s=r.output,p=r.avail_out,i=r.next_in,n=r.input,l=r.avail_in,m=e.hold,v=e.bits,e.mode===es&&(e.back=-1);break}for(e.back=0;B=e.lencode[m&(1<>>24,R=B>>>16&255,C=B&65535,!(P<=v);){if(l===0)break t;l--,m+=n[i++]<>O)],P=B>>>24,R=B>>>16&255,C=B&65535,!(O+P<=v);){if(l===0)break t;l--,m+=n[i++]<>>=O,v-=O,e.back+=O}if(m>>>=P,v-=P,e.back+=P,e.length=C,R===0){e.mode=_3;break}if(R&32){e.back=-1,e.mode=es;break}if(R&64){r.msg="invalid literal/length code",e.mode=qr;break}e.extra=R&15,e.mode=y3;case y3:if(e.extra){for(d=e.extra;v>>=e.extra,v-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=b3;case b3:for(;B=e.distcode[m&(1<>>24,R=B>>>16&255,C=B&65535,!(P<=v);){if(l===0)break t;l--,m+=n[i++]<>O)],P=B>>>24,R=B>>>16&255,C=B&65535,!(O+P<=v);){if(l===0)break t;l--,m+=n[i++]<>>=O,v-=O,e.back+=O}if(m>>>=P,v-=P,e.back+=P,R&64){r.msg="invalid distance code",e.mode=qr;break}e.offset=C,e.extra=R&15,e.mode=w3;case w3:if(e.extra){for(d=e.extra;v>>=e.extra,v-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){r.msg="invalid distance too far back",e.mode=qr;break}e.mode=x3;case x3:if(p===0)break t;if(w=E-p,e.offset>w){if(w=e.offset-w,w>e.whave&&e.sane){r.msg="invalid distance too far back",e.mode=qr;break}w>e.wnext?(w-=e.wnext,x=e.wsize-w):x=e.wnext-w,w>e.length&&(w=e.length),A=e.window}else A=s,x=c-e.offset,w=e.length;w>p&&(w=p),p-=w,e.length-=w;do s[c++]=A[x++];while(--w);e.length===0&&(e.mode=s0);break;case _3:if(p===0)break t;s[c++]=e.length,p--,e.mode=s0;break;case Ap:if(e.wrap){for(;v<32;){if(l===0)break t;l--,m|=n[i++]<{if(au(r))return $i;let t=r.state;return t.window&&(t.window=null),r.state=null,Ya},JO=(r,t)=>{if(au(r))return $i;const e=r.state;return e.wrap&2?(e.head=t,t.done=!1,Ya):$i},QO=(r,t)=>{const e=t.length;let n,s,i;return au(r)||(n=r.state,n.wrap!==0&&n.mode!==ll)?$i:n.mode===ll&&(s=1,s=jc(s,t,e,0),s!==n.check)?V9:(i=tM(r,t,e,e),i?(n.mode=W9,Z9):(n.havedict=1,Ya))};var tU=X9,eU=J9,rU=Y9,nU=WO,iU=Q9,oU=YO,sU=XO,aU=JO,uU=QO,fU="pako inflate (from Nodeca project)",ls={inflateReset:tU,inflateReset2:eU,inflateResetKeep:rU,inflateInit:nU,inflateInit2:iU,inflate:oU,inflateEnd:sU,inflateGetHeader:aU,inflateSetDictionary:uU,inflateInfo:fU};function cU(){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 hU=cU;const eM=Object.prototype.toString,{Z_NO_FLUSH:lU,Z_FINISH:dU,Z_OK:Hc,Z_STREAM_END:Ip,Z_NEED_DICT:Bp,Z_STREAM_ERROR:pU,Z_DATA_ERROR:k3,Z_MEM_ERROR:mU}=Ih;function Ph(r){this.options=hd.assign({chunkSize:1024*64,windowBits:15,to:""},r||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),t.windowBits>=0&&t.windowBits<16&&!(r&&r.windowBits)&&(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&(t.windowBits&15||(t.windowBits|=15)),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new j9,this.strm.avail_out=0;let e=ls.inflateInit2(this.strm,t.windowBits);if(e!==Hc)throw new Error(of[e]);if(this.header=new hU,ls.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=$c.string2buf(t.dictionary):eM.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=ls.inflateSetDictionary(this.strm,t.dictionary),e!==Hc)))throw new Error(of[e])}Ph.prototype.push=function(r,t){const e=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let i,c,l;if(this.ended)return!1;for(t===~~t?c=t:c=t===!0?dU:lU,eM.call(r)==="[object ArrayBuffer]"?e.input=new Uint8Array(r):e.input=r,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),i=ls.inflate(e,c),i===Bp&&s&&(i=ls.inflateSetDictionary(e,s),i===Hc?i=ls.inflate(e,c):i===k3&&(i=Bp));e.avail_in>0&&i===Ip&&e.state.wrap>0&&r[e.next_in]!==0;)ls.inflateReset(e),i=ls.inflate(e,c);switch(i){case pU:case k3:case Bp:case mU:return this.onEnd(i),this.ended=!0,!1}if(l=e.avail_out,e.next_out&&(e.avail_out===0||i===Ip))if(this.options.to==="string"){let p=$c.utf8border(e.output,e.next_out),m=e.next_out-p,v=$c.buf2string(e.output,p);e.next_out=m,e.avail_out=n-m,m&&e.output.set(e.output.subarray(p,p+m),0),this.onData(v)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(!(i===Hc&&l===0)){if(i===Ip)return i=ls.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(e.avail_in===0)break}}return!0};Ph.prototype.onData=function(r){this.chunks.push(r)};Ph.prototype.onEnd=function(r){r===Hc&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=hd.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function Ug(r,t){const e=new Ph(t);if(e.push(r),e.err)throw e.msg||of[e.err];return e.result}function vU(r,t){return t=t||{},t.raw=!0,Ug(r,t)}var gU=Ph,yU=Ug,bU=vU,wU=Ug,xU=Ih,_U={Inflate:gU,inflate:yU,inflateRaw:bU,ungzip:wU,constants:xU};const{Inflate:WW,inflate:MU,inflateRaw:GW,ungzip:YW}=_U;var EU=MU;function AU(r,t){return Array.apply(0,new Array(Math.ceil(r.length/t))).map((e,n)=>r.slice(n*t,(n+1)*t))}const Yf=r=>"version"in r;function SU(r){return r.reduce((t,e)=>t+e.toString(16).padStart(2,"0"),"0x")}function kU(r){r.indexOf("0x")===0&&(r=r.substr(2)),r.length%2===1&&(r="0"+r);let t=r.match(/.{2}/g);return t===null?yr.Buffer.from([]):yr.Buffer.from(t.map(e=>parseInt(e,16)))}var IU=Object.freeze({__proto__:null,encode:SU,decode:kU});function rM(r){return new TextDecoder("utf-8").decode(r)}function nM(r){return new TextEncoder().encode(r)}var BU=Object.freeze({__proto__:null,decode:rM,encode:nM});function x2(r){return Ou.encode(r)}function PU(r){return Ou.decode(r)}var RU=Object.freeze({__proto__:null,encode:x2,decode:PU});function CU(r){return s2(r)}function iM(r){return yr.Buffer.from(H7(r))}var TU=Object.freeze({__proto__:null,encode:CU,decode:iM}),LU=Object.freeze({__proto__:null,hex:IU,utf8:BU,bs58:RU,base64:TU});function oM(r){const t=new Map;return r.errors&&r.errors.forEach(e=>{var n;let s=(n=e.msg)!==null&&n!==void 0?n:e.name;t.set(e.code,s)}),t}function sM(r,...t){if(r.args.length!=t.length)throw new Error("Invalid argument length");const e={};let n=0;return r.args.forEach(s=>{e[s.name]=t[n],n+=1}),e}function Ng(r,t={}){r.forEach(e=>{if("accounts"in e)Ng(e.accounts,t[e.name]);else if(t[e.name]===void 0)throw new Error(`Invalid arguments: ${e.name} not provided.`)})}function si(r){return r instanceof Ne?r:new Ne(r)}class OU extends TypeError{constructor(t,e){let n;const{message:s,...i}=t,{path:c}=t,l=c.length===0?s:"At path: "+c.join(".")+" -- "+s;super(l),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,i),this.name=this.constructor.name,this.failures=()=>{var p;return(p=n)!=null?p:n=[t,...e()]}}}function UU(r){return Nu(r)&&typeof r[Symbol.iterator]=="function"}function Nu(r){return typeof r=="object"&&r!=null}function ra(r){return typeof r=="string"?JSON.stringify(r):""+r}function NU(r){const{done:t,value:e}=r.next();return t?void 0:e}function DU(r,t,e,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:s,branch:i}=t,{type:c}=e,{refinement:l,message:p="Expected a value of type `"+c+"`"+(l?" with refinement `"+l+"`":"")+", but received: `"+ra(n)+"`"}=r;return{value:n,type:c,refinement:l,key:s[s.length-1],path:s,branch:i,...r,message:p}}function*I3(r,t,e,n){UU(r)||(r=[r]);for(const s of r){const i=DU(s,t,e,n);i&&(yield i)}}function*Dg(r,t,e){e===void 0&&(e={});const{path:n=[],branch:s=[r],coerce:i=!1,mask:c=!1}=e,l={path:n,branch:s};if(i&&(r=t.coercer(r,l),c&&t.type!=="type"&&Nu(t.schema)&&Nu(r)&&!Array.isArray(r)))for(const m in r)t.schema[m]===void 0&&delete r[m];let p=!0;for(const m of t.validator(r,l))p=!1,yield[m,void 0];for(let[m,v,_]of t.entries(r,l)){const E=Dg(v,_,{path:m===void 0?n:[...n,m],branch:m===void 0?s:[...s,v],coerce:i,mask:c});for(const w of E)w[0]?(p=!1,yield[w[0],void 0]):i&&(v=w[1],m===void 0?r=v:r instanceof Map?r.set(m,v):r instanceof Set?r.add(v):Nu(r)&&(r[m]=v))}if(p)for(const m of t.refiner(r,l))p=!1,yield[m,void 0];p&&(yield[void 0,r])}class aa{constructor(t){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:e,schema:n,validator:s,refiner:i,coercer:c=p=>p,entries:l=function*(){}}=t;this.type=e,this.schema=n,this.entries=l,this.coercer=c,s?this.validator=(p,m)=>{const v=s(p,m);return I3(v,m,this,p)}:this.validator=()=>[],i?this.refiner=(p,m)=>{const v=i(p,m);return I3(v,m,this,p)}:this.refiner=()=>[]}assert(t){return zU(t,this)}create(t){return zg(t,this)}is(t){return aM(t,this)}mask(t){return qU(t,this)}validate(t,e){return e===void 0&&(e={}),Rh(t,this,e)}}function zU(r,t){const e=Rh(r,t);if(e[0])throw e[0]}function zg(r,t){const e=Rh(r,t,{coerce:!0});if(e[0])throw e[0];return e[1]}function qU(r,t){const e=Rh(r,t,{coerce:!0,mask:!0});if(e[0])throw e[0];return e[1]}function aM(r,t){return!Rh(r,t)[0]}function Rh(r,t,e){e===void 0&&(e={});const n=Dg(r,t,e),s=NU(n);return s[0]?[new OU(s[0],function*(){for(const c of n)c[0]&&(yield c[0])}),void 0]:[void 0,s[1]]}function Ch(r,t){return new aa({type:r,schema:null,validator:t})}function FU(){return Ch("any",()=>!0)}function Pp(r){return new aa({type:"array",schema:r,*entries(t){if(r&&Array.isArray(t))for(const[e,n]of t.entries())yield[e,n,r]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||"Expected an array value, but received: "+ra(t)}})}function jU(){return Ch("boolean",r=>typeof r=="boolean")}function B3(r){const t=ra(r),e=typeof r;return new aa({type:"literal",schema:e==="string"||e==="number"||e==="boolean"?r:null,validator(n){return n===r||"Expected the literal `"+t+"`, but received: "+ra(n)}})}function a0(r){return new aa({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function W0(){return Ch("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+ra(r))}function G0(r){return new aa({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function Ra(){return Ch("string",r=>typeof r=="string"||"Expected a string, but received: "+ra(r))}function Js(r){const t=Object.keys(r);return new aa({type:"type",schema:r,*entries(e){if(Nu(e))for(const n of t)yield[n,e[n],r[n]]},validator(e){return Nu(e)||"Expected an object, but received: "+ra(e)}})}function uM(r){const t=r.map(e=>e.type).join(" | ");return new aa({type:"union",schema:null,coercer(e,n){return(r.find(i=>{const[c]=i.validate(e,{coerce:!0});return!c})||qg()).coercer(e,n)},validator(e,n){const s=[];for(const i of r){const[...c]=Dg(e,i,n),[l]=c;if(l[0])for(const[p]of c)p&&s.push(p);else return[]}return["Expected the value to satisfy a union of `"+t+"`, but received: "+ra(e),...s]}})}function qg(){return Ch("unknown",()=>!0)}function KU(r,t,e){return new aa({...r,coercer:(n,s)=>aM(n,t)?r.coercer(e(n,s),s):r.coercer(n,s)})}async function $U(r,t,e,n){r=si(r),n||(n=Vc());const s=new Zl;if(s.add(new gh({programId:r,keys:t??[],data:e})),n.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");return await n.sendAndConfirm(s,[])}const P3=99;async function HU(r,t,e){return(await Fg(r,t,e)).map(s=>s?{publicKey:s.publicKey,account:s.account}:null)}async function Fg(r,t,e){if(t.length<=P3)return await R3(r,t,e);{const n=AU(t,P3);return(await Promise.all(n.map(i=>R3(r,i,e)))).flat()}}async function R3(r,t,e){const n=e??r.commitment,{value:s,context:i}=await r.getMultipleAccountsInfoAndContext(t,n);return s.map((l,p)=>l===null?null:{publicKey:t[p],account:l,context:i})}async function fM(r,t,e,n,s){var i;e&&e.length>0&&t.sign(...e);const c=t._compile(),l=c.serialize(),m=t._serialize(l).toString("base64"),v={encoding:"base64",commitment:n??r.commitment};if(s){const x=(Array.isArray(s)?s:c.nonProgramIds()).map(A=>A.toBase58());v.accounts={encoding:"base64",addresses:x}}e&&(v.sigVerify=!0);const _=[m,v],E=await r._rpcRequest("simulateTransaction",_),w=zg(E,GU);if("error"in w){let x;if("data"in w.error&&(x=(i=w.error.data)===null||i===void 0?void 0:i.logs,x&&Array.isArray(x))){const A=` + `,B=A+x.join(A);console.error(w.error.message,B)}throw new o2("failed to simulate transaction: "+w.error.message,x)}return w.result}function VU(r){return KU(cM(r),ZU,t=>"error"in t?t:{...t,result:zg(t.result,r)})}const ZU=cM(qg());function cM(r){return uM([Js({jsonrpc:B3("2.0"),id:Ra(),result:r}),Js({jsonrpc:B3("2.0"),id:Ra(),error:Js({code:qg(),message:Ra(),data:G0(FU())})})])}function WU(r){return VU(Js({context:Js({slot:W0()}),value:r}))}const GU=WU(Js({err:a0(uM([Js({}),Ra()])),logs:a0(Pp(Ra())),accounts:G0(a0(Pp(a0(Js({executable:jU(),owner:Ra(),lamports:W0(),data:Pp(Ra()),rentEpoch:G0(W0())}))))),unitsConsumed:G0(W0())}));var YU=Object.freeze({__proto__:null,invoke:$U,getMultipleAccounts:HU,getMultipleAccountsAndContext:Fg,simulateTransaction:fM});class hM{constructor(t,e,n){this.connection=t,this.wallet=e,this.opts=n,this.publicKey=e==null?void 0:e.publicKey}static defaultOptions(){return{preflightCommitment:"processed",commitment:"processed"}}static local(t,e){throw new Error("Provider local is not available on browser.")}static env(){throw new Error("Provider env is not available on browser.")}async sendAndConfirm(t,e,n){var s,i,c,l;if(n===void 0&&(n=this.opts),Yf(t))e&&t.sign(e);else if(t.feePayer=(s=t.feePayer)!==null&&s!==void 0?s:this.wallet.publicKey,t.recentBlockhash=(await this.connection.getLatestBlockhash(n.preflightCommitment)).blockhash,e)for(const m of e)t.partialSign(m);t=await this.wallet.signTransaction(t);const p=t.serialize();try{return await C3(this.connection,p,n)}catch(m){if(m instanceof _2){const v=x2(Yf(t)?((i=t.signatures)===null||i===void 0?void 0:i[0])||new Uint8Array:(c=t.signature)!==null&&c!==void 0?c:new Uint8Array),_=await this.connection.getTransaction(v,{commitment:"confirmed"});if(_){const E=(l=_.meta)===null||l===void 0?void 0:l.logMessages;throw E?new o2(m.message,E):m}else throw m}else throw m}}async sendAll(t,e){var n,s,i;e===void 0&&(e=this.opts);const c=(await this.connection.getLatestBlockhash(e.preflightCommitment)).blockhash;let l=t.map(v=>{var _,E;if(Yf(v.tx)){let w=v.tx;return v.signers&&w.sign(v.signers),w}else{let w=v.tx,x=(_=v.signers)!==null&&_!==void 0?_:[];return w.feePayer=(E=w.feePayer)!==null&&E!==void 0?E:this.wallet.publicKey,w.recentBlockhash=c,x.forEach(A=>{w.partialSign(A)}),w}});const p=await this.wallet.signAllTransactions(l),m=[];for(let v=0;vE.startsWith("Program log: AnchorError"));if(e===-1)return null;const n=t[e],s=[n];let i;if(e+11)return null;s=l[0].match(/([0-9]+)/g)[0]}let i;try{i=parseInt(s)}catch{return null}let c=e.get(i);return c!==void 0?new Wc(i,c,t.logs):(c=dM.get(i),c!==void 0?new Wc(i,c,t.logs):null)}get program(){var t;return(t=this._programErrorStack)===null||t===void 0?void 0:t.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){var t;return(t=this._programErrorStack)===null||t===void 0?void 0:t.stack}toString(){return this.msg}}function Kg(r,t){jg("debug-logs")&&console.log("Translating error:",r);const e=Du.parse(r.logs);if(e)return e;const n=Wc.parse(r,t);if(n)return n;if(r.logs){const s={get:function(i,c){return c==="programErrorStack"?i.programErrorStack.stack:c==="program"?i.programErrorStack.stack[r.programErrorStack.stack.length-1]:Reflect.get(...arguments)}};return r.programErrorStack=If.parse(r.logs),new Proxy(r,s)}return r}const ze={InstructionMissing:100,InstructionFallbackNotFound:101,InstructionDidNotDeserialize:102,InstructionDidNotSerialize:103,IdlInstructionStub:1e3,IdlInstructionInvalidProgram:1001,ConstraintMut:2e3,ConstraintHasOne:2001,ConstraintSigner:2002,ConstraintRaw:2003,ConstraintOwner:2004,ConstraintRentExempt:2005,ConstraintSeeds:2006,ConstraintExecutable:2007,ConstraintState:2008,ConstraintAssociated:2009,ConstraintAssociatedInit:2010,ConstraintClose:2011,ConstraintAddress:2012,ConstraintZero:2013,ConstraintTokenMint:2014,ConstraintTokenOwner:2015,ConstraintMintMintAuthority:2016,ConstraintMintFreezeAuthority:2017,ConstraintMintDecimals:2018,ConstraintSpace:2019,ConstraintAccountIsNone:2020,RequireViolated:2500,RequireEqViolated:2501,RequireKeysEqViolated:2502,RequireNeqViolated:2503,RequireKeysNeqViolated:2504,RequireGtViolated:2505,RequireGteViolated:2506,AccountDiscriminatorAlreadySet:3e3,AccountDiscriminatorNotFound:3001,AccountDiscriminatorMismatch:3002,AccountDidNotDeserialize:3003,AccountDidNotSerialize:3004,AccountNotEnoughKeys:3005,AccountNotMutable:3006,AccountOwnedByWrongProgram:3007,InvalidProgramId:3008,InvalidProgramExecutable:3009,AccountNotSigner:3010,AccountNotSystemOwned:3011,AccountNotInitialized:3012,AccountNotProgramData:3013,AccountNotAssociatedTokenAccount:3014,AccountSysvarMismatch:3015,AccountReallocExceedsLimit:3016,AccountDuplicateReallocs:3017,DeclaredProgramIdMismatch:4100,Deprecated:5e3},dM=new Map([[ze.InstructionMissing,"8 byte instruction identifier not provided"],[ze.InstructionFallbackNotFound,"Fallback functions are not supported"],[ze.InstructionDidNotDeserialize,"The program could not deserialize the given instruction"],[ze.InstructionDidNotSerialize,"The program could not serialize the given instruction"],[ze.IdlInstructionStub,"The program was compiled without idl instructions"],[ze.IdlInstructionInvalidProgram,"The transaction was given an invalid program for the IDL instruction"],[ze.ConstraintMut,"A mut constraint was violated"],[ze.ConstraintHasOne,"A has one constraint was violated"],[ze.ConstraintSigner,"A signer constraint was violated"],[ze.ConstraintRaw,"A raw constraint was violated"],[ze.ConstraintOwner,"An owner constraint was violated"],[ze.ConstraintRentExempt,"A rent exemption constraint was violated"],[ze.ConstraintSeeds,"A seeds constraint was violated"],[ze.ConstraintExecutable,"An executable constraint was violated"],[ze.ConstraintState,"Deprecated Error, feel free to replace with something else"],[ze.ConstraintAssociated,"An associated constraint was violated"],[ze.ConstraintAssociatedInit,"An associated init constraint was violated"],[ze.ConstraintClose,"A close constraint was violated"],[ze.ConstraintAddress,"An address constraint was violated"],[ze.ConstraintZero,"Expected zero account discriminant"],[ze.ConstraintTokenMint,"A token mint constraint was violated"],[ze.ConstraintTokenOwner,"A token owner constraint was violated"],[ze.ConstraintMintMintAuthority,"A mint mint authority constraint was violated"],[ze.ConstraintMintFreezeAuthority,"A mint freeze authority constraint was violated"],[ze.ConstraintMintDecimals,"A mint decimals constraint was violated"],[ze.ConstraintSpace,"A space constraint was violated"],[ze.ConstraintAccountIsNone,"A required account for the constraint is None"],[ze.RequireViolated,"A require expression was violated"],[ze.RequireEqViolated,"A require_eq expression was violated"],[ze.RequireKeysEqViolated,"A require_keys_eq expression was violated"],[ze.RequireNeqViolated,"A require_neq expression was violated"],[ze.RequireKeysNeqViolated,"A require_keys_neq expression was violated"],[ze.RequireGtViolated,"A require_gt expression was violated"],[ze.RequireGteViolated,"A require_gte expression was violated"],[ze.AccountDiscriminatorAlreadySet,"The account discriminator was already set on this account"],[ze.AccountDiscriminatorNotFound,"No 8 byte discriminator was found on the account"],[ze.AccountDiscriminatorMismatch,"8 byte discriminator did not match what was expected"],[ze.AccountDidNotDeserialize,"Failed to deserialize the account"],[ze.AccountDidNotSerialize,"Failed to serialize the account"],[ze.AccountNotEnoughKeys,"Not enough account keys given to the instruction"],[ze.AccountNotMutable,"The given account is not mutable"],[ze.AccountOwnedByWrongProgram,"The given account is owned by a different program than expected"],[ze.InvalidProgramId,"Program ID was not as expected"],[ze.InvalidProgramExecutable,"Program account is not executable"],[ze.AccountNotSigner,"The given account did not sign"],[ze.AccountNotSystemOwned,"The given account is not owned by the system program"],[ze.AccountNotInitialized,"The program expected this account to be already initialized"],[ze.AccountNotProgramData,"The given account is not a program data account"],[ze.AccountNotAssociatedTokenAccount,"The given account is not the associated token account"],[ze.AccountSysvarMismatch,"The given public key does not match the required sysvar"],[ze.AccountReallocExceedsLimit,"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"],[ze.AccountDuplicateReallocs,"The account was duplicated for more than one reallocation"],[ze.DeclaredProgramIdMismatch,"The declared program id does not match the actual program id"],[ze.Deprecated,"The API being used is deprecated and should no longer be used"]]);var E2=function(){return E2=Object.assign||function(t){for(var e,n=1,s=arguments.length;nc.name===s);if(i.length!==1)throw new Zc(`Type not found: ${JSON.stringify(t)}`);return wi.typeDefLayout(i[0],e,n)}else if("array"in t.type){let s=t.type.array[0],i=t.type.array[1],c=wi.fieldLayout({name:void 0,type:s},e);return Ze.array(c,i,n)}else throw new Error(`Not yet implemented: ${t}`)}}}static typeDefLayout(t,e=[],n){if(t.type.kind==="struct"){const s=t.type.fields.map(i=>wi.fieldLayout(i,e));return Ze.struct(s,n)}else if(t.type.kind==="enum"){let s=t.type.variants.map(i=>{const c=Dr(i.name);if(i.fields===void 0)return Ze.struct([],c);const l=i.fields.map((p,m)=>p.hasOwnProperty("name")?wi.fieldLayout(p,e):wi.fieldLayout({type:p,name:m.toString()},e));return Ze.struct(l,c)});return n!==void 0?Ze.rustEnum(s).replicate(n):Ze.rustEnum(s,n)}else throw new Error(`Unknown type kint: ${t}`)}}const L3="global";class dd{constructor(t){this.idl=t,this.ixLayout=dd.parseIxLayout(t);const e=new Map;t.instructions.forEach(n=>{const s=O3(L3,n.name);e.set(Ou.encode(s),{layout:this.ixLayout.get(n.name),name:n.name})}),this.sighashLayouts=e}encode(t,e){return this._encode(L3,t,e)}_encode(t,e,n){const s=yr.Buffer.alloc(1e3),i=Dr(e),c=this.ixLayout.get(i);if(!c)throw new Error(`Unknown method: ${i}`);const l=c.encode(n,s),p=s.slice(0,l);return yr.Buffer.concat([O3(t,e),p])}static parseIxLayout(t){const e=t.instructions.map(n=>{let s=n.args.map(c=>{var l,p;return wi.fieldLayout(c,Array.from([...(l=t.accounts)!==null&&l!==void 0?l:[],...(p=t.types)!==null&&p!==void 0?p:[]]))});const i=Dr(n.name);return[i,Ze.struct(s,i)]});return new Map(e)}decode(t,e="hex"){typeof t=="string"&&(t=e==="hex"?yr.Buffer.from(t,"hex"):Ou.decode(t));let n=Ou.encode(t.slice(0,8)),s=t.slice(8);const i=this.sighashLayouts.get(n);return i?{data:i.layout.decode(s),name:i.name}:null}format(t,e){return ss.format(t,e,this.idl)}}class ss{static format(t,e,n){const s=n.instructions.filter(p=>t.name===p.name)[0];if(s===void 0)return console.error("Invalid instruction given"),null;const i=s.args.map(p=>({name:p.name,type:ss.formatIdlType(p.type),data:ss.formatIdlData(p,t.data[p.name],n.types)})),c=ss.flattenIdlAccounts(s.accounts),l=e.map((p,m)=>m`;if("option"in t)return`Option<${this.formatIdlType(t.option)}>`;if("defined"in t)return t.defined;if("array"in t)return`Array<${t.array[0]}; ${t.array[1]}>`;throw new Error(`Unknown IDL type: ${t}`)}static formatIdlData(t,e,n){if(typeof t.type=="string")return e.toString();if(t.type.hasOwnProperty("vec"))return"["+e.map(s=>this.formatIdlData({name:"",type:t.type.vec},s)).join(", ")+"]";if(t.type.hasOwnProperty("option"))return e===null?"null":this.formatIdlData({name:"",type:t.type.option},e,n);if(t.type.hasOwnProperty("defined")){if(n===void 0)throw new Error("User defined types not provided");const s=n.filter(i=>i.name===t.type.defined);if(s.length!==1)throw new Error(`Type not found: ${t.type.defined}`);return ss.formatIdlDataDefined(s[0],e,n)}return"unknown"}static formatIdlDataDefined(t,e,n){if(t.type.kind==="struct"){const s=t.type;return"{ "+Object.keys(e).map(c=>{const l=s.fields.filter(p=>p.name===c)[0];if(l===void 0)throw new Error("Unable to find type");return c+": "+ss.formatIdlData(l,e[c],n)}).join(", ")+" }"}else{if(t.type.variants.length===0)return"{}";if(t.type.variants[0].name){const s=t.type.variants,i=Object.keys(e)[0],c=e[i],l=Object.keys(c).map(m=>{var v;const _=c[m],E=(v=s[i])===null||v===void 0?void 0:v.filter(w=>w.name===m)[0];if(E===void 0)throw new Error("Unable to find variant");return m+": "+ss.formatIdlData(E,_,n)}).join(", "),p=Dr(i,{pascalCase:!0});return l.length===0?p:`${p} { ${l} }`}else return"Tuple formatting not yet implemented"}}static flattenIdlAccounts(t,e){return t.map(n=>{const s=uN(n.name);if(n.hasOwnProperty("accounts")){const i=e?`${e} > ${s}`:s;return ss.flattenIdlAccounts(n.accounts,i)}else return{...n,name:e?`${e} > ${s}`:s}}).flat()}}function uN(r){const t=r.replace(/([A-Z])/g," $1");return t.charAt(0).toUpperCase()+t.slice(1)}function O3(r,t){let e=aN(t),n=`${r}:${e}`;return yr.Buffer.from(Vl(n).slice(0,8))}function $g(r,t){if(t.type.kind==="enum"){const e=t.type.variants.map(n=>n.fields?n.fields.map(s=>typeof s=="object"&&"name"in s?zu(r,s.type):zu(r,s)).reduce((s,i)=>s+i,0):0);return Math.max(...e)+1}return t.type.fields.map(e=>zu(r,e.type)).reduce((e,n)=>e+n,0)}function zu(r,t){var e,n;switch(t){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"publicKey":return 32;default:if("vec"in t)return 1;if("option"in t)return 1+zu(r,t.option);if("coption"in t)return 4+zu(r,t.coption);if("defined"in t){const s=(n=(e=r.types)===null||e===void 0?void 0:e.filter(c=>c.name===t.defined))!==null&&n!==void 0?n:[];if(s.length!==1)throw new Zc(`Type not found: ${JSON.stringify(t)}`);let i=s[0];return $g(r,i)}if("array"in t){let s=t.array[0],i=t.array[1];return zu(r,s)*i}throw new Error(`Invalid type ${JSON.stringify(t)}`)}}const dl=8;function pM(r){return Zt.Buffer.from(Vl(r).slice(0,dl))}class Ca{constructor(t){if(t.accounts===void 0){this.accountLayouts=new Map;return}const e=t.accounts.map(n=>[n.name,wi.typeDefLayout(n,t.types)]);this.accountLayouts=new Map(e),this.idl=t}async encode(t,e){const n=yr.Buffer.alloc(1e3),s=this.accountLayouts.get(t);if(!s)throw new Error(`Unknown account: ${t}`);const i=s.encode(e,n);let c=n.slice(0,i),l=Ca.accountDiscriminator(t);return yr.Buffer.concat([l,c])}decode(t,e){if(Ca.accountDiscriminator(t).compare(e.slice(0,8)))throw new Error("Invalid account discriminator");return this.decodeUnchecked(t,e)}decodeAny(t){const e=t.slice(0,8),n=Array.from(this.accountLayouts.keys()).find(s=>Ca.accountDiscriminator(s).equals(e));if(!n)throw new Error("Account descriminator not found");return this.decodeUnchecked(n,t)}decodeUnchecked(t,e){const n=e.subarray(dl),s=this.accountLayouts.get(t);if(!s)throw new Error(`Unknown account: ${t}`);return s.decode(n)}memcmp(t,e){const n=Ca.accountDiscriminator(t);return{offset:0,bytes:Ou.encode(e?yr.Buffer.concat([n,e]):n)}}size(t){var e;return dl+((e=$g(this.idl,t))!==null&&e!==void 0?e:0)}static accountDiscriminator(t){const e=`account:${Dr(t,{pascalCase:!0,preserveConsecutiveUppercase:!0})}`;return pM(e)}}class mM{constructor(t){if(t.events===void 0){this.layouts=new Map;return}const e=t.events.map(n=>{let s={name:n.name,type:{kind:"struct",fields:n.fields.map(i=>({name:i.name,type:i.type}))}};return[n.name,wi.typeDefLayout(s,t.types)]});this.layouts=new Map(e),this.discriminators=new Map(t.events===void 0?[]:t.events.map(n=>[s2(vM(n.name)),n.name]))}decode(t){let e;try{e=yr.Buffer.from(H7(t))}catch{return null}const n=s2(e.slice(0,8)),s=this.discriminators.get(n);if(s===void 0)return null;const i=this.layouts.get(s);if(!i)throw new Error(`Unknown event: ${s}`);return{data:i.decode(e.slice(8)),name:s}}}function vM(r){return pM(`event:${r}`)}class fN{constructor(t){if(t.types===void 0){this.typeLayouts=new Map;return}const e=t.types.map(n=>[n.name,wi.typeDefLayout(n,t.types)]);this.typeLayouts=new Map(e),this.idl=t}encode(t,e){const n=yr.Buffer.alloc(1e3),s=this.typeLayouts.get(t);if(!s)throw new Error(`Unknown type: ${t}`);const i=s.encode(e,n);return n.slice(0,i)}decode(t,e){const n=this.typeLayouts.get(t);if(!n)throw new Error(`Unknown type: ${t}`);return n.decode(e)}}class Hg{constructor(t){this.instruction=new dd(t),this.accounts=new Ca(t),this.events=new mM(t),this.types=new fN(t)}}var cN=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Zt.global<"u"?Zt.global:typeof self<"u"?self:{};function hN(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}class fi{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}var pd=fi;function lN(r,t){return t.property?r+"["+t.property+"]":r}class Ta extends fi{isCount(){throw new Error("ExternalLayout is abstract")}}class gM extends Ta{constructor(t,e,n){if(!(t instanceof fi))throw new TypeError("layout must be a Layout");if(e===void 0)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof md||this.layout instanceof yM}decode(t,e){return e===void 0&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return n===void 0&&(n=0),this.layout.encode(t,e,n+this.offset)}}class md extends fi{constructor(t,e){if(super(t,e),6i&&c instanceof fi,!0)))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const i of t)if(0>i.span&&i.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let s=-1;try{s=t.reduce((i,c)=>i+c.getSpan(),0)}catch{}super(s,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;try{n=this.fields.reduce((s,i)=>{const c=i.getSpan(t,e);return e+=c,s+c},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e){e===void 0&&(e=0);const n=this.makeDestinationObject();for(const s of this.fields)if(s.property!==void 0&&(n[s.property]=s.decode(t,e)),e+=s.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){n===void 0&&(n=0);const s=n;let i=0,c=0;for(const l of this.fields){let p=l.span;if(c=0p&&(p=l.getSpan(e,n)))}i=n,n+=p}return i+c-s}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?e=-1:0<=e&&(e+=n.span)}}}class xM{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class U3 extends xM{constructor(t,e){if(!(t instanceof Ta&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class _M extends fi{constructor(t,e,n){const s=t instanceof md||t instanceof yM;if(s)t=new U3(new gM(t));else if(t instanceof Ta&&t.isCount())t=new U3(t);else if(!(t instanceof xM))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof fi))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&s&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=s,this.defaultLayout=e,this.registry={};let c=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(l){return c(l)},this.configGetSourceVariant=function(l){c=l.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){e===void 0&&(e=0);let n;const s=this.discriminator,i=s.decode(t,e);let c=this.registry[i];if(c===void 0){let l=0;c=this.defaultLayout,this.usesPrefixDiscriminator&&(l=s.layout.span),n=this.makeDestinationObject(),n[s.property]=i,n[c.property]=this.defaultLayout.decode(t,e+l)}else n=c.decode(t,e);return n}encode(t,e,n){n===void 0&&(n=0);const s=this.getSourceVariant(t);if(s===void 0){const i=this.discriminator,c=this.defaultLayout;let l=0;return this.usesPrefixDiscriminator&&(l=i.layout.span),i.encode(t[i.property],e,n),l+c.encode(t[c.property],e,n+l)}return s.encode(t,e,n)}addVariant(t,e,n){const s=new vN(this,t,e,n);return this.registry[t]=s,s}getVariant(t,e){let n=t;return Zt.Buffer.isBuffer(t)&&(e===void 0&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class vN extends fi{constructor(t,e,n,s){if(!(t instanceof _M))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&s===void 0&&(s=n,n=null),n){if(!(n instanceof fi))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof s!="string")throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,s),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(e===void 0&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let s=0;return this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+s):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){n===void 0&&(n=0);let s=0;if(this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=s;if(this.layout&&(this.layout.encode(t[this.property],e,n+s),i+=this.layout.getSpan(e,n+s),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}class gN extends fi{constructor(t,e){if(!(t instanceof Ta&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;t instanceof Ta||(n=t),super(n,e),this.length=t}getSpan(t,e){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),n}decode(t,e){e===void 0&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let s=this.length;if(this.length instanceof Ta&&(s=t.length),!(Zt.Buffer.isBuffer(t)&&s===t.length))throw new TypeError(lN("Blob.encode",this)+" requires (length "+s+") Buffer as src");if(n+s>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,s,"hex"),this.length instanceof Ta&&this.length.encode(s,e,n),s}}var yN=(r,t,e)=>new gM(r,t,e),bN=r=>new md(1,r),ms=r=>new md(4,r),wN=r=>new dN(r),ks=r=>new pN(r),vn=(r,t,e)=>new mN(r,t,e),MM=(r,t,e)=>new _M(r,t,e),Th=(r,t)=>new gN(r,t);class xN{constructor(t){}encode(t,e){switch(Dr(t)){case"createAccount":return MN(e);case"assign":return EN(e);case"transfer":return AN(e);case"createAccountWithSeed":return SN(e);case"advanceNonceAccount":return IN(e);case"withdrawNonceAccount":return BN(e);case"initializeNonceAccount":return kN(e);case"authorizeNonceAccount":return PN(e);case"allocate":return RN(e);case"allocateWithSeed":return CN(e);case"assignWithSeed":return TN(e);case"transferWithSeed":return LN(e);default:throw new Error(`Invalid instruction: ${t}`)}}encodeState(t,e){throw new Error("System does not have state")}}class _N extends pd{constructor(t){super(-1,t),this.property=t,this.layout=vn([ms("length"),ms("lengthPadding"),Th(yN(ms(),-8),"chars")],this.property)}encode(t,e,n=0){if(t==null)return this.layout.span;const s={chars:Zt.Buffer.from(t,"utf8")};return this.layout.encode(s,e,n)}decode(t,e=0){return this.layout.decode(t,e).chars.toString()}getSpan(t,e=0){return ms().span+ms().span+new Jv(new Uint8Array(t).slice(e,e+4),10,"le").toNumber()}}function vd(r){return new _N(r)}function Hi(r){return Th(32,r)}function MN({lamports:r,space:t,owner:e}){return Gi({createAccount:{lamports:r,space:t,owner:e.toBuffer()}})}function EN({owner:r}){return Gi({assign:{owner:r.toBuffer()}})}function AN({lamports:r}){return Gi({transfer:{lamports:r}})}function SN({base:r,seed:t,lamports:e,space:n,owner:s}){return Gi({createAccountWithSeed:{base:r.toBuffer(),seed:t,lamports:e,space:n,owner:s.toBuffer()}},An.getVariant(3).span+t.length)}function kN({authorized:r}){return Gi({initializeNonceAccount:{authorized:r.toBuffer()}})}function IN({authorized:r}){return Gi({advanceNonceAccount:{authorized:r.toBuffer()}})}function BN({lamports:r}){return Gi({withdrawNonceAccount:{lamports:r}})}function PN({authorized:r}){return Gi({authorizeNonceAccount:{authorized:r.toBuffer()}})}function RN({space:r}){return Gi({allocate:{space:r}})}function CN({base:r,seed:t,space:e,owner:n}){return Gi({allocateWithSeed:{base:r.toBuffer(),seed:t,space:e,owner:n.toBuffer()}},An.getVariant(9).span+t.length)}function TN({base:r,seed:t,owner:e}){return Gi({assignWithSeed:{base:r.toBuffer(),seed:t,owner:e.toBuffer()}},An.getVariant(10).span+t.length)}function LN({lamports:r,seed:t,owner:e}){return Gi({transferWithSeed:{lamports:r,seed:t,owner:e.toBuffer()}},An.getVariant(11).span+t.length)}const An=MM(ms("instruction"));An.addVariant(0,vn([ks("lamports"),ks("space"),Hi("owner")]),"createAccount");An.addVariant(1,vn([Hi("owner")]),"assign");An.addVariant(2,vn([ks("lamports")]),"transfer");An.addVariant(3,vn([Hi("base"),vd("seed"),ks("lamports"),ks("space"),Hi("owner")]),"createAccountWithSeed");An.addVariant(4,vn([Hi("authorized")]),"advanceNonceAccount");An.addVariant(5,vn([ks("lamports")]),"withdrawNonceAccount");An.addVariant(6,vn([Hi("authorized")]),"initializeNonceAccount");An.addVariant(7,vn([Hi("authorized")]),"authorizeNonceAccount");An.addVariant(8,vn([ks("space")]),"allocate");An.addVariant(9,vn([Hi("base"),vd("seed"),ks("space"),Hi("owner")]),"allocateWithSeed");An.addVariant(10,vn([Hi("base"),vd("seed"),Hi("owner")]),"assignWithSeed");An.addVariant(11,vn([ks("lamports"),vd("seed"),Hi("owner")]),"transferWithSeed");function Gi(r,t){const e=Zt.Buffer.alloc(t??ON),n=An.encode(r,e);return t===void 0?e.slice(0,n):e}const ON=Math.max(...Object.values(An.registry).map(r=>r.span));class UN{constructor(t){this.idl=t}async encode(t,e){switch(t){case"nonce":{const n=Zt.Buffer.alloc(wb),s=EM.encode(e,n);return n.slice(0,s)}default:throw new Error(`Invalid account name: ${t}`)}}decode(t,e){return this.decodeUnchecked(t,e)}decodeUnchecked(t,e){switch(t){case"nonce":return NN(e);default:throw new Error(`Invalid account name: ${t}`)}}memcmp(t,e){switch(t){case"nonce":return{dataSize:wb};default:throw new Error(`Invalid account name: ${t}`)}}size(t){var e;return(e=$g(this.idl,t))!==null&&e!==void 0?e:0}}function NN(r){return EM.decode(r)}class DN extends pd{constructor(t,e,n,s){super(t.span,s),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}function N3(r){return new DN(Th(32),t=>new Ne(t),t=>t.toBuffer(),r)}const EM=vn([ms("version"),ms("state"),N3("authorizedPubkey"),N3("nonce"),vn([wN("lamportsPerSignature")],"feeCalculator")]);class zN{constructor(t){}decode(t){throw new Error("System program does not have events")}}class qN{constructor(t){}encode(t,e){throw new Error("System does not have user-defined types")}decode(t,e){throw new Error("System does not have user-defined types")}}class AM{constructor(t){this.instruction=new xN(t),this.accounts=new UN(t),this.events=new zN(t),this.types=new qN(t)}}function FN(r){return new TextDecoder().decode(Vl(r))}var jN=Object.freeze({__proto__:null,hash:FN});function KN(r,t,e){const n=yr.Buffer.concat([r.toBuffer(),yr.Buffer.from(t),e.toBuffer()]);return new Ne(Vl(n))}function SM(r,...t){let e=[yr.Buffer.from([97,110,99,104,111,114])];t.forEach(s=>{e.push(s instanceof yr.Buffer?s:si(s).toBuffer())});const[n]=Ne.findProgramAddressSync(e,si(r));return n}var $N=Object.freeze({__proto__:null,createWithSeedSync:KN,associated:SM});const Vg=new Ne("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),Zg=new Ne("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");function HN({mint:r,owner:t}){return Ne.findProgramAddressSync([t.toBuffer(),Vg.toBuffer(),r.toBuffer()],Zg)[0]}var VN=Object.freeze({__proto__:null,TOKEN_PROGRAM_ID:Vg,ASSOCIATED_PROGRAM_ID:Zg,associatedAddress:HN}),k2={exports:{}};(function(r,t){var e=typeof self<"u"?self:cN,n=function(){function i(){this.fetch=!1,this.DOMException=e.DOMException}return i.prototype=e,new i}();(function(i){(function(c){var l={searchParams:"URLSearchParams"in i,iterable:"Symbol"in i&&"iterator"in Symbol,blob:"FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in i,arrayBuffer:"ArrayBuffer"in i};function p(f){return f&&DataView.prototype.isPrototypeOf(f)}if(l.arrayBuffer)var m=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],v=ArrayBuffer.isView||function(f){return f&&m.indexOf(Object.prototype.toString.call(f))>-1};function _(f){if(typeof f!="string"&&(f=String(f)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(f))throw new TypeError("Invalid character in header field name");return f.toLowerCase()}function E(f){return typeof f!="string"&&(f=String(f)),f}function w(f){var h={next:function(){var g=f.shift();return{done:g===void 0,value:g}}};return l.iterable&&(h[Symbol.iterator]=function(){return h}),h}function x(f){this.map={},f instanceof x?f.forEach(function(h,g){this.append(g,h)},this):Array.isArray(f)?f.forEach(function(h){this.append(h[0],h[1])},this):f&&Object.getOwnPropertyNames(f).forEach(function(h){this.append(h,f[h])},this)}x.prototype.append=function(f,h){f=_(f),h=E(h);var g=this.map[f];this.map[f]=g?g+", "+h:h},x.prototype.delete=function(f){delete this.map[_(f)]},x.prototype.get=function(f){return f=_(f),this.has(f)?this.map[f]:null},x.prototype.has=function(f){return this.map.hasOwnProperty(_(f))},x.prototype.set=function(f,h){this.map[_(f)]=E(h)},x.prototype.forEach=function(f,h){for(var g in this.map)this.map.hasOwnProperty(g)&&f.call(h,this.map[g],g,this)},x.prototype.keys=function(){var f=[];return this.forEach(function(h,g){f.push(g)}),w(f)},x.prototype.values=function(){var f=[];return this.forEach(function(h){f.push(h)}),w(f)},x.prototype.entries=function(){var f=[];return this.forEach(function(h,g){f.push([g,h])}),w(f)},l.iterable&&(x.prototype[Symbol.iterator]=x.prototype.entries);function A(f){if(f.bodyUsed)return Promise.reject(new TypeError("Already read"));f.bodyUsed=!0}function B(f){return new Promise(function(h,g){f.onload=function(){h(f.result)},f.onerror=function(){g(f.error)}})}function P(f){var h=new FileReader,g=B(h);return h.readAsArrayBuffer(f),g}function R(f){var h=new FileReader,g=B(h);return h.readAsText(f),g}function C(f){for(var h=new Uint8Array(f),g=new Array(h.length),S=0;S-1?h:f}function nt(f,h){h=h||{};var g=h.body;if(f instanceof nt){if(f.bodyUsed)throw new TypeError("Already read");this.url=f.url,this.credentials=f.credentials,h.headers||(this.headers=new x(f.headers)),this.method=f.method,this.mode=f.mode,this.signal=f.signal,!g&&f._bodyInit!=null&&(g=f._bodyInit,f.bodyUsed=!0)}else this.url=String(f);if(this.credentials=h.credentials||this.credentials||"same-origin",(h.headers||!this.headers)&&(this.headers=new x(h.headers)),this.method=tt(h.method||this.method||"GET"),this.mode=h.mode||this.mode||null,this.signal=h.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&g)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(g)}nt.prototype.clone=function(){return new nt(this,{body:this._bodyInit})};function G(f){var h=new FormData;return f.trim().split("&").forEach(function(g){if(g){var S=g.split("="),I=S.shift().replace(/\+/g," "),y=S.join("=").replace(/\+/g," ");h.append(decodeURIComponent(I),decodeURIComponent(y))}}),h}function M(f){var h=new x,g=f.replace(/\r?\n[\t ]+/g," ");return g.split(/\r?\n/).forEach(function(S){var I=S.split(":"),y=I.shift().trim();if(y){var u=I.join(":").trim();h.append(y,u)}}),h}z.call(nt.prototype);function d(f,h){h||(h={}),this.type="default",this.status=h.status===void 0?200:h.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in h?h.statusText:"OK",this.headers=new x(h.headers),this.url=h.url||"",this._initBody(f)}z.call(d.prototype),d.prototype.clone=function(){return new d(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new x(this.headers),url:this.url})},d.error=function(){var f=new d(null,{status:0,statusText:""});return f.type="error",f};var o=[301,302,303,307,308];d.redirect=function(f,h){if(o.indexOf(h)===-1)throw new RangeError("Invalid status code");return new d(null,{status:h,headers:{location:f}})},c.DOMException=i.DOMException;try{new c.DOMException}catch{c.DOMException=function(h,g){this.message=h,this.name=g;var S=Error(h);this.stack=S.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function a(f,h){return new Promise(function(g,S){var I=new nt(f,h);if(I.signal&&I.signal.aborted)return S(new c.DOMException("Aborted","AbortError"));var y=new XMLHttpRequest;function u(){y.abort()}y.onload=function(){var b={status:y.status,statusText:y.statusText,headers:M(y.getAllResponseHeaders()||"")};b.url="responseURL"in y?y.responseURL:b.headers.get("X-Request-URL");var D="response"in y?y.response:y.responseText;g(new d(D,b))},y.onerror=function(){S(new TypeError("Network request failed"))},y.ontimeout=function(){S(new TypeError("Network request failed"))},y.onabort=function(){S(new c.DOMException("Aborted","AbortError"))},y.open(I.method,I.url,!0),I.credentials==="include"?y.withCredentials=!0:I.credentials==="omit"&&(y.withCredentials=!1),"responseType"in y&&l.blob&&(y.responseType="blob"),I.headers.forEach(function(b,D){y.setRequestHeader(D,b)}),I.signal&&(I.signal.addEventListener("abort",u),y.onreadystatechange=function(){y.readyState===4&&I.signal.removeEventListener("abort",u)}),y.send(typeof I._bodyInit>"u"?null:I._bodyInit)})}return a.polyfill=!0,i.fetch||(i.fetch=a,i.Headers=x,i.Request=nt,i.Response=d),c.Headers=x,c.Request=nt,c.Response=d,c.fetch=a,Object.defineProperty(c,"__esModule",{value:!0}),c})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var s=n;t=s.fetch,t.default=s.fetch,t.fetch=s.fetch,t.Headers=s.Headers,t.Request=s.Request,t.Response=s.Response,r.exports=t})(k2,k2.exports);var ZN=hN(k2.exports);async function WN(r,t,e=5){const n=`https://api.apr.dev/api/v0/program/${t.toString()}/latest?limit=${e}`,[s,i]=await Promise.all([kM(r,t),ZN(n)]),c=(await i.json()).filter(p=>!p.aborted&&p.state==="Built"&&p.verified==="Verified");if(c.length===0)return null;const l=c[0];return s.slot.toNumber()!==l.verified_slot?null:l}async function kM(r,t){const e=await r.getAccountInfo(t);if(e===null)throw new Error("program account not found");const{program:n}=I2(e.data),s=await r.getAccountInfo(n.programdataAddress);if(s===null)throw new Error("program data account not found");const{programData:i}=I2(s.data);return i}const GN=Ze.rustEnum([Ze.struct([],"uninitialized"),Ze.struct([Ze.option(Ze.publicKey(),"authorityAddress")],"buffer"),Ze.struct([Ze.publicKey("programdataAddress")],"program"),Ze.struct([Ze.u64("slot"),Ze.option(Ze.publicKey(),"upgradeAuthorityAddress")],"programData")],void 0,Ze.u32());function I2(r){return GN.decode(r)}var YN=Object.freeze({__proto__:null,verifiedBuild:WN,fetchData:kM,decodeUpgradeableLoaderState:I2}),XN=Object.freeze({__proto__:null,sha256:jN,rpc:YU,publicKey:$N,bytes:LU,token:VN,features:eN,registry:YN});function JN(r){return"accounts"in r}async function QN(r){const t=(await Ne.findProgramAddress([],r))[0];return await Ne.createWithSeed(t,tD(),r)}function tD(){return"anchor:idl"}const eD=Ze.struct([Ze.publicKey("authority"),Ze.vecU8("data")]);function rD(r){return eD.decode(r)}function Lh(r,t){var e,n;let s={};const i=r.args?r.args.length:0;if(t.length>i){if(t.length!==i+1)throw new Error(`provided too many arguments ${t} to instruction ${r==null?void 0:r.name} expecting: ${(n=(e=r.args)===null||e===void 0?void 0:e.map(c=>c.name))!==null&&n!==void 0?n:[]}`);s=t.pop()}return[t,s]}class pl{static build(t,e,n){if(t.name==="_inner")throw new Zc("the _inner name is reserved");const s=(...i)=>{const[c,l]=Lh(t,[...i]);Ng(t.accounts,l.accounts),nD(t,...i);const p=s.accounts(l.accounts);return l.remainingAccounts!==void 0&&p.push(...l.remainingAccounts),jg("debug-logs")&&console.log("Outgoing account metas:",p),new gh({keys:p,programId:n,data:e(t.name,sM(t,...c))})};return s.accounts=i=>pl.accountsArray(i,t.accounts,n,t.name),s}static accountsArray(t,e,n,s){return t?e.map(i=>{if(("accounts"in i?i.accounts:void 0)!==void 0){const l=t[i.name];return pl.accountsArray(l,i.accounts,n,s).flat()}else{const l=i;let p;try{p=si(t[i.name])}catch{throw new Error(`Wrong input type for account "${i.name}" in the instruction accounts object${s!==void 0?' for instruction "'+s+'"':""}. Expected PublicKey or string.`)}const m=l.isOptional&&p.equals(n),v=l.isMut&&!m,_=l.isSigner&&!m;return{pubkey:p,isWritable:v,isSigner:_}}}).flat():[]}}function nD(r,...t){}class iD{static build(t,e){return(...s)=>{var i,c,l;const[,p]=Lh(t,[...s]),m=new Zl;if(p.preInstructions&&p.instructions)throw new Error("instructions is deprecated, use preInstructions");return(i=p.preInstructions)===null||i===void 0||i.forEach(v=>m.add(v)),(c=p.instructions)===null||c===void 0||c.forEach(v=>m.add(v)),m.add(e(...s)),(l=p.postInstructions)===null||l===void 0||l.forEach(v=>m.add(v)),m}}}class oD{static build(t,e,n,s){return async(...c)=>{var l;const p=e(...c),[,m]=Lh(t,[...c]);if(s.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");try{return await s.sendAndConfirm(p,(l=m.signers)!==null&&l!==void 0?l:[],m.options)}catch(v){throw Kg(v,n)}}}}class sD{static build(t,e,n,s){var i;const c={};return(i=t.accounts)===null||i===void 0||i.forEach(l=>{const p=Dr(l.name);c[p]=new IM(t,l,n,s,e)}),c}}class IM{get size(){return this._size}get programId(){return this._programId}get provider(){return this._provider}get coder(){return this._coder}get idlAccount(){return this._idlAccount}constructor(t,e,n,s,i){this._idlAccount=e,this._programId=n,this._provider=s??Vc(),this._coder=i??new Hg(t),this._size=this._coder.accounts.size(e)}async fetchNullable(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);return n}async fetchNullableAndContext(t,e){const n=await this.getAccountInfoAndContext(t,e),{value:s,context:i}=n;return{data:s&&s.data.length!==0?this._coder.accounts.decode(this._idlAccount.name,s.data):null,context:i}}async fetch(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);if(n===null)throw new Error(`Account does not exist or has no data ${t.toString()}`);return n}async fetchAndContext(t,e){const{data:n,context:s}=await this.fetchNullableAndContext(t,e);if(n===null)throw new Error(`Account does not exist ${t.toString()}`);return{data:n,context:s}}async fetchMultiple(t,e){return(await this.fetchMultipleAndContext(t,e)).map(s=>s?s.data:null)}async fetchMultipleAndContext(t,e){return(await Fg(this._provider.connection,t.map(s=>si(s)),e)).map(s=>{if(s==null)return null;const{account:i,context:c}=s;return{data:this._coder.accounts.decode(this._idlAccount.name,i.data),context:c}})}async all(t){const e=this.coder.accounts.memcmp(this._idlAccount.name,t instanceof Zt.Buffer?t:void 0),n=[];return(e==null?void 0:e.offset)!=null&&(e==null?void 0:e.bytes)!=null&&n.push({memcmp:{offset:e.offset,bytes:e.bytes}}),(e==null?void 0:e.dataSize)!=null&&n.push({dataSize:e.dataSize}),(await this._provider.connection.getProgramAccounts(this._programId,{commitment:this._provider.connection.commitment,filters:[...n,...Array.isArray(t)?t:[]]})).map(({pubkey:i,account:c})=>({publicKey:i,account:this._coder.accounts.decode(this._idlAccount.name,c.data)}))}subscribe(t,e){const n=Xf.get(t.toString());if(n)return n.ee;const s=new hI;t=si(t);const i=this._provider.connection.onAccountChange(t,c=>{const l=this._coder.accounts.decode(this._idlAccount.name,c.data);s.emit("change",l)},e);return Xf.set(t.toString(),{ee:s,listener:i}),s}async unsubscribe(t){let e=Xf.get(t.toString());if(!e){console.warn("Address is not subscribed");return}Xf&&await this._provider.connection.removeAccountChangeListener(e.listener).then(()=>{Xf.delete(t.toString())}).catch(console.error)}async createInstruction(t,e){const n=this.size;if(this._provider.publicKey===void 0)throw new Error("This function requires the Provider interface implementor to have a 'publicKey' field.");return Hl.createAccount({fromPubkey:this._provider.publicKey,newAccountPubkey:t.publicKey,space:e??n,lamports:await this._provider.connection.getMinimumBalanceForRentExemption(e??n),programId:this._programId})}async associated(...t){const e=await this.associatedAddress(...t);return await this.fetch(e)}async associatedAddress(...t){return await SM(this._programId,...t)}async getAccountInfo(t,e){return await this._provider.connection.getAccountInfo(si(t),e)}async getAccountInfoAndContext(t,e){return await this._provider.connection.getAccountInfoAndContext(si(t),e)}}const Xf=new Map,B2="Program log: ",BM="Program data: ",aD=B2.length,uD=BM.length;class PM{constructor(t,e,n){this._programId=t,this._provider=e,this._eventParser=new Wg(t,n),this._eventCallbacks=new Map,this._eventListeners=new Map,this._listenerIdCount=0}addEventListener(t,e){var n;let s=this._listenerIdCount;return this._listenerIdCount+=1,this._eventListeners.has(t)||this._eventListeners.set(t,[]),this._eventListeners.set(t,((n=this._eventListeners.get(t))!==null&&n!==void 0?n:[]).concat(s)),this._eventCallbacks.set(s,[t,e]),this._onLogsSubscriptionId!==void 0||(this._onLogsSubscriptionId=this._provider.connection.onLogs(this._programId,(i,c)=>{if(!i.err)for(const l of this._eventParser.parseLogs(i.logs)){const p=this._eventListeners.get(l.name);p&&p.forEach(m=>{const v=this._eventCallbacks.get(m);if(v){const[,_]=v;_(l.data,c.slot,i.signature)}})}})),s}async removeEventListener(t){const e=this._eventCallbacks.get(t);if(!e)throw new Error(`Event listener ${t} doesn't exist!`);const[n]=e;let s=this._eventListeners.get(n);if(!s)throw new Error(`Event listeners don't exist for ${n}!`);if(this._eventCallbacks.delete(t),s=s.filter(i=>i!==t),this._eventListeners.set(n,s),s.length===0&&this._eventListeners.delete(n),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 Wg{constructor(t,e){this.coder=e,this.programId=t}*parseLogs(t,e=!1){const n=new cD(t),s=new fD;let i=n.next();for(;i!==null;){let[c,l,p]=this.handleLog(s,i,e);c&&(yield c),l&&s.push(l),p&&s.pop(),i=n.next()}}handleLog(t,e,n){return t.stack.length>0&&t.program()===this.programId.toString()?this.handleProgramLog(e,n):[null,...this.handleSystemLog(e)]}handleProgramLog(t,e){if(t.startsWith(B2)||t.startsWith(BM)){const n=t.startsWith(B2)?t.slice(aD):t.slice(uD),s=this.coder.events.decode(n);if(e&&s===null)throw new Error(`Unable to decode event ${n}`);return[s,null,!1]}else return[null,...this.handleSystemLog(t)]}handleSystemLog(t){const e=t.split(":")[0];return e.match(/^Program (.*) success/g)!==null?[null,!0]:e.startsWith(`Program ${this.programId.toString()} invoke`)?[this.programId.toString(),!1]:e.includes("invoke")?["cpi",!1]:[null,!1]}}class fD{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(t){this.stack.push(t)}pop(){if(!this.stack.length)throw new Error("Expected the stack to have elements");this.stack.pop()}}class cD{constructor(t){this.logs=t}next(){if(this.logs.length===0)return null;let t=this.logs[0];return this.logs=this.logs.slice(1),t}}class hD{static build(t,e,n,s,i,c,l){return async(...m)=>{var v;const _=e(...m),[,E]=Lh(t,[...m]);let w;if(s.simulate===void 0)throw new Error("This function requires 'Provider.simulate' to be implemented.");try{w=await s.simulate(_,E.signers,(v=E.options)===null||v===void 0?void 0:v.commitment)}catch(B){throw Kg(B,n)}if(w===void 0)throw new Error("Unable to simulate transaction");const x=w.logs;if(!x)throw new Error("Simulated logs not found");const A=[];if(l.events){let B=new Wg(c,i);for(const P of B.parseLogs(x))A.push(P)}return{events:A,raw:x}}}}function Rp(r){return new RM(Th(8),t=>Gg.fromBuffer(t),t=>t.toBuffer(),r)}function u0(r){return new RM(Th(32),t=>new Ne(t),t=>t.toBuffer(),r)}function Cp(r,t){return new lD(r,t)}class RM extends pd{constructor(t,e,n,s){super(t.span,s),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}class lD extends pd{constructor(t,e){super(-1,e),this.layout=t,this.discriminator=ms()}encode(t,e,n=0){return t==null?this.layout.span+this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+4)+4)}decode(t,e=0){const n=this.discriminator.decode(t,e);if(n===0)return null;if(n===1)return this.layout.decode(t,e+4);throw new Error("Invalid coption "+this.layout.property)}getSpan(t,e=0){return this.layout.getSpan(t,e+4)+4}}class Gg extends Jv{toBuffer(){const t=super.toArray().reverse(),e=Zt.Buffer.from(t);if(e.length===8)return e;if(e.length>=8)throw new Error("u64 too large");const n=Zt.Buffer.alloc(8);return e.copy(n),n}static fromBuffer(t){if(t.length!==8)throw new Error(`Invalid buffer length: ${t.length}`);return new Gg([...t].reverse().map(e=>`00${e.toString(16)}`.slice(-2)).join(""),16)}}const dD=vn([u0("mint"),u0("owner"),Rp("amount"),Cp(u0(),"delegate"),(r=>{const t=MM(bN("discriminator"),null,r);return t.addVariant(0,vn([]),"uninitialized"),t.addVariant(1,vn([]),"initialized"),t.addVariant(2,vn([]),"frozen"),t})("state"),Cp(Rp(),"isNative"),Rp("delegatedAmount"),Cp(u0(),"closeAuthority")]);function pD(r){return dD.decode(r)}class Gc{constructor(t,e,n,s,i,c,l,p){this._accounts=e,this._provider=n,this._programId=s,this._idlIx=i,this._idlTypes=l,this._customResolver=p,this._args=t,this._accountStore=new mD(n,c,this._programId)}args(t){this._args=t}async resolve(){for(await this.resolveConst(this._idlIx.accounts),this._resolveEventCpi(this._idlIx.accounts);await this.resolvePdas(this._idlIx.accounts)+await this.resolveRelations(this._idlIx.accounts)+await this.resolveCustom()>0;);}async resolveCustom(){if(this._customResolver){const{accounts:t,resolved:e}=await this._customResolver({args:this._args,accounts:this._accounts,provider:this._provider,programId:this._programId,idlIx:this._idlIx});return this._accounts=t,e}return 0}resolveOptionalsHelper(t,e){const n={};for(const s of e){const i=s.name,c=t[i];c!==void 0&&(TM(c)?JN(s)?n[i]=this.resolveOptionalsHelper(c,s.accounts):n[i]=LM(c,!0):c!==null?n[i]=si(c):s.isOptional&&(n[i]=this._programId))}return n}resolveOptionals(t){Object.assign(this._accounts,this.resolveOptionalsHelper(t,this._idlIx.accounts))}get(t){const e=t.reduce((n,s)=>n&&n[s],this._accounts);if(e&&e.toBase58)return e}set(t,e){let n=this._accounts;t.forEach((s,i)=>{i==t.length-1&&(n[s]=e),n[s]=n[s]||{},n=n[s]})}async resolveConst(t,e=[]){for(let n=0;n0&&!this.get([...e,p])&&await this.autoPopulatePda(l,e)&&(n+=1)}return n}async resolveRelations(t,e=[]){let n=0;for(let s=0;s!this.get([...e,Dr(E)]));if(n+=_.length,_.length>0){const E=await this._accountStore.fetchAccount({publicKey:v});await Promise.all(_.map(async w=>{const x=Dr(w);return this.set([...e,x],E[x]),E[x]}))}}}return n}async autoPopulatePda(t,e=[]){if(!t.pda||!t.pda.seeds)throw new Error("Must have seeds");const n=await Promise.all(t.pda.seeds.map(c=>this.toBuffer(c,e)));if(n.some(c=>typeof c>"u"))return;const s=await this.parseProgramId(t,e);if(!s)return;const[i]=await Ne.findProgramAddress(n,s);this.set([...e,Dr(t.name)],i)}async parseProgramId(t,e=[]){var n;if(!(!((n=t.pda)===null||n===void 0)&&n.programId))return this._programId;switch(t.pda.programId.kind){case"const":return new Ne(this.toBufferConst(t.pda.programId.value));case"arg":return this.argValue(t.pda.programId);case"account":return await this.accountValue(t.pda.programId,e);default:throw new Error(`Unexpected program seed kind: ${t.pda.programId.kind}`)}}async toBuffer(t,e=[]){switch(t.kind){case"const":return this.toBufferConst(t);case"arg":return await this.toBufferArg(t);case"account":return await this.toBufferAccount(t,e);default:throw new Error(`Unexpected seed kind: ${t.kind}`)}}getType(t,e=[]){if(e.length>0&&t.defined){const n=this._idlTypes.find(c=>c.name===t.defined);if(!n)throw new Error(`Cannot find type ${t.defined}`);const i=n.type.fields.find(c=>c.name===e[0]);return this.getType(i.type,e.slice(1))}return t}toBufferConst(t){return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),t.value)}async toBufferArg(t){const e=this.argValue(t);if(!(typeof e>"u"))return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),e)}argValue(t){const e=t.path.split("."),n=Dr(e[0]),s=this._idlIx.args.findIndex(i=>i.name===n);if(s===-1)throw new Error(`Unable to find argument for seed: ${n}`);return e.slice(1).reduce((i,c)=>(i||{})[c],this._args[s])}async toBufferAccount(t,e=[]){const n=await this.accountValue(t,e);if(n)return this.toBufferValue(t.type,n)}async accountValue(t,e=[]){const n=t.path.split("."),s=n[0],i=this.get([...e,Dr(s)]);if(i===null)throw new Error("fieldPubkey is null");if(n.length===1)return i;const c=await this._accountStore.fetchAccount({publicKey:i,name:t.account});return this.parseAccountValue(c,n.slice(1))}parseAccountValue(t,e){let n;for(;e.length>0;)n=t[Dr(e[0])],e=e.slice(1);return n}toBufferValue(t,e){switch(t){case"u8":return Zt.Buffer.from([e]);case"u16":let n=Zt.Buffer.alloc(2);return n.writeUInt16LE(e),n;case"u32":let s=Zt.Buffer.alloc(4);return s.writeUInt32LE(e),s;case"u64":let i=Zt.Buffer.alloc(8);return i.writeBigUInt64LE(BigInt(e)),i;case"string":return Zt.Buffer.from(nM(e));case"publicKey":return e.toBuffer();default:if(t.array)return Zt.Buffer.from(e);throw new Error(`Unexpected seed type: ${t}`)}}}Gc.CONST_ACCOUNTS={associatedTokenProgram:Zg,rent:fI,systemProgram:Hl.programId,tokenProgram:Vg,clock:cI};class mD{constructor(t,e,n){this._provider=t,this._programId=n,this._cache=new Map,this._idls={},this._idls[n.toBase58()]=e}async ensureIdl(t){if(!this._idls[t.toBase58()]){const e=await Xa.fetchIdl(t,this._provider);if(e){const n=new Xa(e,t,this._provider);this._idls[t.toBase58()]=n.account}}return this._idls[t.toBase58()]}async fetchAccount({publicKey:t,name:e,programId:n=this._programId}){const s=t.toString();if(!this._cache.has(s))if(e==="TokenAccount"){const i=await this._provider.connection.getAccountInfo(t);if(i===null)throw new Error(`invalid account info for ${s}`);const c=pD(i.data);this._cache.set(s,c)}else if(e){const i=await this.ensureIdl(n);if(i){const c=i[Dr(e)];if(c){const l=await c.fetch(t);this._cache.set(s,l)}}}else{const i=await this._provider.connection.getAccountInfo(t);if(i===null)throw new Error(`invalid account info for ${s}`);const c=i.data,l=await this.ensureIdl(i.owner);if(l){const p=Object.values(l)[0];if(!p)throw new Error("No accounts for this program");const m=p.coder.accounts.decodeAny(c);this._cache.set(s,m)}}return this._cache.get(s)}}class CM{static build(t,e,n,s,i,c,l,p,m,v,_){return(...E)=>new vD(E,s,i,c,l,p,t,e,n,m,v,_)}}function TM(r){return typeof r=="object"&&r!==null&&!("_bn"in r)}function LM(r,t){const e={};for(const n in r){const s=r[n];if(s===null){if(t)throw new Error("Failed to resolve optionals due to IDL type mismatch with input accounts!");continue}e[n]=TM(s)?LM(s,!0):si(s)}return e}class vD{constructor(t,e,n,s,i,c,l,p,m,v,_,E){this._ixFn=e,this._txFn=n,this._rpcFn=s,this._simulateFn=i,this._viewFn=c,this._programId=p,this._accounts={},this._remainingAccounts=[],this._signers=[],this._preInstructions=[],this._postInstructions=[],this._autoResolveAccounts=!0,this._args=t,this._accountsResolver=new Gc(t,this._accounts,l,p,m,v,_,E)}args(t){this._args=t,this._accountsResolver.args(t)}async pubkeys(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._accounts}accounts(t){return this._autoResolveAccounts=!0,this._accountsResolver.resolveOptionals(t),this}accountsStrict(t){return this._autoResolveAccounts=!1,this._accountsResolver.resolveOptionals(t),this}signers(t){return this._signers=this._signers.concat(t),this}remainingAccounts(t){return this._remainingAccounts=this._remainingAccounts.concat(t),this}preInstructions(t){return this._preInstructions=this._preInstructions.concat(t),this}postInstructions(t){return this._postInstructions=this._postInstructions.concat(t),this}async rpc(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._rpcFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async rpcAndKeys(t){return{pubkeys:await this.pubkeys(),signature:await this.rpc(t)}}async view(t){if(this._autoResolveAccounts&&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:t})}async simulate(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._simulateFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async instruction(){return this._autoResolveAccounts&&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:await this._signers}}async transaction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._txFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}}class gD{static build(t,e,n,s){const i=e.accounts.find(p=>p.isMut),c=!!e.returns;return i||!c?void 0:async(...p)=>{var m,v;let _=await n(...p);const E=`Program return: ${t} `;let w=_.raw.find(P=>P.startsWith(E));if(!w)throw new Error("View expected return log");let x=iM(w.slice(E.length)),A=e.returns;if(!A)throw new Error("View expected return type");return wi.fieldLayout({type:A},Array.from([...(m=s.accounts)!==null&&m!==void 0?m:[],...(v=s.types)!==null&&v!==void 0?v:[]])).decode(x)}}}class yD{static build(t,e,n,s,i){const c={},l={},p={},m={},v={},_={},E=oM(t),w=t.accounts?sD.build(t,e,n,s):{};return t.instructions.forEach(x=>{const A=pl.build(x,(H,tt)=>e.instruction.encode(H,tt),n),B=iD.build(x,A),P=oD.build(x,B,E,s),R=hD.build(x,B,E,s,e,n,t),C=gD.build(n,x,R,t),O=CM.build(s,n,x,A,B,P,R,C,w,t.types||[],i&&i(x)),z=Dr(x.name);l[z]=A,p[z]=B,c[z]=P,m[z]=R,v[z]=O,C&&(_[z]=C)}),[c,l,p,w,m,v,_]}}class Xa{get programId(){return this._programId}get idl(){return this._idl}get coder(){return this._coder}get provider(){return this._provider}constructor(t,e,n,s,i){e=si(e),n||(n=Vc()),this._idl=t,this._provider=n,this._programId=e,this._coder=s??new Hg(t),this._events=new PM(this._programId,n,this._coder);const[c,l,p,m,v,_,E]=yD.build(t,this._coder,e,n,i??(()=>{}));this.rpc=c,this.instruction=l,this.transaction=p,this.account=m,this.simulate=v,this.methods=_,this.views=E}static async at(t,e){const n=si(t),s=await Xa.fetchIdl(n,e);if(!s)throw new Error(`IDL not found for program: ${t.toString()}`);return new Xa(s,n,e)}static async fetchIdl(t,e){e=e??Vc();const n=si(t),s=await QN(n),i=await e.connection.getAccountInfo(s);if(!i)return null;let c=rD(i.data.slice(8));const l=EU(c.data);return JSON.parse(rM(l))}addEventListener(t,e){return this._events.addEventListener(t,e)}async removeEventListener(t){return await this._events.removeEventListener(t)}}const bD=new Ne("11111111111111111111111111111111");function wD(r){return new Xa(OM,bD,r,xD())}function xD(){return new AM(OM)}const OM={version:"0.1.0",name:"system_program",instructions:[{name:"createAccount",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!0}],args:[{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assign",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"owner",type:"publicKey"}]},{name:"transfer",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"}]},{name:"createAccountWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"advanceNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"withdrawNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"to",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"lamports",type:"u64"}]},{name:"initializeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!0},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"authorized",type:"publicKey"}]},{name:"authorizeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"allocate",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"space",type:"u64"}]},{name:"allocateWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assignWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]},{name:"transferWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]}],accounts:[{name:"nonce",type:{kind:"struct",fields:[{name:"version",type:"u32"},{name:"state",type:"u32"},{name:"authorizedPubkey",type:"publicKey"},{name:"nonce",type:"publicKey"},{name:"feeCalculator",type:{defined:"FeeCalculator"}}]}}],types:[{name:"FeeCalculator",type:{kind:"struct",fields:[{name:"lamportsPerSignature",type:"u64"}]}}]};class _D{static system(t){return wD(t)}}const MD=Object.freeze(Object.defineProperty({__proto__:null,AccountClient:IM,AnchorError:Du,AnchorProvider:hM,BN:Jv,BorshAccountsCoder:Ca,BorshCoder:Hg,BorshEventCoder:mM,BorshInstructionCoder:dd,DISCRIMINATOR_SIZE:dl,EventManager:PM,EventParser:Wg,IdlError:Zc,LangErrorCode:ze,LangErrorMessage:dM,MethodsBuilderFactory:CM,Native:_D,Program:Xa,ProgramError:Wc,ProgramErrorStack:If,SystemCoder:AM,eventDiscriminator:vM,getProvider:Vc,parseIdlErrors:oM,setProvider:JU,splitArgsAndCtx:Lh,toInstruction:sM,translateAddress:si,translateError:Kg,utils:XN,validateAccounts:Ng,web3:K7},Symbol.toStringTag,{value:"Module"})),UM=j7(MD);var Jf={},Qf={},D3;function ED(){if(D3)return Qf;D3=1,Object.defineProperty(Qf,"__esModule",{value:!0}),Qf.PythOracleEventCoder=void 0;var r=function(){function t(){}return t.prototype.decode=function(e){throw new Error("Pyth oracle program does not have events")},t}();return Qf.PythOracleEventCoder=r,Qf}var tc={},z3;function AD(){if(z3)return tc;z3=1;var r=Re&&Re.__awaiter||function(n,s,i,c){function l(p){return p instanceof i?p:new i(function(m){m(p)})}return new(i||(i=Promise))(function(p,m){function v(w){try{E(c.next(w))}catch(x){m(x)}}function _(w){try{E(c.throw(w))}catch(x){m(x)}}function E(w){w.done?p(w.value):l(w.value).then(v,_)}E((c=c.apply(n,s||[])).next())})},t=Re&&Re.__generator||function(n,s){var i={label:0,sent:function(){if(p[0]&1)throw p[1];return p[1]},trys:[],ops:[]},c,l,p,m;return m={next:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(m[Symbol.iterator]=function(){return this}),m;function v(E){return function(w){return _([E,w])}}function _(E){if(c)throw new TypeError("Generator is already executing.");for(;i;)try{if(c=1,l&&(p=E[0]&2?l.return:E[0]?l.throw||((p=l.return)&&p.call(l),0):l.next)&&!(p=p.call(l,E[1])).done)return p;switch(l=0,p&&(E=[E[0]&2,p.value]),E[0]){case 0:case 1:p=E;break;case 4:return i.label++,{value:E[1],done:!1};case 5:i.label++,l=E[1],E=[0];continue;case 7:E=i.ops.pop(),i.trys.pop();continue;default:if(p=i.trys,!(p=p.length>0&&p[p.length-1])&&(E[0]===6||E[0]===2)){i=0;continue}if(E[0]===3&&(!p||E[1]>p[0]&&E[1]v)throw new Error("The metadata is too long");var tt=A.subarray(0,C);return c.Buffer.concat([R,tt])}else{var nt=P.encode(x,A),tt=A.subarray(0,nt);return c.Buffer.concat([R,tt])}},E.parseIxLayout=function(w){var x=w.instructions.map(function(A){var B=A.args.map(function(R){var C,O;return m.IdlCoder.fieldLayout(R,Array.from(n(n([],(C=w.accounts)!==null&&C!==void 0?C:[]),(O=w.types)!==null&&O!==void 0?O:[])))}),P=l.default(A.name);return[P,p.struct(B,P)]});return new Map(x)},E.prototype.decode=function(w,x){x===void 0&&(x="hex"),typeof w=="string"&&(w=x==="hex"?c.Buffer.from(w,"hex"):c.Buffer.from(i.default.decode(w)));var A=i.default.encode(w.subarray(0,this.discriminatorLength)),B=w.subarray(this.discriminatorLength),P=this.discriminatorLayouts.get(A);if(!P)return null;if(P.name==="updProduct"||P.name==="addProduct"){for(var R={},C=0;Cr.MAX_SLOT_DIFFERENCE&&(pt=s.Unknown);var Ft,lt;pt===s.Trading&&(Ft=yt.price,lt=yt.confidence);for(var ct=[],Tt=240;ct.length=n;)l-=n,e[p]=c>>l&i,p+=1}),s)l>0&&(e[p]=c<=t)throw new Error("Excessive padding: ".concat(l," (max ").concat(t-1," allowed)"));if(c%(1<8||t<1)throw new RangeError("Invalid bits per element; 1 to 8 expected");return NM(r,8,e,t,!0),e}function qD(r,t,e){if(t>8||t<1)throw new RangeError("Invalid bits per element; 1 to 8 expected");return NM(r,t,e,8,!1),e}var mo={};Object.defineProperty(mo,"__esModule",{value:!0});mo.CHECKSUM_LENGTH=void 0;mo.createChecksum=$D;mo.decode=jM;mo.decodeWithPrefix=VD;mo.detectCase=ZD;mo.encode=HD;mo.expandPrefix=FM;mo.verifyChecksum=KD;var DM=Bf,P2="qpzry9x8gf2tvdw0s3jn54khce6mua7l",zM=734539939,G3=33,Y3=126,R2=6;mo.CHECKSUM_LENGTH=R2;var FD=function(){for(var r=new Map,t=0;t>25,s=(t&33554431)<<5^e;return jD.reduce(function(i,c,l){return n>>l&1?i^c:i},s)},1)}function FM(r,t){for(var e=0;e>5,t[e+r.length+1]=n&31}t[r.length]=0}function KD(r){switch(qM(r)){case 1:return"bech32";case zM:return"bech32m";default:return}}function $D(r,t){var e;switch(t){case"bech32":e=1;break;case"bech32m":e=zM;break;default:throw Error("Invalid encoding value: ".concat(t,"; expected bech32 or bech32m"))}for(var n=qM(r)^e,s=0;s>i&31}}function HD(r){return r.reduce(function(t,e){return t+P2[e]},"")}function jM(r,t){for(var e=t||(0,DM.createBitArray)(r.length),n=0;n1&&arguments[1]!==void 0?arguments[1]:"message",e=!1,n=!1,s=0;sY3)throw new TypeError("Invalid char in ".concat(t,": ").concat(i,"; ")+"should be in ASCII range ".concat(G3,"-").concat(Y3));n=n||i>=65&&i<=90,e=e||i>=97&&i<=122}if(e&&n)throw new TypeError("Mixed-case ".concat(t));return n?"upper":e?"lower":null}Object.defineProperty(Ps,"__esModule",{value:!0});Ps.BitcoinAddress=void 0;Ps.decode=XD;Ps.decodeTo5BitArray=ty;Ps.encode=YD;Ps.encode5BitArray=Qg;Ps.from5BitArray=Jg;Ps.to5BitArray=Xg;var Yc=Bf,Di=mo;function WD(r,t){if(!(r instanceof t))throw new TypeError("Cannot call a class as a function")}function X3(r,t){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:"bech32",s=2*r.length+1+t.length+Di.CHECKSUM_LENGTH;if(s-r.length>ml)throw new Error("Message to be produced is too long (max ".concat(ml," supported)"));var i=(e=(0,Di.detectCase)(r,"prefix"))!==null&&e!==void 0?e:"lower",c=(0,Yc.createBitArray)(s);(0,Di.expandPrefix)(r.toLowerCase(),c.subarray(0,2*r.length+1));var l=c.subarray(2*r.length+1,c.length-Di.CHECKSUM_LENGTH);l.set(t),(0,Di.createChecksum)(c,n);var p=(0,Di.encode)(c.subarray(2*r.length+1));return i==="upper"&&(p=p.toUpperCase()),"".concat(r,"1").concat(p)}function YD(r,t){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"bech32";return Qg(r,Xg(t),e)}function ty(r){if(r.length>ml)throw new TypeError("Message too long; max ".concat(ml," expected"));(0,Di.detectCase)(r);var t=r.toLowerCase(),e=t.lastIndexOf("1");if(e<0)throw new Error('No separator char ("1") found');if(e>r.length-Di.CHECKSUM_LENGTH-1)throw new Error("Data part of the message too short (at least ".concat(Di.CHECKSUM_LENGTH," chars expected)"));var n=t.substring(0,e),s=(0,Di.decodeWithPrefix)(n,t.substring(e+1)),i=(0,Di.verifyChecksum)(s);if(i===void 0)throw new Error("Invalid checksum");return{prefix:n,encoding:i,data:s.subarray(2*n.length+1,s.length-Di.CHECKSUM_LENGTH)}}function XD(r){var t=ty(r),e=t.prefix,n=t.encoding,s=t.data;return{prefix:e,encoding:n,data:Jg(s)}}var JD=function(){function r(t,e,n){if(WD(this,r),t!=="bc"&&t!=="tb")throw new Error('Invalid human-readable prefix, "bc" or "tb" expected');if(e<0||e>16)throw new RangeError("Invalid scriptVersion, value in range [0, 16] expected");if(n.length<2||n.length>40)throw new RangeError("Invalid script length: expected 2 to 40 bytes");if(e===0&&n.length!==20&&n.length!==32)throw new Error("Invalid v0 script length: expected 20 or 32 bytes");this.prefix=t,this.scriptVersion=e,this.data=n}return GD(r,[{key:"type",value:function(){if(this.scriptVersion===0)switch(this.data.length){case 20:return"p2wpkh";case 32:return"p2wsh";default:return}}},{key:"encode",value:function(){var e=Math.ceil(this.data.length*8/5),n=(0,Yc.createBitArray)(e+1);n[0]=this.scriptVersion,Xg(this.data,n.subarray(1));var s=this.scriptVersion===0?"bech32":"bech32m";return Qg(this.prefix,n,s)}}],[{key:"decode",value:function(e){var n=ty(e),s=n.prefix,i=n.data,c=n.encoding;if(s!=="bc"&&s!=="tb")throw new Error('Invalid human-readable prefix, "bc" or "tb" expected');var l=i[0];if(l===0&&c!=="bech32")throw Error("Unexpected encoding ".concat(c," used for version 0 script"));if(l>0&&c!=="bech32m")throw Error("Unexpected encoding ".concat(c," used for version ").concat(l," script"));return new this(s,l,Jg(i.subarray(1)))}}]),r}();Ps.BitcoinAddress=JD;var QD={exports:{}};(function(r){(function(t){var e=function(K){var Y,V=new Float64Array(16);if(K)for(Y=0;Y>24&255,K[Y+1]=V>>16&255,K[Y+2]=V>>8&255,K[Y+3]=V&255,K[Y+4]=U>>24&255,K[Y+5]=U>>16&255,K[Y+6]=U>>8&255,K[Y+7]=U&255}function A(K,Y,V,U,W){var et,dt=0;for(et=0;et>>8)-1}function B(K,Y,V,U){return A(K,Y,V,U,16)}function P(K,Y,V,U){return A(K,Y,V,U,32)}function R(K,Y,V,U){for(var W=U[0]&255|(U[1]&255)<<8|(U[2]&255)<<16|(U[3]&255)<<24,et=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,dt=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,ut=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,ht=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,zt=U[4]&255|(U[5]&255)<<8|(U[6]&255)<<16|(U[7]&255)<<24,Wt=Y[0]&255|(Y[1]&255)<<8|(Y[2]&255)<<16|(Y[3]&255)<<24,ye=Y[4]&255|(Y[5]&255)<<8|(Y[6]&255)<<16|(Y[7]&255)<<24,Yt=Y[8]&255|(Y[9]&255)<<8|(Y[10]&255)<<16|(Y[11]&255)<<24,pe=Y[12]&255|(Y[13]&255)<<8|(Y[14]&255)<<16|(Y[15]&255)<<24,ve=U[8]&255|(U[9]&255)<<8|(U[10]&255)<<16|(U[11]&255)<<24,ge=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,ie=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,ue=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,fe=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,ce=U[12]&255|(U[13]&255)<<8|(U[14]&255)<<16|(U[15]&255)<<24,Kt=W,oe=et,Jt=dt,le=ut,ae=ht,ne=zt,Ot=Wt,Nt=ye,he=Yt,ee=pe,re=ve,me=ge,Fe=ie,Ge=ue,Xe=fe,Ye=ce,bt,ir=0;ir<20;ir+=2)bt=Kt+Fe|0,ae^=bt<<7|bt>>>32-7,bt=ae+Kt|0,he^=bt<<9|bt>>>32-9,bt=he+ae|0,Fe^=bt<<13|bt>>>32-13,bt=Fe+he|0,Kt^=bt<<18|bt>>>32-18,bt=ne+oe|0,ee^=bt<<7|bt>>>32-7,bt=ee+ne|0,Ge^=bt<<9|bt>>>32-9,bt=Ge+ee|0,oe^=bt<<13|bt>>>32-13,bt=oe+Ge|0,ne^=bt<<18|bt>>>32-18,bt=re+Ot|0,Xe^=bt<<7|bt>>>32-7,bt=Xe+re|0,Jt^=bt<<9|bt>>>32-9,bt=Jt+Xe|0,Ot^=bt<<13|bt>>>32-13,bt=Ot+Jt|0,re^=bt<<18|bt>>>32-18,bt=Ye+me|0,le^=bt<<7|bt>>>32-7,bt=le+Ye|0,Nt^=bt<<9|bt>>>32-9,bt=Nt+le|0,me^=bt<<13|bt>>>32-13,bt=me+Nt|0,Ye^=bt<<18|bt>>>32-18,bt=Kt+le|0,oe^=bt<<7|bt>>>32-7,bt=oe+Kt|0,Jt^=bt<<9|bt>>>32-9,bt=Jt+oe|0,le^=bt<<13|bt>>>32-13,bt=le+Jt|0,Kt^=bt<<18|bt>>>32-18,bt=ne+ae|0,Ot^=bt<<7|bt>>>32-7,bt=Ot+ne|0,Nt^=bt<<9|bt>>>32-9,bt=Nt+Ot|0,ae^=bt<<13|bt>>>32-13,bt=ae+Nt|0,ne^=bt<<18|bt>>>32-18,bt=re+ee|0,me^=bt<<7|bt>>>32-7,bt=me+re|0,he^=bt<<9|bt>>>32-9,bt=he+me|0,ee^=bt<<13|bt>>>32-13,bt=ee+he|0,re^=bt<<18|bt>>>32-18,bt=Ye+Xe|0,Fe^=bt<<7|bt>>>32-7,bt=Fe+Ye|0,Ge^=bt<<9|bt>>>32-9,bt=Ge+Fe|0,Xe^=bt<<13|bt>>>32-13,bt=Xe+Ge|0,Ye^=bt<<18|bt>>>32-18;Kt=Kt+W|0,oe=oe+et|0,Jt=Jt+dt|0,le=le+ut|0,ae=ae+ht|0,ne=ne+zt|0,Ot=Ot+Wt|0,Nt=Nt+ye|0,he=he+Yt|0,ee=ee+pe|0,re=re+ve|0,me=me+ge|0,Fe=Fe+ie|0,Ge=Ge+ue|0,Xe=Xe+fe|0,Ye=Ye+ce|0,K[0]=Kt>>>0&255,K[1]=Kt>>>8&255,K[2]=Kt>>>16&255,K[3]=Kt>>>24&255,K[4]=oe>>>0&255,K[5]=oe>>>8&255,K[6]=oe>>>16&255,K[7]=oe>>>24&255,K[8]=Jt>>>0&255,K[9]=Jt>>>8&255,K[10]=Jt>>>16&255,K[11]=Jt>>>24&255,K[12]=le>>>0&255,K[13]=le>>>8&255,K[14]=le>>>16&255,K[15]=le>>>24&255,K[16]=ae>>>0&255,K[17]=ae>>>8&255,K[18]=ae>>>16&255,K[19]=ae>>>24&255,K[20]=ne>>>0&255,K[21]=ne>>>8&255,K[22]=ne>>>16&255,K[23]=ne>>>24&255,K[24]=Ot>>>0&255,K[25]=Ot>>>8&255,K[26]=Ot>>>16&255,K[27]=Ot>>>24&255,K[28]=Nt>>>0&255,K[29]=Nt>>>8&255,K[30]=Nt>>>16&255,K[31]=Nt>>>24&255,K[32]=he>>>0&255,K[33]=he>>>8&255,K[34]=he>>>16&255,K[35]=he>>>24&255,K[36]=ee>>>0&255,K[37]=ee>>>8&255,K[38]=ee>>>16&255,K[39]=ee>>>24&255,K[40]=re>>>0&255,K[41]=re>>>8&255,K[42]=re>>>16&255,K[43]=re>>>24&255,K[44]=me>>>0&255,K[45]=me>>>8&255,K[46]=me>>>16&255,K[47]=me>>>24&255,K[48]=Fe>>>0&255,K[49]=Fe>>>8&255,K[50]=Fe>>>16&255,K[51]=Fe>>>24&255,K[52]=Ge>>>0&255,K[53]=Ge>>>8&255,K[54]=Ge>>>16&255,K[55]=Ge>>>24&255,K[56]=Xe>>>0&255,K[57]=Xe>>>8&255,K[58]=Xe>>>16&255,K[59]=Xe>>>24&255,K[60]=Ye>>>0&255,K[61]=Ye>>>8&255,K[62]=Ye>>>16&255,K[63]=Ye>>>24&255}function C(K,Y,V,U){for(var W=U[0]&255|(U[1]&255)<<8|(U[2]&255)<<16|(U[3]&255)<<24,et=V[0]&255|(V[1]&255)<<8|(V[2]&255)<<16|(V[3]&255)<<24,dt=V[4]&255|(V[5]&255)<<8|(V[6]&255)<<16|(V[7]&255)<<24,ut=V[8]&255|(V[9]&255)<<8|(V[10]&255)<<16|(V[11]&255)<<24,ht=V[12]&255|(V[13]&255)<<8|(V[14]&255)<<16|(V[15]&255)<<24,zt=U[4]&255|(U[5]&255)<<8|(U[6]&255)<<16|(U[7]&255)<<24,Wt=Y[0]&255|(Y[1]&255)<<8|(Y[2]&255)<<16|(Y[3]&255)<<24,ye=Y[4]&255|(Y[5]&255)<<8|(Y[6]&255)<<16|(Y[7]&255)<<24,Yt=Y[8]&255|(Y[9]&255)<<8|(Y[10]&255)<<16|(Y[11]&255)<<24,pe=Y[12]&255|(Y[13]&255)<<8|(Y[14]&255)<<16|(Y[15]&255)<<24,ve=U[8]&255|(U[9]&255)<<8|(U[10]&255)<<16|(U[11]&255)<<24,ge=V[16]&255|(V[17]&255)<<8|(V[18]&255)<<16|(V[19]&255)<<24,ie=V[20]&255|(V[21]&255)<<8|(V[22]&255)<<16|(V[23]&255)<<24,ue=V[24]&255|(V[25]&255)<<8|(V[26]&255)<<16|(V[27]&255)<<24,fe=V[28]&255|(V[29]&255)<<8|(V[30]&255)<<16|(V[31]&255)<<24,ce=U[12]&255|(U[13]&255)<<8|(U[14]&255)<<16|(U[15]&255)<<24,Kt=W,oe=et,Jt=dt,le=ut,ae=ht,ne=zt,Ot=Wt,Nt=ye,he=Yt,ee=pe,re=ve,me=ge,Fe=ie,Ge=ue,Xe=fe,Ye=ce,bt,ir=0;ir<20;ir+=2)bt=Kt+Fe|0,ae^=bt<<7|bt>>>32-7,bt=ae+Kt|0,he^=bt<<9|bt>>>32-9,bt=he+ae|0,Fe^=bt<<13|bt>>>32-13,bt=Fe+he|0,Kt^=bt<<18|bt>>>32-18,bt=ne+oe|0,ee^=bt<<7|bt>>>32-7,bt=ee+ne|0,Ge^=bt<<9|bt>>>32-9,bt=Ge+ee|0,oe^=bt<<13|bt>>>32-13,bt=oe+Ge|0,ne^=bt<<18|bt>>>32-18,bt=re+Ot|0,Xe^=bt<<7|bt>>>32-7,bt=Xe+re|0,Jt^=bt<<9|bt>>>32-9,bt=Jt+Xe|0,Ot^=bt<<13|bt>>>32-13,bt=Ot+Jt|0,re^=bt<<18|bt>>>32-18,bt=Ye+me|0,le^=bt<<7|bt>>>32-7,bt=le+Ye|0,Nt^=bt<<9|bt>>>32-9,bt=Nt+le|0,me^=bt<<13|bt>>>32-13,bt=me+Nt|0,Ye^=bt<<18|bt>>>32-18,bt=Kt+le|0,oe^=bt<<7|bt>>>32-7,bt=oe+Kt|0,Jt^=bt<<9|bt>>>32-9,bt=Jt+oe|0,le^=bt<<13|bt>>>32-13,bt=le+Jt|0,Kt^=bt<<18|bt>>>32-18,bt=ne+ae|0,Ot^=bt<<7|bt>>>32-7,bt=Ot+ne|0,Nt^=bt<<9|bt>>>32-9,bt=Nt+Ot|0,ae^=bt<<13|bt>>>32-13,bt=ae+Nt|0,ne^=bt<<18|bt>>>32-18,bt=re+ee|0,me^=bt<<7|bt>>>32-7,bt=me+re|0,he^=bt<<9|bt>>>32-9,bt=he+me|0,ee^=bt<<13|bt>>>32-13,bt=ee+he|0,re^=bt<<18|bt>>>32-18,bt=Ye+Xe|0,Fe^=bt<<7|bt>>>32-7,bt=Fe+Ye|0,Ge^=bt<<9|bt>>>32-9,bt=Ge+Fe|0,Xe^=bt<<13|bt>>>32-13,bt=Xe+Ge|0,Ye^=bt<<18|bt>>>32-18;K[0]=Kt>>>0&255,K[1]=Kt>>>8&255,K[2]=Kt>>>16&255,K[3]=Kt>>>24&255,K[4]=ne>>>0&255,K[5]=ne>>>8&255,K[6]=ne>>>16&255,K[7]=ne>>>24&255,K[8]=re>>>0&255,K[9]=re>>>8&255,K[10]=re>>>16&255,K[11]=re>>>24&255,K[12]=Ye>>>0&255,K[13]=Ye>>>8&255,K[14]=Ye>>>16&255,K[15]=Ye>>>24&255,K[16]=Ot>>>0&255,K[17]=Ot>>>8&255,K[18]=Ot>>>16&255,K[19]=Ot>>>24&255,K[20]=Nt>>>0&255,K[21]=Nt>>>8&255,K[22]=Nt>>>16&255,K[23]=Nt>>>24&255,K[24]=he>>>0&255,K[25]=he>>>8&255,K[26]=he>>>16&255,K[27]=he>>>24&255,K[28]=ee>>>0&255,K[29]=ee>>>8&255,K[30]=ee>>>16&255,K[31]=ee>>>24&255}function O(K,Y,V,U){R(K,Y,V,U)}function z(K,Y,V,U){C(K,Y,V,U)}var H=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function tt(K,Y,V,U,W,et,dt){var ut=new Uint8Array(16),ht=new Uint8Array(64),zt,Wt;for(Wt=0;Wt<16;Wt++)ut[Wt]=0;for(Wt=0;Wt<8;Wt++)ut[Wt]=et[Wt];for(;W>=64;){for(O(ht,ut,dt,H),Wt=0;Wt<64;Wt++)K[Y+Wt]=V[U+Wt]^ht[Wt];for(zt=1,Wt=8;Wt<16;Wt++)zt=zt+(ut[Wt]&255)|0,ut[Wt]=zt&255,zt>>>=8;W-=64,Y+=64,U+=64}if(W>0)for(O(ht,ut,dt,H),Wt=0;Wt=64;){for(O(dt,et,W,H),ht=0;ht<64;ht++)K[Y+ht]=dt[ht];for(ut=1,ht=8;ht<16;ht++)ut=ut+(et[ht]&255)|0,et[ht]=ut&255,ut>>>=8;V-=64,Y+=64}if(V>0)for(O(dt,et,W,H),ht=0;ht>>13|V<<3)&8191,U=K[4]&255|(K[5]&255)<<8,this.r[2]=(V>>>10|U<<6)&7939,W=K[6]&255|(K[7]&255)<<8,this.r[3]=(U>>>7|W<<9)&8191,et=K[8]&255|(K[9]&255)<<8,this.r[4]=(W>>>4|et<<12)&255,this.r[5]=et>>>1&8190,dt=K[10]&255|(K[11]&255)<<8,this.r[6]=(et>>>14|dt<<2)&8191,ut=K[12]&255|(K[13]&255)<<8,this.r[7]=(dt>>>11|ut<<5)&8065,ht=K[14]&255|(K[15]&255)<<8,this.r[8]=(ut>>>8|ht<<8)&8191,this.r[9]=ht>>>5&127,this.pad[0]=K[16]&255|(K[17]&255)<<8,this.pad[1]=K[18]&255|(K[19]&255)<<8,this.pad[2]=K[20]&255|(K[21]&255)<<8,this.pad[3]=K[22]&255|(K[23]&255)<<8,this.pad[4]=K[24]&255|(K[25]&255)<<8,this.pad[5]=K[26]&255|(K[27]&255)<<8,this.pad[6]=K[28]&255|(K[29]&255)<<8,this.pad[7]=K[30]&255|(K[31]&255)<<8};d.prototype.blocks=function(K,Y,V){for(var U=this.fin?0:2048,W,et,dt,ut,ht,zt,Wt,ye,Yt,pe,ve,ge,ie,ue,fe,ce,Kt,oe,Jt,le=this.h[0],ae=this.h[1],ne=this.h[2],Ot=this.h[3],Nt=this.h[4],he=this.h[5],ee=this.h[6],re=this.h[7],me=this.h[8],Fe=this.h[9],Ge=this.r[0],Xe=this.r[1],Ye=this.r[2],bt=this.r[3],ir=this.r[4],mr=this.r[5],vr=this.r[6],Qe=this.r[7],dr=this.r[8],pr=this.r[9];V>=16;)W=K[Y+0]&255|(K[Y+1]&255)<<8,le+=W&8191,et=K[Y+2]&255|(K[Y+3]&255)<<8,ae+=(W>>>13|et<<3)&8191,dt=K[Y+4]&255|(K[Y+5]&255)<<8,ne+=(et>>>10|dt<<6)&8191,ut=K[Y+6]&255|(K[Y+7]&255)<<8,Ot+=(dt>>>7|ut<<9)&8191,ht=K[Y+8]&255|(K[Y+9]&255)<<8,Nt+=(ut>>>4|ht<<12)&8191,he+=ht>>>1&8191,zt=K[Y+10]&255|(K[Y+11]&255)<<8,ee+=(ht>>>14|zt<<2)&8191,Wt=K[Y+12]&255|(K[Y+13]&255)<<8,re+=(zt>>>11|Wt<<5)&8191,ye=K[Y+14]&255|(K[Y+15]&255)<<8,me+=(Wt>>>8|ye<<8)&8191,Fe+=ye>>>5|U,Yt=0,pe=Yt,pe+=le*Ge,pe+=ae*(5*pr),pe+=ne*(5*dr),pe+=Ot*(5*Qe),pe+=Nt*(5*vr),Yt=pe>>>13,pe&=8191,pe+=he*(5*mr),pe+=ee*(5*ir),pe+=re*(5*bt),pe+=me*(5*Ye),pe+=Fe*(5*Xe),Yt+=pe>>>13,pe&=8191,ve=Yt,ve+=le*Xe,ve+=ae*Ge,ve+=ne*(5*pr),ve+=Ot*(5*dr),ve+=Nt*(5*Qe),Yt=ve>>>13,ve&=8191,ve+=he*(5*vr),ve+=ee*(5*mr),ve+=re*(5*ir),ve+=me*(5*bt),ve+=Fe*(5*Ye),Yt+=ve>>>13,ve&=8191,ge=Yt,ge+=le*Ye,ge+=ae*Xe,ge+=ne*Ge,ge+=Ot*(5*pr),ge+=Nt*(5*dr),Yt=ge>>>13,ge&=8191,ge+=he*(5*Qe),ge+=ee*(5*vr),ge+=re*(5*mr),ge+=me*(5*ir),ge+=Fe*(5*bt),Yt+=ge>>>13,ge&=8191,ie=Yt,ie+=le*bt,ie+=ae*Ye,ie+=ne*Xe,ie+=Ot*Ge,ie+=Nt*(5*pr),Yt=ie>>>13,ie&=8191,ie+=he*(5*dr),ie+=ee*(5*Qe),ie+=re*(5*vr),ie+=me*(5*mr),ie+=Fe*(5*ir),Yt+=ie>>>13,ie&=8191,ue=Yt,ue+=le*ir,ue+=ae*bt,ue+=ne*Ye,ue+=Ot*Xe,ue+=Nt*Ge,Yt=ue>>>13,ue&=8191,ue+=he*(5*pr),ue+=ee*(5*dr),ue+=re*(5*Qe),ue+=me*(5*vr),ue+=Fe*(5*mr),Yt+=ue>>>13,ue&=8191,fe=Yt,fe+=le*mr,fe+=ae*ir,fe+=ne*bt,fe+=Ot*Ye,fe+=Nt*Xe,Yt=fe>>>13,fe&=8191,fe+=he*Ge,fe+=ee*(5*pr),fe+=re*(5*dr),fe+=me*(5*Qe),fe+=Fe*(5*vr),Yt+=fe>>>13,fe&=8191,ce=Yt,ce+=le*vr,ce+=ae*mr,ce+=ne*ir,ce+=Ot*bt,ce+=Nt*Ye,Yt=ce>>>13,ce&=8191,ce+=he*Xe,ce+=ee*Ge,ce+=re*(5*pr),ce+=me*(5*dr),ce+=Fe*(5*Qe),Yt+=ce>>>13,ce&=8191,Kt=Yt,Kt+=le*Qe,Kt+=ae*vr,Kt+=ne*mr,Kt+=Ot*ir,Kt+=Nt*bt,Yt=Kt>>>13,Kt&=8191,Kt+=he*Ye,Kt+=ee*Xe,Kt+=re*Ge,Kt+=me*(5*pr),Kt+=Fe*(5*dr),Yt+=Kt>>>13,Kt&=8191,oe=Yt,oe+=le*dr,oe+=ae*Qe,oe+=ne*vr,oe+=Ot*mr,oe+=Nt*ir,Yt=oe>>>13,oe&=8191,oe+=he*bt,oe+=ee*Ye,oe+=re*Xe,oe+=me*Ge,oe+=Fe*(5*pr),Yt+=oe>>>13,oe&=8191,Jt=Yt,Jt+=le*pr,Jt+=ae*dr,Jt+=ne*Qe,Jt+=Ot*vr,Jt+=Nt*mr,Yt=Jt>>>13,Jt&=8191,Jt+=he*ir,Jt+=ee*bt,Jt+=re*Ye,Jt+=me*Xe,Jt+=Fe*Ge,Yt+=Jt>>>13,Jt&=8191,Yt=(Yt<<2)+Yt|0,Yt=Yt+pe|0,pe=Yt&8191,Yt=Yt>>>13,ve+=Yt,le=pe,ae=ve,ne=ge,Ot=ie,Nt=ue,he=fe,ee=ce,re=Kt,me=oe,Fe=Jt,Y+=16,V-=16;this.h[0]=le,this.h[1]=ae,this.h[2]=ne,this.h[3]=Ot,this.h[4]=Nt,this.h[5]=he,this.h[6]=ee,this.h[7]=re,this.h[8]=me,this.h[9]=Fe},d.prototype.finish=function(K,Y){var V=new Uint16Array(10),U,W,et,dt;if(this.leftover){for(dt=this.leftover,this.buffer[dt++]=1;dt<16;dt++)this.buffer[dt]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(U=this.h[1]>>>13,this.h[1]&=8191,dt=2;dt<10;dt++)this.h[dt]+=U,U=this.h[dt]>>>13,this.h[dt]&=8191;for(this.h[0]+=U*5,U=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=U,U=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=U,V[0]=this.h[0]+5,U=V[0]>>>13,V[0]&=8191,dt=1;dt<10;dt++)V[dt]=this.h[dt]+U,U=V[dt]>>>13,V[dt]&=8191;for(V[9]-=8192,W=(U^1)-1,dt=0;dt<10;dt++)V[dt]&=W;for(W=~W,dt=0;dt<10;dt++)this.h[dt]=this.h[dt]&W|V[dt];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,et=this.h[0]+this.pad[0],this.h[0]=et&65535,dt=1;dt<8;dt++)et=(this.h[dt]+this.pad[dt]|0)+(et>>>16)|0,this.h[dt]=et&65535;K[Y+0]=this.h[0]>>>0&255,K[Y+1]=this.h[0]>>>8&255,K[Y+2]=this.h[1]>>>0&255,K[Y+3]=this.h[1]>>>8&255,K[Y+4]=this.h[2]>>>0&255,K[Y+5]=this.h[2]>>>8&255,K[Y+6]=this.h[3]>>>0&255,K[Y+7]=this.h[3]>>>8&255,K[Y+8]=this.h[4]>>>0&255,K[Y+9]=this.h[4]>>>8&255,K[Y+10]=this.h[5]>>>0&255,K[Y+11]=this.h[5]>>>8&255,K[Y+12]=this.h[6]>>>0&255,K[Y+13]=this.h[6]>>>8&255,K[Y+14]=this.h[7]>>>0&255,K[Y+15]=this.h[7]>>>8&255},d.prototype.update=function(K,Y,V){var U,W;if(this.leftover){for(W=16-this.leftover,W>V&&(W=V),U=0;U=16&&(W=V-V%16,this.blocks(K,Y,W),Y+=W,V-=W),V){for(U=0;U>16&1),et[V-1]&=65535;et[15]=dt[15]-32767-(et[14]>>16&1),W=et[15]>>16&1,et[14]&=65535,I(dt,et,1-W)}for(V=0;V<16;V++)K[2*V]=dt[V]&255,K[2*V+1]=dt[V]>>8}function u(K,Y){var V=new Uint8Array(32),U=new Uint8Array(32);return y(V,K),y(U,Y),P(V,0,U,0)}function b(K){var Y=new Uint8Array(32);return y(Y,K),Y[0]&1}function D(K,Y){var V;for(V=0;V<16;V++)K[V]=Y[2*V]+(Y[2*V+1]<<8);K[15]&=32767}function Z(K,Y,V){for(var U=0;U<16;U++)K[U]=Y[U]+V[U]}function F(K,Y,V){for(var U=0;U<16;U++)K[U]=Y[U]-V[U]}function q(K,Y,V){var U,W,et=0,dt=0,ut=0,ht=0,zt=0,Wt=0,ye=0,Yt=0,pe=0,ve=0,ge=0,ie=0,ue=0,fe=0,ce=0,Kt=0,oe=0,Jt=0,le=0,ae=0,ne=0,Ot=0,Nt=0,he=0,ee=0,re=0,me=0,Fe=0,Ge=0,Xe=0,Ye=0,bt=V[0],ir=V[1],mr=V[2],vr=V[3],Qe=V[4],dr=V[5],pr=V[6],on=V[7],Pr=V[8],Yr=V[9],Xr=V[10],Jr=V[11],ln=V[12],Un=V[13],Nn=V[14],Dn=V[15];U=Y[0],et+=U*bt,dt+=U*ir,ut+=U*mr,ht+=U*vr,zt+=U*Qe,Wt+=U*dr,ye+=U*pr,Yt+=U*on,pe+=U*Pr,ve+=U*Yr,ge+=U*Xr,ie+=U*Jr,ue+=U*ln,fe+=U*Un,ce+=U*Nn,Kt+=U*Dn,U=Y[1],dt+=U*bt,ut+=U*ir,ht+=U*mr,zt+=U*vr,Wt+=U*Qe,ye+=U*dr,Yt+=U*pr,pe+=U*on,ve+=U*Pr,ge+=U*Yr,ie+=U*Xr,ue+=U*Jr,fe+=U*ln,ce+=U*Un,Kt+=U*Nn,oe+=U*Dn,U=Y[2],ut+=U*bt,ht+=U*ir,zt+=U*mr,Wt+=U*vr,ye+=U*Qe,Yt+=U*dr,pe+=U*pr,ve+=U*on,ge+=U*Pr,ie+=U*Yr,ue+=U*Xr,fe+=U*Jr,ce+=U*ln,Kt+=U*Un,oe+=U*Nn,Jt+=U*Dn,U=Y[3],ht+=U*bt,zt+=U*ir,Wt+=U*mr,ye+=U*vr,Yt+=U*Qe,pe+=U*dr,ve+=U*pr,ge+=U*on,ie+=U*Pr,ue+=U*Yr,fe+=U*Xr,ce+=U*Jr,Kt+=U*ln,oe+=U*Un,Jt+=U*Nn,le+=U*Dn,U=Y[4],zt+=U*bt,Wt+=U*ir,ye+=U*mr,Yt+=U*vr,pe+=U*Qe,ve+=U*dr,ge+=U*pr,ie+=U*on,ue+=U*Pr,fe+=U*Yr,ce+=U*Xr,Kt+=U*Jr,oe+=U*ln,Jt+=U*Un,le+=U*Nn,ae+=U*Dn,U=Y[5],Wt+=U*bt,ye+=U*ir,Yt+=U*mr,pe+=U*vr,ve+=U*Qe,ge+=U*dr,ie+=U*pr,ue+=U*on,fe+=U*Pr,ce+=U*Yr,Kt+=U*Xr,oe+=U*Jr,Jt+=U*ln,le+=U*Un,ae+=U*Nn,ne+=U*Dn,U=Y[6],ye+=U*bt,Yt+=U*ir,pe+=U*mr,ve+=U*vr,ge+=U*Qe,ie+=U*dr,ue+=U*pr,fe+=U*on,ce+=U*Pr,Kt+=U*Yr,oe+=U*Xr,Jt+=U*Jr,le+=U*ln,ae+=U*Un,ne+=U*Nn,Ot+=U*Dn,U=Y[7],Yt+=U*bt,pe+=U*ir,ve+=U*mr,ge+=U*vr,ie+=U*Qe,ue+=U*dr,fe+=U*pr,ce+=U*on,Kt+=U*Pr,oe+=U*Yr,Jt+=U*Xr,le+=U*Jr,ae+=U*ln,ne+=U*Un,Ot+=U*Nn,Nt+=U*Dn,U=Y[8],pe+=U*bt,ve+=U*ir,ge+=U*mr,ie+=U*vr,ue+=U*Qe,fe+=U*dr,ce+=U*pr,Kt+=U*on,oe+=U*Pr,Jt+=U*Yr,le+=U*Xr,ae+=U*Jr,ne+=U*ln,Ot+=U*Un,Nt+=U*Nn,he+=U*Dn,U=Y[9],ve+=U*bt,ge+=U*ir,ie+=U*mr,ue+=U*vr,fe+=U*Qe,ce+=U*dr,Kt+=U*pr,oe+=U*on,Jt+=U*Pr,le+=U*Yr,ae+=U*Xr,ne+=U*Jr,Ot+=U*ln,Nt+=U*Un,he+=U*Nn,ee+=U*Dn,U=Y[10],ge+=U*bt,ie+=U*ir,ue+=U*mr,fe+=U*vr,ce+=U*Qe,Kt+=U*dr,oe+=U*pr,Jt+=U*on,le+=U*Pr,ae+=U*Yr,ne+=U*Xr,Ot+=U*Jr,Nt+=U*ln,he+=U*Un,ee+=U*Nn,re+=U*Dn,U=Y[11],ie+=U*bt,ue+=U*ir,fe+=U*mr,ce+=U*vr,Kt+=U*Qe,oe+=U*dr,Jt+=U*pr,le+=U*on,ae+=U*Pr,ne+=U*Yr,Ot+=U*Xr,Nt+=U*Jr,he+=U*ln,ee+=U*Un,re+=U*Nn,me+=U*Dn,U=Y[12],ue+=U*bt,fe+=U*ir,ce+=U*mr,Kt+=U*vr,oe+=U*Qe,Jt+=U*dr,le+=U*pr,ae+=U*on,ne+=U*Pr,Ot+=U*Yr,Nt+=U*Xr,he+=U*Jr,ee+=U*ln,re+=U*Un,me+=U*Nn,Fe+=U*Dn,U=Y[13],fe+=U*bt,ce+=U*ir,Kt+=U*mr,oe+=U*vr,Jt+=U*Qe,le+=U*dr,ae+=U*pr,ne+=U*on,Ot+=U*Pr,Nt+=U*Yr,he+=U*Xr,ee+=U*Jr,re+=U*ln,me+=U*Un,Fe+=U*Nn,Ge+=U*Dn,U=Y[14],ce+=U*bt,Kt+=U*ir,oe+=U*mr,Jt+=U*vr,le+=U*Qe,ae+=U*dr,ne+=U*pr,Ot+=U*on,Nt+=U*Pr,he+=U*Yr,ee+=U*Xr,re+=U*Jr,me+=U*ln,Fe+=U*Un,Ge+=U*Nn,Xe+=U*Dn,U=Y[15],Kt+=U*bt,oe+=U*ir,Jt+=U*mr,le+=U*vr,ae+=U*Qe,ne+=U*dr,Ot+=U*pr,Nt+=U*on,he+=U*Pr,ee+=U*Yr,re+=U*Xr,me+=U*Jr,Fe+=U*ln,Ge+=U*Un,Xe+=U*Nn,Ye+=U*Dn,et+=38*oe,dt+=38*Jt,ut+=38*le,ht+=38*ae,zt+=38*ne,Wt+=38*Ot,ye+=38*Nt,Yt+=38*he,pe+=38*ee,ve+=38*re,ge+=38*me,ie+=38*Fe,ue+=38*Ge,fe+=38*Xe,ce+=38*Ye,W=1,U=et+W+65535,W=Math.floor(U/65536),et=U-W*65536,U=dt+W+65535,W=Math.floor(U/65536),dt=U-W*65536,U=ut+W+65535,W=Math.floor(U/65536),ut=U-W*65536,U=ht+W+65535,W=Math.floor(U/65536),ht=U-W*65536,U=zt+W+65535,W=Math.floor(U/65536),zt=U-W*65536,U=Wt+W+65535,W=Math.floor(U/65536),Wt=U-W*65536,U=ye+W+65535,W=Math.floor(U/65536),ye=U-W*65536,U=Yt+W+65535,W=Math.floor(U/65536),Yt=U-W*65536,U=pe+W+65535,W=Math.floor(U/65536),pe=U-W*65536,U=ve+W+65535,W=Math.floor(U/65536),ve=U-W*65536,U=ge+W+65535,W=Math.floor(U/65536),ge=U-W*65536,U=ie+W+65535,W=Math.floor(U/65536),ie=U-W*65536,U=ue+W+65535,W=Math.floor(U/65536),ue=U-W*65536,U=fe+W+65535,W=Math.floor(U/65536),fe=U-W*65536,U=ce+W+65535,W=Math.floor(U/65536),ce=U-W*65536,U=Kt+W+65535,W=Math.floor(U/65536),Kt=U-W*65536,et+=W-1+37*(W-1),W=1,U=et+W+65535,W=Math.floor(U/65536),et=U-W*65536,U=dt+W+65535,W=Math.floor(U/65536),dt=U-W*65536,U=ut+W+65535,W=Math.floor(U/65536),ut=U-W*65536,U=ht+W+65535,W=Math.floor(U/65536),ht=U-W*65536,U=zt+W+65535,W=Math.floor(U/65536),zt=U-W*65536,U=Wt+W+65535,W=Math.floor(U/65536),Wt=U-W*65536,U=ye+W+65535,W=Math.floor(U/65536),ye=U-W*65536,U=Yt+W+65535,W=Math.floor(U/65536),Yt=U-W*65536,U=pe+W+65535,W=Math.floor(U/65536),pe=U-W*65536,U=ve+W+65535,W=Math.floor(U/65536),ve=U-W*65536,U=ge+W+65535,W=Math.floor(U/65536),ge=U-W*65536,U=ie+W+65535,W=Math.floor(U/65536),ie=U-W*65536,U=ue+W+65535,W=Math.floor(U/65536),ue=U-W*65536,U=fe+W+65535,W=Math.floor(U/65536),fe=U-W*65536,U=ce+W+65535,W=Math.floor(U/65536),ce=U-W*65536,U=Kt+W+65535,W=Math.floor(U/65536),Kt=U-W*65536,et+=W-1+37*(W-1),K[0]=et,K[1]=dt,K[2]=ut,K[3]=ht,K[4]=zt,K[5]=Wt,K[6]=ye,K[7]=Yt,K[8]=pe,K[9]=ve,K[10]=ge,K[11]=ie,K[12]=ue,K[13]=fe,K[14]=ce,K[15]=Kt}function it(K,Y){q(K,Y,Y)}function at(K,Y){var V=e(),U;for(U=0;U<16;U++)V[U]=Y[U];for(U=253;U>=0;U--)it(V,V),U!==2&&U!==4&&q(V,V,Y);for(U=0;U<16;U++)K[U]=V[U]}function Bt(K,Y){var V=e(),U;for(U=0;U<16;U++)V[U]=Y[U];for(U=250;U>=0;U--)it(V,V),U!==1&&q(V,V,Y);for(U=0;U<16;U++)K[U]=V[U]}function yt(K,Y,V){var U=new Uint8Array(32),W=new Float64Array(80),et,dt,ut=e(),ht=e(),zt=e(),Wt=e(),ye=e(),Yt=e();for(dt=0;dt<31;dt++)U[dt]=Y[dt];for(U[31]=Y[31]&127|64,U[0]&=248,D(W,V),dt=0;dt<16;dt++)ht[dt]=W[dt],Wt[dt]=ut[dt]=zt[dt]=0;for(ut[0]=Wt[0]=1,dt=254;dt>=0;--dt)et=U[dt>>>3]>>>(dt&7)&1,I(ut,ht,et),I(zt,Wt,et),Z(ye,ut,zt),F(ut,ut,zt),Z(zt,ht,Wt),F(ht,ht,Wt),it(Wt,ye),it(Yt,ut),q(ut,zt,ut),q(zt,ht,ye),Z(ye,ut,zt),F(ut,ut,zt),it(ht,ut),F(zt,Wt,Yt),q(ut,zt,p),Z(ut,ut,Wt),q(zt,zt,ut),q(ut,Wt,Yt),q(Wt,ht,W),it(ht,ye),I(ut,ht,et),I(zt,Wt,et);for(dt=0;dt<16;dt++)W[dt+16]=ut[dt],W[dt+32]=zt[dt],W[dt+48]=ht[dt],W[dt+64]=Wt[dt];var pe=W.subarray(32),ve=W.subarray(16);return at(pe,pe),q(ve,ve,pe),y(K,ve),0}function pt(K,Y){return yt(K,Y,i)}function Ft(K,Y){return n(Y,32),pt(K,Y)}function lt(K,Y,V){var U=new Uint8Array(32);return yt(U,V,Y),z(K,s,U,H)}var ct=f,Tt=h;function kt(K,Y,V,U,W,et){var dt=new Uint8Array(32);return lt(dt,W,et),ct(K,Y,V,U,dt)}function k(K,Y,V,U,W,et){var dt=new Uint8Array(32);return lt(dt,W,et),Tt(K,Y,V,U,dt)}var T=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function L(K,Y,V,U){for(var W=new Int32Array(16),et=new Int32Array(16),dt,ut,ht,zt,Wt,ye,Yt,pe,ve,ge,ie,ue,fe,ce,Kt,oe,Jt,le,ae,ne,Ot,Nt,he,ee,re,me,Fe=K[0],Ge=K[1],Xe=K[2],Ye=K[3],bt=K[4],ir=K[5],mr=K[6],vr=K[7],Qe=Y[0],dr=Y[1],pr=Y[2],on=Y[3],Pr=Y[4],Yr=Y[5],Xr=Y[6],Jr=Y[7],ln=0;U>=128;){for(ae=0;ae<16;ae++)ne=8*ae+ln,W[ae]=V[ne+0]<<24|V[ne+1]<<16|V[ne+2]<<8|V[ne+3],et[ae]=V[ne+4]<<24|V[ne+5]<<16|V[ne+6]<<8|V[ne+7];for(ae=0;ae<80;ae++)if(dt=Fe,ut=Ge,ht=Xe,zt=Ye,Wt=bt,ye=ir,Yt=mr,pe=vr,ve=Qe,ge=dr,ie=pr,ue=on,fe=Pr,ce=Yr,Kt=Xr,oe=Jr,Ot=vr,Nt=Jr,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=(bt>>>14|Pr<<32-14)^(bt>>>18|Pr<<32-18)^(Pr>>>41-32|bt<<32-(41-32)),Nt=(Pr>>>14|bt<<32-14)^(Pr>>>18|bt<<32-18)^(bt>>>41-32|Pr<<32-(41-32)),he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,Ot=bt&ir^~bt&mr,Nt=Pr&Yr^~Pr&Xr,he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,Ot=T[ae*2],Nt=T[ae*2+1],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,Ot=W[ae%16],Nt=et[ae%16],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,Jt=re&65535|me<<16,le=he&65535|ee<<16,Ot=Jt,Nt=le,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=(Fe>>>28|Qe<<32-28)^(Qe>>>34-32|Fe<<32-(34-32))^(Qe>>>39-32|Fe<<32-(39-32)),Nt=(Qe>>>28|Fe<<32-28)^(Fe>>>34-32|Qe<<32-(34-32))^(Fe>>>39-32|Qe<<32-(39-32)),he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,Ot=Fe&Ge^Fe&Xe^Ge&Xe,Nt=Qe&dr^Qe&pr^dr&pr,he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,pe=re&65535|me<<16,oe=he&65535|ee<<16,Ot=zt,Nt=ue,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=Jt,Nt=le,he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,zt=re&65535|me<<16,ue=he&65535|ee<<16,Ge=dt,Xe=ut,Ye=ht,bt=zt,ir=Wt,mr=ye,vr=Yt,Fe=pe,dr=ve,pr=ge,on=ie,Pr=ue,Yr=fe,Xr=ce,Jr=Kt,Qe=oe,ae%16===15)for(ne=0;ne<16;ne++)Ot=W[ne],Nt=et[ne],he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=W[(ne+9)%16],Nt=et[(ne+9)%16],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,Jt=W[(ne+1)%16],le=et[(ne+1)%16],Ot=(Jt>>>1|le<<32-1)^(Jt>>>8|le<<32-8)^Jt>>>7,Nt=(le>>>1|Jt<<32-1)^(le>>>8|Jt<<32-8)^(le>>>7|Jt<<32-7),he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,Jt=W[(ne+14)%16],le=et[(ne+14)%16],Ot=(Jt>>>19|le<<32-19)^(le>>>61-32|Jt<<32-(61-32))^Jt>>>6,Nt=(le>>>19|Jt<<32-19)^(Jt>>>61-32|le<<32-(61-32))^(le>>>6|Jt<<32-6),he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,W[ne]=re&65535|me<<16,et[ne]=he&65535|ee<<16;Ot=Fe,Nt=Qe,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=K[0],Nt=Y[0],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,K[0]=Fe=re&65535|me<<16,Y[0]=Qe=he&65535|ee<<16,Ot=Ge,Nt=dr,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=K[1],Nt=Y[1],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,K[1]=Ge=re&65535|me<<16,Y[1]=dr=he&65535|ee<<16,Ot=Xe,Nt=pr,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=K[2],Nt=Y[2],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,K[2]=Xe=re&65535|me<<16,Y[2]=pr=he&65535|ee<<16,Ot=Ye,Nt=on,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=K[3],Nt=Y[3],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,K[3]=Ye=re&65535|me<<16,Y[3]=on=he&65535|ee<<16,Ot=bt,Nt=Pr,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=K[4],Nt=Y[4],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,K[4]=bt=re&65535|me<<16,Y[4]=Pr=he&65535|ee<<16,Ot=ir,Nt=Yr,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=K[5],Nt=Y[5],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,K[5]=ir=re&65535|me<<16,Y[5]=Yr=he&65535|ee<<16,Ot=mr,Nt=Xr,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=K[6],Nt=Y[6],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,K[6]=mr=re&65535|me<<16,Y[6]=Xr=he&65535|ee<<16,Ot=vr,Nt=Jr,he=Nt&65535,ee=Nt>>>16,re=Ot&65535,me=Ot>>>16,Ot=K[7],Nt=Y[7],he+=Nt&65535,ee+=Nt>>>16,re+=Ot&65535,me+=Ot>>>16,ee+=he>>>16,re+=ee>>>16,me+=re>>>16,K[7]=vr=re&65535|me<<16,Y[7]=Jr=he&65535|ee<<16,ln+=128,U-=128}return U}function j(K,Y,V){var U=new Int32Array(8),W=new Int32Array(8),et=new Uint8Array(256),dt,ut=V;for(U[0]=1779033703,U[1]=3144134277,U[2]=1013904242,U[3]=2773480762,U[4]=1359893119,U[5]=2600822924,U[6]=528734635,U[7]=1541459225,W[0]=4089235720,W[1]=2227873595,W[2]=4271175723,W[3]=1595750129,W[4]=2917565137,W[5]=725511199,W[6]=4215389547,W[7]=327033209,L(U,W,Y,V),V%=128,dt=0;dt=0;--W)U=V[W/8|0]>>(W&7)&1,Q(K,Y,U),rt(Y,K),rt(K,K),Q(K,Y,U)}function It(K,Y){var V=[e(),e(),e(),e()];g(V[0],_),g(V[1],E),g(V[2],l),q(V[3],_,E),qt(K,V,Y)}function xt(K,Y,V){var U=new Uint8Array(64),W=[e(),e(),e(),e()],et;for(V||n(Y,32),j(U,Y,32),U[0]&=248,U[31]&=127,U[31]|=64,It(W,U),ot(K,W),et=0;et<32;et++)Y[et+32]=K[et];return 0}var Qt=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Ct(K,Y){var V,U,W,et;for(U=63;U>=32;--U){for(V=0,W=U-32,et=U-12;W>4)*Qt[W],V=Y[W]>>8,Y[W]&=255;for(W=0;W<32;W++)Y[W]-=V*Qt[W];for(U=0;U<32;U++)Y[U+1]+=Y[U]>>8,K[U]=Y[U]&255}function Dt(K){var Y=new Float64Array(64),V;for(V=0;V<64;V++)Y[V]=K[V];for(V=0;V<64;V++)K[V]=0;Ct(K,Y)}function Se(K,Y,V,U){var W=new Uint8Array(64),et=new Uint8Array(64),dt=new Uint8Array(64),ut,ht,zt=new Float64Array(64),Wt=[e(),e(),e(),e()];j(W,U,32),W[0]&=248,W[31]&=127,W[31]|=64;var ye=V+64;for(ut=0;ut>7&&F(K[0],c,K[0]),q(K[3],K[0],K[1]),0)}function Ut(K,Y,V,U){var W,et=new Uint8Array(32),dt=new Uint8Array(64),ut=[e(),e(),e(),e()],ht=[e(),e(),e(),e()];if(V<64||te(ht,U))return-1;for(W=0;W=0},t.sign.keyPair=function(){var K=new Uint8Array(Rt),Y=new Uint8Array(wt);return xt(K,Y),{publicKey:K,secretKey:Y}},t.sign.keyPair.fromSecretKey=function(K){if(Pt(K),K.length!==wt)throw new Error("bad secret key size");for(var Y=new Uint8Array(Rt),V=0;V=0;)B++;if(x.substr(0,2)==="::"&&B--,x.substr(-2,2)==="::"&&B--,B>A)return null;for(O=A-B,C=":";O--;)C+="0:";return x=x.replace("::",C),x[0]===":"&&(x=x.slice(1)),x[x.length-1]===":"&&(x=x.slice(0,-1)),A=function(){const z=x.split(":"),H=[];for(let tt=0;tt0;){if(C=B-P,C<0&&(C=0),x[R]>>C!==A[R]>>C)return!1;P-=B,R+=1}return!0}function _(x){if(i.test(x))return parseInt(x,16);if(x[0]==="0"&&!isNaN(parseInt(x[1],10))){if(s.test(x))return parseInt(x,8);throw new Error(`ipaddr: cannot parse ${x} as octal`)}return parseInt(x,10)}function E(x,A){for(;x.length=0;R-=1)if(C=this.octets[R],C in P){if(O=P[C],B&&O!==0)return null;O!==8&&(B=!0),A+=O}else return null;return 32-A},x.prototype.range=function(){return w.subnetMatch(this,this.SpecialRanges)},x.prototype.toByteArray=function(){return this.octets.slice(0)},x.prototype.toIPv4MappedAddress=function(){return w.IPv6.parse(`::ffff:${this.toString()}`)},x.prototype.toNormalizedString=function(){return this.toString()},x.prototype.toString=function(){return this.octets.join(".")},x}(),w.IPv4.broadcastAddressFromCIDR=function(x){try{const A=this.parseCIDR(x),B=A[0].toByteArray(),P=this.subnetMaskFromPrefixLength(A[1]).toByteArray(),R=[];let C=0;for(;C<4;)R.push(parseInt(B[C],10)|parseInt(P[C],10)^255),C++;return new this(R)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},w.IPv4.isIPv4=function(x){return this.parser(x)!==null},w.IPv4.isValid=function(x){try{return new this(this.parser(x)),!0}catch{return!1}},w.IPv4.isValidFourPartDecimal=function(x){return!!(w.IPv4.isValid(x)&&x.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},w.IPv4.networkAddressFromCIDR=function(x){let A,B,P,R,C;try{for(A=this.parseCIDR(x),P=A[0].toByteArray(),C=this.subnetMaskFromPrefixLength(A[1]).toByteArray(),R=[],B=0;B<4;)R.push(parseInt(P[B],10)&parseInt(C[B],10)),B++;return new this(R)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},w.IPv4.parse=function(x){const A=this.parser(x);if(A===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(A)},w.IPv4.parseCIDR=function(x){let A;if(A=x.match(/^(.+)\/(\d+)$/)){const B=parseInt(A[2]);if(B>=0&&B<=32){const P=[this.parse(A[1]),B];return Object.defineProperty(P,"toString",{value:function(){return this.join("/")}}),P}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},w.IPv4.parser=function(x){let A,B,P;if(A=x.match(n.fourOctet))return function(){const R=A.slice(1,6),C=[];for(let O=0;O4294967295||P<0)throw new Error("ipaddr: address outside defined range");return function(){const R=[];let C;for(C=0;C<=24;C+=8)R.push(P>>C&255);return R}().reverse()}else return(A=x.match(n.twoOctet))?function(){const R=A.slice(1,4),C=[];if(P=_(R[1]),P>16777215||P<0)throw new Error("ipaddr: address outside defined range");return C.push(_(R[0])),C.push(P>>16&255),C.push(P>>8&255),C.push(P&255),C}():(A=x.match(n.threeOctet))?function(){const R=A.slice(1,5),C=[];if(P=_(R[2]),P>65535||P<0)throw new Error("ipaddr: address outside defined range");return C.push(_(R[0])),C.push(_(R[1])),C.push(P>>8&255),C.push(P&255),C}():null},w.IPv4.subnetMaskFromPrefixLength=function(x){if(x=parseInt(x),x<0||x>32)throw new Error("ipaddr: invalid IPv4 prefix length");const A=[0,0,0,0];let B=0;const P=Math.floor(x/8);for(;B=0;O-=1)if(R=this.parts[O],R in P){if(C=P[R],B&&C!==0)return null;C!==16&&(B=!0),A+=C}else return null;return 128-A},x.prototype.range=function(){return w.subnetMatch(this,this.SpecialRanges)},x.prototype.toByteArray=function(){let A;const B=[],P=this.parts;for(let R=0;R>8),B.push(A&255);return B},x.prototype.toFixedLengthString=function(){const A=(function(){const P=[];for(let R=0;R>8,B&255,P>>8,P&255])},x.prototype.toNormalizedString=function(){const A=(function(){const P=[];for(let R=0;RR&&(P=C.index,R=C[0].length);return R<0?B:`${B.substring(0,P)}::${B.substring(P+R)}`},x.prototype.toString=function(){return this.toRFC5952String()},x}(),w.IPv6.broadcastAddressFromCIDR=function(x){try{const A=this.parseCIDR(x),B=A[0].toByteArray(),P=this.subnetMaskFromPrefixLength(A[1]).toByteArray(),R=[];let C=0;for(;C<16;)R.push(parseInt(B[C],10)|parseInt(P[C],10)^255),C++;return new this(R)}catch(A){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${A})`)}},w.IPv6.isIPv6=function(x){return this.parser(x)!==null},w.IPv6.isValid=function(x){if(typeof x=="string"&&x.indexOf(":")===-1)return!1;try{const A=this.parser(x);return new this(A.parts,A.zoneId),!0}catch{return!1}},w.IPv6.networkAddressFromCIDR=function(x){let A,B,P,R,C;try{for(A=this.parseCIDR(x),P=A[0].toByteArray(),C=this.subnetMaskFromPrefixLength(A[1]).toByteArray(),R=[],B=0;B<16;)R.push(parseInt(P[B],10)&parseInt(C[B],10)),B++;return new this(R)}catch(O){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${O})`)}},w.IPv6.parse=function(x){const A=this.parser(x);if(A.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(A.parts,A.zoneId)},w.IPv6.parseCIDR=function(x){let A,B,P;if((B=x.match(/^(.+)\/(\d+)$/))&&(A=parseInt(B[2]),A>=0&&A<=128))return P=[this.parse(B[1]),A],Object.defineProperty(P,"toString",{value:function(){return this.join("/")}}),P;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},w.IPv6.parser=function(x){let A,B,P,R,C,O;if(P=x.match(p.deprecatedTransitional))return this.parser(`::ffff:${P[1]}`);if(p.native.test(x))return m(x,8);if((P=x.match(p.transitional))&&(O=P[6]||"",A=m(P[1].slice(0,-1)+O,6),A.parts)){for(C=[parseInt(P[2]),parseInt(P[3]),parseInt(P[4]),parseInt(P[5])],B=0;B128)throw new Error("ipaddr: invalid IPv6 prefix length");const A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let B=0;const P=Math.floor(x/8);for(;B{const t=nz+r,e=kT(yr.Buffer.from(t,"utf8")).slice(2);return yr.Buffer.from(e,"hex")},oz=(r,t,e)=>{const n=[r];t?n.push(t.toBuffer()):n.push(yr.Buffer.alloc(32)),e?n.push(e.toBuffer()):n.push(yr.Buffer.alloc(32));const[s]=Ne.findProgramAddressSync(n,rz);return s},vu=(r,t=$M)=>{let e=iz(r);return{pubkey:oz(e,void 0,t),hashed:e}},T2=(r,t=!1)=>{r.endsWith(".sol")&&(r=r.slice(0,-4));const e=r.split(".");if(e.length===2){const n=yr.Buffer.from([t?1:0]).toString().concat(e[0]),{pubkey:s}=vu(e[1]);return{...vu(n,s),isSub:!0,parent:s}}if(e.length===3&&t){const{pubkey:n}=vu(e[2]),{pubkey:s}=vu("\0".concat(e[1]),n),i=yr.Buffer.from([1]).toString();return{...vu(i.concat(e[0]),s),isSub:!0,parent:n,isSubRecord:!0}}if(e.length>=3)throw new ez(C2.InvalidInput);return{...vu(r,$M),isSub:!1,parent:void 0}};var as;(function(r){r.IPFS="IPFS",r.ARWV="ARWV",r.SOL="SOL",r.ETH="ETH",r.BTC="BTC",r.LTC="LTC",r.DOGE="DOGE",r.Email="email",r.Url="url",r.Discord="discord",r.Github="github",r.Reddit="reddit",r.Twitter="twitter",r.Telegram="telegram",r.Pic="pic",r.SHDW="SHDW",r.POINT="POINT",r.BSC="BSC",r.Injective="INJ",r.Backpack="backpack",r.A="A",r.AAAA="AAAA",r.CNAME="CNAME",r.TXT="TXT",r.Background="background"})(as||(as={}));as.SOL,as.ETH,as.BSC,as.Injective,as.A,as.AAAA,as.Background;new Ne("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29");var Q3;(function(r){r.DegenPoet1="DegenPoet#1",r.Rgb0x001="rgb0x00#1"})(Q3||(Q3={}));new Ne("ART5dr4bDic2sQVZoFheEmUxwQq5VGSx9he7JxHcXNQD");new Ne("CSWvuDHXExVGEMR9kP8xYAHuNjXogeRck9Cnr312CC9g");const sz=["-","_"],az=()=>{const r=Math.floor(2*Math.random());return sz[r]},HM=(r,t=4)=>{const e=[];for(let n=0;n{const e=t.map(s=>T2(s).pubkey),n=await(r==null?void 0:r.getMultipleAccountsInfo(e));return n?t.map((s,i)=>{var c;return{domain:s,available:!((c=n[i])!=null&&c.data)}}):[]},uz=({connection:r,domain:t})=>yg(async()=>{if(!t||!r)return[];const e=t.split(".");if(e.length===2){const n=e[1],s=T2(t).pubkey,i=await(r==null?void 0:r.getAccountInfo(s)),c=HM(n,10),l=await L2(r,c);if(i!=null&&i.data)return[{domain:t,available:!i.data},...l];{const p=T2(n).pubkey,m=await(r==null?void 0:r.getAccountInfo(p));return[{domain:n,available:!(m!=null&&m.data)},...l]}}return L2(r,[t])},[!!r,t]),fz=({connection:r,domain:t})=>yg(async()=>{if(!t||t==="")return[];if(t.split(".").length===2)return[];const e=await(await fetch(`https://sns-api.bonfida.com/v2/suggestion/search/${t}`)).json();if(!e||e.length<5){if(!r)return[];const n=HM(t,10);return L2(r,n)}return e.map(n=>({domain:n,available:!0}))},[t,!!r]),cz=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M16.56 3.06a3.092 3.092 0 0 0-.56.206c-.266.13-.398.244-1.17 1.008l-.87.86.184.343c1.138 2.12 2.165 3.161 4.24 4.3l.476.261.823-.822c.478-.477.879-.913.955-1.039.337-.556.438-1.178.288-1.772-.149-.588-.273-.758-1.342-1.838-1.043-1.054-1.36-1.307-1.816-1.448a2.668 2.668 0 0 0-1.208-.059M9.873 9.233c-3.16 3.169-3.114 3.117-3.29 3.667-.068.213-.583 3.732-.583 3.986C6 17.435 6.565 18 7.114 18c.254 0 3.773-.515 3.986-.583.55-.176.498-.13 3.667-3.29l2.986-2.979-.478-.274c-1.888-1.082-3.003-2.19-4.104-4.081l-.319-.547-2.979 2.987M3.394 19.601c-.284.15-.426.445-.376.779.035.236.278.518.497.579.201.056 16.769.056 16.97 0 .219-.061.462-.343.497-.579.051-.339-.094-.633-.384-.781-.153-.078-.272-.079-8.606-.077-8.276.001-8.455.003-8.598.079"})),VM=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",d:"M19.748 9.058a.75.75 0 0 0-1.496-.116l1.496.116Zm-1.464 9.249.748.057-.748-.057Zm-12.568 0-.748.057.748-.057Zm.032-9.365a.75.75 0 1 0-1.496.116l1.496-.116ZM20.67 7.674a.75.75 0 0 0 .658-1.348l-.658 1.348Zm-18-1.348a.75.75 0 1 0 .658 1.348L2.67 6.326ZM9.25 5a.75.75 0 0 0 1.5 0h-1.5Zm4 0a.75.75 0 0 0 1.5 0h-1.5Zm-2.5 6a.75.75 0 0 0-1.5 0h1.5Zm-1.5 6a.75.75 0 0 0 1.5 0h-1.5Zm5.5-6a.75.75 0 0 0-1.5 0h1.5Zm-1.5 6a.75.75 0 0 0 1.5 0h-1.5Zm5.002-8.058-.716 9.307 1.496.115.716-9.306-1.496-.116ZM14.296 21.25H9.704v1.5h4.592v-1.5Zm-7.832-3-.716-9.308-1.496.116.716 9.306 1.496-.115Zm3.24 3a3.25 3.25 0 0 1-3.24-3l-1.496.114a4.75 4.75 0 0 0 4.736 4.386v-1.5Zm7.832-3a3.25 3.25 0 0 1-3.24 3v1.5a4.75 4.75 0 0 0 4.736-4.386l-1.496-.115ZM12 5.75c3.204 0 6.18.71 8.671 1.924l.658-1.348C18.624 5.008 15.423 4.25 12 4.25v1.5ZM3.329 7.674C5.82 6.46 8.796 5.75 12 5.75v-1.5c-3.423 0-6.624.758-9.329 2.076l.658 1.348ZM10.75 5V4h-1.5v1h1.5Zm2.5-1v1h1.5V4h-1.5ZM12 2.75c.69 0 1.25.56 1.25 1.25h1.5A2.75 2.75 0 0 0 12 1.25v1.5ZM10.75 4c0-.69.56-1.25 1.25-1.25v-1.5A2.75 2.75 0 0 0 9.25 4h1.5Zm-1.5 7v6h1.5v-6h-1.5Zm4 0v6h1.5v-6h-1.5Z"})),ZM=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{stroke:"currentColor",strokeLinejoin:"round",strokeWidth:1.5,d:"M22 7a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v10a4 4 0 0 0 4 4h12a4 4 0 0 0 4-4V7Z"}),xe.createElement("path",{stroke:"currentColor",strokeLinejoin:"round",strokeWidth:1.5,d:"M8 12a3 3 0 0 0-3-3H2v6h3a3 3 0 0 0 3-3Z"})),hz=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",d:"M2.587 9.25a.75.75 0 1 0 0 1.5v-1.5Zm18.826 1.5a.75.75 0 0 0 0-1.5v1.5ZM18.035 6v.75V6Zm3.882 4.808.735.15-.735-.15Zm-19.834 0 .735-.15-.735.15ZM5.965 6v-.75V6ZM7.6 22v-.75.75Zm-3.882-3.192.735-.15-.735.15ZM16.4 22v.75V22Zm3.882-3.192-.735-.15.735.15ZM8 13.25a.75.75 0 0 0 0 1.5v-1.5Zm8 1.5a.75.75 0 0 0 0-1.5v1.5Zm-7 2.5a.75.75 0 0 0 0 1.5v-1.5Zm6 1.5a.75.75 0 0 0 0-1.5v1.5ZM9.6 2.45a.75.75 0 1 0-1.2-.9l1.2.9Zm-4.2 3.1a.75.75 0 1 0 1.2.9l-1.2-.9Zm10.2-4a.75.75 0 1 0-1.2.9l1.2-.9Zm1.8 4.9a.75.75 0 1 0 1.2-.9l-1.2.9Zm-1 14.8H7.6v1.5h8.8v-1.5ZM4.453 18.658l-1.635-8-1.47.3 1.635 8 1.47-.3ZM5.965 6.75h12.07v-1.5H5.965v1.5Zm15.217 3.908-1.635 8 1.47.3 1.635-8-1.47-.3Zm-18.595.092h18.826v-1.5H2.587v1.5Zm15.448-4c2.028 0 3.56 1.883 3.147 3.908l1.47.3c.6-2.938-1.623-5.708-4.617-5.708v1.5ZM2.818 10.658C2.404 8.633 3.938 6.75 5.965 6.75v-1.5c-2.994 0-5.217 2.77-4.617 5.708l1.47-.3ZM7.6 21.25a3.222 3.222 0 0 1-3.147-2.592l-1.47.3c.45 2.203 2.375 3.792 4.617 3.792v-1.5Zm8.8 1.5c2.242 0 4.167-1.589 4.617-3.792l-1.47-.3A3.223 3.223 0 0 1 16.4 21.25v1.5Zm-8.4-8h8v-1.5H8v1.5Zm1 4h6v-1.5H9v1.5Zm-.6-17.2-3 4 1.2.9 3-4-1.2-.9Zm6 .9 3 4 1.2-.9-3-4-1.2.9Z"})),lz=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",d:"M5.469 12.414a.75.75 0 0 0-.938 1.172l.938-1.172Zm3.057 3.407-.468.586.468-.586Zm2.736-.224-.557-.501.557.501Zm8.296-8.095a.75.75 0 1 0-1.116-1.004l1.116 1.004ZM4.53 13.586l3.527 2.82.937-1.17-3.526-2.822-.938 1.172Zm7.289 2.513 7.738-8.597-1.116-1.004-7.737 8.598 1.115 1.003Zm-3.762.308a2.75 2.75 0 0 0 3.762-.308l-1.115-1.003a1.25 1.25 0 0 1-1.71.14l-.937 1.17Z"})),WM=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",fillRule:"evenodd",d:"M11.12 2.039c-2.479.248-4.706 1.323-6.359 3.068a9.985 9.985 0 0 0-1.624 11.516 9.432 9.432 0 0 0 1.801 2.438c.992.99 2.1 1.728 3.334 2.217 3.362 1.332 7.041.802 9.928-1.433.437-.338 1.307-1.208 1.645-1.645C21.256 16.378 22 14.236 22 12c0-4.568-3.158-8.613-7.57-9.697-.984-.241-2.402-.355-3.31-.264m1.285 5.342c.08.051.188.162.24.246.091.146.095.184.095.88v.726l-.121.172c-.166.236-.346.334-.619.334s-.453-.098-.619-.334l-.121-.172v-.726c0-.691.005-.734.093-.876.233-.375.691-.484 1.052-.25m-.113 3.433c.155.065.375.305.417.457.017.06.031 1.201.031 2.536v2.426l-.121.172c-.166.237-.346.334-.619.334s-.453-.097-.619-.334l-.121-.172v-2.426c0-1.335.014-2.476.031-2.536.041-.147.259-.39.408-.455a.881.881 0 0 1 .593-.002"})),GM=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",d:"M16.773 8.288a.75.75 0 0 0-1.06-1.061l1.06 1.06Zm-9.546 7.424a.75.75 0 0 0 1.06 1.061l-1.06-1.06Zm8.485 1.06a.75.75 0 1 0 1.06-1.06l-1.06 1.06ZM8.288 7.228a.75.75 0 0 0-1.061 1.06l1.06-1.06Zm7.424 0-8.485 8.485 1.06 1.061 8.486-8.485-1.06-1.061Zm1.06 8.485L8.289 7.227l-1.061 1.06 8.485 8.486 1.06-1.06Z"})),dz=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",d:"m18.63 21.422.53-.53-.53.53Zm2.792-2.793.53-.53-.53.53Zm-1.392-2.452a.75.75 0 0 0-1.06 1.06l1.06-1.06Zm-2.792 2.793a.75.75 0 0 0-1.06 1.06l1.06-1.06ZM2.75 10.5a7.75 7.75 0 0 1 7.75-7.75v-1.5a9.25 9.25 0 0 0-9.25 9.25h1.5Zm7.75-7.75a7.75 7.75 0 0 1 7.75 7.75h1.5a9.25 9.25 0 0 0-9.25-9.25v1.5Zm7.75 7.75a7.75 7.75 0 0 1-7.75 7.75v1.5a9.25 9.25 0 0 0 9.25-9.25h-1.5Zm-7.75 7.75a7.75 7.75 0 0 1-7.75-7.75h-1.5a9.25 9.25 0 0 0 9.25 9.25v-1.5Zm10.391 2.641a1.224 1.224 0 0 1-1.731 0l-1.061 1.061a2.725 2.725 0 0 0 3.853 0l-1.06-1.06Zm0-1.731a1.224 1.224 0 0 1 0 1.731l1.061 1.061a2.725 2.725 0 0 0 0-3.853l-1.06 1.06Zm-1.921-1.922 1.921 1.922 1.061-1.061-1.922-1.922-1.06 1.06Zm.19 3.653-1.922-1.921-1.06 1.06 1.92 1.922 1.062-1.06Z"})),pz=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{fill:"currentColor",d:"M16.625 3.987a.75.75 0 1 0 .75-1.298l-.75 1.298Zm5.448 4.25a.75.75 0 1 0-1.405.526l1.405-.526ZM7.469 9.414a.75.75 0 1 0-.938 1.172l.938-1.172Zm3.057 3.407-.468.586.468-.586Zm2.736-.224-.557-.501.557.501Zm8.296-8.095a.75.75 0 1 0-1.116-1.004l1.116 1.004ZM21.25 12A9.25 9.25 0 0 1 12 21.25v1.5c5.937 0 10.75-4.813 10.75-10.75h-1.5ZM12 21.25A9.25 9.25 0 0 1 2.75 12h-1.5c0 5.937 4.813 10.75 10.75 10.75v-1.5ZM2.75 12A9.25 9.25 0 0 1 12 2.75v-1.5C6.063 1.25 1.25 6.063 1.25 12h1.5ZM12 2.75c1.686 0 3.265.45 4.625 1.237l.75-1.298A10.704 10.704 0 0 0 12 1.25v1.5Zm8.668 6.013A9.228 9.228 0 0 1 21.25 12h1.5c0-1.322-.24-2.59-.677-3.763l-1.405.526ZM6.53 10.586l3.527 2.82.937-1.17-3.526-2.822-.938 1.172Zm7.289 2.513 7.738-8.597-1.116-1.004-7.737 8.598 1.115 1.003Zm-3.762.308a2.75 2.75 0 0 0 3.762-.308l-1.115-1.003a1.25 1.25 0 0 1-1.71.14l-.937 1.17Z"})),mz=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:1.5,d:"m10 8-4 4m0 0 4 4m-4-4h12"})),vz=r=>xe.createElement("svg",{fill:"none",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",...r},xe.createElement("circle",{cx:12,cy:7,r:1,fill:"currentColor"}),xe.createElement("path",{fill:"currentColor",d:"M11 9.25a.75.75 0 0 0 0 1.5v-1.5Zm1 .75h.75a.75.75 0 0 0-.75-.75V10Zm-.75 7a.75.75 0 0 0 1.5 0h-1.5Zm10-5A9.25 9.25 0 0 1 12 21.25v1.5c5.937 0 10.75-4.813 10.75-10.75h-1.5ZM12 21.25A9.25 9.25 0 0 1 2.75 12h-1.5c0 5.937 4.813 10.75 10.75 10.75v-1.5ZM2.75 12A9.25 9.25 0 0 1 12 2.75v-1.5C6.063 1.25 1.25 6.063 1.25 12h1.5ZM12 2.75A9.25 9.25 0 0 1 21.25 12h1.5c0-5.937-4.813-10.75-10.75-10.75v1.5Zm-1 8h1v-1.5h-1v1.5Zm.25-.75v7h1.5v-7h-1.5Z"})),gz=r=>St.jsx("svg",{width:r.width||20,height:r.height||20,viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",...r,children:St.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M5.29279 7.29302C5.48031 7.10555 5.73462 7.00023 5.99979 7.00023C6.26495 7.00023 6.51926 7.10555 6.70679 7.29302L9.99979 10.586L13.2928 7.29302C13.385 7.19751 13.4954 7.12133 13.6174 7.06892C13.7394 7.01651 13.8706 6.98892 14.0034 6.98777C14.1362 6.98662 14.2678 7.01192 14.3907 7.0622C14.5136 7.11248 14.6253 7.18673 14.7192 7.28062C14.8131 7.37452 14.8873 7.48617 14.9376 7.60907C14.9879 7.73196 15.0132 7.86364 15.012 7.99642C15.0109 8.1292 14.9833 8.26042 14.9309 8.38242C14.8785 8.50443 14.8023 8.61477 14.7068 8.70702L10.7068 12.707C10.5193 12.8945 10.265 12.9998 9.99979 12.9998C9.73462 12.9998 9.48031 12.8945 9.29279 12.707L5.29279 8.70702C5.10532 8.51949 5 8.26518 5 8.00002C5 7.73486 5.10532 7.48055 5.29279 7.29302Z",fill:"currentColor"})}),yz=r=>St.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",fill:"none",viewBox:"0 0 18 18",...r,children:St.jsx("path",{stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",d:"M7.5 4.5h-3A1.5 1.5 0 0 0 3 6v7.5A1.5 1.5 0 0 0 4.5 15H12a1.5 1.5 0 0 0 1.5-1.5v-3m-3-7.5H15m0 0v4.5M15 3l-7.5 7.5"})}),bz=r=>St.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",...r,children:St.jsx("path",{fill:"currentColor",d:"M19.27 5.33C17.94 4.71 16.5 4.26 15 4a.09.09 0 0 0-.07.03c-.18.33-.39.76-.53 1.09a16.09 16.09 0 0 0-4.8 0c-.14-.34-.35-.76-.54-1.09-.01-.02-.04-.03-.07-.03-1.5.26-2.93.71-4.27 1.33-.01 0-.02.01-.03.02-2.72 4.07-3.47 8.03-3.1 11.95 0 .02.01.04.03.05 1.8 1.32 3.53 2.12 5.24 2.65.03.01.06 0 .07-.02.4-.55.76-1.13 1.07-1.74.02-.04 0-.08-.04-.09-.57-.22-1.11-.48-1.64-.78-.04-.02-.04-.08-.01-.11.11-.08.22-.17.33-.25.02-.02.05-.02.07-.01 3.44 1.57 7.15 1.57 10.55 0 .02-.01.05-.01.07.01.11.09.22.17.33.26.04.03.04.09-.01.11-.52.31-1.07.56-1.64.78-.04.01-.05.06-.04.09.32.61.68 1.19 1.07 1.74.03.01.06.02.09.01 1.72-.53 3.45-1.33 5.25-2.65.02-.01.03-.03.03-.05.44-4.53-.73-8.46-3.1-11.95-.01-.01-.02-.02-.04-.02ZM8.52 14.91c-1.03 0-1.89-.95-1.89-2.12 0-1.17.84-2.12 1.89-2.12 1.06 0 1.9.96 1.89 2.12 0 1.17-.84 2.12-1.89 2.12Zm6.97 0c-1.03 0-1.89-.95-1.89-2.12 0-1.17.84-2.12 1.89-2.12 1.06 0 1.9.96 1.89 2.12 0 1.17-.83 2.12-1.89 2.12Z"})}),wz=({type:r="text",value:t,className:e,errorMessage:n,...s}={})=>{const i=xe.useRef(null);return St.jsxs("div",{className:sn("flex-grow",r==="search"&&"relative"),children:[St.jsx("input",{...s,ref:i,value:t,className:sn("w-full h-full px-3 py-4 text-sm border border-opacity-25 rounded-xl border-field-border dark:border-interactive-border bg-background-secondary text-ellipsis",e,r==="search"&&"pr-8"),type:r==="search"?"text":r}),r==="search"&&t&&St.jsx("button",{type:"button",className:"absolute p-1 top-3 right-1","aria-label":"Clear",tabIndex:0,onClick:()=>{i.current&&(i.current.value="")},children:St.jsx(GM,{width:24,height:24})}),n&&St.jsx("p",{className:"absolute top-[calc(100%+4px)] text-error font-medium tracking-widest pl-3 text-xs animate-[fade-in_300ms_ease-out]",children:n})]})};var $e=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Zt.global<"u"?Zt.global:typeof self<"u"?self:{};function Yi(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Oh(r){if(r.__esModule)return r;var t=r.default;if(typeof t=="function"){var e=function n(){return this instanceof n?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(n){var s=Object.getOwnPropertyDescriptor(r,n);Object.defineProperty(e,n,s.get?s:{enumerable:!0,get:function(){return r[n]}})}),e}for(var Ae={},O2={byteLength:function(r){var t=e5(r),e=t[0],n=t[1];return 3*(e+n)/4-n}},YM=O2.toByteArray=function(r){var t,e,n=e5(r),s=n[0],i=n[1],c=new xz(function(m,v,_){return 3*(v+_)/4-_}(0,s,i)),l=0,p=i>0?s-4:s;for(e=0;e>16&255,c[l++]=t>>8&255,c[l++]=255&t;return i===2&&(t=Li[r.charCodeAt(e)]<<2|Li[r.charCodeAt(e+1)]>>4,c[l++]=255&t),i===1&&(t=Li[r.charCodeAt(e)]<<10|Li[r.charCodeAt(e+1)]<<4|Li[r.charCodeAt(e+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t),c},U2=O2.fromByteArray=function(r){for(var t,e=r.length,n=e%3,s=[],i=16383,c=0,l=e-n;cl?l:c+i));return n===1?(t=r[e-1],s.push(To[t>>2]+To[t<<4&63]+"==")):n===2&&(t=(r[e-2]<<8)+r[e-1],s.push(To[t>>10]+To[t>>4&63]+To[t<<2&63]+"=")),s.join("")},To=[],Li=[],xz=typeof Uint8Array<"u"?Uint8Array:Array,t5="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",gu=0;gu<64;++gu)To[gu]=t5[gu],Li[t5.charCodeAt(gu)]=gu;function e5(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");return e===-1&&(e=t),[e,e===t?0:4-e%4]}function _z(r,t,e){for(var n,s,i=[],c=t;c>18&63]+To[s>>12&63]+To[s>>6&63]+To[63&s]);return i.join("")}Li["-".charCodeAt(0)]=62,Li["_".charCodeAt(0)]=63;var Tp={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */function vl(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function ey(r,...t){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(r.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${r.length}`)}function uf(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function XM(r,t){ey(r);const e=t.outputLen;if(r.length>1,v=-7,_=e?s-1:0,E=e?-1:1,w=r[t+_];for(_+=E,i=w&(1<<-v)-1,w>>=-v,v+=l;v>0;i=256*i+r[t+_],_+=E,v-=8);for(c=i&(1<<-v)-1,i>>=-v,v+=n;v>0;c=256*c+r[t+_],_+=E,v-=8);if(i===0)i=1-m;else{if(i===p)return c?NaN:1/0*(w?-1:1);c+=Math.pow(2,n),i-=m}return(w?-1:1)*c*Math.pow(2,i-n)},Tp.write=function(r,t,e,n,s,i){var c,l,p,m=8*i-s-1,v=(1<>1,E=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:i-1,x=n?1:-1,A=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,c=v):(c=Math.floor(Math.log(t)/Math.LN2),t*(p=Math.pow(2,-c))<1&&(c--,p*=2),(t+=c+_>=1?E/p:E*Math.pow(2,1-_))*p>=2&&(c++,p/=2),c+_>=v?(l=0,c=v):c+_>=1?(l=(t*p-1)*Math.pow(2,s),c+=_):(l=t*Math.pow(2,_-1)*Math.pow(2,s),c=0));s>=8;r[e+w]=255&l,w+=x,l/=256,s-=8);for(c=c<0;r[e+w]=255&c,w+=x,c/=256,m-=8);r[e+w-x]|=128*A},function(r){const t=O2,e=Tp,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=c,r.SlowBuffer=function(k){return+k!=k&&(k=0),c.alloc(+k)},r.INSPECT_MAX_BYTES=50;const s=2147483647;function i(k){if(k>s)throw new RangeError('The value "'+k+'" is invalid for option "size"');const T=new Uint8Array(k);return Object.setPrototypeOf(T,c.prototype),T}function c(k,T,L){if(typeof k=="number"){if(typeof T=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(k)}return l(k,T,L)}function l(k,T,L){if(typeof k=="string")return function(Q,ot){if(typeof ot=="string"&&ot!==""||(ot="utf8"),!c.isEncoding(ot))throw new TypeError("Unknown encoding: "+ot);const qt=0|w(Q,ot);let It=i(qt);const xt=It.write(Q,ot);return xt!==qt&&(It=It.slice(0,xt)),It}(k,T);if(ArrayBuffer.isView(k))return function(Q){if(Ft(Q,Uint8Array)){const ot=new Uint8Array(Q);return _(ot.buffer,ot.byteOffset,ot.byteLength)}return v(Q)}(k);if(k==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k);if(Ft(k,ArrayBuffer)||k&&Ft(k.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ft(k,SharedArrayBuffer)||k&&Ft(k.buffer,SharedArrayBuffer)))return _(k,T,L);if(typeof k=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const j=k.valueOf&&k.valueOf();if(j!=null&&j!==k)return c.from(j,T,L);const rt=function(Q){if(c.isBuffer(Q)){const ot=0|E(Q.length),qt=i(ot);return qt.length===0||Q.copy(qt,0,0,ot),qt}if(Q.length!==void 0)return typeof Q.length!="number"||lt(Q.length)?i(0):v(Q);if(Q.type==="Buffer"&&Array.isArray(Q.data))return v(Q.data)}(k);if(rt)return rt;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]=="function")return c.from(k[Symbol.toPrimitive]("string"),T,L);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}function p(k){if(typeof k!="number")throw new TypeError('"size" argument must be of type number');if(k<0)throw new RangeError('The value "'+k+'" is invalid for option "size"')}function m(k){return p(k),i(k<0?0:0|E(k))}function v(k){const T=k.length<0?0:0|E(k.length),L=i(T);for(let j=0;j=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|k}function w(k,T){if(c.isBuffer(k))return k.length;if(ArrayBuffer.isView(k)||Ft(k,ArrayBuffer))return k.byteLength;if(typeof k!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);const L=k.length,j=arguments.length>2&&arguments[2]===!0;if(!j&&L===0)return 0;let rt=!1;for(;;)switch(T){case"ascii":case"latin1":case"binary":return L;case"utf8":case"utf-8":return Bt(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*L;case"hex":return L>>>1;case"base64":return yt(k).length;default:if(rt)return j?-1:Bt(k).length;T=(""+T).toLowerCase(),rt=!0}}function x(k,T,L){let j=!1;if((T===void 0||T<0)&&(T=0),T>this.length||((L===void 0||L>this.length)&&(L=this.length),L<=0)||(L>>>=0)<=(T>>>=0))return"";for(k||(k="utf8");;)switch(k){case"hex":return o(this,T,L);case"utf8":case"utf-8":return nt(this,T,L);case"ascii":return M(this,T,L);case"latin1":case"binary":return d(this,T,L);case"base64":return tt(this,T,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a(this,T,L);default:if(j)throw new TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),j=!0}}function A(k,T,L){const j=k[T];k[T]=k[L],k[L]=j}function B(k,T,L,j,rt){if(k.length===0)return-1;if(typeof L=="string"?(j=L,L=0):L>2147483647?L=2147483647:L<-2147483648&&(L=-2147483648),lt(L=+L)&&(L=rt?0:k.length-1),L<0&&(L=k.length+L),L>=k.length){if(rt)return-1;L=k.length-1}else if(L<0){if(!rt)return-1;L=0}if(typeof T=="string"&&(T=c.from(T,j)),c.isBuffer(T))return T.length===0?-1:P(k,T,L,j,rt);if(typeof T=="number")return T&=255,typeof Uint8Array.prototype.indexOf=="function"?rt?Uint8Array.prototype.indexOf.call(k,T,L):Uint8Array.prototype.lastIndexOf.call(k,T,L):P(k,[T],L,j,rt);throw new TypeError("val must be string, number or Buffer")}function P(k,T,L,j,rt){let Q,ot=1,qt=k.length,It=T.length;if(j!==void 0&&((j=String(j).toLowerCase())==="ucs2"||j==="ucs-2"||j==="utf16le"||j==="utf-16le")){if(k.length<2||T.length<2)return-1;ot=2,qt/=2,It/=2,L/=2}function xt(Qt,Ct){return ot===1?Qt[Ct]:Qt.readUInt16BE(Ct*ot)}if(rt){let Qt=-1;for(Q=L;Qqt&&(L=qt-It),Q=L;Q>=0;Q--){let Qt=!0;for(let Ct=0;Ctrt&&(j=rt):j=rt;const Q=T.length;let ot;for(j>Q/2&&(j=Q/2),ot=0;ot>8,It=ot%256,xt.push(It),xt.push(qt);return xt}(T,k.length-L),k,L,j)}function tt(k,T,L){return T===0&&L===k.length?t.fromByteArray(k):t.fromByteArray(k.slice(T,L))}function nt(k,T,L){L=Math.min(k.length,L);const j=[];let rt=T;for(;rt239?4:Q>223?3:Q>191?2:1;if(rt+qt<=L){let It,xt,Qt,Ct;switch(qt){case 1:Q<128&&(ot=Q);break;case 2:It=k[rt+1],(192&It)==128&&(Ct=(31&Q)<<6|63&It,Ct>127&&(ot=Ct));break;case 3:It=k[rt+1],xt=k[rt+2],(192&It)==128&&(192&xt)==128&&(Ct=(15&Q)<<12|(63&It)<<6|63&xt,Ct>2047&&(Ct<55296||Ct>57343)&&(ot=Ct));break;case 4:It=k[rt+1],xt=k[rt+2],Qt=k[rt+3],(192&It)==128&&(192&xt)==128&&(192&Qt)==128&&(Ct=(15&Q)<<18|(63&It)<<12|(63&xt)<<6|63&Qt,Ct>65535&&Ct<1114112&&(ot=Ct))}}ot===null?(ot=65533,qt=1):ot>65535&&(ot-=65536,j.push(ot>>>10&1023|55296),ot=56320|1023&ot),j.push(ot),rt+=qt}return function(Q){const ot=Q.length;if(ot<=G)return String.fromCharCode.apply(String,Q);let qt="",It=0;for(;It"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."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(k,T,L){return l(k,T,L)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(k,T,L){return function(j,rt,Q){return p(j),j<=0?i(j):rt!==void 0?typeof Q=="string"?i(j).fill(rt,Q):i(j).fill(rt):i(j)}(k,T,L)},c.allocUnsafe=function(k){return m(k)},c.allocUnsafeSlow=function(k){return m(k)},c.isBuffer=function(k){return k!=null&&k._isBuffer===!0&&k!==c.prototype},c.compare=function(k,T){if(Ft(k,Uint8Array)&&(k=c.from(k,k.offset,k.byteLength)),Ft(T,Uint8Array)&&(T=c.from(T,T.offset,T.byteLength)),!c.isBuffer(k)||!c.isBuffer(T))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(k===T)return 0;let L=k.length,j=T.length;for(let rt=0,Q=Math.min(L,j);rtj.length?(c.isBuffer(Q)||(Q=c.from(Q)),Q.copy(j,rt)):Uint8Array.prototype.set.call(j,Q,rt);else{if(!c.isBuffer(Q))throw new TypeError('"list" argument must be an Array of Buffers');Q.copy(j,rt)}rt+=Q.length}return j},c.byteLength=w,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const k=this.length;if(k%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let T=0;TT&&(k+=" ... "),""},n&&(c.prototype[n]=c.prototype.inspect),c.prototype.compare=function(k,T,L,j,rt){if(Ft(k,Uint8Array)&&(k=c.from(k,k.offset,k.byteLength)),!c.isBuffer(k))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof k);if(T===void 0&&(T=0),L===void 0&&(L=k?k.length:0),j===void 0&&(j=0),rt===void 0&&(rt=this.length),T<0||L>k.length||j<0||rt>this.length)throw new RangeError("out of range index");if(j>=rt&&T>=L)return 0;if(j>=rt)return-1;if(T>=L)return 1;if(this===k)return 0;let Q=(rt>>>=0)-(j>>>=0),ot=(L>>>=0)-(T>>>=0);const qt=Math.min(Q,ot),It=this.slice(j,rt),xt=k.slice(T,L);for(let Qt=0;Qt>>=0,isFinite(L)?(L>>>=0,j===void 0&&(j="utf8")):(j=L,L=void 0)}const rt=this.length-T;if((L===void 0||L>rt)&&(L=rt),k.length>0&&(L<0||T<0)||T>this.length)throw new RangeError("Attempt to write outside buffer bounds");j||(j="utf8");let Q=!1;for(;;)switch(j){case"hex":return R(this,k,T,L);case"utf8":case"utf-8":return C(this,k,T,L);case"ascii":case"latin1":case"binary":return O(this,k,T,L);case"base64":return z(this,k,T,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return H(this,k,T,L);default:if(Q)throw new TypeError("Unknown encoding: "+j);j=(""+j).toLowerCase(),Q=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const G=4096;function M(k,T,L){let j="";L=Math.min(k.length,L);for(let rt=T;rtj)&&(L=j);let rt="";for(let Q=T;QL)throw new RangeError("Trying to access beyond buffer length")}function h(k,T,L,j,rt,Q){if(!c.isBuffer(k))throw new TypeError('"buffer" argument must be a Buffer instance');if(T>rt||Tk.length)throw new RangeError("Index out of range")}function g(k,T,L,j,rt){F(T,j,rt,k,L,7);let Q=Number(T&BigInt(4294967295));k[L++]=Q,Q>>=8,k[L++]=Q,Q>>=8,k[L++]=Q,Q>>=8,k[L++]=Q;let ot=Number(T>>BigInt(32)&BigInt(4294967295));return k[L++]=ot,ot>>=8,k[L++]=ot,ot>>=8,k[L++]=ot,ot>>=8,k[L++]=ot,L}function S(k,T,L,j,rt){F(T,j,rt,k,L,7);let Q=Number(T&BigInt(4294967295));k[L+7]=Q,Q>>=8,k[L+6]=Q,Q>>=8,k[L+5]=Q,Q>>=8,k[L+4]=Q;let ot=Number(T>>BigInt(32)&BigInt(4294967295));return k[L+3]=ot,ot>>=8,k[L+2]=ot,ot>>=8,k[L+1]=ot,ot>>=8,k[L]=ot,L+8}function I(k,T,L,j,rt,Q){if(L+j>k.length)throw new RangeError("Index out of range");if(L<0)throw new RangeError("Index out of range")}function y(k,T,L,j,rt){return T=+T,L>>>=0,rt||I(k,0,L,4),e.write(k,T,L,j,23,4),L+4}function u(k,T,L,j,rt){return T=+T,L>>>=0,rt||I(k,0,L,8),e.write(k,T,L,j,52,8),L+8}c.prototype.slice=function(k,T){const L=this.length;(k=~~k)<0?(k+=L)<0&&(k=0):k>L&&(k=L),(T=T===void 0?L:~~T)<0?(T+=L)<0&&(T=0):T>L&&(T=L),T>>=0,T>>>=0,L||f(k,T,this.length);let j=this[k],rt=1,Q=0;for(;++Q>>=0,T>>>=0,L||f(k,T,this.length);let j=this[k+--T],rt=1;for(;T>0&&(rt*=256);)j+=this[k+--T]*rt;return j},c.prototype.readUint8=c.prototype.readUInt8=function(k,T){return k>>>=0,T||f(k,1,this.length),this[k]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(k,T){return k>>>=0,T||f(k,2,this.length),this[k]|this[k+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(k,T){return k>>>=0,T||f(k,2,this.length),this[k]<<8|this[k+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(k,T){return k>>>=0,T||f(k,4,this.length),(this[k]|this[k+1]<<8|this[k+2]<<16)+16777216*this[k+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(k,T){return k>>>=0,T||f(k,4,this.length),16777216*this[k]+(this[k+1]<<16|this[k+2]<<8|this[k+3])},c.prototype.readBigUInt64LE=Tt(function(k){q(k>>>=0,"offset");const T=this[k],L=this[k+7];T!==void 0&&L!==void 0||it(k,this.length-8);const j=T+256*this[++k]+65536*this[++k]+this[++k]*2**24,rt=this[++k]+256*this[++k]+65536*this[++k]+L*2**24;return BigInt(j)+(BigInt(rt)<>>=0,"offset");const T=this[k],L=this[k+7];T!==void 0&&L!==void 0||it(k,this.length-8);const j=T*2**24+65536*this[++k]+256*this[++k]+this[++k],rt=this[++k]*2**24+65536*this[++k]+256*this[++k]+L;return(BigInt(j)<>>=0,T>>>=0,L||f(k,T,this.length);let j=this[k],rt=1,Q=0;for(;++Q=rt&&(j-=Math.pow(2,8*T)),j},c.prototype.readIntBE=function(k,T,L){k>>>=0,T>>>=0,L||f(k,T,this.length);let j=T,rt=1,Q=this[k+--j];for(;j>0&&(rt*=256);)Q+=this[k+--j]*rt;return rt*=128,Q>=rt&&(Q-=Math.pow(2,8*T)),Q},c.prototype.readInt8=function(k,T){return k>>>=0,T||f(k,1,this.length),128&this[k]?-1*(255-this[k]+1):this[k]},c.prototype.readInt16LE=function(k,T){k>>>=0,T||f(k,2,this.length);const L=this[k]|this[k+1]<<8;return 32768&L?4294901760|L:L},c.prototype.readInt16BE=function(k,T){k>>>=0,T||f(k,2,this.length);const L=this[k+1]|this[k]<<8;return 32768&L?4294901760|L:L},c.prototype.readInt32LE=function(k,T){return k>>>=0,T||f(k,4,this.length),this[k]|this[k+1]<<8|this[k+2]<<16|this[k+3]<<24},c.prototype.readInt32BE=function(k,T){return k>>>=0,T||f(k,4,this.length),this[k]<<24|this[k+1]<<16|this[k+2]<<8|this[k+3]},c.prototype.readBigInt64LE=Tt(function(k){q(k>>>=0,"offset");const T=this[k],L=this[k+7];T!==void 0&&L!==void 0||it(k,this.length-8);const j=this[k+4]+256*this[k+5]+65536*this[k+6]+(L<<24);return(BigInt(j)<>>=0,"offset");const T=this[k],L=this[k+7];T!==void 0&&L!==void 0||it(k,this.length-8);const j=(T<<24)+65536*this[++k]+256*this[++k]+this[++k];return(BigInt(j)<>>=0,T||f(k,4,this.length),e.read(this,k,!0,23,4)},c.prototype.readFloatBE=function(k,T){return k>>>=0,T||f(k,4,this.length),e.read(this,k,!1,23,4)},c.prototype.readDoubleLE=function(k,T){return k>>>=0,T||f(k,8,this.length),e.read(this,k,!0,52,8)},c.prototype.readDoubleBE=function(k,T){return k>>>=0,T||f(k,8,this.length),e.read(this,k,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(k,T,L,j){k=+k,T>>>=0,L>>>=0,!j&&h(this,k,T,L,Math.pow(2,8*L)-1,0);let rt=1,Q=0;for(this[T]=255&k;++Q>>=0,L>>>=0,!j&&h(this,k,T,L,Math.pow(2,8*L)-1,0);let rt=L-1,Q=1;for(this[T+rt]=255&k;--rt>=0&&(Q*=256);)this[T+rt]=k/Q&255;return T+L},c.prototype.writeUint8=c.prototype.writeUInt8=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,1,255,0),this[T]=255&k,T+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,2,65535,0),this[T]=255&k,this[T+1]=k>>>8,T+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,2,65535,0),this[T]=k>>>8,this[T+1]=255&k,T+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,4,4294967295,0),this[T+3]=k>>>24,this[T+2]=k>>>16,this[T+1]=k>>>8,this[T]=255&k,T+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,4,4294967295,0),this[T]=k>>>24,this[T+1]=k>>>16,this[T+2]=k>>>8,this[T+3]=255&k,T+4},c.prototype.writeBigUInt64LE=Tt(function(k,T=0){return g(this,k,T,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Tt(function(k,T=0){return S(this,k,T,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(k,T,L,j){if(k=+k,T>>>=0,!j){const qt=Math.pow(2,8*L-1);h(this,k,T,L,qt-1,-qt)}let rt=0,Q=1,ot=0;for(this[T]=255&k;++rt>0)-ot&255;return T+L},c.prototype.writeIntBE=function(k,T,L,j){if(k=+k,T>>>=0,!j){const qt=Math.pow(2,8*L-1);h(this,k,T,L,qt-1,-qt)}let rt=L-1,Q=1,ot=0;for(this[T+rt]=255&k;--rt>=0&&(Q*=256);)k<0&&ot===0&&this[T+rt+1]!==0&&(ot=1),this[T+rt]=(k/Q>>0)-ot&255;return T+L},c.prototype.writeInt8=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,1,127,-128),k<0&&(k=255+k+1),this[T]=255&k,T+1},c.prototype.writeInt16LE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,2,32767,-32768),this[T]=255&k,this[T+1]=k>>>8,T+2},c.prototype.writeInt16BE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,2,32767,-32768),this[T]=k>>>8,this[T+1]=255&k,T+2},c.prototype.writeInt32LE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,4,2147483647,-2147483648),this[T]=255&k,this[T+1]=k>>>8,this[T+2]=k>>>16,this[T+3]=k>>>24,T+4},c.prototype.writeInt32BE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,4,2147483647,-2147483648),k<0&&(k=4294967295+k+1),this[T]=k>>>24,this[T+1]=k>>>16,this[T+2]=k>>>8,this[T+3]=255&k,T+4},c.prototype.writeBigInt64LE=Tt(function(k,T=0){return g(this,k,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Tt(function(k,T=0){return S(this,k,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(k,T,L){return y(this,k,T,!0,L)},c.prototype.writeFloatBE=function(k,T,L){return y(this,k,T,!1,L)},c.prototype.writeDoubleLE=function(k,T,L){return u(this,k,T,!0,L)},c.prototype.writeDoubleBE=function(k,T,L){return u(this,k,T,!1,L)},c.prototype.copy=function(k,T,L,j){if(!c.isBuffer(k))throw new TypeError("argument should be a Buffer");if(L||(L=0),j||j===0||(j=this.length),T>=k.length&&(T=k.length),T||(T=0),j>0&&j=this.length)throw new RangeError("Index out of range");if(j<0)throw new RangeError("sourceEnd out of bounds");j>this.length&&(j=this.length),k.length-T>>=0,L=L===void 0?this.length:L>>>0,k||(k=0),typeof k=="number")for(rt=T;rt=j+4;L-=3)T=`_${k.slice(L-3,L)}${T}`;return`${k.slice(0,L)}${T}`}function F(k,T,L,j,rt,Q){if(k>L||k3?T===0||T===BigInt(0)?`>= 0${ot} and < 2${ot} ** ${8*(Q+1)}${ot}`:`>= -(2${ot} ** ${8*(Q+1)-1}${ot}) and < 2 ** ${8*(Q+1)-1}${ot}`:`>= ${T}${ot} and <= ${L}${ot}`,new b.ERR_OUT_OF_RANGE("value",qt,k)}(function(ot,qt,It){q(qt,"offset"),ot[qt]!==void 0&&ot[qt+It]!==void 0||it(qt,ot.length-(It+1))})(j,rt,Q)}function q(k,T){if(typeof k!="number")throw new b.ERR_INVALID_ARG_TYPE(T,"number",k)}function it(k,T,L){throw Math.floor(k)!==k?(q(k,L),new b.ERR_OUT_OF_RANGE(L||"offset","an integer",k)):T<0?new b.ERR_BUFFER_OUT_OF_BOUNDS:new b.ERR_OUT_OF_RANGE(L||"offset",`>= ${L?1:0} and <= ${T}`,k)}D("ERR_BUFFER_OUT_OF_BOUNDS",function(k){return k?`${k} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),D("ERR_INVALID_ARG_TYPE",function(k,T){return`The "${k}" argument must be of type number. Received type ${typeof T}`},TypeError),D("ERR_OUT_OF_RANGE",function(k,T,L){let j=`The value of "${k}" is out of range.`,rt=L;return Number.isInteger(L)&&Math.abs(L)>2**32?rt=Z(String(L)):typeof L=="bigint"&&(rt=String(L),(L>BigInt(2)**BigInt(32)||L<-(BigInt(2)**BigInt(32)))&&(rt=Z(rt)),rt+="n"),j+=` It must be ${T}. Received ${rt}`,j},RangeError);const at=/[^+/0-9A-Za-z-_]/g;function Bt(k,T){let L;T=T||1/0;const j=k.length;let rt=null;const Q=[];for(let ot=0;ot55295&&L<57344){if(!rt){if(L>56319){(T-=3)>-1&&Q.push(239,191,189);continue}if(ot+1===j){(T-=3)>-1&&Q.push(239,191,189);continue}rt=L;continue}if(L<56320){(T-=3)>-1&&Q.push(239,191,189),rt=L;continue}L=65536+(rt-55296<<10|L-56320)}else rt&&(T-=3)>-1&&Q.push(239,191,189);if(rt=null,L<128){if((T-=1)<0)break;Q.push(L)}else if(L<2048){if((T-=2)<0)break;Q.push(L>>6|192,63&L|128)}else if(L<65536){if((T-=3)<0)break;Q.push(L>>12|224,L>>6&63|128,63&L|128)}else{if(!(L<1114112))throw new Error("Invalid code point");if((T-=4)<0)break;Q.push(L>>18|240,L>>12&63|128,L>>6&63|128,63&L|128)}}return Q}function yt(k){return t.toByteArray(function(T){if((T=(T=T.split("=")[0]).trim().replace(at,"")).length<2)return"";for(;T.length%4!=0;)T+="=";return T}(k))}function pt(k,T,L,j){let rt;for(rt=0;rt=T.length||rt>=k.length);++rt)T[rt+L]=k[rt];return rt}function Ft(k,T){return k instanceof T||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===T.name}function lt(k){return k!=k}const ct=function(){const k="0123456789abcdef",T=new Array(256);for(let L=0;L<16;++L){const j=16*L;for(let rt=0;rt<16;++rt)T[j+rt]=k[L]+k[rt]}return T}();function Tt(k){return typeof BigInt>"u"?kt:k}function kt(){throw new Error("BigInt not supported")}}(Ae);const Lp=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,JM=r=>r instanceof Uint8Array,Op=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),go=(r,t)=>r<<32-t|r>>>t;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */if(new Uint8Array(new Uint32Array([287454020]).buffer)[0]!==68)throw new Error("Non little-endian hardware is not supported");function Mz(r){if(typeof r!="string")throw new Error("utf8ToBytes expected string, got "+typeof r);return new Uint8Array(new TextEncoder().encode(r))}function gd(r){if(typeof r=="string"&&(r=Mz(r)),!JM(r))throw new Error("expected Uint8Array, got "+typeof r);return r}function Ez(...r){const t=new Uint8Array(r.reduce((n,s)=>n+s.length,0));let e=0;return r.forEach(n=>{if(!JM(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}let ry=class{clone(){return this._cloneInto()}};function ny(r){const t=n=>r().update(gd(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function QM(r=32){if(Lp&&typeof Lp.getRandomValues=="function")return Lp.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}let tE=class extends ry{constructor(t,e,n,s){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Op(this.buffer)}update(t){uf(this);const{view:e,buffer:n,blockLen:s}=this,i=(t=gd(t)).length;for(let c=0;cs-c&&(this.process(n,0),c=0);for(let _=c;_>A&B),R=Number(w&B),C=x?4:0,O=x?0:4;_.setUint32(E+C,P,x),_.setUint32(E+O,R,x)})(n,s-8,BigInt(8*this.length),i),this.process(n,0);const l=Op(t),p=this.outputLen;if(p%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const m=p/4,v=this.get();if(m>v.length)throw new Error("_sha2: outputLen bigger than state");for(let _=0;_>N2&f0)}:{h:0|Number(r>>N2&f0),l:0|Number(r&f0)}}function rE(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let s=0;sr<>>32-e,iE=(r,t,e)=>t<>>32-e,oE=(r,t,e)=>t<>>64-e,sE=(r,t,e)=>r<>>64-e,Az={fromBig:eE,split:rE,toBig:(r,t)=>BigInt(r>>>0)<>>0),shrSH:(r,t,e)=>r>>>e,shrSL:(r,t,e)=>r<<32-e|t>>>e,rotrSH:(r,t,e)=>r>>>e|t<<32-e,rotrSL:(r,t,e)=>r<<32-e|t>>>e,rotrBH:(r,t,e)=>r<<64-e|t>>>e-32,rotrBL:(r,t,e)=>r>>>e-32|t<<64-e,rotr32H:(r,t)=>t,rotr32L:(r,t)=>r,rotlSH:nE,rotlSL:iE,rotlBH:oE,rotlBL:sE,add:function(r,t,e,n){const s=(t>>>0)+(n>>>0);return{h:r+e+(s/2**32|0)|0,l:0|s}},add3L:(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),add3H:(r,t,e,n)=>t+e+n+(r/2**32|0)|0,add4L:(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),add4H:(r,t,e,n,s)=>t+e+n+s+(r/2**32|0)|0,add5H:(r,t,e,n,s,i)=>t+e+n+s+i+(r/2**32|0)|0,add5L:(r,t,e,n,s)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(s>>>0)};var tr=Az;const[Sz,kz]=(()=>tr.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(r=>BigInt(r))))(),Ts=new Uint32Array(80),Ls=new Uint32Array(80);let Iz=class extends tE{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:t,Al:e,Bh:n,Bl:s,Ch:i,Cl:c,Dh:l,Dl:p,Eh:m,El:v,Fh:_,Fl:E,Gh:w,Gl:x,Hh:A,Hl:B}=this;return[t,e,n,s,i,c,l,p,m,v,_,E,w,x,A,B]}set(t,e,n,s,i,c,l,p,m,v,_,E,w,x,A,B){this.Ah=0|t,this.Al=0|e,this.Bh=0|n,this.Bl=0|s,this.Ch=0|i,this.Cl=0|c,this.Dh=0|l,this.Dl=0|p,this.Eh=0|m,this.El=0|v,this.Fh=0|_,this.Fl=0|E,this.Gh=0|w,this.Gl=0|x,this.Hh=0|A,this.Hl=0|B}process(t,e){for(let C=0;C<16;C++,e+=4)Ts[C]=t.getUint32(e),Ls[C]=t.getUint32(e+=4);for(let C=16;C<80;C++){const O=0|Ts[C-15],z=0|Ls[C-15],H=tr.rotrSH(O,z,1)^tr.rotrSH(O,z,8)^tr.shrSH(O,z,7),tt=tr.rotrSL(O,z,1)^tr.rotrSL(O,z,8)^tr.shrSL(O,z,7),nt=0|Ts[C-2],G=0|Ls[C-2],M=tr.rotrSH(nt,G,19)^tr.rotrBH(nt,G,61)^tr.shrSH(nt,G,6),d=tr.rotrSL(nt,G,19)^tr.rotrBL(nt,G,61)^tr.shrSL(nt,G,6),o=tr.add4L(tt,d,Ls[C-7],Ls[C-16]),a=tr.add4H(o,H,M,Ts[C-7],Ts[C-16]);Ts[C]=0|a,Ls[C]=0|o}let{Ah:n,Al:s,Bh:i,Bl:c,Ch:l,Cl:p,Dh:m,Dl:v,Eh:_,El:E,Fh:w,Fl:x,Gh:A,Gl:B,Hh:P,Hl:R}=this;for(let C=0;C<80;C++){const O=tr.rotrSH(_,E,14)^tr.rotrSH(_,E,18)^tr.rotrBH(_,E,41),z=tr.rotrSL(_,E,14)^tr.rotrSL(_,E,18)^tr.rotrBL(_,E,41),H=_&w^~_&A,tt=E&x^~E&B,nt=tr.add5L(R,z,tt,kz[C],Ls[C]),G=tr.add5H(nt,P,O,H,Sz[C],Ts[C]),M=0|nt,d=tr.rotrSH(n,s,28)^tr.rotrBH(n,s,34)^tr.rotrBH(n,s,39),o=tr.rotrSL(n,s,28)^tr.rotrBL(n,s,34)^tr.rotrBL(n,s,39),a=n&i^n&l^i&l,f=s&c^s&p^c&p;P=0|A,R=0|B,A=0|w,B=0|x,w=0|_,x=0|E,{h:_,l:E}=tr.add(0|m,0|v,0|G,0|M),m=0|l,v=0|p,l=0|i,p=0|c,i=0|n,c=0|s;const h=tr.add3L(M,o,f);n=tr.add3H(h,G,d,a),s=0|h}({h:n,l:s}=tr.add(0|this.Ah,0|this.Al,0|n,0|s)),{h:i,l:c}=tr.add(0|this.Bh,0|this.Bl,0|i,0|c),{h:l,l:p}=tr.add(0|this.Ch,0|this.Cl,0|l,0|p),{h:m,l:v}=tr.add(0|this.Dh,0|this.Dl,0|m,0|v),{h:_,l:E}=tr.add(0|this.Eh,0|this.El,0|_,0|E),{h:w,l:x}=tr.add(0|this.Fh,0|this.Fl,0|w,0|x),{h:A,l:B}=tr.add(0|this.Gh,0|this.Gl,0|A,0|B),{h:P,l:R}=tr.add(0|this.Hh,0|this.Hl,0|P,0|R),this.set(n,s,i,c,l,p,m,v,_,E,w,x,A,B,P,R)}roundClean(){Ts.fill(0),Ls.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 Bz=ny(()=>new Iz),r5=BigInt(0),Y0=BigInt(1),Pz=BigInt(2),yd=r=>r instanceof Uint8Array,Rz=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ja(r){if(!yd(r))throw new Error("Uint8Array expected");let t="";for(let e=0;en+s.length,0));let e=0;return r.forEach(n=>{if(!yd(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}const oy=r=>(Pz<new Uint8Array(r),i5=r=>Uint8Array.from(r);function aE(r,t,e){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let n=Up(r),s=Up(r),i=0;const c=()=>{n.fill(1),s.fill(0),i=0},l=(...v)=>e(s,n,...v),p=(v=Up())=>{s=l(i5([0]),v),n=l(),v.length!==0&&(s=l(i5([1]),v),n=l())},m=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let v=0;const _=[];for(;v{let E;for(c(),p(v);!(E=_(m()));)p();return c(),E}}const Cz={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||r instanceof Uint8Array,isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function cf(r,t,e={}){const n=(s,i,c)=>{const l=Cz[i];if(typeof l!="function")throw new Error(`Invalid validator "${i}", expected function`);const p=r[s];if(!(c&&p===void 0||l(p,r)))throw new Error(`Invalid param ${String(s)}=${p} (${typeof p}), expected ${i}`)};for(const[s,i]of Object.entries(t))n(s,i,!1);for(const[s,i]of Object.entries(e))n(s,i,!0);return r}var Tz=Object.freeze({__proto__:null,bytesToHex:Ja,numberToHexUnpadded:n5,hexToNumber:iy,hexToBytes:ff,bytesToNumberBE:La,bytesToNumberLE:qu,numberToBytesBE:Fu,numberToBytesLE:Xc,numberToVarBytesBE:function(r){return ff(n5(r))},ensureBytes:mn,concatBytes:Qa,equalBytes:function(r,t){if(r.length!==t.length)return!1;for(let e=0;er5;r>>=Y0,t+=1);return t},bitGet:function(r,t){return r>>BigInt(t)&Y0},bitSet:(r,t,e)=>r|(e?Y0:r5)<=En?e:t+e}function Oz(r,t,e){if(e<=En||t 0");if(e===Zr)return En;let n=Zr;for(;t>En;)t&Zr&&(n=n*r%e),r=r*r%e,t>>=Zr;return n}function en(r,t,e){let n=r;for(;t-- >En;)n*=n,n%=e;return n}function D2(r,t){if(r===En||t<=En)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=Kr(r,t),n=t,s=En,i=Zr;for(;e!==En;){const c=n%e,l=s-i*(n/e);n=e,e=c,s=i,i=l}if(n!==Zr)throw new Error("invert: does not exist");return Kr(s,t)}function Uz(r){if(r%Np===Lz){const t=(r+Zr)/Np;return function(e,n){const s=e.pow(n,t);if(!e.eql(e.sqr(s),n))throw new Error("Cannot find square root");return s}}if(r%s5===o5){const t=(r-o5)/s5;return function(e,n){const s=e.mul(n,pa),i=e.pow(s,t),c=e.mul(n,i),l=e.mul(e.mul(c,pa),i),p=e.mul(c,e.sub(l,e.ONE));if(!e.eql(e.sqr(p),n))throw new Error("Cannot find square root");return p}}return function(t){const e=(t-Zr)/pa;let n,s,i;for(n=t-Zr,s=0;n%pa===En;n/=pa,s++);for(i=pa;i 0, got ${r}`);const{nBitLength:s,nByteLength:i}=uE(r,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const c=Uz(r),l=Object.freeze({ORDER:r,BITS:s,BYTES:i,MASK:oy(s),ZERO:En,ONE:Zr,create:p=>Kr(p,r),isValid:p=>{if(typeof p!="bigint")throw new Error("Invalid field element: expected bigint, got "+typeof p);return En<=p&&pp===En,isOdd:p=>(p&Zr)===Zr,neg:p=>Kr(-p,r),eql:(p,m)=>p===m,sqr:p=>Kr(p*p,r),add:(p,m)=>Kr(p+m,r),sub:(p,m)=>Kr(p-m,r),mul:(p,m)=>Kr(p*m,r),pow:(p,m)=>function(v,_,E){if(E 0");if(E===En)return v.ONE;if(E===Zr)return _;let w=v.ONE,x=_;for(;E>En;)E&Zr&&(w=v.mul(w,x)),x=v.sqr(x),E>>=Zr;return w}(l,p,m),div:(p,m)=>Kr(p*D2(m,r),r),sqrN:p=>p*p,addN:(p,m)=>p+m,subN:(p,m)=>p-m,mulN:(p,m)=>p*m,inv:p=>D2(p,r),sqrt:n.sqrt||(p=>c(l,p)),invertBatch:p=>function(m,v){const _=new Array(v.length),E=v.reduce((x,A,B)=>m.is0(A)?x:(_[B]=x,m.mul(x,A)),m.ONE),w=m.inv(E);return v.reduceRight((x,A,B)=>m.is0(A)?x:(_[B]=m.mul(x,_[B]),m.mul(x,A)),w),_}(l,p),cmov:(p,m,v)=>v?m:p,toBytes:p=>e?Xc(p,i):Fu(p,i),fromBytes:p=>{if(p.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${p.length}`);return e?qu(p):La(p)}});return Object.freeze(l)}function cE(r){if(typeof r!="bigint")throw new Error("field order must be bigint");const t=r.toString(2).length;return Math.ceil(t/8)}function a5(r){const t=cE(r);return t+Math.ceil(t/2)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Dz=BigInt(0),Dp=BigInt(1);function hE(r,t){const e=(s,i)=>{const c=i.negate();return s?c:i},n=s=>({windows:Math.ceil(t/s)+1,windowSize:2**(s-1)});return{constTimeNegate:e,unsafeLadder(s,i){let c=r.ZERO,l=s;for(;i>Dz;)i&Dp&&(c=c.add(l)),l=l.double(),i>>=Dp;return c},precomputeWindow(s,i){const{windows:c,windowSize:l}=n(i),p=[];let m=s,v=m;for(let _=0;_>=w,B>p&&(B-=E,c+=Dp);const P=A,R=A+Math.abs(B)-1,C=x%2!=0,O=B<0;B===0?v=v.add(e(C,i[P])):m=m.add(e(O,i[R]))}return{p:m,f:v}},wNAFCached(s,i,c,l){const p=s._WINDOW_SIZE||1;let m=i.get(s);return m||(m=this.precomputeWindow(s,p),p!==1&&i.set(s,l(m))),this.wNAF(p,m,c)}}}function sy(r){return cf(r.Fp,Nz.reduce((t,e)=>(t[e]="function",t),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),cf(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...uE(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ji=BigInt(0),mi=BigInt(1),c0=BigInt(2),zz=BigInt(8),qz={zip215:!0};function Fz(r){const t=function(f){const h=sy(f);return cf(f,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...h})}(r),{Fp:e,n,prehash:s,hash:i,randomBytes:c,nByteLength:l,h:p}=t,m=c0<{try{return{isValid:!0,value:e.sqrt(f*e.inv(h))}}catch{return{isValid:!1,value:Ji}}}),E=t.adjustScalarBytes||(f=>f),w=t.domain||((f,h,g)=>{if(h.length||g)throw new Error("Contexts/pre-hash are not supported");return f}),x=f=>typeof f=="bigint"&&Jix(f)&&x(h)&&ff===Ji||A(f,m);function P(f,h){if(A(f,h))return f;throw new Error(`Expected valid scalar < ${h}, got ${typeof f} ${f}`)}function R(f){return f===Ji?f:P(f,n)}const C=new Map;function O(f){if(!(f instanceof z))throw new Error("ExtendedPoint expected")}class z{constructor(h,g,S,I){if(this.ex=h,this.ey=g,this.ez=S,this.et=I,!B(h))throw new Error("x required");if(!B(g))throw new Error("y required");if(!B(S))throw new Error("z required");if(!B(I))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(h){if(h instanceof z)throw new Error("extended point not allowed");const{x:g,y:S}=h||{};if(!B(g)||!B(S))throw new Error("invalid affine point");return new z(g,S,mi,v(g*S))}static normalizeZ(h){const g=e.invertBatch(h.map(S=>S.ez));return h.map((S,I)=>S.toAffine(g[I])).map(z.fromAffine)}_setWindowSize(h){this._WINDOW_SIZE=h,C.delete(this)}assertValidity(){const{a:h,d:g}=t;if(this.is0())throw new Error("bad point: ZERO");const{ex:S,ey:I,ez:y,et:u}=this,b=v(S*S),D=v(I*I),Z=v(y*y),F=v(Z*Z),q=v(b*h);if(v(Z*v(q+D))!==v(F+v(g*v(b*D))))throw new Error("bad point: equation left != right (1)");if(v(S*I)!==v(y*u))throw new Error("bad point: equation left != right (2)")}equals(h){O(h);const{ex:g,ey:S,ez:I}=this,{ex:y,ey:u,ez:b}=h,D=v(g*b),Z=v(y*I),F=v(S*b),q=v(u*I);return D===Z&&F===q}is0(){return this.equals(z.ZERO)}negate(){return new z(v(-this.ex),this.ey,this.ez,v(-this.et))}double(){const{a:h}=t,{ex:g,ey:S,ez:I}=this,y=v(g*g),u=v(S*S),b=v(c0*v(I*I)),D=v(h*y),Z=g+S,F=v(v(Z*Z)-y-u),q=D+u,it=q-b,at=D-u,Bt=v(F*it),yt=v(q*at),pt=v(F*at),Ft=v(it*q);return new z(Bt,yt,Ft,pt)}add(h){O(h);const{a:g,d:S}=t,{ex:I,ey:y,ez:u,et:b}=this,{ex:D,ey:Z,ez:F,et:q}=h;if(g===BigInt(-1)){const L=v((y-I)*(Z+D)),j=v((y+I)*(Z-D)),rt=v(j-L);if(rt===Ji)return this.double();const Q=v(u*c0*q),ot=v(b*c0*F),qt=ot+Q,It=j+L,xt=ot-Q,Qt=v(qt*rt),Ct=v(It*xt),Dt=v(qt*xt),Se=v(rt*It);return new z(Qt,Ct,Se,Dt)}const it=v(I*D),at=v(y*Z),Bt=v(b*S*q),yt=v(u*F),pt=v((I+y)*(D+Z)-it-at),Ft=yt-Bt,lt=yt+Bt,ct=v(at-g*it),Tt=v(pt*Ft),kt=v(lt*ct),k=v(pt*ct),T=v(Ft*lt);return new z(Tt,kt,T,k)}subtract(h){return this.add(h.negate())}wNAF(h){return nt.wNAFCached(this,C,h,z.normalizeZ)}multiply(h){const{p:g,f:S}=this.wNAF(P(h,n));return z.normalizeZ([g,S])[0]}multiplyUnsafe(h){let g=R(h);return g===Ji?tt:this.equals(tt)||g===mi?this:this.equals(H)?this.wNAF(g).p:nt.unsafeLadder(this,g)}isSmallOrder(){return this.multiplyUnsafe(p).is0()}isTorsionFree(){return nt.unsafeLadder(this,n).is0()}toAffine(h){const{ex:g,ey:S,ez:I}=this,y=this.is0();h==null&&(h=y?zz:e.inv(I));const u=v(g*h),b=v(S*h),D=v(I*h);if(y)return{x:Ji,y:mi};if(D!==mi)throw new Error("invZ was invalid");return{x:u,y:b}}clearCofactor(){const{h}=t;return h===mi?this:this.multiplyUnsafe(h)}static fromHex(h,g=!1){const{d:S,a:I}=t,y=e.BYTES,u=(h=mn("pointHex",h,y)).slice(),b=h[y-1];u[y-1]=-129&b;const D=qu(u);D===Ji||P(D,g?m:e.ORDER);const Z=v(D*D),F=v(Z-mi),q=v(S*Z-I);let{isValid:it,value:at}=_(F,q);if(!it)throw new Error("Point.fromHex: invalid y coordinate");const Bt=(at&mi)===mi,yt=(128&b)!=0;if(!g&&at===Ji&&yt)throw new Error("Point.fromHex: x=0 and x_0=1");return yt!==Bt&&(at=v(-at)),z.fromAffine({x:at,y:D})}static fromPrivateKey(h){return d(h).point}toRawBytes(){const{x:h,y:g}=this.toAffine(),S=Xc(g,e.BYTES);return S[S.length-1]|=h&mi?128:0,S}toHex(){return Ja(this.toRawBytes())}}z.BASE=new z(t.Gx,t.Gy,mi,v(t.Gx*t.Gy)),z.ZERO=new z(Ji,mi,mi,Ji);const{BASE:H,ZERO:tt}=z,nt=hE(z,8*l);function G(f){return Kr(f,n)}function M(f){return G(qu(f))}function d(f){const h=l;f=mn("private key",f,h);const g=mn("hashed private key",i(f),2*h),S=E(g.slice(0,h)),I=g.slice(h,2*h),y=M(S),u=H.multiply(y),b=u.toRawBytes();return{head:S,prefix:I,scalar:y,point:u,pointBytes:b}}function o(f=new Uint8Array,...h){const g=Qa(...h);return M(i(w(g,mn("context",f),!!s)))}const a=qz;return H._setWindowSize(8),{CURVE:t,getPublicKey:function(f){return d(f).pointBytes},sign:function(f,h,g={}){f=mn("message",f),s&&(f=s(f));const{prefix:S,scalar:I,pointBytes:y}=d(h),u=o(g.context,S,f),b=H.multiply(u).toRawBytes(),D=G(u+o(g.context,b,y,f)*I);return R(D),mn("result",Qa(b,Xc(D,e.BYTES)),2*l)},verify:function(f,h,g,S=a){const{context:I,zip215:y}=S,u=e.BYTES;f=mn("signature",f,2*u),h=mn("message",h),s&&(h=s(h));const b=qu(f.slice(u,2*u));let D,Z,F;try{D=z.fromHex(g,y),Z=z.fromHex(f.slice(0,u),y),F=H.multiplyUnsafe(b)}catch{return!1}if(!y&&D.isSmallOrder())return!1;const q=o(I,Z.toRawBytes(),D.toRawBytes(),h);return Z.add(D.multiplyUnsafe(q)).subtract(F).clearCofactor().equals(z.ZERO)},ExtendedPoint:z,utils:{getExtendedPublicKey:d,randomPrivateKey:()=>c(e.BYTES),precompute:(f=8,h=z.BASE)=>(h._setWindowSize(f),h.multiply(BigInt(3)),h)}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const z2=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),u5=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const jz=BigInt(1),q2=BigInt(2),Kz=BigInt(5),f5=BigInt(10),$z=BigInt(20),Hz=BigInt(40),c5=BigInt(80),us=fE(z2,void 0,!0),Vz={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:us,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Bz,randomBytes:QM,adjustScalarBytes:function(r){return r[0]&=248,r[31]&=127,r[31]|=64,r},uvRatio:function(r,t){const e=z2,n=Kr(t*t*t,e),s=function(E){const w=z2,x=E*E%w*E%w,A=en(x,q2,w)*x%w,B=en(A,jz,w)*E%w,P=en(B,Kz,w)*B%w,R=en(P,f5,w)*P%w,C=en(R,$z,w)*R%w,O=en(C,Hz,w)*C%w,z=en(O,c5,w)*O%w,H=en(z,c5,w)*O%w,tt=en(H,f5,w)*P%w;return{pow_p_5_8:en(tt,q2,w)*E%w,b2:x}}(r*Kr(n*n*t,e)).pow_p_5_8;let i=Kr(r*n*s,e);const c=Kr(t*i*i,e),l=i,p=Kr(i*u5,e),m=c===r,v=c===Kr(-r,e),_=c===Kr(-r*u5,e);return m&&(i=l),(v||_)&&(i=p),(Kr(i,e)&Zr)===Zr&&(i=Kr(-i,e)),{isValid:m||v,value:i}}},Pf=Fz(Vz),Zz=(us.ORDER+BigInt(3))/BigInt(8);us.pow(q2,Zz),us.sqrt(us.neg(us.ONE)),us.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(r,t){if(!r.isOdd)throw new Error("Field doesn't have isOdd");const e=r.sqrt(t);r.isOdd(e)&&r.neg(e)}(us,us.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var lE={exports:{}},dE=Oh(Object.freeze({__proto__:null,default:{}}));(function(r,t){function e(M,d){if(!M)throw new Error(d||"Assertion failed")}function n(M,d){M.super_=d;var o=function(){};o.prototype=d.prototype,M.prototype=new o,M.prototype.constructor=M}function s(M,d,o){if(s.isBN(M))return M;this.negative=0,this.words=null,this.length=0,this.red=null,M!==null&&(d!=="le"&&d!=="be"||(o=d,d=10),this._init(M||0,d||10,o||"be"))}var i;typeof r=="object"?r.exports=s:t.BN=s,s.BN=s,s.wordSize=26;try{i=typeof window<"u"&&window.Buffer!==void 0?window.Buffer:dE.Buffer}catch{}function c(M,d){var o=M.charCodeAt(d);return o>=48&&o<=57?o-48:o>=65&&o<=70?o-55:o>=97&&o<=102?o-87:void e(!1,"Invalid character in "+M)}function l(M,d,o){var a=c(M,o);return o-1>=d&&(a|=c(M,o-1)<<4),a}function p(M,d,o,a){for(var f=0,h=0,g=Math.min(M.length,o),S=d;S=49?I-49+10:I>=17?I-17+10:I,e(I>=0&&h0?M:d},s.min=function(M,d){return M.cmp(d)<0?M:d},s.prototype._init=function(M,d,o){if(typeof M=="number")return this._initNumber(M,d,o);if(typeof M=="object")return this._initArray(M,d,o);d==="hex"&&(d=16),e(d===(0|d)&&d>=2&&d<=36);var a=0;(M=M.toString().replace(/\s+/g,""))[0]==="-"&&(a++,this.negative=1),a=0;a-=3)h=M[a]|M[a-1]<<8|M[a-2]<<16,this.words[f]|=h<>>26-g&67108863,(g+=24)>=26&&(g-=26,f++);else if(o==="le")for(a=0,f=0;a>>26-g&67108863,(g+=24)>=26&&(g-=26,f++);return this._strip()},s.prototype._parseHex=function(M,d,o){this.length=Math.ceil((M.length-d)/6),this.words=new Array(this.length);for(var a=0;a=d;a-=2)f=l(M,d,a)<=18?(h-=18,g+=1,this.words[g]|=f>>>26):h+=8;else for(a=(M.length-d)%2==0?d+1:d;a=18?(h-=18,g+=1,this.words[g]|=f>>>26):h+=8;this._strip()},s.prototype._parseBase=function(M,d,o){this.words=[0],this.length=1;for(var a=0,f=1;f<=67108863;f*=d)a++;a--,f=f/d|0;for(var h=M.length-o,g=h%a,S=Math.min(h,h-g)+o,I=0,y=o;y1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=v}catch{s.prototype.inspect=v}else s.prototype.inspect=v;function v(){return(this.red?""}var _=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],E=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],w=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function x(M,d,o){o.negative=d.negative^M.negative;var a=M.length+d.length|0;o.length=a,a=a-1|0;var f=0|M.words[0],h=0|d.words[0],g=f*h,S=67108863&g,I=g/67108864|0;o.words[0]=S;for(var y=1;y>>26,b=67108863&I,D=Math.min(y,d.length-1),Z=Math.max(0,y-M.length+1);Z<=D;Z++){var F=y-Z|0;u+=(g=(f=0|M.words[F])*(h=0|d.words[Z])+b)/67108864|0,b=67108863&g}o.words[y]=0|b,I=0|u}return I!==0?o.words[y]=0|I:o.length--,o._strip()}s.prototype.toString=function(M,d){var o;if(d=0|d||1,(M=M||10)===16||M==="hex"){o="";for(var a=0,f=0,h=0;h>>24-a&16777215,(a+=2)>=26&&(a-=26,h--),o=f!==0||h!==this.length-1?_[6-S.length]+S+o:S+o}for(f!==0&&(o=f.toString(16)+o);o.length%d!=0;)o="0"+o;return this.negative!==0&&(o="-"+o),o}if(M===(0|M)&&M>=2&&M<=36){var I=E[M],y=w[M];o="";var u=this.clone();for(u.negative=0;!u.isZero();){var b=u.modrn(y).toString(M);o=(u=u.idivn(y)).isZero()?b+o:_[I-b.length]+b+o}for(this.isZero()&&(o="0"+o);o.length%d!=0;)o="0"+o;return this.negative!==0&&(o="-"+o),o}e(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var M=this.words[0];return this.length===2?M+=67108864*this.words[1]:this.length===3&&this.words[2]===1?M+=4503599627370496+67108864*this.words[1]:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-M:M},s.prototype.toJSON=function(){return this.toString(16,2)},i&&(s.prototype.toBuffer=function(M,d){return this.toArrayLike(i,M,d)}),s.prototype.toArray=function(M,d){return this.toArrayLike(Array,M,d)},s.prototype.toArrayLike=function(M,d,o){this._strip();var a=this.byteLength(),f=o||Math.max(1,a);e(a<=f,"byte array longer than desired length"),e(f>0,"Requested array length <= 0");var h=function(g,S){return g.allocUnsafe?g.allocUnsafe(S):new g(S)}(M,f);return this["_toArrayLike"+(d==="le"?"LE":"BE")](h,a),h},s.prototype._toArrayLikeLE=function(M,d){for(var o=0,a=0,f=0,h=0;f>8&255),o>16&255),h===6?(o>24&255),a=0,h=0):(a=g>>>24,h+=2)}if(o=0&&(M[o--]=g>>8&255),o>=0&&(M[o--]=g>>16&255),h===6?(o>=0&&(M[o--]=g>>24&255),a=0,h=0):(a=g>>>24,h+=2)}if(o>=0)for(M[o--]=a;o>=0;)M[o--]=0},Math.clz32?s.prototype._countBits=function(M){return 32-Math.clz32(M)}:s.prototype._countBits=function(M){var d=M,o=0;return d>=4096&&(o+=13,d>>>=13),d>=64&&(o+=7,d>>>=7),d>=8&&(o+=4,d>>>=4),d>=2&&(o+=2,d>>>=2),o+d},s.prototype._zeroBits=function(M){if(M===0)return 26;var d=M,o=0;return!(8191&d)&&(o+=13,d>>>=13),!(127&d)&&(o+=7,d>>>=7),!(15&d)&&(o+=4,d>>>=4),!(3&d)&&(o+=2,d>>>=2),!(1&d)&&o++,o},s.prototype.bitLength=function(){var M=this.words[this.length-1],d=this._countBits(M);return 26*(this.length-1)+d},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var M=0,d=0;dM.length?this.clone().ior(M):M.clone().ior(this)},s.prototype.uor=function(M){return this.length>M.length?this.clone().iuor(M):M.clone().iuor(this)},s.prototype.iuand=function(M){var d;d=this.length>M.length?M:this;for(var o=0;oM.length?this.clone().iand(M):M.clone().iand(this)},s.prototype.uand=function(M){return this.length>M.length?this.clone().iuand(M):M.clone().iuand(this)},s.prototype.iuxor=function(M){var d,o;this.length>M.length?(d=this,o=M):(d=M,o=this);for(var a=0;aM.length?this.clone().ixor(M):M.clone().ixor(this)},s.prototype.uxor=function(M){return this.length>M.length?this.clone().iuxor(M):M.clone().iuxor(this)},s.prototype.inotn=function(M){e(typeof M=="number"&&M>=0);var d=0|Math.ceil(M/26),o=M%26;this._expand(d),o>0&&d--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-o),this._strip()},s.prototype.notn=function(M){return this.clone().inotn(M)},s.prototype.setn=function(M,d){e(typeof M=="number"&&M>=0);var o=M/26|0,a=M%26;return this._expand(o+1),this.words[o]=d?this.words[o]|1<M.length?(o=this,a=M):(o=M,a=this);for(var f=0,h=0;h>>26;for(;f!==0&&h>>26;if(this.length=o.length,f!==0)this.words[this.length]=f,this.length++;else if(o!==this)for(;hM.length?this.clone().iadd(M):M.clone().iadd(this)},s.prototype.isub=function(M){if(M.negative!==0){M.negative=0;var d=this.iadd(M);return M.negative=1,d._normSign()}if(this.negative!==0)return this.negative=0,this.iadd(M),this.negative=1,this._normSign();var o,a,f=this.cmp(M);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;f>0?(o=this,a=M):(o=M,a=this);for(var h=0,g=0;g>26,this.words[g]=67108863&d;for(;h!==0&&g>26,this.words[g]=67108863&d;if(h===0&&g>>13,Z=0|g[1],F=8191&Z,q=Z>>>13,it=0|g[2],at=8191&it,Bt=it>>>13,yt=0|g[3],pt=8191&yt,Ft=yt>>>13,lt=0|g[4],ct=8191<,Tt=lt>>>13,kt=0|g[5],k=8191&kt,T=kt>>>13,L=0|g[6],j=8191&L,rt=L>>>13,Q=0|g[7],ot=8191&Q,qt=Q>>>13,It=0|g[8],xt=8191&It,Qt=It>>>13,Ct=0|g[9],Dt=8191&Ct,Se=Ct>>>13,te=0|S[0],Ut=8191&te,Te=te>>>13,J=0|S[1],X=8191&J,st=J>>>13,N=0|S[2],$=8191&N,gt=N>>>13,ft=0|S[3],mt=8191&ft,vt=ft>>>13,At=0|S[4],_t=8191&At,Gt=At>>>13,Rt=0|S[5],wt=8191&Rt,se=Rt>>>13,Lt=0|S[6],Et=8191&Lt,de=Lt>>>13,Pt=0|S[7],Mt=8191&Pt,K=Pt>>>13,Y=0|S[8],V=8191&Y,U=Y>>>13,W=0|S[9],et=8191&W,dt=W>>>13;o.negative=M.negative^d.negative,o.length=19;var ut=(y+(a=Math.imul(b,Ut))|0)+((8191&(f=(f=Math.imul(b,Te))+Math.imul(D,Ut)|0))<<13)|0;y=((h=Math.imul(D,Te))+(f>>>13)|0)+(ut>>>26)|0,ut&=67108863,a=Math.imul(F,Ut),f=(f=Math.imul(F,Te))+Math.imul(q,Ut)|0,h=Math.imul(q,Te);var ht=(y+(a=a+Math.imul(b,X)|0)|0)+((8191&(f=(f=f+Math.imul(b,st)|0)+Math.imul(D,X)|0))<<13)|0;y=((h=h+Math.imul(D,st)|0)+(f>>>13)|0)+(ht>>>26)|0,ht&=67108863,a=Math.imul(at,Ut),f=(f=Math.imul(at,Te))+Math.imul(Bt,Ut)|0,h=Math.imul(Bt,Te),a=a+Math.imul(F,X)|0,f=(f=f+Math.imul(F,st)|0)+Math.imul(q,X)|0,h=h+Math.imul(q,st)|0;var zt=(y+(a=a+Math.imul(b,$)|0)|0)+((8191&(f=(f=f+Math.imul(b,gt)|0)+Math.imul(D,$)|0))<<13)|0;y=((h=h+Math.imul(D,gt)|0)+(f>>>13)|0)+(zt>>>26)|0,zt&=67108863,a=Math.imul(pt,Ut),f=(f=Math.imul(pt,Te))+Math.imul(Ft,Ut)|0,h=Math.imul(Ft,Te),a=a+Math.imul(at,X)|0,f=(f=f+Math.imul(at,st)|0)+Math.imul(Bt,X)|0,h=h+Math.imul(Bt,st)|0,a=a+Math.imul(F,$)|0,f=(f=f+Math.imul(F,gt)|0)+Math.imul(q,$)|0,h=h+Math.imul(q,gt)|0;var Wt=(y+(a=a+Math.imul(b,mt)|0)|0)+((8191&(f=(f=f+Math.imul(b,vt)|0)+Math.imul(D,mt)|0))<<13)|0;y=((h=h+Math.imul(D,vt)|0)+(f>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,a=Math.imul(ct,Ut),f=(f=Math.imul(ct,Te))+Math.imul(Tt,Ut)|0,h=Math.imul(Tt,Te),a=a+Math.imul(pt,X)|0,f=(f=f+Math.imul(pt,st)|0)+Math.imul(Ft,X)|0,h=h+Math.imul(Ft,st)|0,a=a+Math.imul(at,$)|0,f=(f=f+Math.imul(at,gt)|0)+Math.imul(Bt,$)|0,h=h+Math.imul(Bt,gt)|0,a=a+Math.imul(F,mt)|0,f=(f=f+Math.imul(F,vt)|0)+Math.imul(q,mt)|0,h=h+Math.imul(q,vt)|0;var ye=(y+(a=a+Math.imul(b,_t)|0)|0)+((8191&(f=(f=f+Math.imul(b,Gt)|0)+Math.imul(D,_t)|0))<<13)|0;y=((h=h+Math.imul(D,Gt)|0)+(f>>>13)|0)+(ye>>>26)|0,ye&=67108863,a=Math.imul(k,Ut),f=(f=Math.imul(k,Te))+Math.imul(T,Ut)|0,h=Math.imul(T,Te),a=a+Math.imul(ct,X)|0,f=(f=f+Math.imul(ct,st)|0)+Math.imul(Tt,X)|0,h=h+Math.imul(Tt,st)|0,a=a+Math.imul(pt,$)|0,f=(f=f+Math.imul(pt,gt)|0)+Math.imul(Ft,$)|0,h=h+Math.imul(Ft,gt)|0,a=a+Math.imul(at,mt)|0,f=(f=f+Math.imul(at,vt)|0)+Math.imul(Bt,mt)|0,h=h+Math.imul(Bt,vt)|0,a=a+Math.imul(F,_t)|0,f=(f=f+Math.imul(F,Gt)|0)+Math.imul(q,_t)|0,h=h+Math.imul(q,Gt)|0;var Yt=(y+(a=a+Math.imul(b,wt)|0)|0)+((8191&(f=(f=f+Math.imul(b,se)|0)+Math.imul(D,wt)|0))<<13)|0;y=((h=h+Math.imul(D,se)|0)+(f>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Ut),f=(f=Math.imul(j,Te))+Math.imul(rt,Ut)|0,h=Math.imul(rt,Te),a=a+Math.imul(k,X)|0,f=(f=f+Math.imul(k,st)|0)+Math.imul(T,X)|0,h=h+Math.imul(T,st)|0,a=a+Math.imul(ct,$)|0,f=(f=f+Math.imul(ct,gt)|0)+Math.imul(Tt,$)|0,h=h+Math.imul(Tt,gt)|0,a=a+Math.imul(pt,mt)|0,f=(f=f+Math.imul(pt,vt)|0)+Math.imul(Ft,mt)|0,h=h+Math.imul(Ft,vt)|0,a=a+Math.imul(at,_t)|0,f=(f=f+Math.imul(at,Gt)|0)+Math.imul(Bt,_t)|0,h=h+Math.imul(Bt,Gt)|0,a=a+Math.imul(F,wt)|0,f=(f=f+Math.imul(F,se)|0)+Math.imul(q,wt)|0,h=h+Math.imul(q,se)|0;var pe=(y+(a=a+Math.imul(b,Et)|0)|0)+((8191&(f=(f=f+Math.imul(b,de)|0)+Math.imul(D,Et)|0))<<13)|0;y=((h=h+Math.imul(D,de)|0)+(f>>>13)|0)+(pe>>>26)|0,pe&=67108863,a=Math.imul(ot,Ut),f=(f=Math.imul(ot,Te))+Math.imul(qt,Ut)|0,h=Math.imul(qt,Te),a=a+Math.imul(j,X)|0,f=(f=f+Math.imul(j,st)|0)+Math.imul(rt,X)|0,h=h+Math.imul(rt,st)|0,a=a+Math.imul(k,$)|0,f=(f=f+Math.imul(k,gt)|0)+Math.imul(T,$)|0,h=h+Math.imul(T,gt)|0,a=a+Math.imul(ct,mt)|0,f=(f=f+Math.imul(ct,vt)|0)+Math.imul(Tt,mt)|0,h=h+Math.imul(Tt,vt)|0,a=a+Math.imul(pt,_t)|0,f=(f=f+Math.imul(pt,Gt)|0)+Math.imul(Ft,_t)|0,h=h+Math.imul(Ft,Gt)|0,a=a+Math.imul(at,wt)|0,f=(f=f+Math.imul(at,se)|0)+Math.imul(Bt,wt)|0,h=h+Math.imul(Bt,se)|0,a=a+Math.imul(F,Et)|0,f=(f=f+Math.imul(F,de)|0)+Math.imul(q,Et)|0,h=h+Math.imul(q,de)|0;var ve=(y+(a=a+Math.imul(b,Mt)|0)|0)+((8191&(f=(f=f+Math.imul(b,K)|0)+Math.imul(D,Mt)|0))<<13)|0;y=((h=h+Math.imul(D,K)|0)+(f>>>13)|0)+(ve>>>26)|0,ve&=67108863,a=Math.imul(xt,Ut),f=(f=Math.imul(xt,Te))+Math.imul(Qt,Ut)|0,h=Math.imul(Qt,Te),a=a+Math.imul(ot,X)|0,f=(f=f+Math.imul(ot,st)|0)+Math.imul(qt,X)|0,h=h+Math.imul(qt,st)|0,a=a+Math.imul(j,$)|0,f=(f=f+Math.imul(j,gt)|0)+Math.imul(rt,$)|0,h=h+Math.imul(rt,gt)|0,a=a+Math.imul(k,mt)|0,f=(f=f+Math.imul(k,vt)|0)+Math.imul(T,mt)|0,h=h+Math.imul(T,vt)|0,a=a+Math.imul(ct,_t)|0,f=(f=f+Math.imul(ct,Gt)|0)+Math.imul(Tt,_t)|0,h=h+Math.imul(Tt,Gt)|0,a=a+Math.imul(pt,wt)|0,f=(f=f+Math.imul(pt,se)|0)+Math.imul(Ft,wt)|0,h=h+Math.imul(Ft,se)|0,a=a+Math.imul(at,Et)|0,f=(f=f+Math.imul(at,de)|0)+Math.imul(Bt,Et)|0,h=h+Math.imul(Bt,de)|0,a=a+Math.imul(F,Mt)|0,f=(f=f+Math.imul(F,K)|0)+Math.imul(q,Mt)|0,h=h+Math.imul(q,K)|0;var ge=(y+(a=a+Math.imul(b,V)|0)|0)+((8191&(f=(f=f+Math.imul(b,U)|0)+Math.imul(D,V)|0))<<13)|0;y=((h=h+Math.imul(D,U)|0)+(f>>>13)|0)+(ge>>>26)|0,ge&=67108863,a=Math.imul(Dt,Ut),f=(f=Math.imul(Dt,Te))+Math.imul(Se,Ut)|0,h=Math.imul(Se,Te),a=a+Math.imul(xt,X)|0,f=(f=f+Math.imul(xt,st)|0)+Math.imul(Qt,X)|0,h=h+Math.imul(Qt,st)|0,a=a+Math.imul(ot,$)|0,f=(f=f+Math.imul(ot,gt)|0)+Math.imul(qt,$)|0,h=h+Math.imul(qt,gt)|0,a=a+Math.imul(j,mt)|0,f=(f=f+Math.imul(j,vt)|0)+Math.imul(rt,mt)|0,h=h+Math.imul(rt,vt)|0,a=a+Math.imul(k,_t)|0,f=(f=f+Math.imul(k,Gt)|0)+Math.imul(T,_t)|0,h=h+Math.imul(T,Gt)|0,a=a+Math.imul(ct,wt)|0,f=(f=f+Math.imul(ct,se)|0)+Math.imul(Tt,wt)|0,h=h+Math.imul(Tt,se)|0,a=a+Math.imul(pt,Et)|0,f=(f=f+Math.imul(pt,de)|0)+Math.imul(Ft,Et)|0,h=h+Math.imul(Ft,de)|0,a=a+Math.imul(at,Mt)|0,f=(f=f+Math.imul(at,K)|0)+Math.imul(Bt,Mt)|0,h=h+Math.imul(Bt,K)|0,a=a+Math.imul(F,V)|0,f=(f=f+Math.imul(F,U)|0)+Math.imul(q,V)|0,h=h+Math.imul(q,U)|0;var ie=(y+(a=a+Math.imul(b,et)|0)|0)+((8191&(f=(f=f+Math.imul(b,dt)|0)+Math.imul(D,et)|0))<<13)|0;y=((h=h+Math.imul(D,dt)|0)+(f>>>13)|0)+(ie>>>26)|0,ie&=67108863,a=Math.imul(Dt,X),f=(f=Math.imul(Dt,st))+Math.imul(Se,X)|0,h=Math.imul(Se,st),a=a+Math.imul(xt,$)|0,f=(f=f+Math.imul(xt,gt)|0)+Math.imul(Qt,$)|0,h=h+Math.imul(Qt,gt)|0,a=a+Math.imul(ot,mt)|0,f=(f=f+Math.imul(ot,vt)|0)+Math.imul(qt,mt)|0,h=h+Math.imul(qt,vt)|0,a=a+Math.imul(j,_t)|0,f=(f=f+Math.imul(j,Gt)|0)+Math.imul(rt,_t)|0,h=h+Math.imul(rt,Gt)|0,a=a+Math.imul(k,wt)|0,f=(f=f+Math.imul(k,se)|0)+Math.imul(T,wt)|0,h=h+Math.imul(T,se)|0,a=a+Math.imul(ct,Et)|0,f=(f=f+Math.imul(ct,de)|0)+Math.imul(Tt,Et)|0,h=h+Math.imul(Tt,de)|0,a=a+Math.imul(pt,Mt)|0,f=(f=f+Math.imul(pt,K)|0)+Math.imul(Ft,Mt)|0,h=h+Math.imul(Ft,K)|0,a=a+Math.imul(at,V)|0,f=(f=f+Math.imul(at,U)|0)+Math.imul(Bt,V)|0,h=h+Math.imul(Bt,U)|0;var ue=(y+(a=a+Math.imul(F,et)|0)|0)+((8191&(f=(f=f+Math.imul(F,dt)|0)+Math.imul(q,et)|0))<<13)|0;y=((h=h+Math.imul(q,dt)|0)+(f>>>13)|0)+(ue>>>26)|0,ue&=67108863,a=Math.imul(Dt,$),f=(f=Math.imul(Dt,gt))+Math.imul(Se,$)|0,h=Math.imul(Se,gt),a=a+Math.imul(xt,mt)|0,f=(f=f+Math.imul(xt,vt)|0)+Math.imul(Qt,mt)|0,h=h+Math.imul(Qt,vt)|0,a=a+Math.imul(ot,_t)|0,f=(f=f+Math.imul(ot,Gt)|0)+Math.imul(qt,_t)|0,h=h+Math.imul(qt,Gt)|0,a=a+Math.imul(j,wt)|0,f=(f=f+Math.imul(j,se)|0)+Math.imul(rt,wt)|0,h=h+Math.imul(rt,se)|0,a=a+Math.imul(k,Et)|0,f=(f=f+Math.imul(k,de)|0)+Math.imul(T,Et)|0,h=h+Math.imul(T,de)|0,a=a+Math.imul(ct,Mt)|0,f=(f=f+Math.imul(ct,K)|0)+Math.imul(Tt,Mt)|0,h=h+Math.imul(Tt,K)|0,a=a+Math.imul(pt,V)|0,f=(f=f+Math.imul(pt,U)|0)+Math.imul(Ft,V)|0,h=h+Math.imul(Ft,U)|0;var fe=(y+(a=a+Math.imul(at,et)|0)|0)+((8191&(f=(f=f+Math.imul(at,dt)|0)+Math.imul(Bt,et)|0))<<13)|0;y=((h=h+Math.imul(Bt,dt)|0)+(f>>>13)|0)+(fe>>>26)|0,fe&=67108863,a=Math.imul(Dt,mt),f=(f=Math.imul(Dt,vt))+Math.imul(Se,mt)|0,h=Math.imul(Se,vt),a=a+Math.imul(xt,_t)|0,f=(f=f+Math.imul(xt,Gt)|0)+Math.imul(Qt,_t)|0,h=h+Math.imul(Qt,Gt)|0,a=a+Math.imul(ot,wt)|0,f=(f=f+Math.imul(ot,se)|0)+Math.imul(qt,wt)|0,h=h+Math.imul(qt,se)|0,a=a+Math.imul(j,Et)|0,f=(f=f+Math.imul(j,de)|0)+Math.imul(rt,Et)|0,h=h+Math.imul(rt,de)|0,a=a+Math.imul(k,Mt)|0,f=(f=f+Math.imul(k,K)|0)+Math.imul(T,Mt)|0,h=h+Math.imul(T,K)|0,a=a+Math.imul(ct,V)|0,f=(f=f+Math.imul(ct,U)|0)+Math.imul(Tt,V)|0,h=h+Math.imul(Tt,U)|0;var ce=(y+(a=a+Math.imul(pt,et)|0)|0)+((8191&(f=(f=f+Math.imul(pt,dt)|0)+Math.imul(Ft,et)|0))<<13)|0;y=((h=h+Math.imul(Ft,dt)|0)+(f>>>13)|0)+(ce>>>26)|0,ce&=67108863,a=Math.imul(Dt,_t),f=(f=Math.imul(Dt,Gt))+Math.imul(Se,_t)|0,h=Math.imul(Se,Gt),a=a+Math.imul(xt,wt)|0,f=(f=f+Math.imul(xt,se)|0)+Math.imul(Qt,wt)|0,h=h+Math.imul(Qt,se)|0,a=a+Math.imul(ot,Et)|0,f=(f=f+Math.imul(ot,de)|0)+Math.imul(qt,Et)|0,h=h+Math.imul(qt,de)|0,a=a+Math.imul(j,Mt)|0,f=(f=f+Math.imul(j,K)|0)+Math.imul(rt,Mt)|0,h=h+Math.imul(rt,K)|0,a=a+Math.imul(k,V)|0,f=(f=f+Math.imul(k,U)|0)+Math.imul(T,V)|0,h=h+Math.imul(T,U)|0;var Kt=(y+(a=a+Math.imul(ct,et)|0)|0)+((8191&(f=(f=f+Math.imul(ct,dt)|0)+Math.imul(Tt,et)|0))<<13)|0;y=((h=h+Math.imul(Tt,dt)|0)+(f>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,a=Math.imul(Dt,wt),f=(f=Math.imul(Dt,se))+Math.imul(Se,wt)|0,h=Math.imul(Se,se),a=a+Math.imul(xt,Et)|0,f=(f=f+Math.imul(xt,de)|0)+Math.imul(Qt,Et)|0,h=h+Math.imul(Qt,de)|0,a=a+Math.imul(ot,Mt)|0,f=(f=f+Math.imul(ot,K)|0)+Math.imul(qt,Mt)|0,h=h+Math.imul(qt,K)|0,a=a+Math.imul(j,V)|0,f=(f=f+Math.imul(j,U)|0)+Math.imul(rt,V)|0,h=h+Math.imul(rt,U)|0;var oe=(y+(a=a+Math.imul(k,et)|0)|0)+((8191&(f=(f=f+Math.imul(k,dt)|0)+Math.imul(T,et)|0))<<13)|0;y=((h=h+Math.imul(T,dt)|0)+(f>>>13)|0)+(oe>>>26)|0,oe&=67108863,a=Math.imul(Dt,Et),f=(f=Math.imul(Dt,de))+Math.imul(Se,Et)|0,h=Math.imul(Se,de),a=a+Math.imul(xt,Mt)|0,f=(f=f+Math.imul(xt,K)|0)+Math.imul(Qt,Mt)|0,h=h+Math.imul(Qt,K)|0,a=a+Math.imul(ot,V)|0,f=(f=f+Math.imul(ot,U)|0)+Math.imul(qt,V)|0,h=h+Math.imul(qt,U)|0;var Jt=(y+(a=a+Math.imul(j,et)|0)|0)+((8191&(f=(f=f+Math.imul(j,dt)|0)+Math.imul(rt,et)|0))<<13)|0;y=((h=h+Math.imul(rt,dt)|0)+(f>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(Dt,Mt),f=(f=Math.imul(Dt,K))+Math.imul(Se,Mt)|0,h=Math.imul(Se,K),a=a+Math.imul(xt,V)|0,f=(f=f+Math.imul(xt,U)|0)+Math.imul(Qt,V)|0,h=h+Math.imul(Qt,U)|0;var le=(y+(a=a+Math.imul(ot,et)|0)|0)+((8191&(f=(f=f+Math.imul(ot,dt)|0)+Math.imul(qt,et)|0))<<13)|0;y=((h=h+Math.imul(qt,dt)|0)+(f>>>13)|0)+(le>>>26)|0,le&=67108863,a=Math.imul(Dt,V),f=(f=Math.imul(Dt,U))+Math.imul(Se,V)|0,h=Math.imul(Se,U);var ae=(y+(a=a+Math.imul(xt,et)|0)|0)+((8191&(f=(f=f+Math.imul(xt,dt)|0)+Math.imul(Qt,et)|0))<<13)|0;y=((h=h+Math.imul(Qt,dt)|0)+(f>>>13)|0)+(ae>>>26)|0,ae&=67108863;var ne=(y+(a=Math.imul(Dt,et))|0)+((8191&(f=(f=Math.imul(Dt,dt))+Math.imul(Se,et)|0))<<13)|0;return y=((h=Math.imul(Se,dt))+(f>>>13)|0)+(ne>>>26)|0,ne&=67108863,I[0]=ut,I[1]=ht,I[2]=zt,I[3]=Wt,I[4]=ye,I[5]=Yt,I[6]=pe,I[7]=ve,I[8]=ge,I[9]=ie,I[10]=ue,I[11]=fe,I[12]=ce,I[13]=Kt,I[14]=oe,I[15]=Jt,I[16]=le,I[17]=ae,I[18]=ne,y!==0&&(I[19]=y,o.length++),o};function B(M,d,o){o.negative=d.negative^M.negative,o.length=M.length+d.length;for(var a=0,f=0,h=0;h>>26)|0)>>>26,g&=67108863}o.words[h]=S,a=g,g=f}return a!==0?o.words[h]=a:o.length--,o._strip()}function P(M,d,o){return B(M,d,o)}Math.imul||(A=x),s.prototype.mulTo=function(M,d){var o=this.length+M.length;return this.length===10&&M.length===10?A(this,M,d):o<63?x(this,M,d):o<1024?B(this,M,d):P(this,M,d)},s.prototype.mul=function(M){var d=new s(null);return d.words=new Array(this.length+M.length),this.mulTo(M,d)},s.prototype.mulf=function(M){var d=new s(null);return d.words=new Array(this.length+M.length),P(this,M,d)},s.prototype.imul=function(M){return this.clone().mulTo(M,this)},s.prototype.imuln=function(M){var d=M<0;d&&(M=-M),e(typeof M=="number"),e(M<67108864);for(var o=0,a=0;a>=26,o+=f/67108864|0,o+=h>>>26,this.words[a]=67108863&h}return o!==0&&(this.words[a]=o,this.length++),d?this.ineg():this},s.prototype.muln=function(M){return this.clone().imuln(M)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(M){var d=function(h){for(var g=new Array(h.bitLength()),S=0;S>>y&1}return g}(M);if(d.length===0)return new s(1);for(var o=this,a=0;a=0);var d,o=M%26,a=(M-o)/26,f=67108863>>>26-o<<26-o;if(o!==0){var h=0;for(d=0;d>>26-o}h&&(this.words[d]=h,this.length++)}if(a!==0){for(d=this.length-1;d>=0;d--)this.words[d+a]=this.words[d];for(d=0;d=0),a=d?(d-d%26)/26:0;var f=M%26,h=Math.min((M-f)/26,this.length),g=67108863^67108863>>>f<h)for(this.length-=h,I=0;I=0&&(y!==0||I>=a);I--){var u=0|this.words[I];this.words[I]=y<<26-f|u>>>f,y=u&g}return S&&y!==0&&(S.words[S.length++]=y),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(M,d,o){return e(this.negative===0),this.iushrn(M,d,o)},s.prototype.shln=function(M){return this.clone().ishln(M)},s.prototype.ushln=function(M){return this.clone().iushln(M)},s.prototype.shrn=function(M){return this.clone().ishrn(M)},s.prototype.ushrn=function(M){return this.clone().iushrn(M)},s.prototype.testn=function(M){e(typeof M=="number"&&M>=0);var d=M%26,o=(M-d)/26,a=1<=0);var d=M%26,o=(M-d)/26;if(e(this.negative===0,"imaskn works only with positive numbers"),this.length<=o)return this;if(d!==0&&o++,this.length=Math.min(o,this.length),d!==0){var a=67108863^67108863>>>d<=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},s.prototype.isubn=function(M){if(e(typeof M=="number"),e(M<67108864),M<0)return this.iaddn(-M);if(this.negative!==0)return this.negative=0,this.iaddn(M),this.negative=1,this;if(this.words[0]-=M,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d>26)-(S/67108864|0),this.words[a+o]=67108863&f}for(;a>26,this.words[a+o]=67108863&f;if(g===0)return this._strip();for(e(g===-1),g=0,a=0;a>26,this.words[a]=67108863&f;return this.negative=1,this._strip()},s.prototype._wordDiv=function(M,d){var o=(this.length,M.length),a=this.clone(),f=M,h=0|f.words[f.length-1];(o=26-this._countBits(h))!=0&&(f=f.ushln(o),a.iushln(o),h=0|f.words[f.length-1]);var g,S=a.length-f.length;if(d!=="mod"){(g=new s(null)).length=S+1,g.words=new Array(g.length);for(var I=0;I=0;u--){var b=67108864*(0|a.words[f.length+u])+(0|a.words[f.length+u-1]);for(b=Math.min(b/h|0,67108863),a._ishlnsubmul(f,b,u);a.negative!==0;)b--,a.negative=0,a._ishlnsubmul(f,1,u),a.isZero()||(a.negative^=1);g&&(g.words[u]=b)}return g&&g._strip(),a._strip(),d!=="div"&&o!==0&&a.iushrn(o),{div:g||null,mod:a}},s.prototype.divmod=function(M,d,o){return e(!M.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:this.negative!==0&&M.negative===0?(h=this.neg().divmod(M,d),d!=="mod"&&(a=h.div.neg()),d!=="div"&&(f=h.mod.neg(),o&&f.negative!==0&&f.iadd(M)),{div:a,mod:f}):this.negative===0&&M.negative!==0?(h=this.divmod(M.neg(),d),d!=="mod"&&(a=h.div.neg()),{div:a,mod:h.mod}):this.negative&M.negative?(h=this.neg().divmod(M.neg(),d),d!=="div"&&(f=h.mod.neg(),o&&f.negative!==0&&f.isub(M)),{div:h.div,mod:f}):M.length>this.length||this.cmp(M)<0?{div:new s(0),mod:this}:M.length===1?d==="div"?{div:this.divn(M.words[0]),mod:null}:d==="mod"?{div:null,mod:new s(this.modrn(M.words[0]))}:{div:this.divn(M.words[0]),mod:new s(this.modrn(M.words[0]))}:this._wordDiv(M,d);var a,f,h},s.prototype.div=function(M){return this.divmod(M,"div",!1).div},s.prototype.mod=function(M){return this.divmod(M,"mod",!1).mod},s.prototype.umod=function(M){return this.divmod(M,"mod",!0).mod},s.prototype.divRound=function(M){var d=this.divmod(M);if(d.mod.isZero())return d.div;var o=d.div.negative!==0?d.mod.isub(M):d.mod,a=M.ushrn(1),f=M.andln(1),h=o.cmp(a);return h<0||f===1&&h===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},s.prototype.modrn=function(M){var d=M<0;d&&(M=-M),e(M<=67108863);for(var o=(1<<26)%M,a=0,f=this.length-1;f>=0;f--)a=(o*a+(0|this.words[f]))%M;return d?-a:a},s.prototype.modn=function(M){return this.modrn(M)},s.prototype.idivn=function(M){var d=M<0;d&&(M=-M),e(M<=67108863);for(var o=0,a=this.length-1;a>=0;a--){var f=(0|this.words[a])+67108864*o;this.words[a]=f/M|0,o=f%M}return this._strip(),d?this.ineg():this},s.prototype.divn=function(M){return this.clone().idivn(M)},s.prototype.egcd=function(M){e(M.negative===0),e(!M.isZero());var d=this,o=M.clone();d=d.negative!==0?d.umod(M):d.clone();for(var a=new s(1),f=new s(0),h=new s(0),g=new s(1),S=0;d.isEven()&&o.isEven();)d.iushrn(1),o.iushrn(1),++S;for(var I=o.clone(),y=d.clone();!d.isZero();){for(var u=0,b=1;!(d.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(d.iushrn(u);u-- >0;)(a.isOdd()||f.isOdd())&&(a.iadd(I),f.isub(y)),a.iushrn(1),f.iushrn(1);for(var D=0,Z=1;!(o.words[0]&Z)&&D<26;++D,Z<<=1);if(D>0)for(o.iushrn(D);D-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(I),g.isub(y)),h.iushrn(1),g.iushrn(1);d.cmp(o)>=0?(d.isub(o),a.isub(h),f.isub(g)):(o.isub(d),h.isub(a),g.isub(f))}return{a:h,b:g,gcd:o.iushln(S)}},s.prototype._invmp=function(M){e(M.negative===0),e(!M.isZero());var d=this,o=M.clone();d=d.negative!==0?d.umod(M):d.clone();for(var a,f=new s(1),h=new s(0),g=o.clone();d.cmpn(1)>0&&o.cmpn(1)>0;){for(var S=0,I=1;!(d.words[0]&I)&&S<26;++S,I<<=1);if(S>0)for(d.iushrn(S);S-- >0;)f.isOdd()&&f.iadd(g),f.iushrn(1);for(var y=0,u=1;!(o.words[0]&u)&&y<26;++y,u<<=1);if(y>0)for(o.iushrn(y);y-- >0;)h.isOdd()&&h.iadd(g),h.iushrn(1);d.cmp(o)>=0?(d.isub(o),f.isub(h)):(o.isub(d),h.isub(f))}return(a=d.cmpn(1)===0?f:h).cmpn(0)<0&&a.iadd(M),a},s.prototype.gcd=function(M){if(this.isZero())return M.abs();if(M.isZero())return this.abs();var d=this.clone(),o=M.clone();d.negative=0,o.negative=0;for(var a=0;d.isEven()&&o.isEven();a++)d.iushrn(1),o.iushrn(1);for(;;){for(;d.isEven();)d.iushrn(1);for(;o.isEven();)o.iushrn(1);var f=d.cmp(o);if(f<0){var h=d;d=o,o=h}else if(f===0||o.cmpn(1)===0)break;d.isub(o)}return o.iushln(a)},s.prototype.invm=function(M){return this.egcd(M).a.umod(M)},s.prototype.isEven=function(){return(1&this.words[0])==0},s.prototype.isOdd=function(){return(1&this.words[0])==1},s.prototype.andln=function(M){return this.words[0]&M},s.prototype.bincn=function(M){e(typeof M=="number");var d=M%26,o=(M-d)/26,a=1<>>26,g&=67108863,this.words[h]=g}return f!==0&&(this.words[h]=f,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(M){var d,o=M<0;if(this.negative!==0&&!o)return-1;if(this.negative===0&&o)return 1;if(this._strip(),this.length>1)d=1;else{o&&(M=-M),e(M<=67108863,"Number is too big");var a=0|this.words[0];d=a===M?0:aM.length)return 1;if(this.length=0;o--){var a=0|this.words[o],f=0|M.words[o];if(a!==f){af&&(d=1);break}}return d},s.prototype.gtn=function(M){return this.cmpn(M)===1},s.prototype.gt=function(M){return this.cmp(M)===1},s.prototype.gten=function(M){return this.cmpn(M)>=0},s.prototype.gte=function(M){return this.cmp(M)>=0},s.prototype.ltn=function(M){return this.cmpn(M)===-1},s.prototype.lt=function(M){return this.cmp(M)===-1},s.prototype.lten=function(M){return this.cmpn(M)<=0},s.prototype.lte=function(M){return this.cmp(M)<=0},s.prototype.eqn=function(M){return this.cmpn(M)===0},s.prototype.eq=function(M){return this.cmp(M)===0},s.red=function(M){return new nt(M)},s.prototype.toRed=function(M){return e(!this.red,"Already a number in reduction context"),e(this.negative===0,"red works only with positives"),M.convertTo(this)._forceRed(M)},s.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(M){return this.red=M,this},s.prototype.forceRed=function(M){return e(!this.red,"Already a number in reduction context"),this._forceRed(M)},s.prototype.redAdd=function(M){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,M)},s.prototype.redIAdd=function(M){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,M)},s.prototype.redSub=function(M){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,M)},s.prototype.redISub=function(M){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,M)},s.prototype.redShl=function(M){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,M)},s.prototype.redMul=function(M){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,M),this.red.mul(this,M)},s.prototype.redIMul=function(M){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,M),this.red.imul(this,M)},s.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(M){return e(this.red&&!M.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,M)};var R={k256:null,p224:null,p192:null,p25519:null};function C(M,d){this.name=M,this.p=new s(d,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function O(){C.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function z(){C.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function H(){C.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function tt(){C.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function nt(M){if(typeof M=="string"){var d=s._prime(M);this.m=d.p,this.prime=d}else e(M.gtn(1),"modulus must be greater than 1"),this.m=M,this.prime=null}function G(M){nt.call(this,M),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(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)}C.prototype._tmp=function(){var M=new s(null);return M.words=new Array(Math.ceil(this.n/13)),M},C.prototype.ireduce=function(M){var d,o=M;do this.split(o,this.tmp),d=(o=(o=this.imulK(o)).iadd(this.tmp)).bitLength();while(d>this.n);var a=d0?o.isub(this.p):o.strip!==void 0?o.strip():o._strip(),o},C.prototype.split=function(M,d){M.iushrn(this.n,0,d)},C.prototype.imulK=function(M){return M.imul(this.k)},n(O,C),O.prototype.split=function(M,d){for(var o=4194303,a=Math.min(M.length,9),f=0;f>>22,h=g}h>>>=22,M.words[f-10]=h,h===0&&M.length>10?M.length-=10:M.length-=9},O.prototype.imulK=function(M){M.words[M.length]=0,M.words[M.length+1]=0,M.length+=2;for(var d=0,o=0;o>>=26,M.words[o]=f,d=a}return d!==0&&(M.words[M.length++]=d),M},s._prime=function(M){if(R[M])return R[M];var d;if(M==="k256")d=new O;else if(M==="p224")d=new z;else if(M==="p192")d=new H;else{if(M!=="p25519")throw new Error("Unknown prime "+M);d=new tt}return R[M]=d,d},nt.prototype._verify1=function(M){e(M.negative===0,"red works only with positives"),e(M.red,"red works only with red numbers")},nt.prototype._verify2=function(M,d){e((M.negative|d.negative)==0,"red works only with positives"),e(M.red&&M.red===d.red,"red works only with red numbers")},nt.prototype.imod=function(M){return this.prime?this.prime.ireduce(M)._forceRed(this):(m(M,M.umod(this.m)._forceRed(this)),M)},nt.prototype.neg=function(M){return M.isZero()?M.clone():this.m.sub(M)._forceRed(this)},nt.prototype.add=function(M,d){this._verify2(M,d);var o=M.add(d);return o.cmp(this.m)>=0&&o.isub(this.m),o._forceRed(this)},nt.prototype.iadd=function(M,d){this._verify2(M,d);var o=M.iadd(d);return o.cmp(this.m)>=0&&o.isub(this.m),o},nt.prototype.sub=function(M,d){this._verify2(M,d);var o=M.sub(d);return o.cmpn(0)<0&&o.iadd(this.m),o._forceRed(this)},nt.prototype.isub=function(M,d){this._verify2(M,d);var o=M.isub(d);return o.cmpn(0)<0&&o.iadd(this.m),o},nt.prototype.shl=function(M,d){return this._verify1(M),this.imod(M.ushln(d))},nt.prototype.imul=function(M,d){return this._verify2(M,d),this.imod(M.imul(d))},nt.prototype.mul=function(M,d){return this._verify2(M,d),this.imod(M.mul(d))},nt.prototype.isqr=function(M){return this.imul(M,M.clone())},nt.prototype.sqr=function(M){return this.mul(M,M)},nt.prototype.sqrt=function(M){if(M.isZero())return M.clone();var d=this.m.andln(3);if(e(d%2==1),d===3){var o=this.m.add(new s(1)).iushrn(2);return this.pow(M,o)}for(var a=this.m.subn(1),f=0;!a.isZero()&&a.andln(1)===0;)f++,a.iushrn(1);e(!a.isZero());var h=new s(1).toRed(this),g=h.redNeg(),S=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,S).cmp(g)!==0;)I.redIAdd(g);for(var y=this.pow(I,a),u=this.pow(M,a.addn(1).iushrn(1)),b=this.pow(M,a),D=f;b.cmp(h)!==0;){for(var Z=b,F=0;Z.cmp(h)!==0;F++)Z=Z.redSqr();e(F=0;a--){for(var I=d.words[a],y=S-1;y>=0;y--){var u=I>>y&1;f!==o[0]&&(f=this.sqr(f)),u!==0||h!==0?(h<<=1,h|=u,(++g==4||a===0&&y===0)&&(f=this.mul(f,o[h]),g=0,h=0)):g=0}S=26}return f},nt.prototype.convertTo=function(M){var d=M.umod(this.m);return d===M?d.clone():d},nt.prototype.convertFrom=function(M){var d=M.clone();return d.red=null,d},s.mont=function(M){return new G(M)},n(G,nt),G.prototype.convertTo=function(M){return this.imod(M.ushln(this.shift))},G.prototype.convertFrom=function(M){var d=this.imod(M.mul(this.rinv));return d.red=null,d},G.prototype.imul=function(M,d){if(M.isZero()||d.isZero())return M.words[0]=0,M.length=1,M;var o=M.imul(d),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=o.isub(a).iushrn(this.shift),h=f;return f.cmp(this.m)>=0?h=f.isub(this.m):f.cmpn(0)<0&&(h=f.iadd(this.m)),h._forceRed(this)},G.prototype.mul=function(M,d){if(M.isZero()||d.isZero())return new s(0)._forceRed(this);var o=M.mul(d),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=o.isub(a).iushrn(this.shift),h=f;return f.cmp(this.m)>=0?h=f.isub(this.m):f.cmpn(0)<0&&(h=f.iadd(this.m)),h._forceRed(this)},G.prototype.invm=function(M){return this.imod(M._invmp(this.m).mul(this.r2))._forceRed(this)}})(lE,$e);var ay=lE.exports,Jc=Yi(ay),F2={exports:{}};(function(r,t){var e=Ae,n=e.Buffer;function s(c,l){for(var p in c)l[p]=c[p]}function i(c,l,p){return n(c,l,p)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?r.exports=e:(s(e,t),t.Buffer=i),i.prototype=Object.create(n.prototype),s(n,i),i.from=function(c,l,p){if(typeof c=="number")throw new TypeError("Argument must not be a number");return n(c,l,p)},i.alloc=function(c,l,p){if(typeof c!="number")throw new TypeError("Argument must be a number");var m=n(c);return l!==void 0?typeof p=="string"?m.fill(l,p):m.fill(l):m.fill(0),m},i.allocUnsafe=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return n(c)},i.allocUnsafeSlow=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return e.SlowBuffer(c)}})(F2,F2.exports);var h0=F2.exports.Buffer,uy=function(r){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),e=0;e>>0,B=new Uint8Array(A);_[E];){var P=t[_.charCodeAt(E)];if(P===255)return;for(var R=0,C=A-1;(P!==0||R>>0,B[C]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");x=R,E++}for(var O=A-x;O!==A&&B[O]===0;)O++;var z=h0.allocUnsafe(w+(A-O));z.fill(0,0,w);for(var H=w;O!==A;)z[H++]=B[O++];return z}return{encode:function(_){if((Array.isArray(_)||_ instanceof Uint8Array)&&(_=h0.from(_)),!h0.isBuffer(_))throw new TypeError("Expected Buffer");if(_.length===0)return"";for(var E=0,w=0,x=0,A=_.length;x!==A&&_[x]===0;)x++,E++;for(var B=(A-x)*m+1>>>0,P=new Uint8Array(B);x!==A;){for(var R=_[x],C=0,O=B-1;(R!==0||C>>0,P[O]=R%c>>>0,R=R/c>>>0;if(R!==0)throw new Error("Non-zero carry");w=C,x++}for(var z=B-w;z!==B&&P[z]===0;)z++;for(var H=l.repeat(E);zr&t^~r&e,Gz=(r,t,e)=>r&t^r&e^t&e,Yz=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]),Os=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Us=new Uint32Array(64);let Xz=class extends tE{constructor(){super(64,32,8,!1),this.A=0|Os[0],this.B=0|Os[1],this.C=0|Os[2],this.D=0|Os[3],this.E=0|Os[4],this.F=0|Os[5],this.G=0|Os[6],this.H=0|Os[7]}get(){const{A:t,B:e,C:n,D:s,E:i,F:c,G:l,H:p}=this;return[t,e,n,s,i,c,l,p]}set(t,e,n,s,i,c,l,p){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|s,this.E=0|i,this.F=0|c,this.G=0|l,this.H=0|p}process(t,e){for(let _=0;_<16;_++,e+=4)Us[_]=t.getUint32(e,!1);for(let _=16;_<64;_++){const E=Us[_-15],w=Us[_-2],x=go(E,7)^go(E,18)^E>>>3,A=go(w,17)^go(w,19)^w>>>10;Us[_]=A+Us[_-7]+x+Us[_-16]|0}let{A:n,B:s,C:i,D:c,E:l,F:p,G:m,H:v}=this;for(let _=0;_<64;_++){const E=v+(go(l,6)^go(l,11)^go(l,25))+Wz(l,p,m)+Yz[_]+Us[_]|0,w=(go(n,2)^go(n,13)^go(n,22))+Gz(n,s,i)|0;v=m,m=p,p=l,l=c+E|0,c=i,i=s,s=n,n=E+w|0}n=n+this.A|0,s=s+this.B|0,i=i+this.C|0,c=c+this.D|0,l=l+this.E|0,p=p+this.F|0,m=m+this.G|0,v=v+this.H|0,this.set(n,s,i,c,l,p,m,v)}roundClean(){Us.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const tu=ny(()=>new Xz);var Cn={},Jz=uy("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function vs(r,t,e){return t<=r&&r<=e}function gl(r){if(r===void 0)return{};if(r===Object(r))return r;throw TypeError("Could not convert argument to dictionary")}function j2(r){this.tokens=[].slice.call(r)}j2.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(r){if(Array.isArray(r))for(var t=r;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(r)},push:function(r){if(Array.isArray(r))for(var t=r;t.length;)this.tokens.push(t.shift());else this.tokens.push(r)}};var Ru=-1;function zp(r,t){if(r)throw TypeError("Decoder error");return t||65533}var yl="utf-8";function bl(r,t){if(!(this instanceof bl))return new bl(r,t);if((r=r!==void 0?String(r).toLowerCase():yl)!==yl)throw new Error("Encoding not supported. Only utf-8 is supported");t=gl(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function wl(r,t){if(!(this instanceof wl))return new wl(r,t);if((r=r!==void 0?String(r).toLowerCase():yl)!==yl)throw new Error("Encoding not supported. Only utf-8 is supported");t=gl(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}function Qz(r){var t=r.fatal,e=0,n=0,s=0,i=128,c=191;this.handler=function(l,p){if(p===-1&&s!==0)return s=0,zp(t);if(p===-1)return Ru;if(s===0){if(vs(p,0,127))return p;if(vs(p,194,223))s=1,e=p-192;else if(vs(p,224,239))p===224&&(i=160),p===237&&(c=159),s=2,e=p-224;else{if(!vs(p,240,244))return zp(t);p===240&&(i=144),p===244&&(c=143),s=3,e=p-240}return e<<=6*s,null}if(!vs(p,i,c))return e=s=n=0,i=128,c=191,l.prepend(p),zp(t);if(i=128,c=191,e+=p-128<<6*(s-(n+=1)),n!==s)return null;var m=e;return e=s=n=0,m}}function tq(r){r.fatal,this.handler=function(t,e){if(e===-1)return Ru;if(vs(e,0,127))return e;var n,s;vs(e,128,2047)?(n=1,s=192):vs(e,2048,65535)?(n=2,s=224):vs(e,65536,1114111)&&(n=3,s=240);for(var i=[(e>>6*n)+s];n>0;){var c=e>>6*(n-1);i.push(128|63&c),n-=1}return i}}bl.prototype={decode:function(r,t){var e;e=typeof r=="object"&&r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="object"&&"buffer"in r&&r.buffer instanceof ArrayBuffer?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(0),t=gl(t),this._streaming||(this._decoder=new Qz({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!t.stream;for(var n,s=new j2(e),i=[];!s.endOfStream()&&(n=this._decoder.handler(s,s.read()))!==Ru;)n!==null&&(Array.isArray(n)?i.push.apply(i,n):i.push(n));if(!this._streaming){do{if((n=this._decoder.handler(s,s.read()))===Ru)break;n!==null&&(Array.isArray(n)?i.push.apply(i,n):i.push(n))}while(!s.endOfStream());this._decoder=null}return i.length&&(["utf-8"].indexOf(this.encoding)===-1||this._ignoreBOM||this._BOMseen||(i[0]===65279?(this._BOMseen=!0,i.shift()):this._BOMseen=!0)),function(c){for(var l="",p=0;p>10),56320+(1023&m)))}return l}(i)}},wl.prototype={encode:function(r,t){r=r?String(r):"",t=gl(t),this._streaming||(this._encoder=new tq(this._options)),this._streaming=!!t.stream;for(var e,n=[],s=new j2(function(i){for(var c=String(i),l=c.length,p=0,m=[];p57343)m.push(v);else if(56320<=v&&v<=57343)m.push(65533);else if(55296<=v&&v<=56319)if(p===l-1)m.push(65533);else{var _=i.charCodeAt(p+1);if(56320<=_&&_<=57343){var E=1023&v,w=1023&_;m.push(65536+(E<<10)+w),p+=1}else m.push(65533)}p+=1}return m}(r));!s.endOfStream()&&(e=this._encoder.handler(s,s.read()))!==Ru;)Array.isArray(e)?n.push.apply(n,e):n.push(e);if(!this._streaming){for(;(e=this._encoder.handler(s,s.read()))!==Ru;)Array.isArray(e)?n.push.apply(n,e):n.push(e);this._encoder=null}return new Uint8Array(n)}};var eq=Oh(Object.freeze({__proto__:null,TextEncoder:wl,TextDecoder:bl})),rq=$e&&$e.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e),Object.defineProperty(r,n,{enumerable:!0,get:function(){return t[e]}})}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),nq=$e&&$e.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),yo=$e&&$e.__decorate||function(r,t,e,n){var s,i=arguments.length,c=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(r,t,e,n);else for(var l=r.length-1;l>=0;l--)(s=r[l])&&(c=(i<3?s(c):i>3?s(t,e,c):s(t,e))||c);return i>3&&c&&Object.defineProperty(t,e,c),c},iq=$e&&$e.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.hasOwnProperty.call(r,e)&&rq(t,r,e);return nq(t,r),t},pE=$e&&$e.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Cn,"__esModule",{value:!0});var mE=Cn.deserializeUnchecked=bE=Cn.deserialize=fy=Cn.serialize=Cn.BinaryReader=Cn.BinaryWriter=Cn.BorshError=Cn.baseDecode=Cn.baseEncode=void 0;const Hs=pE(ay),h5=pE(Jz),oq=iq(eq),sq=new(typeof TextDecoder!="function"?oq.TextDecoder:TextDecoder)("utf-8",{fatal:!0});Cn.baseEncode=function(r){return typeof r=="string"&&(r=Zt.Buffer.from(r,"utf8")),h5.default.encode(Zt.Buffer.from(r))},Cn.baseDecode=function(r){return Zt.Buffer.from(h5.default.decode(r))};const qp=1024;let Jn=class extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}};Cn.BorshError=Jn;let vE=class{constructor(){this.buf=Zt.Buffer.alloc(qp),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Zt.Buffer.concat([this.buf,Zt.Buffer.alloc(qp)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(Zt.Buffer.from(new Hs.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(Zt.Buffer.from(new Hs.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(Zt.Buffer.from(new Hs.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(Zt.Buffer.from(new Hs.default(t).toArray("le",64)))}writeBuffer(t){this.buf=Zt.Buffer.concat([Zt.Buffer.from(this.buf.subarray(0,this.length)),t,Zt.Buffer.alloc(qp)]),this.length+=t.length}writeString(t){this.maybeResize();const e=Zt.Buffer.from(t,"utf8");this.writeU32(e.length),this.writeBuffer(e)}writeFixedArray(t){this.writeBuffer(Zt.Buffer.from(t))}writeArray(t,e){this.maybeResize(),this.writeU32(t.length);for(const n of t)this.maybeResize(),e(n)}toArray(){return this.buf.subarray(0,this.length)}};function bo(r,t,e){const n=e.value;e.value=function(...s){try{return n.apply(this,s)}catch(i){if(i instanceof RangeError){const c=i.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(c)>=0)throw new Jn("Reached the end of buffer when deserializing")}throw i}}}Cn.BinaryWriter=vE;let gi=class{constructor(t){this.buf=t,this.offset=0}readU8(){const t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){const t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){const t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){const t=this.readBuffer(8);return new Hs.default(t,"le")}readU128(){const t=this.readBuffer(16);return new Hs.default(t,"le")}readU256(){const t=this.readBuffer(32);return new Hs.default(t,"le")}readU512(){const t=this.readBuffer(64);return new Hs.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new Jn(`Expected buffer length ${t} isn't within bounds`);const e=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,e}readString(){const t=this.readU32(),e=this.readBuffer(t);try{return sq.decode(e)}catch(n){throw new Jn(`Error decoding UTF-8 string: ${n}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){const e=this.readU32(),n=Array();for(let s=0;s{Ma(r,t,i,n[0],s)});else if(n.kind!==void 0)switch(n.kind){case"option":e==null?s.writeU8(0):(s.writeU8(1),Ma(r,t,e,n.type,s));break;case"map":s.writeU32(e.size),e.forEach((i,c)=>{Ma(r,t,c,n.key,s),Ma(r,t,i,n.value,s)});break;default:throw new Jn(`FieldType ${n} unrecognized`)}else yE(r,e,s)}catch(i){throw i instanceof Jn&&i.addToFieldPath(t),i}}function yE(r,t,e){if(typeof t.borshSerialize=="function")return void t.borshSerialize(e);const n=r.get(t.constructor);if(!n)throw new Jn(`Class ${t.constructor.name} is missing in schema`);if(n.kind==="struct")n.fields.map(([s,i])=>{Ma(r,s,t[s],i,e)});else{if(n.kind!=="enum")throw new Jn(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`);{const s=t[n.field];for(let i=0;iEa(r,t,e[0],n))}if(e.kind==="option")return n.readU8()?Ea(r,t,e.type,n):void 0;if(e.kind==="map"){let s=new Map;const i=n.readU32();for(let c=0;c=n.values.length)throw new Jn(`Enum index: ${s} is out of range`);const[i,c]=n.values[s];return new t({[i]:Ea(r,i,c,e)})}throw new Jn(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`)}var bE=Cn.deserialize=function(r,t,e,n=gi){const s=new n(e),i=cy(r,t,s);if(s.offsetthis.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}};function ly(r,t){return t.property?r+"["+t.property+"]":r}Ht.Layout=Cr,Ht.nameWithProperty=ly,Ht.bindConstructorLayout=function(r,t){if(typeof r!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(r,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Cr))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");r.layout_=t,t.boundConstructor_=r,t.makeDestinationObject=()=>new r,Object.defineProperty(r.prototype,"encode",{value(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(r,"decode",{value:(e,n)=>t.decode(e,n),writable:!0})};let ri=class extends Cr{isCount(){throw new Error("ExternalLayout is abstract")}};Ht.ExternalLayout=ri;class wE extends ri{constructor(t=1,e){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e=0){Rf(t);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}Ht.GreedyCount=wE;class dy extends ri{constructor(t,e=0,n){if(!(t instanceof Cr))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof ji||this.layout instanceof so}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,n=0){return this.layout.encode(t,e,n+this.offset)}}Ht.OffsetLayout=dy;class ji extends Cr{constructor(t,e){if(super(t,e),6c+s.encode(l,e,n+c),0);return this.count instanceof ri&&this.count.encode(t.length,e,n),i}}Ht.Sequence=BE;class PE extends Cr{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce((i,c)=>i&&c instanceof Cr,!0))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const i of t)if(0>i.span&&i.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let s=-1;try{s=t.reduce((i,c)=>i+c.getSpan(),0)}catch{}super(s,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce((s,i)=>{const c=i.getSpan(t,e);return e+=c,s+c},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e=0){Rf(t);const n=this.makeDestinationObject();for(const s of this.fields)if(s.property!==void 0&&(n[s.property]=s.decode(t,e)),e+=s.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n=0){const s=n;let i=0,c=0;for(const l of this.fields){let p=l.span;if(c=0p&&(p=l.getSpan(e,n)))}i=n,n+=p}return i+c-s}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?e=-1:0<=e&&(e+=n.span)}}}Ht.Structure=PE;class py{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,n){throw new Error("UnionDiscriminator is abstract")}}Ht.UnionDiscriminator=py;class xl extends py{constructor(t,e){if(!(t instanceof ri&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}Ht.UnionLayoutDiscriminator=xl;class my extends Cr{constructor(t,e,n){let s;if(t instanceof ji||t instanceof so)s=new xl(new dy(t));else if(t instanceof ri&&t.isCount())s=new xl(t);else{if(!(t instanceof py))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");s=t}if(e===void 0&&(e=null),!(e===null||e instanceof Cr))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&(t instanceof ji||t instanceof so)&&(i+=s.layout.span)),super(i,n),this.discriminator=s,this.usesPrefixDiscriminator=t instanceof ji||t instanceof so,this.defaultLayout=e,this.registry={};let c=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(l){return c(l)},this.configGetSourceVariant=function(l){c=l.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(n.property&&Object.prototype.hasOwnProperty.call(t,n.property))return n}throw new Error("unable to infer src variant")}decode(t,e=0){let n;const s=this.discriminator,i=s.decode(t,e),c=this.registry[i];if(c===void 0){const l=this.defaultLayout;let p=0;this.usesPrefixDiscriminator&&(p=s.layout.span),n=this.makeDestinationObject(),n[s.property]=i,n[l.property]=l.decode(t,e+p)}else n=c.decode(t,e);return n}encode(t,e,n=0){const s=this.getSourceVariant(t);if(s===void 0){const i=this.discriminator,c=this.defaultLayout;let l=0;return this.usesPrefixDiscriminator&&(l=i.layout.span),i.encode(t[i.property],e,n),l+c.encode(t[c.property],e,n+l)}return s.encode(t,e,n)}addVariant(t,e,n){const s=new RE(this,t,e,n);return this.registry[t]=s,s}getVariant(t,e=0){let n;return n=t instanceof Uint8Array?this.discriminator.decode(t,e):t,this.registry[n]}}Ht.Union=my;let RE=class extends Cr{constructor(t,e,n,s){if(!(t instanceof my))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&s===void 0&&(s=n,n=null),n){if(!(n instanceof Cr))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof s!="string")throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,s),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let s=0;return this.layout&&(s=this.layout.getSpan(t,e+n)),n+s}decode(t,e=0){const n=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let s=0;return this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+s):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n=0){let s=0;if(this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=s;if(this.layout&&(this.layout.encode(t[this.property],e,n+s),i+=this.layout.getSpan(e,n+s),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}};function Au(r){return 0>r&&(r+=4294967296),r}Ht.VariantLayout=RE;class vy extends Cr{constructor(t,e,n){if(!(t instanceof ji||t instanceof so))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof e=="string"&&n===void 0&&(n=e,e=!1),4=e)throw new TypeError("bits must be positive integer");const s=8*t.span,i=t.fields.reduce((c,l)=>c+l.bits,0);if(e+i>s)throw new Error("bits too long for span remainder ("+(s-i)+" of "+s+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(typeof t!="number"||!Number.isInteger(t)||t!==Au(t&this.valueMask))throw new TypeError(ly("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=Au(t<n&&(n=this.length.decode(t,e)),n}decode(t,e=0){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),_r(t).slice(e,e+n)}encode(t,e,n){let s=this.length;if(this.length instanceof ri&&(s=t.length),!(t instanceof Uint8Array&&s===t.length))throw new TypeError(ly("Blob.encode",this)+" requires (length "+s+") Uint8Array as src");if(n+s>e.length)throw new RangeError("encoding overruns Uint8Array");const i=_r(t);return _r(e).write(i.toString("hex"),n,s,"hex"),this.length instanceof ri&&this.length.encode(s,e,n),s}}Ht.Blob=TE;class LE extends Cr{constructor(t){super(-1,t)}getSpan(t,e=0){Rf(t);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");const c=_r(e);return s.copy(c,n),c[n+i]=0,i+1}}Ht.CString=LE;class OE extends Cr{constructor(t,e){if(typeof t=="string"&&e===void 0&&(e=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return Rf(t),t.length-e}decode(t,e=0){const n=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return s.copy(_r(e),n),i}}Ht.UTF8=OE;class UE extends Cr{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,n){return 0}}Ht.Constant=UE,Ht.greedy=(r,t)=>new wE(r,t);var Qs=Ht.offset=(r,t,e)=>new dy(r,t,e),or=Ht.u8=r=>new ji(1,r),Ni=Ht.u16=r=>new ji(2,r);Ht.u24=r=>new ji(3,r);var Ce=Ht.u32=r=>new ji(4,r);Ht.u40=r=>new ji(5,r),Ht.u48=r=>new ji(6,r);var In=Ht.nu64=r=>new xE(r);Ht.u16be=r=>new so(2,r),Ht.u24be=r=>new so(3,r),Ht.u32be=r=>new so(4,r),Ht.u40be=r=>new so(5,r),Ht.u48be=r=>new so(6,r),Ht.nu64be=r=>new _E(r),Ht.s8=r=>new wa(1,r),Ht.s16=r=>new wa(2,r),Ht.s24=r=>new wa(3,r),Ht.s32=r=>new wa(4,r),Ht.s40=r=>new wa(5,r),Ht.s48=r=>new wa(6,r);var xi=Ht.ns64=r=>new ME(r);Ht.s16be=r=>new Eu(2,r),Ht.s24be=r=>new Eu(3,r),Ht.s32be=r=>new Eu(4,r),Ht.s40be=r=>new Eu(5,r),Ht.s48be=r=>new Eu(6,r),Ht.ns64be=r=>new EE(r),Ht.f32=r=>new AE(r),Ht.f32be=r=>new SE(r),Ht.f64=r=>new kE(r),Ht.f64be=r=>new IE(r);var Ue=Ht.struct=(r,t,e)=>new PE(r,t,e);Ht.bits=(r,t,e)=>new vy(r,t,e);var On=Ht.seq=(r,t,e)=>new BE(r,t,e);Ht.union=(r,t,e)=>new my(r,t,e),Ht.unionLayoutDiscriminator=(r,t)=>new xl(r,t);var Or=Ht.blob=(r,t)=>new TE(r,t);Ht.cstr=r=>new LE(r),Ht.utf8=(r,t)=>new OE(r,t),Ht.constant=(r,t)=>new UE(r,t);var Uh={};Object.defineProperty(Uh,"__esModule",{value:!0});var NE=Uh.toBigIntLE=function(r){{const t=Zt.Buffer.from(r);t.reverse();const e=t.toString("hex");return e.length===0?BigInt(0):BigInt(`0x${e}`)}};Uh.toBigIntBE=function(r){{const t=r.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}};var Fp,yy=Uh.toBufferLE=function(r,t){{const e=r.toString(16),n=Zt.Buffer.from(e.padStart(2*t,"0").slice(0,2*t),"hex");return n.reverse(),n}};Uh.toBufferBE=function(r,t){{const e=r.toString(16);return Zt.Buffer.from(e.padStart(2*t,"0").slice(0,2*t),"hex")}};class aq extends TypeError{constructor(t,e){let n;const{message:s,...i}=t,{path:c}=t;super(c.length===0?s:"At path: "+c.join(".")+" -- "+s),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var l;return(l=n)!=null?l:n=[t,...e()]}}}function ta(r){return typeof r=="object"&&r!=null}function co(r){return typeof r=="string"?JSON.stringify(r):""+r}function uq(r,t,e,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:s,branch:i}=t,{type:c}=e,{refinement:l,message:p="Expected a value of type `"+c+"`"+(l?" with refinement `"+l+"`":"")+", but received: `"+co(n)+"`"}=r;return{value:n,type:c,refinement:l,key:s[s.length-1],path:s,branch:i,...r,message:p}}function*l5(r,t,e,n){(function(s){return ta(s)&&typeof s[Symbol.iterator]=="function"})(r)||(r=[r]);for(const s of r){const i=uq(s,t,e,n);i&&(yield i)}}function*by(r,t,e={}){const{path:n=[],branch:s=[r],coerce:i=!1,mask:c=!1}=e,l={path:n,branch:s};if(i&&(r=t.coercer(r,l),c&&t.type!=="type"&&ta(t.schema)&&ta(r)&&!Array.isArray(r)))for(const m in r)t.schema[m]===void 0&&delete r[m];let p=!0;for(const m of t.validator(r,l))p=!1,yield[m,void 0];for(let[m,v,_]of t.entries(r,l)){const E=by(v,_,{path:m===void 0?n:[...n,m],branch:m===void 0?s:[...s,v],coerce:i,mask:c});for(const w of E)w[0]?(p=!1,yield[w[0],void 0]):i&&(v=w[1],m===void 0?r=v:r instanceof Map?r.set(m,v):r instanceof Set?r.add(v):ta(r)&&(r[m]=v))}if(p)for(const m of t.refiner(r,l))p=!1,yield[m,void 0];p&&(yield[void 0,r])}class Qo{constructor(t){const{type:e,schema:n,validator:s,refiner:i,coercer:c=p=>p,entries:l=function*(){}}=t;this.type=e,this.schema=n,this.entries=l,this.coercer=c,this.validator=s?(p,m)=>l5(s(p,m),m,this,p):()=>[],this.refiner=i?(p,m)=>l5(i(p,m),m,this,p):()=>[]}assert(t){return DE(t,this)}create(t){return Ee(t,this)}is(t){return zE(t,this)}mask(t){return function(e,n){const s=Qc(e,n,{coerce:!0,mask:!0});if(s[0])throw s[0];return s[1]}(t,this)}validate(t,e={}){return Qc(t,this,e)}}function DE(r,t){const e=Qc(r,t);if(e[0])throw e[0]}function Ee(r,t){const e=Qc(r,t,{coerce:!0});if(e[0])throw e[0];return e[1]}function zE(r,t){return!Qc(r,t)[0]}function Qc(r,t,e={}){const n=by(r,t,e),s=function(i){const{done:c,value:l}=i.next();return c?void 0:l}(n);return s[0]?[new aq(s[0],function*(){for(const c of n)c[0]&&(yield c[0])}),void 0]:[void 0,s[1]]}function uu(r,t){return new Qo({type:r,schema:null,validator:t})}function Ie(r){return new Qo({type:"array",schema:r,*entries(t){if(r&&Array.isArray(t))for(const[e,n]of t.entries())yield[e,n,r]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||"Expected an array value, but received: "+co(t)})}function Go(){return uu("boolean",r=>typeof r=="boolean")}function wy(r){return uu("instance",t=>t instanceof r||"Expected a `"+r.name+"` instance, but received: "+co(t))}function Wr(r){const t=co(r),e=typeof r;return new Qo({type:"literal",schema:e==="string"||e==="number"||e==="boolean"?r:null,validator:n=>n===r||"Expected the literal `"+t+"`, but received: "+co(n)})}function ke(r){return new Qo({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function jt(){return uu("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+co(r))}function Ve(r){return new Qo({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function qE(r,t){return new Qo({type:"record",schema:null,*entries(e){if(ta(e))for(const n in e){const s=e[n];yield[n,n,r],yield[n,s,t]}},validator:e=>ta(e)||"Expected an object, but received: "+co(e)})}function _e(){return uu("string",r=>typeof r=="string"||"Expected a string, but received: "+co(r))}function xy(r){const t=uu("never",()=>!1);return new Qo({type:"tuple",schema:null,*entries(e){if(Array.isArray(e)){const n=Math.max(r.length,e.length);for(let s=0;sArray.isArray(e)||"Expected an array, but received: "+co(e)})}function we(r){const t=Object.keys(r);return new Qo({type:"type",schema:r,*entries(e){if(ta(e))for(const n of t)yield[n,e[n],r[n]]},validator:e=>ta(e)||"Expected an object, but received: "+co(e)})}function ci(r){const t=r.map(e=>e.type).join(" | ");return new Qo({type:"union",schema:null,validator(e,n){const s=[];for(const i of r){const[...c]=by(e,i,n),[l]=c;if(!l[0])return[];for(const[p]of c)p&&s.push(p)}return["Expected the value to satisfy a union of `"+t+"`, but received: "+co(e),...s]}})}function Nh(){return uu("unknown",()=>!0)}function Dh(r,t,e){return new Qo({...r,coercer:(n,s)=>zE(n,t)?r.coercer(e(n,s),s):r.coercer(n,s)})}var fq=new Uint8Array(16);function d5(){if(!Fp&&!(Fp=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Fp(fq)}var cq=/^(?:[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 _l(r){return typeof r=="string"&&cq.test(r)}for(var p5,jp,Sn=[],Kp=0;Kp<256;++Kp)Sn.push((Kp+256).toString(16).substr(1));function X0(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(Sn[r[t+0]]+Sn[r[t+1]]+Sn[r[t+2]]+Sn[r[t+3]]+"-"+Sn[r[t+4]]+Sn[r[t+5]]+"-"+Sn[r[t+6]]+Sn[r[t+7]]+"-"+Sn[r[t+8]]+Sn[r[t+9]]+"-"+Sn[r[t+10]]+Sn[r[t+11]]+Sn[r[t+12]]+Sn[r[t+13]]+Sn[r[t+14]]+Sn[r[t+15]]).toLowerCase();if(!_l(e))throw TypeError("Stringified UUID is invalid");return e}var $p=0,Hp=0;function FE(r){if(!_l(r))throw TypeError("Invalid UUID");var t,e=new Uint8Array(16);return e[0]=(t=parseInt(r.slice(0,8),16))>>>24,e[1]=t>>>16&255,e[2]=t>>>8&255,e[3]=255&t,e[4]=(t=parseInt(r.slice(9,13),16))>>>8,e[5]=255&t,e[6]=(t=parseInt(r.slice(14,18),16))>>>8,e[7]=255&t,e[8]=(t=parseInt(r.slice(19,23),16))>>>8,e[9]=255&t,e[10]=(t=parseInt(r.slice(24,36),16))/1099511627776&255,e[11]=t/4294967296&255,e[12]=t>>>24&255,e[13]=t>>>16&255,e[14]=t>>>8&255,e[15]=255&t,e}function jE(r,t,e){function n(s,i,c,l){if(typeof s=="string"&&(s=function(v){v=unescape(encodeURIComponent(v));for(var _=[],E=0;E>>9<<4)+1}function Vs(r,t){var e=(65535&r)+(65535&t);return(r>>16)+(t>>16)+(e>>16)<<16|65535&e}function xd(r,t,e,n,s,i){return Vs((c=Vs(Vs(t,r),Vs(n,i)))<<(l=s)|c>>>32-l,e);var c,l}function Kn(r,t,e,n,s,i,c){return xd(t&e|~t&n,r,t,s,i,c)}function $n(r,t,e,n,s,i,c){return xd(t&n|e&~n,r,t,s,i,c)}function Hn(r,t,e,n,s,i,c){return xd(t^e^n,r,t,s,i,c)}function Vn(r,t,e,n,s,i,c){return xd(e^(t|~n),r,t,s,i,c)}var hq=jE("v3",48,function(r){if(typeof r=="string"){var t=unescape(encodeURIComponent(r));r=new Uint8Array(t.length);for(var e=0;e>5]>>>l%32&255,m=parseInt(c.charAt(p>>>4&15)+c.charAt(15&p),16);s.push(m)}return s}(function(n,s){n[s>>5]|=128<>5]|=(255&n[c/8])<>>32-t}var pq=jE("v5",80,function(r){var t=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof r=="string"){var n=unescape(encodeURIComponent(r));r=[];for(var s=0;s>>0;C=R,R=P,P=Vp(B,30)>>>0,B=A,A=H}e[0]=e[0]+A>>>0,e[1]=e[1]+B>>>0,e[2]=e[2]+P>>>0,e[3]=e[3]+R>>>0,e[4]=e[4]+C>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,255&e[0],e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,255&e[1],e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,255&e[2],e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,255&e[3],e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,255&e[4]]}),mq=pq,vq=Object.freeze({__proto__:null,v1:function(r,t,e){var n=t&&e||0,s=t||new Array(16),i=(r=r||{}).node||p5,c=r.clockseq!==void 0?r.clockseq:jp;if(i==null||c==null){var l=r.random||(r.rng||d5)();i==null&&(i=p5=[1|l[0],l[1],l[2],l[3],l[4],l[5]]),c==null&&(c=jp=16383&(l[6]<<8|l[7]))}var p=r.msecs!==void 0?r.msecs:Date.now(),m=r.nsecs!==void 0?r.nsecs:Hp+1,v=p-$p+(m-Hp)/1e4;if(v<0&&r.clockseq===void 0&&(c=c+1&16383),(v<0||p>$p)&&r.nsecs===void 0&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");$p=p,Hp=m,jp=c;var _=(1e4*(268435455&(p+=122192928e5))+m)%4294967296;s[n++]=_>>>24&255,s[n++]=_>>>16&255,s[n++]=_>>>8&255,s[n++]=255&_;var E=p/4294967296*1e4&268435455;s[n++]=E>>>8&255,s[n++]=255&E,s[n++]=E>>>24&15|16,s[n++]=E>>>16&255,s[n++]=c>>>8|128,s[n++]=255&c;for(var w=0;w<6;++w)s[n+w]=i[w];return t||X0(s)},v3:lq,v4:function(r,t,e){var n=(r=r||{}).random||(r.rng||d5)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){e=e||0;for(var s=0;s<16;++s)t[e+s]=n[s];return t}return X0(n)},v5:mq,NIL:"00000000-0000-0000-0000-000000000000",version:function(r){if(!_l(r))throw TypeError("Invalid UUID");return parseInt(r.substr(14,1),16)},validate:_l,stringify:X0,parse:FE}),KE=Oh(vq);const gq=KE.v4;var yq=function(r,t,e,n){if(typeof r!="string")throw new TypeError(r+" must be a string");const s=typeof(n=n||{}).version=="number"?n.version:2;if(s!==1&&s!==2)throw new TypeError(s+" must be 1 or 2");const i={method:r};if(s===2&&(i.jsonrpc="2.0"),t){if(typeof t!="object"&&!Array.isArray(t))throw new TypeError(t+" must be an object, array or omitted");i.params=t}if(e===void 0){const c=typeof n.generator=="function"?n.generator:function(){return gq()};i.id=c(i,n)}else s===2&&e===null?n.notificationIdNull&&(i.id=null):i.id=e;return i};const bq=KE.v4,wq=yq,th=function(r,t){if(!(this instanceof th))return new th(r,t);t||(t={}),this.options={reviver:t.reviver!==void 0?t.reviver:null,replacer:t.replacer!==void 0?t.replacer:null,generator:t.generator!==void 0?t.generator:function(){return bq()},version:t.version!==void 0?t.version:2,notificationIdNull:typeof t.notificationIdNull=="boolean"&&t.notificationIdNull},this.callServer=r};var xq=th;th.prototype.request=function(r,t,e,n){const s=this;let i=null;const c=Array.isArray(r)&&typeof t=="function";if(this.options.version===1&&c)throw new TypeError("JSON-RPC 1.0 does not support batching");if(c||!c&&r&&typeof r=="object"&&typeof t=="function")n=t,i=r;else{typeof e=="function"&&(n=e,e=void 0);const p=typeof n=="function";try{i=wq(r,t,e,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(m){if(p)return n(m);throw m}if(!p)return i}let l;try{l=JSON.stringify(i,this.options.replacer)}catch(p){return n(p)}return this.callServer(l,function(p,m){s._parseResponse(p,m,n)}),i},th.prototype._parseResponse=function(r,t,e){if(r)return void e(r);if(!t)return e();let n;try{n=JSON.parse(t,this.options.reviver)}catch(s){return e(s)}if(e.length===3){if(Array.isArray(n)){const s=function(c){return c.error!==void 0},i=function(c){return!s(c)};return e(null,n.filter(s),n.filter(i))}return e(null,n.error,n.result)}e(null,n)};var l0,_q=Yi(xq),$E={},HE={exports:{}};(l0=HE).exports=function(r){return r&&r.__esModule?r:{default:r}},l0.exports.__esModule=!0,l0.exports.default=l0.exports;var v5,g5,Zp,y5,VE=HE.exports,b5={exports:{}},w5={exports:{}};function zh(){return v5||(v5=1,function(r){function t(e){return r.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},r.exports.__esModule=!0,r.exports.default=r.exports,t(e)}r.exports=t,r.exports.__esModule=!0,r.exports.default=r.exports}(w5)),w5.exports}function Mq(){if(y5)return Zp;y5=1;var r=(g5||(g5=1,function(t){var e=zh().default;function n(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */t.exports=n=function(){return i},t.exports.__esModule=!0,t.exports.default=t.exports;var s,i={},c=Object.prototype,l=c.hasOwnProperty,p=Object.defineProperty||function(u,b,D){u[b]=D.value},m=typeof Symbol=="function"?Symbol:{},v=m.iterator||"@@iterator",_=m.asyncIterator||"@@asyncIterator",E=m.toStringTag||"@@toStringTag";function w(u,b,D){return Object.defineProperty(u,b,{value:D,enumerable:!0,configurable:!0,writable:!0}),u[b]}try{w({},"")}catch{w=function(b,D,Z){return b[D]=Z}}function x(u,b,D,Z){var F=b&&b.prototype instanceof z?b:z,q=Object.create(F.prototype),it=new I(Z||[]);return p(q,"_invoke",{value:f(u,D,it)}),q}function A(u,b,D){try{return{type:"normal",arg:u.call(b,D)}}catch(Z){return{type:"throw",arg:Z}}}i.wrap=x;var B="suspendedStart",P="suspendedYield",R="executing",C="completed",O={};function z(){}function H(){}function tt(){}var nt={};w(nt,v,function(){return this});var G=Object.getPrototypeOf,M=G&&G(G(y([])));M&&M!==c&&l.call(M,v)&&(nt=M);var d=tt.prototype=z.prototype=Object.create(nt);function o(u){["next","throw","return"].forEach(function(b){w(u,b,function(D){return this._invoke(b,D)})})}function a(u,b){function D(F,q,it,at){var Bt=A(u[F],u,q);if(Bt.type!=="throw"){var yt=Bt.arg,pt=yt.value;return pt&&e(pt)=="object"&&l.call(pt,"__await")?b.resolve(pt.__await).then(function(Ft){D("next",Ft,it,at)},function(Ft){D("throw",Ft,it,at)}):b.resolve(pt).then(function(Ft){yt.value=Ft,it(yt)},function(Ft){return D("throw",Ft,it,at)})}at(Bt.arg)}var Z;p(this,"_invoke",{value:function(F,q){function it(){return new b(function(at,Bt){D(F,q,at,Bt)})}return Z=Z?Z.then(it,it):it()}})}function f(u,b,D){var Z=B;return function(F,q){if(Z===R)throw new Error("Generator is already running");if(Z===C){if(F==="throw")throw q;return{value:s,done:!0}}for(D.method=F,D.arg=q;;){var it=D.delegate;if(it){var at=h(it,D);if(at){if(at===O)continue;return at}}if(D.method==="next")D.sent=D._sent=D.arg;else if(D.method==="throw"){if(Z===B)throw Z=C,D.arg;D.dispatchException(D.arg)}else D.method==="return"&&D.abrupt("return",D.arg);Z=R;var Bt=A(u,b,D);if(Bt.type==="normal"){if(Z=D.done?C:P,Bt.arg===O)continue;return{value:Bt.arg,done:D.done}}Bt.type==="throw"&&(Z=C,D.method="throw",D.arg=Bt.arg)}}}function h(u,b){var D=b.method,Z=u.iterator[D];if(Z===s)return b.delegate=null,D==="throw"&&u.iterator.return&&(b.method="return",b.arg=s,h(u,b),b.method==="throw")||D!=="return"&&(b.method="throw",b.arg=new TypeError("The iterator does not provide a '"+D+"' method")),O;var F=A(Z,u.iterator,b.arg);if(F.type==="throw")return b.method="throw",b.arg=F.arg,b.delegate=null,O;var q=F.arg;return q?q.done?(b[u.resultName]=q.value,b.next=u.nextLoc,b.method!=="return"&&(b.method="next",b.arg=s),b.delegate=null,O):q:(b.method="throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,O)}function g(u){var b={tryLoc:u[0]};1 in u&&(b.catchLoc=u[1]),2 in u&&(b.finallyLoc=u[2],b.afterLoc=u[3]),this.tryEntries.push(b)}function S(u){var b=u.completion||{};b.type="normal",delete b.arg,u.completion=b}function I(u){this.tryEntries=[{tryLoc:"root"}],u.forEach(g,this),this.reset(!0)}function y(u){if(u||u===""){var b=u[v];if(b)return b.call(u);if(typeof u.next=="function")return u;if(!isNaN(u.length)){var D=-1,Z=function F(){for(;++D=0;--Z){var F=this.tryEntries[Z],q=F.completion;if(F.tryLoc==="root")return D("end");if(F.tryLoc<=this.prev){var it=l.call(F,"catchLoc"),at=l.call(F,"finallyLoc");if(it&&at){if(this.prev=0;--D){var Z=this.tryEntries[D];if(Z.tryLoc<=this.prev&&l.call(Z,"finallyLoc")&&this.prev=0;--b){var D=this.tryEntries[b];if(D.finallyLoc===u)return this.complete(D.completion,D.afterLoc),S(D),O}},catch:function(u){for(var b=this.tryEntries.length-1;b>=0;--b){var D=this.tryEntries[b];if(D.tryLoc===u){var Z=D.completion;if(Z.type==="throw"){var F=Z.arg;S(D)}return F}}throw new Error("illegal catch attempt")},delegateYield:function(u,b,D){return this.delegate={iterator:y(u),resultName:b,nextLoc:D},this.method==="next"&&(this.arg=s),O}},i}t.exports=n,t.exports.__esModule=!0,t.exports.default=t.exports}(b5)),b5.exports)();Zp=r;try{regeneratorRuntime=r}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=r:Function("r","regeneratorRuntime = r")(r)}return Zp}var x5,_5={exports:{}},M5,E5={exports:{}};function ZE(){return M5||(M5=1,function(r){r.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},r.exports.__esModule=!0,r.exports.default=r.exports}(E5)),E5.exports}var A5,S5,k5,I5={exports:{}},B5={exports:{}},P5={exports:{}};function Eq(){return A5||(A5=1,function(r){var t=zh().default;r.exports=function(e,n){if(t(e)!=="object"||e===null)return e;var s=e[Symbol.toPrimitive];if(s!==void 0){var i=s.call(e,n||"default");if(t(i)!=="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(n==="string"?String:Number)(e)},r.exports.__esModule=!0,r.exports.default=r.exports}(P5)),P5.exports}function Aq(){return S5||(S5=1,function(r){var t=zh().default,e=Eq();r.exports=function(n){var s=e(n,"string");return t(s)==="symbol"?s:String(s)},r.exports.__esModule=!0,r.exports.default=r.exports}(B5)),B5.exports}function WE(){return k5||(k5=1,function(r){var t=Aq();function e(n,s){for(var i=0;i"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}}();return function(){var A,B=(0,m.default)(w);if(x){var P=(0,m.default)(this).constructor;A=Reflect.construct(B,arguments,P)}else A=B.apply(this,arguments);return(0,p.default)(this,A)}}var E=function(w){(0,l.default)(C,w);var x,A,B,P,R=_(C);function C(O){var z,H=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"ws://localhost:8080",tt=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},nt=arguments.length>3?arguments[3]:void 0;(0,i.default)(this,C);var G=tt.autoconnect,M=G===void 0||G,d=tt.reconnect,o=d===void 0||d,a=tt.reconnect_interval,f=a===void 0?1e3:a,h=tt.max_reconnects,g=h===void 0?5:h,S=function(I,y){var u={};for(var b in I)Object.prototype.hasOwnProperty.call(I,b)&&y.indexOf(b)<0&&(u[b]=I[b]);if(I!=null&&typeof Object.getOwnPropertySymbols=="function"){var D=0;for(b=Object.getOwnPropertySymbols(I);DH.current_reconnects||H.max_reconnects===0)&&(H.reconnect_timer_id=setTimeout(function(){return H._connect(O,z)},H.reconnect_interval)))})}}]),C}(v.EventEmitter);r.default=E})($E);var Iq=Yi($E),JE={};(function(r){var t=VE;Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(m,v){return new p(m,v)};var e=t(ZE()),n=t(WE()),s=t(GE()),i=t(YE()),c=t(XE());function l(m){var v=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var _,E=(0,c.default)(m);if(v){var w=(0,c.default)(this).constructor;_=Reflect.construct(E,arguments,w)}else _=E.apply(this,arguments);return(0,i.default)(this,_)}}var p=function(m){(0,s.default)(_,m);var v=l(_);function _(E,w,x){var A;return(0,e.default)(this,_),(A=v.call(this)).socket=new window.WebSocket(E,x),A.socket.onopen=function(){return A.emit("open")},A.socket.onmessage=function(B){return A.emit("message",B.data)},A.socket.onerror=function(B){return A.emit("error",B)},A.socket.onclose=function(B){A.emit("close",B.code,B.reason)},A}return(0,n.default)(_,[{key:"send",value:function(E,w,x){var A=x||w;try{this.socket.send(E),A()}catch(B){A(B)}}},{key:"close",value:function(E,w){this.socket.close(E,w)}},{key:"addEventListener",value:function(E,w,x){this.socket.addEventListener(E,w,x)}}]),_}(_y().EventEmitter)})(JE);var Bq=Yi(JE);const[QE,tA,eA]=[[],[],[]],Pq=BigInt(0),oc=BigInt(1),Rq=BigInt(2),Cq=BigInt(7),Tq=BigInt(256),Lq=BigInt(113);for(let r=0,t=oc,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],QE.push(2*(5*n+e)),tA.push((r+1)*(r+2)/2%64);let s=Pq;for(let i=0;i<7;i++)t=(t<>Cq)*Lq)%Tq,t&Rq&&(s^=oc<<(oc<e>32?oE(r,t,e):nE(r,t,e),$5=(r,t,e)=>e>32?sE(r,t,e):iE(r,t,e);class My extends ry{constructor(t,e,n,s=!1,i=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=s,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,vl(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");var c;this.state=new Uint8Array(200),this.state32=(c=this.state,new Uint32Array(c.buffer,c.byteOffset,Math.floor(c.byteLength/4)))}keccak(){(function(t,e=24){const n=new Uint32Array(10);for(let s=24-e;s<24;s++){for(let l=0;l<10;l++)n[l]=t[l]^t[l+10]^t[l+20]^t[l+30]^t[l+40];for(let l=0;l<10;l+=2){const p=(l+8)%10,m=(l+2)%10,v=n[m],_=n[m+1],E=K5(v,_,1)^n[p],w=$5(v,_,1)^n[p+1];for(let x=0;x<50;x+=10)t[l+x]^=E,t[l+x+1]^=w}let i=t[2],c=t[3];for(let l=0;l<24;l++){const p=tA[l],m=K5(i,c,p),v=$5(i,c,p),_=QE[l];i=t[_],c=t[_+1],t[_]=m,t[_+1]=v}for(let l=0;l<50;l+=10){for(let p=0;p<10;p++)n[p]=t[l+p];for(let p=0;p<10;p++)t[l+p]^=~n[(p+2)%10]&n[(p+4)%10]}t[0]^=Oq[s],t[1]^=Uq[s]}n.fill(0)})(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){uf(this);const{blockLen:e,state:n}=this,s=(t=gd(t)).length;for(let i=0;i=n&&this.keccak();const c=Math.min(n-this.posOut,i-s);t.set(e.subarray(this.posOut,this.posOut+c),s),this.posOut+=c,s+=c}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return vl(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(XM(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:s,rounds:i,enableXOF:c}=this;return t||(t=new My(e,n,s,c,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=n,t.outputLen=s,t.enableXOF=c,t.destroyed=this.destroyed,t}}const H5=((r,t,e)=>ny(()=>new My(t,r,e)))(1,136,32),{bytesToNumberBE:Nq,hexToBytes:Dq}=Tz,Oa={Err:class extends Error{constructor(r=""){super(r)}},_parseInt(r){const{Err:t}=Oa;if(r.length<2||r[0]!==2)throw new t("Invalid signature integer tag");const e=r[1],n=r.subarray(2,e+2);if(!e||n.length!==e)throw new t("Invalid signature integer: wrong length");if(128&n[0])throw new t("Invalid signature integer: negative");if(n[0]===0&&!(128&n[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:Nq(n),l:r.subarray(e+2)}},toSig(r){const{Err:t}=Oa,e=typeof r=="string"?Dq(r):r;if(!(e instanceof Uint8Array))throw new Error("ui8a expected");let n=e.length;if(n<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==n-2)throw new t("Invalid signature: incorrect length");const{d:s,l:i}=Oa._parseInt(e.subarray(2)),{d:c,l}=Oa._parseInt(i);if(l.length)throw new t("Invalid signature: left bytes after parsing");return{r:s,s:c}},hexFromSig(r){const t=m=>8&Number.parseInt(m[0],16)?"00"+m:m,e=m=>{const v=m.toString(16);return 1&v.length?`0${v}`:v},n=t(e(r.s)),s=t(e(r.r)),i=n.length/2,c=s.length/2,l=e(i),p=e(c);return`30${e(c+i+4)}02${p}${s}02${l}${n}`}},gs=BigInt(0),Ui=BigInt(1);BigInt(2);const V5=BigInt(3);function zq(r){const t=function(x){const A=sy(x);cf(A,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:B,Fp:P,a:R}=A;if(B){if(!P.eql(R,P.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof B!="object"||typeof B.beta!="bigint"||typeof B.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...A})}(r),{Fp:e}=t,n=t.toBytes||((x,A,B)=>{const P=A.toAffine();return Qa(Uint8Array.from([4]),e.toBytes(P.x),e.toBytes(P.y))}),s=t.fromBytes||(x=>{const A=x.subarray(1);return{x:e.fromBytes(A.subarray(0,e.BYTES)),y:e.fromBytes(A.subarray(e.BYTES,2*e.BYTES))}});function i(x){const{a:A,b:B}=t,P=e.sqr(x),R=e.mul(P,x);return e.add(e.add(R,e.mul(x,A)),B)}if(!e.eql(e.sqr(t.Gy),i(t.Gx)))throw new Error("bad generator point: equation left != right");function c(x){return typeof x=="bigint"&&gse.eql(C,e.ZERO);return R(B)&&R(P)?_.ZERO:new _(B,P,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(A){const B=e.invertBatch(A.map(P=>P.pz));return A.map((P,R)=>P.toAffine(B[R])).map(_.fromAffine)}static fromHex(A){const B=_.fromAffine(s(mn("pointHex",A)));return B.assertValidity(),B}static fromPrivateKey(A){return _.BASE.multiply(p(A))}_setWindowSize(A){this._WINDOW_SIZE=A,m.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:A,y:B}=this.toAffine();if(!e.isValid(A)||!e.isValid(B))throw new Error("bad point: x or y not FE");const P=e.sqr(B),R=i(A);if(!e.eql(P,R))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:A}=this.toAffine();if(e.isOdd)return!e.isOdd(A);throw new Error("Field doesn't support isOdd")}equals(A){v(A);const{px:B,py:P,pz:R}=this,{px:C,py:O,pz:z}=A,H=e.eql(e.mul(B,z),e.mul(C,R)),tt=e.eql(e.mul(P,z),e.mul(O,R));return H&&tt}negate(){return new _(this.px,e.neg(this.py),this.pz)}double(){const{a:A,b:B}=t,P=e.mul(B,V5),{px:R,py:C,pz:O}=this;let z=e.ZERO,H=e.ZERO,tt=e.ZERO,nt=e.mul(R,R),G=e.mul(C,C),M=e.mul(O,O),d=e.mul(R,C);return d=e.add(d,d),tt=e.mul(R,O),tt=e.add(tt,tt),z=e.mul(A,tt),H=e.mul(P,M),H=e.add(z,H),z=e.sub(G,H),H=e.add(G,H),H=e.mul(z,H),z=e.mul(d,z),tt=e.mul(P,tt),M=e.mul(A,M),d=e.sub(nt,M),d=e.mul(A,d),d=e.add(d,tt),tt=e.add(nt,nt),nt=e.add(tt,nt),nt=e.add(nt,M),nt=e.mul(nt,d),H=e.add(H,nt),M=e.mul(C,O),M=e.add(M,M),nt=e.mul(M,d),z=e.sub(z,nt),tt=e.mul(M,G),tt=e.add(tt,tt),tt=e.add(tt,tt),new _(z,H,tt)}add(A){v(A);const{px:B,py:P,pz:R}=this,{px:C,py:O,pz:z}=A;let H=e.ZERO,tt=e.ZERO,nt=e.ZERO;const G=t.a,M=e.mul(t.b,V5);let d=e.mul(B,C),o=e.mul(P,O),a=e.mul(R,z),f=e.add(B,P),h=e.add(C,O);f=e.mul(f,h),h=e.add(d,o),f=e.sub(f,h),h=e.add(B,R);let g=e.add(C,z);return h=e.mul(h,g),g=e.add(d,a),h=e.sub(h,g),g=e.add(P,R),H=e.add(O,z),g=e.mul(g,H),H=e.add(o,a),g=e.sub(g,H),nt=e.mul(G,h),H=e.mul(M,a),nt=e.add(H,nt),H=e.sub(o,nt),nt=e.add(o,nt),tt=e.mul(H,nt),o=e.add(d,d),o=e.add(o,d),a=e.mul(G,a),h=e.mul(M,h),o=e.add(o,a),a=e.sub(d,a),a=e.mul(G,a),h=e.add(h,a),d=e.mul(o,h),tt=e.add(tt,d),d=e.mul(g,h),H=e.mul(f,H),H=e.sub(H,d),d=e.mul(f,o),nt=e.mul(g,nt),nt=e.add(nt,d),new _(H,tt,nt)}subtract(A){return this.add(A.negate())}is0(){return this.equals(_.ZERO)}wNAF(A){return w.wNAFCached(this,m,A,B=>{const P=e.invertBatch(B.map(R=>R.pz));return B.map((R,C)=>R.toAffine(P[C])).map(_.fromAffine)})}multiplyUnsafe(A){const B=_.ZERO;if(A===gs)return B;if(l(A),A===Ui)return this;const{endo:P}=t;if(!P)return w.unsafeLadder(this,A);let{k1neg:R,k1:C,k2neg:O,k2:z}=P.splitScalar(A),H=B,tt=B,nt=this;for(;C>gs||z>gs;)C&Ui&&(H=H.add(nt)),z&Ui&&(tt=tt.add(nt)),nt=nt.double(),C>>=Ui,z>>=Ui;return R&&(H=H.negate()),O&&(tt=tt.negate()),tt=new _(e.mul(tt.px,P.beta),tt.py,tt.pz),H.add(tt)}multiply(A){l(A);let B,P,R=A;const{endo:C}=t;if(C){const{k1neg:O,k1:z,k2neg:H,k2:tt}=C.splitScalar(R);let{p:nt,f:G}=this.wNAF(z),{p:M,f:d}=this.wNAF(tt);nt=w.constTimeNegate(O,nt),M=w.constTimeNegate(H,M),M=new _(e.mul(M.px,C.beta),M.py,M.pz),B=nt.add(M),P=G.add(d)}else{const{p:O,f:z}=this.wNAF(R);B=O,P=z}return _.normalizeZ([B,P])[0]}multiplyAndAddUnsafe(A,B,P){const R=_.BASE,C=(z,H)=>H!==gs&&H!==Ui&&z.equals(R)?z.multiply(H):z.multiplyUnsafe(H),O=C(this,B).add(C(A,P));return O.is0()?void 0:O}toAffine(A){const{px:B,py:P,pz:R}=this,C=this.is0();A==null&&(A=C?e.ONE:e.inv(R));const O=e.mul(B,A),z=e.mul(P,A),H=e.mul(R,A);if(C)return{x:e.ZERO,y:e.ZERO};if(!e.eql(H,e.ONE))throw new Error("invZ was invalid");return{x:O,y:z}}isTorsionFree(){const{h:A,isTorsionFree:B}=t;if(A===Ui)return!0;if(B)return B(_,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:A,clearCofactor:B}=t;return A===Ui?this:B?B(_,this):this.multiplyUnsafe(t.h)}toRawBytes(A=!0){return this.assertValidity(),n(_,this,A)}toHex(A=!0){return Ja(this.toRawBytes(A))}}_.BASE=new _(t.Gx,t.Gy,e.ONE),_.ZERO=new _(e.ZERO,e.ONE,e.ZERO);const E=t.nBitLength,w=hE(_,t.endo?Math.ceil(E/2):E);return{CURVE:t,ProjectivePoint:_,normPrivateKeyToScalar:p,weierstrassEquation:i,isWithinCurveOrder:c}}function qq(r){const t=function(G){const M=sy(G);return cf(M,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...M})}(r),{Fp:e,n}=t,s=e.BYTES+1,i=2*e.BYTES+1;function c(G){return Kr(G,n)}function l(G){return D2(G,n)}const{ProjectivePoint:p,normPrivateKeyToScalar:m,weierstrassEquation:v,isWithinCurveOrder:_}=zq({...t,toBytes(G,M,d){const o=M.toAffine(),a=e.toBytes(o.x),f=Qa;return d?f(Uint8Array.from([M.hasEvenY()?2:3]),a):f(Uint8Array.from([4]),a,e.toBytes(o.y))},fromBytes(G){const M=G.length,d=G[0],o=G.subarray(1);if(M!==s||d!==2&&d!==3){if(M===i&&d===4)return{x:e.fromBytes(o.subarray(0,e.BYTES)),y:e.fromBytes(o.subarray(e.BYTES,2*e.BYTES))};throw new Error(`Point of length ${M} was invalid. Expected ${s} compressed bytes or ${i} uncompressed bytes`)}{const f=La(o);if(!(gs<(a=f)&&aJa(Fu(G,t.nByteLength));function w(G){return G>n>>Ui}const x=(G,M,d)=>La(G.slice(M,d));class A{constructor(M,d,o){this.r=M,this.s=d,this.recovery=o,this.assertValidity()}static fromCompact(M){const d=t.nByteLength;return M=mn("compactSignature",M,2*d),new A(x(M,0,d),x(M,d,2*d))}static fromDER(M){const{r:d,s:o}=Oa.toSig(mn("DER",M));return new A(d,o)}assertValidity(){if(!_(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!_(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(M){return new A(this.r,this.s,M)}recoverPublicKey(M){const{r:d,s:o,recovery:a}=this,f=C(mn("msgHash",M));if(a==null||![0,1,2,3].includes(a))throw new Error("recovery id invalid");const h=a===2||a===3?d+t.n:d;if(h>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");const g=1&a?"03":"02",S=p.fromHex(g+E(h)),I=l(h),y=c(-f*I),u=c(o*I),b=p.BASE.multiplyAndAddUnsafe(S,y,u);if(!b)throw new Error("point at infinify");return b.assertValidity(),b}hasHighS(){return w(this.s)}normalizeS(){return this.hasHighS()?new A(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return ff(this.toDERHex())}toDERHex(){return Oa.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return ff(this.toCompactHex())}toCompactHex(){return E(this.r)+E(this.s)}}const B={isValidPrivateKey(G){try{return m(G),!0}catch{return!1}},normPrivateKeyToScalar:m,randomPrivateKey:()=>{const G=a5(t.n);return function(M,d,o=!1){const a=M.length,f=cE(d),h=a5(d);if(a<16||a1024)throw new Error(`expected ${h}-1024 bytes of input, got ${a}`);const g=Kr(o?La(M):qu(M),d-Zr)+Zr;return o?Xc(g,f):Fu(g,f)}(t.randomBytes(G),t.n)},precompute:(G=8,M=p.BASE)=>(M._setWindowSize(G),M.multiply(BigInt(3)),M)};function P(G){const M=G instanceof Uint8Array,d=typeof G=="string",o=(M||d)&&G.length;return M?o===s||o===i:d?o===2*s||o===2*i:G instanceof p}const R=t.bits2int||function(G){const M=La(G),d=8*G.length-t.nBitLength;return d>0?M>>BigInt(d):M},C=t.bits2int_modN||function(G){return c(R(G))},O=oy(t.nBitLength);function z(G){if(typeof G!="bigint")throw new Error("bigint expected");if(!(gs<=G&&GD in d))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:a}=t;let{lowS:f,prehash:h,extraEntropy:g}=d;f==null&&(f=!0),G=mn("msgHash",G),h&&(G=mn("prehashed msgHash",o(G)));const S=C(G),I=m(M),y=[z(I),z(S)];if(g!=null){const D=g===!0?a(e.BYTES):g;y.push(mn("extraEntropy",D))}const u=Qa(...y),b=S;return{seed:u,k2sig:function(D){const Z=R(D);if(!_(Z))return;const F=l(Z),q=p.BASE.multiply(Z).toAffine(),it=c(q.x);if(it===gs)return;const at=c(F*c(b+it*I));if(at===gs)return;let Bt=(q.x===it?0:2)|Number(q.y&Ui),yt=at;return f&&w(at)&&(yt=function(pt){return w(pt)?c(-pt):pt}(at),Bt^=1),new A(it,yt,Bt)}}}const tt={lowS:t.lowS,prehash:!1},nt={lowS:t.lowS,prehash:!1};return p.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(G,M=!0){return p.fromPrivateKey(G).toRawBytes(M)},getSharedSecret:function(G,M,d=!0){if(P(G))throw new Error("first arg must be private key");if(!P(M))throw new Error("second arg must be public key");return p.fromHex(M).multiply(m(G)).toRawBytes(d)},sign:function(G,M,d=tt){const{seed:o,k2sig:a}=H(G,M,d),f=t;return aE(f.hash.outputLen,f.nByteLength,f.hmac)(o,a)},verify:function(G,M,d,o=nt){var q;const a=G;if(M=mn("msgHash",M),d=mn("publicKey",d),"strict"in o)throw new Error("options.strict was renamed to lowS");const{lowS:f,prehash:h}=o;let g,S;try{if(typeof a=="string"||a instanceof Uint8Array)try{g=A.fromDER(a)}catch(it){if(!(it instanceof Oa.Err))throw it;g=A.fromCompact(a)}else{if(typeof a!="object"||typeof a.r!="bigint"||typeof a.s!="bigint")throw new Error("PARSE");{const{r:it,s:at}=a;g=new A(it,at)}}S=p.fromHex(d)}catch(it){if(it.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(f&&g.hasHighS())return!1;h&&(M=t.hash(M));const{r:I,s:y}=g,u=C(M),b=l(y),D=c(u*b),Z=c(I*b),F=(q=p.BASE.multiplyAndAddUnsafe(S,D,Z))==null?void 0:q.toAffine();return!!F&&c(F.x)===I},ProjectivePoint:p,Signature:A,utils:B}}BigInt(4);class rA extends ry{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(c){if(typeof c!="function"||typeof c.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");vl(c.outputLen),vl(c.blockLen)}(t);const n=gd(e);if(this.iHash=t.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 s=this.blockLen,i=new Uint8Array(s);i.set(n.length>s?t.create().update(n).digest():n);for(let c=0;cnew rA(r,t).update(e).digest();/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Fq(r){return{hash:r,hmac:(t,...e)=>nA(r,t,Ez(...e)),randomBytes:QM}}nA.create=(r,t)=>new rA(r,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Z5=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),W5=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),jq=BigInt(1),$2=BigInt(2),G5=(r,t)=>(r+t/$2)/t,H2=fE(Z5,void 0,void 0,{sqrt:function(r){const t=Z5,e=BigInt(3),n=BigInt(6),s=BigInt(11),i=BigInt(22),c=BigInt(23),l=BigInt(44),p=BigInt(88),m=r*r*r%t,v=m*m*r%t,_=en(v,e,t)*v%t,E=en(_,e,t)*v%t,w=en(E,$2,t)*m%t,x=en(w,s,t)*w%t,A=en(x,i,t)*x%t,B=en(A,l,t)*A%t,P=en(B,p,t)*B%t,R=en(P,l,t)*A%t,C=en(R,e,t)*v%t,O=en(C,c,t)*x%t,z=en(O,n,t)*m%t,H=en(z,$2,t);if(!H2.eql(H2.sqr(H),r))throw new Error("Cannot find square root");return H}}),_d=function(r,t){const e=n=>qq({...r,...Fq(n)});return Object.freeze({...e(t),create:e})}({a:BigInt(0),b:BigInt(7),Fp:H2,n:W5,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{const t=W5,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-jq*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=e,c=BigInt("0x100000000000000000000000000000000"),l=G5(i*r,t),p=G5(-n*r,t);let m=Kr(r-l*e-p*s,t),v=Kr(-l*n-p*i,t);const _=m>c,E=v>c;if(_&&(m=t-m),E&&(v=t-v),m>c||v>c)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:_,k1:m,k2neg:E,k2:v}}}},tu);BigInt(0),_d.ProjectivePoint;const Kq=Pf.utils.randomPrivateKey,Y5=()=>{const r=Pf.utils.randomPrivateKey(),t=Ml(r),e=new Uint8Array(64);return e.set(r),e.set(t,32),{publicKey:t,secretKey:e}},Ml=Pf.getPublicKey;function X5(r){try{return Pf.ExtendedPoint.fromHex(r),!0}catch{return!1}}const Ey=(r,t)=>Pf.sign(r,t.slice(0,32)),$q=Pf.verify,nr=r=>Ae.Buffer.isBuffer(r)?r:r instanceof Uint8Array?Ae.Buffer.from(r.buffer,r.byteOffset,r.byteLength):Ae.Buffer.from(r);class V2{constructor(t){Object.assign(this,t)}encode(){return Ae.Buffer.from(fy(Ic,this))}static decode(t){return bE(Ic,this,t)}static decodeUnchecked(t){return mE(Ic,this,t)}}const Ic=new Map;var J5;let iA;const Si=32;let Q5=1;iA=Symbol.toStringTag;class Xt extends V2{constructor(t){if(super({}),this._bn=void 0,function(e){return e._bn!==void 0}(t))this._bn=t._bn;else{if(typeof t=="string"){const e=Ln.decode(t);if(e.length!=Si)throw new Error("Invalid public key input");this._bn=new Jc(e)}else this._bn=new Jc(t);if(this._bn.byteLength()>Si)throw new Error("Invalid public key input")}}static unique(){const t=new Xt(Q5);return Q5+=1,new Xt(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return Ln.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(Ae.Buffer);if(t.length===Si)return t;const e=Ae.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[iA](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,n){const s=Ae.Buffer.concat([t.toBuffer(),Ae.Buffer.from(e),n.toBuffer()]),i=tu(s);return new Xt(i)}static createProgramAddressSync(t,e){let n=Ae.Buffer.alloc(0);t.forEach(function(i){if(i.length>32)throw new TypeError("Max seed length exceeded");n=Ae.Buffer.concat([n,nr(i)])}),n=Ae.Buffer.concat([n,e.toBuffer(),Ae.Buffer.from("ProgramDerivedAddress")]);const s=tu(n);if(X5(s))throw new Error("Invalid seeds, address must fall off the curve");return new Xt(s)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n,s=255;for(;s!=0;){try{const i=t.concat(Ae.Buffer.from([s]));n=this.createProgramAddressSync(i,e)}catch(i){if(i instanceof TypeError)throw i;s--;continue}return[n,s]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return X5(new Xt(t).toBytes())}}J5=Xt,Xt.default=new J5("11111111111111111111111111111111"),Ic.set(Xt,{kind:"struct",fields:[["_bn","u256"]]});const Hq=new Xt("BPFLoader1111111111111111111111111111111111"),ju=1232,Md=127,hf=64;class Z2 extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(Z2.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class W2 extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(W2.prototype,"name",{value:"TransactionExpiredTimeoutError"});class Su extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(Su.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class eh{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const e of this.keySegments()){if(t256)throw new Error("Account index overflow encountered during compilation");const e=new Map;this.keySegments().flat().forEach((s,i)=>{e.set(s.toBase58(),i)});const n=s=>{const i=e.get(s.toBase58());if(i===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return i};return t.map(s=>({programIdIndex:n(s.programId),accountKeyIndexes:s.keys.map(i=>n(i.pubkey)),data:s.data}))}}const ar=(r="publicKey")=>Or(32,r),Vq=(r="signature")=>Or(64,r),Ua=(r="string")=>{const t=Ue([Ce("length"),Ce("lengthPadding"),Or(Qs(Ce(),-8),"chars")],r),e=t.decode.bind(t),n=t.encode.bind(t),s=t;return s.decode=(i,c)=>e(i,c).chars.toString(),s.encode=(i,c,l)=>{const p={chars:Ae.Buffer.from(i,"utf8")};return n(p,c,l)},s.alloc=i=>Ce().span+Ce().span+Ae.Buffer.from(i,"utf8").length,s};function oA(r,t){const e=s=>{if(s.span>=0)return s.span;if(typeof s.alloc=="function")return s.alloc(t[s.property]);if("count"in s&&"elementLayout"in s){const i=t[s.property];if(Array.isArray(i))return i.length*e(s.elementLayout)}else if("fields"in s)return oA({layout:s},t[s.property]);return 0};let n=0;return r.layout.fields.forEach(s=>{n+=e(s)}),n}function ti(r){let t=0,e=0;for(;;){let n=r.shift();if(t|=(127&n)<<7*e,e+=1,(128&n)==0)break}return t}function _i(r,t){let e=t;for(;;){let n=127&e;if(e>>=7,e==0){r.push(n);break}n|=128,r.push(n)}}function xr(r,t){if(!r)throw new Error(t||"Assertion failed")}class Ed{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){const n=new Map,s=c=>{const l=c.toBase58();let p=n.get(l);return p===void 0&&(p={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(l,p)),p},i=s(e);i.isSigner=!0,i.isWritable=!0;for(const c of t){s(c.programId).isInvoked=!0;for(const l of c.keys){const p=s(l.pubkey);p.isSigner||(p.isSigner=l.isSigner),p.isWritable||(p.isWritable=l.isWritable)}}return new Ed(e,n)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];xr(t.length<=256,"Max static account keys length exceeded");const e=t.filter(([,l])=>l.isSigner&&l.isWritable),n=t.filter(([,l])=>l.isSigner&&!l.isWritable),s=t.filter(([,l])=>!l.isSigner&&l.isWritable),i=t.filter(([,l])=>!l.isSigner&&!l.isWritable),c={numRequiredSignatures:e.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};{xr(e.length>0,"Expected at least one writable signer key");const[l]=e[0];xr(l===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}return[c,[...e.map(([l])=>new Xt(l)),...n.map(([l])=>new Xt(l)),...s.map(([l])=>new Xt(l)),...i.map(([l])=>new Xt(l))]]}extractTableLookup(t){const[e,n]=this.drainKeysFoundInLookupTable(t.state.addresses,c=>!c.isSigner&&!c.isInvoked&&c.isWritable),[s,i]=this.drainKeysFoundInLookupTable(t.state.addresses,c=>!c.isSigner&&!c.isInvoked&&!c.isWritable);if(e.length!==0||s.length!==0)return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:s},{writable:n,readonly:i}]}drainKeysFoundInLookupTable(t,e){const n=new Array,s=new Array;for(const[i,c]of this.keyMetaMap.entries())if(e(c)){const l=new Xt(i),p=t.findIndex(m=>m.equals(l));p>=0&&(xr(p<256,"Max lookup table index exceeded"),n.push(p),s.push(l),this.keyMetaMap.delete(i))}return[n,s]}}class uo{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map(e=>new Xt(e)),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach(e=>this.indexToProgramIds.set(e.programIdIndex,this.accountKeys[e.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Ln.decode(t.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new eh(this.staticAccountKeys)}static compile(t){const e=Ed.compile(t.instructions,t.payerKey),[n,s]=e.getMessageComponents(),i=new eh(s).compileInstructions(t.instructions).map(c=>({programIdIndex:c.programIdIndex,accounts:c.accountKeyIndexes,data:Ln.encode(c.data)}));return new uo({header:n,accountKeys:s,recentBlockhash:t.recentBlockhash,instructions:i})}isAccountSigner(t){return t=this.header.numRequiredSignatures?t-e!this.isProgramId(e))}serialize(){const t=this.accountKeys.length;let e=[];_i(e,t);const n=this.instructions.map(_=>{const{accounts:E,programIdIndex:w}=_,x=Array.from(Ln.decode(_.data));let A=[];_i(A,E.length);let B=[];return _i(B,x.length),{programIdIndex:w,keyIndicesCount:Ae.Buffer.from(A),keyIndices:E,dataLength:Ae.Buffer.from(B),data:x}});let s=[];_i(s,n.length);let i=Ae.Buffer.alloc(ju);Ae.Buffer.from(s).copy(i);let c=s.length;n.forEach(_=>{const E=Ue([or("programIdIndex"),Or(_.keyIndicesCount.length,"keyIndicesCount"),On(or("keyIndex"),_.keyIndices.length,"keyIndices"),Or(_.dataLength.length,"dataLength"),On(or("userdatum"),_.data.length,"data")]).encode(_,i,c);c+=E}),i=i.slice(0,c);const l=Ue([Or(1,"numRequiredSignatures"),Or(1,"numReadonlySignedAccounts"),Or(1,"numReadonlyUnsignedAccounts"),Or(e.length,"keyCount"),On(ar("key"),t,"keys"),ar("recentBlockhash")]),p={numRequiredSignatures:Ae.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:Ae.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:Ae.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:Ae.Buffer.from(e),keys:this.accountKeys.map(_=>nr(_.toBytes())),recentBlockhash:Ln.decode(this.recentBlockhash)};let m=Ae.Buffer.alloc(2048);const v=l.encode(p,m);return i.copy(m,v),m.slice(0,v+i.length)}static from(t){let e=[...t];const n=e.shift();if(n!==(n&Md))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const s=e.shift(),i=e.shift(),c=ti(e);let l=[];for(let E=0;E0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new eh(this.staticAccountKeys,e)}isAccountSigner(t){return t=n){const s=t-n,i=this.addressTableLookups.reduce((c,l)=>c+l.writableIndexes.length,0);return s=this.header.numRequiredSignatures?t-ei.key.equals(n.accountKey));if(!s)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(const i of n.writableIndexes){if(!(im.toBytes()),recentBlockhash:Ln.decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:e,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:s},l);return l.slice(0,p)}serializeInstructions(){let t=0;const e=new Uint8Array(ju);for(const n of this.compiledInstructions){const s=Array();_i(s,n.accountKeyIndexes.length);const i=Array();_i(i,n.data.length),t+=Ue([or("programIdIndex"),Or(s.length,"encodedAccountKeyIndexesLength"),On(or(),n.accountKeyIndexes.length,"accountKeyIndexes"),Or(i.length,"encodedDataLength"),Or(n.data.length,"data")]).encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(s),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(i),data:n.data},e,t)}return e.slice(0,t)}serializeAddressTableLookups(){let t=0;const e=new Uint8Array(ju);for(const n of this.addressTableLookups){const s=Array();_i(s,n.writableIndexes.length);const i=Array();_i(i,n.readonlyIndexes.length),t+=Ue([ar("accountKey"),Or(s.length,"encodedWritableIndexesLength"),On(or(),n.writableIndexes.length,"writableIndexes"),Or(i.length,"encodedReadonlyIndexesLength"),On(or(),n.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(s),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:n.readonlyIndexes},e,t)}return e.slice(0,t)}static deserialize(t){let e=[...t];const n=e.shift(),s=n&Md;xr(n!==s,"Expected versioned message but received legacy message"),xr(s===0,`Expected versioned message with version 0 but found version ${s}`);const i={numRequiredSignatures:e.shift(),numReadonlySignedAccounts:e.shift(),numReadonlyUnsignedAccounts:e.shift()},c=[],l=ti(e);for(let w=0;w{const t=Ay.deserializeMessageVersion(r);if(t==="legacy")return uo.from(r);if(t===0)return eu.deserialize(r);throw new Error(`Transaction message version ${t} deserialization is not supported`)}};let rs=function(r){return r[r.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",r[r.PROCESSED=1]="PROCESSED",r[r.TIMED_OUT=2]="TIMED_OUT",r[r.NONCE_INVALID=3]="NONCE_INVALID",r}({});const Zq=Ae.Buffer.alloc(hf).fill(0);class Ir{constructor(t){this.keys=void 0,this.programId=void 0,this.data=Ae.Buffer.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map(({pubkey:t,isSigner:e,isWritable:n})=>({pubkey:t.toJSON(),isSigner:e,isWritable:n})),programId:this.programId.toJSON(),data:[...this.data]}}}class wr{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){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,t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:e,nonceInfo:n}=t;this.minNonceContextSlot=e,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:n}=t;this.recentBlockhash=e,this.lastValidBlockHeight=n}else{const{recentBlockhash:e,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=e}}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(t=>t.toJSON()),signers:this.signatures.map(({publicKey:t})=>t.toJSON())}}add(...t){if(t.length===0)throw new Error("No instructions");return t.forEach(e=>{"instructions"in e?this.instructions=this.instructions.concat(e.instructions):"data"in e&&"programId"in e&&"keys"in e?this.instructions.push(e):this.instructions.push(new Ir(e))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e,n;if(this.nonceInfo?(t=this.nonceInfo.nonce,e=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction,...this.instructions]:this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");if(e.length<1&&console.warn("No instructions provided"),this.feePayer)n=this.feePayer;else{if(!(this.signatures.length>0&&this.signatures[0].publicKey))throw new Error("Transaction fee payer required");n=this.signatures[0].publicKey}for(let A=0;A{A.keys.forEach(P=>{i.push({...P})});const B=A.programId.toString();s.includes(B)||s.push(B)}),s.forEach(A=>{i.push({pubkey:new Xt(A),isSigner:!1,isWritable:!1})});const c=[];i.forEach(A=>{const B=A.pubkey.toString(),P=c.findIndex(R=>R.pubkey.toString()===B);P>-1?(c[P].isWritable=c[P].isWritable||A.isWritable,c[P].isSigner=c[P].isSigner||A.isSigner):c.push(A)}),c.sort(function(A,B){return A.isSigner!==B.isSigner?A.isSigner?-1:1:A.isWritable!==B.isWritable?A.isWritable?-1:1:A.pubkey.toBase58().localeCompare(B.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})});const l=c.findIndex(A=>A.pubkey.equals(n));if(l>-1){const[A]=c.splice(l,1);A.isSigner=!0,A.isWritable=!0,c.unshift(A)}else c.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const A of this.signatures){const B=c.findIndex(P=>P.pubkey.equals(A.publicKey));if(!(B>-1))throw new Error(`unknown signer: ${A.publicKey.toString()}`);c[B].isSigner||(c[B].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."))}let p=0,m=0,v=0;const _=[],E=[];c.forEach(({pubkey:A,isSigner:B,isWritable:P})=>{B?(_.push(A.toString()),p+=1,P||(m+=1)):(E.push(A.toString()),P||(v+=1))});const w=_.concat(E),x=e.map(A=>{const{data:B,programId:P}=A;return{programIdIndex:w.indexOf(P.toString()),accounts:A.keys.map(R=>w.indexOf(R.pubkey.toString())),data:Ln.encode(B)}});return x.forEach(A=>{xr(A.programIdIndex>=0),A.accounts.forEach(B=>xr(B>=0))}),new uo({header:{numRequiredSignatures:p,numReadonlySignedAccounts:m,numReadonlyUnsignedAccounts:v},accountKeys:w,recentBlockhash:t,instructions:x})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every((s,i)=>e[i].equals(s.publicKey))||(this.signatures=e.map(n=>({signature:null,publicKey:n}))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(t.length===0)throw new Error("No signers");const e=new Set;this.signatures=t.filter(n=>{const s=n.toString();return!e.has(s)&&(e.add(s),!0)}).map(n=>({signature:null,publicKey:n}))}sign(...t){if(t.length===0)throw new Error("No signers");const e=new Set,n=[];for(const i of t){const c=i.publicKey.toString();e.has(c)||(e.add(c),n.push(i))}this.signatures=n.map(i=>({signature:null,publicKey:i.publicKey}));const s=this._compile();this._partialSign(s,...n)}partialSign(...t){if(t.length===0)throw new Error("No signers");const e=new Set,n=[];for(const i of t){const c=i.publicKey.toString();e.has(c)||(e.add(c),n.push(i))}const s=this._compile();this._partialSign(s,...n)}_partialSign(t,...e){const n=t.serialize();e.forEach(s=>{const i=Ey(n,s.secretKey);this._addSignature(s.publicKey,nr(i))})}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){xr(e.length===64);const n=this.signatures.findIndex(s=>t.equals(s.publicKey));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=Ae.Buffer.from(e)}verifySignatures(t){return this._verifySignatures(this.serializeMessage(),t===void 0||t)}_verifySignatures(t,e){for(const{signature:n,publicKey:s}of this.signatures)if(n===null){if(e)return!1}else if(!$q(n,t,s.toBytes()))return!1;return!0}serialize(t){const{requireAllSignatures:e,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),s=this.serializeMessage();if(n&&!this._verifySignatures(s,e))throw new Error("Signature verification failed");return this._serialize(s)}_serialize(t){const{signatures:e}=this,n=[];_i(n,e.length);const s=n.length+64*e.length+t.length,i=Ae.Buffer.alloc(s);return xr(e.length<256),Ae.Buffer.from(n).copy(i,0),e.forEach(({signature:c},l)=>{c!==null&&(xr(c.length===64,"signature has invalid length"),Ae.Buffer.from(c).copy(i,n.length+64*l))}),t.copy(i,n.length+64*e.length),xr(i.length<=ju,`Transaction too large: ${i.length} > 1232`),i}get keys(){return xr(this.instructions.length===1),this.instructions[0].keys.map(t=>t.pubkey)}get programId(){return xr(this.instructions.length===1),this.instructions[0].programId}get data(){return xr(this.instructions.length===1),this.instructions[0].data}static from(t){let e=[...t];const n=ti(e);let s=[];for(let i=0;i0&&(n.feePayer=t.accountKeys[0]),e.forEach((s,i)=>{const c={signature:s==Ln.encode(Zq)?null:Ln.decode(s),publicKey:t.accountKeys[i]};n.signatures.push(c)}),t.instructions.forEach(s=>{const i=s.accounts.map(c=>{const l=t.accountKeys[c];return{pubkey:l,isSigner:n.signatures.some(p=>p.publicKey.toString()===l.toString())||t.isAccountSigner(c),isWritable:t.isAccountWritable(c)}});n.instructions.push(new Ir({keys:i,programId:t.accountKeys[s.programIdIndex],data:Ln.decode(s.data)}))}),n._message=t,n._json=n.toJSON(),n}}class Sy{constructor(t){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=t.payerKey,this.instructions=t.instructions,this.recentBlockhash=t.recentBlockhash}static decompile(t,e){const{header:n,compiledInstructions:s,recentBlockhash:i}=t,{numRequiredSignatures:c,numReadonlySignedAccounts:l,numReadonlyUnsignedAccounts:p}=n,m=c-l;xr(m>0,"Message header is invalid");const v=t.staticAccountKeys.length-c-p;xr(v>=0,"Message header is invalid");const _=t.getAccountKeys(e),E=_.get(0);if(E===void 0)throw new Error("Failed to decompile message because no account keys were found");const w=[];for(const x of s){const A=[];for(const P of x.accountKeyIndexes){const R=_.get(P);if(R===void 0)throw new Error(`Failed to find key for account key index ${P}`);let C;C=Pc.equals(s.publicKey));xr(i>=0,`Cannot sign with non signer key ${s.publicKey.toBase58()}`),this.signatures[i]=Ey(e,s.secretKey)}}addSignature(t,e){xr(e.byteLength===64,"Signature must be 64 bytes long");const n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(s=>s.equals(t));xr(n>=0,`Can not add signature; \`${t.toBase58()}\` is not required to sign this transaction`),this.signatures[n]=e}}const oo=new Xt("SysvarC1ock11111111111111111111111111111111"),Wq=new Xt("SysvarEpochSchedu1e111111111111111111111111"),Gq=new Xt("Sysvar1nstructions1111111111111111111111111"),J0=new Xt("SysvarRecentB1ockHashes11111111111111111111"),na=new Xt("SysvarRent111111111111111111111111111111111"),Yq=new Xt("SysvarRewards111111111111111111111111111111"),Xq=new Xt("SysvarS1otHashes111111111111111111111111111"),Jq=new Xt("SysvarS1otHistory11111111111111111111111111"),Q0=new Xt("SysvarStakeHistory1111111111111111111111111");async function G2(r,t,e,n){const s=n&&{skipPreflight:n.skipPreflight,preflightCommitment:n.preflightCommitment||n.commitment,maxRetries:n.maxRetries,minContextSlot:n.minContextSlot},i=await r.sendTransaction(t,e,s);let c;if(t.recentBlockhash!=null&&t.lastValidBlockHeight!=null)c=(await r.confirmTransaction({abortSignal:n==null?void 0:n.abortSignal,signature:i,blockhash:t.recentBlockhash,lastValidBlockHeight:t.lastValidBlockHeight},n&&n.commitment)).value;else if(t.minNonceContextSlot!=null&&t.nonceInfo!=null){const{nonceInstruction:l}=t.nonceInfo,p=l.keys[0].pubkey;c=(await r.confirmTransaction({abortSignal:n==null?void 0:n.abortSignal,minContextSlot:t.minNonceContextSlot,nonceAccountPubkey:p,nonceValue:t.nonceInfo.nonce,signature:i},n&&n.commitment)).value}else(n==null?void 0:n.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."),c=(await r.confirmTransaction(i,n&&n.commitment)).value;if(c.err)throw new Error(`Transaction ${i} failed (${JSON.stringify(c)})`);return i}function xa(r){return new Promise(t=>setTimeout(t,r))}function gr(r,t){const e=r.layout.span>=0?r.layout.span:oA(r,t),n=Ae.Buffer.alloc(e),s=Object.assign({instruction:r.index},t);return r.layout.encode(s,n),n}function Br(r,t){let e;try{e=r.layout.decode(t)}catch(n){throw new Error("invalid instruction; "+n)}if(e.instruction!==r.index)throw new Error(`invalid instruction; instruction index mismatch ${e.instruction} != ${r.index}`);return e}const sA=In("lamportsPerSignature"),aA=Ue([Ce("version"),Ce("state"),ar("authorizedPubkey"),ar("nonce"),Ue([sA],"feeCalculator")]),rh=aA.span;class El{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){const e=aA.decode(nr(t),0);return new El({authorizedPubkey:new Xt(e.authorizedPubkey),nonce:new Xt(e.nonce).toString(),feeCalculator:e.feeCalculator})}}const lf=(Wp=8,r=>{const t=Or(Wp,r),{encode:e,decode:n}=(i=>({decode:i.decode.bind(i),encode:i.encode.bind(i)}))(t),s=t;return s.decode=(i,c)=>{const l=n(i,c);return NE(Ae.Buffer.from(l))},s.encode=(i,c,l)=>{const p=yy(i,Wp);return e(p,c,l)},s});var Wp;const Ur=Object.freeze({Create:{index:0,layout:Ue([Ce("instruction"),xi("lamports"),xi("space"),ar("programId")])},Assign:{index:1,layout:Ue([Ce("instruction"),ar("programId")])},Transfer:{index:2,layout:Ue([Ce("instruction"),lf("lamports")])},CreateWithSeed:{index:3,layout:Ue([Ce("instruction"),ar("base"),Ua("seed"),xi("lamports"),xi("space"),ar("programId")])},AdvanceNonceAccount:{index:4,layout:Ue([Ce("instruction")])},WithdrawNonceAccount:{index:5,layout:Ue([Ce("instruction"),xi("lamports")])},InitializeNonceAccount:{index:6,layout:Ue([Ce("instruction"),ar("authorized")])},AuthorizeNonceAccount:{index:7,layout:Ue([Ce("instruction"),ar("authorized")])},Allocate:{index:8,layout:Ue([Ce("instruction"),xi("space")])},AllocateWithSeed:{index:9,layout:Ue([Ce("instruction"),ar("base"),Ua("seed"),xi("space"),ar("programId")])},AssignWithSeed:{index:10,layout:Ue([Ce("instruction"),ar("base"),Ua("seed"),ar("programId")])},TransferWithSeed:{index:11,layout:Ue([Ce("instruction"),lf("lamports"),Ua("seed"),ar("programId")])},UpgradeNonceAccount:{index:12,layout:Ue([Ce("instruction")])}});class an{constructor(){}static createAccount(t){const e=gr(Ur.Create,{lamports:t.lamports,space:t.space,programId:nr(t.programId.toBuffer())});return new Ir({keys:[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:e})}static transfer(t){let e,n;return"basePubkey"in t?(e=gr(Ur.TransferWithSeed,{lamports:BigInt(t.lamports),seed:t.seed,programId:nr(t.programId.toBuffer())}),n=[{pubkey:t.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]):(e=gr(Ur.Transfer,{lamports:BigInt(t.lamports)}),n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0}]),new Ir({keys:n,programId:this.programId,data:e})}static assign(t){let e,n;return"basePubkey"in t?(e=gr(Ur.AssignWithSeed,{base:nr(t.basePubkey.toBuffer()),seed:t.seed,programId:nr(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=gr(Ur.Assign,{programId:nr(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new Ir({keys:n,programId:this.programId,data:e})}static createAccountWithSeed(t){const e=gr(Ur.CreateWithSeed,{base:nr(t.basePubkey.toBuffer()),seed:t.seed,lamports:t.lamports,space:t.space,programId:nr(t.programId.toBuffer())});let n=[{pubkey:t.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:t.newAccountPubkey,isSigner:!1,isWritable:!0}];return t.basePubkey!=t.fromPubkey&&n.push({pubkey:t.basePubkey,isSigner:!0,isWritable:!1}),new Ir({keys:n,programId:this.programId,data:e})}static createNonceAccount(t){const e=new wr;"basePubkey"in t&&"seed"in t?e.add(an.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:rh,programId:this.programId})):e.add(an.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:rh,programId:this.programId}));const n={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return e.add(this.nonceInitialize(n)),e}static nonceInitialize(t){const e=gr(Ur.InitializeNonceAccount,{authorized:nr(t.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:J0,isSigner:!1,isWritable:!1},{pubkey:na,isSigner:!1,isWritable:!1}],programId:this.programId,data:e};return new Ir(n)}static nonceAdvance(t){const e=gr(Ur.AdvanceNonceAccount),n={keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:J0,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e};return new Ir(n)}static nonceWithdraw(t){const e=gr(Ur.WithdrawNonceAccount,{lamports:t.lamports});return new Ir({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.toPubkey,isSigner:!1,isWritable:!0},{pubkey:J0,isSigner:!1,isWritable:!1},{pubkey:na,isSigner:!1,isWritable:!1},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static nonceAuthorize(t){const e=gr(Ur.AuthorizeNonceAccount,{authorized:nr(t.newAuthorizedPubkey.toBuffer())});return new Ir({keys:[{pubkey:t.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:t.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:e})}static allocate(t){let e,n;return"basePubkey"in t?(e=gr(Ur.AllocateWithSeed,{base:nr(t.basePubkey.toBuffer()),seed:t.seed,space:t.space,programId:nr(t.programId.toBuffer())}),n=[{pubkey:t.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:t.basePubkey,isSigner:!0,isWritable:!1}]):(e=gr(Ur.Allocate,{space:t.space}),n=[{pubkey:t.accountPubkey,isSigner:!0,isWritable:!0}]),new Ir({keys:n,programId:this.programId,data:e})}}an.programId=new Xt("11111111111111111111111111111111");class ja{constructor(){}static getMinNumSignatures(t){return 2*(Math.ceil(t/ja.chunkSize)+1+1)}static async load(t,e,n,s,i){{const _=await t.getMinimumBalanceForRentExemption(i.length),E=await t.getAccountInfo(n.publicKey,"confirmed");let w=null;if(E!==null){if(E.executable)return console.error("Program load failed, account is already executable"),!1;E.data.length!==i.length&&(w=w||new wr,w.add(an.allocate({accountPubkey:n.publicKey,space:i.length}))),E.owner.equals(s)||(w=w||new wr,w.add(an.assign({accountPubkey:n.publicKey,programId:s}))),E.lamports<_&&(w=w||new wr,w.add(an.transfer({fromPubkey:e.publicKey,toPubkey:n.publicKey,lamports:_-E.lamports})))}else w=new wr().add(an.createAccount({fromPubkey:e.publicKey,newAccountPubkey:n.publicKey,lamports:_>0?_:1,space:i.length,programId:s}));w!==null&&await G2(t,w,[e,n],{commitment:"confirmed"})}const c=Ue([Ce("instruction"),Ce("offset"),Ce("bytesLength"),Ce("bytesLengthPadding"),On(or("byte"),Qs(Ce(),-8),"bytes")]),l=ja.chunkSize;let p=0,m=i,v=[];for(;m.length>0;){const _=m.slice(0,l),E=Ae.Buffer.alloc(l+16);c.encode({instruction:0,offset:p,bytes:_,bytesLength:0,bytesLengthPadding:0},E);const w=new wr().add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0}],programId:s,data:E});v.push(G2(t,w,[e,n],{commitment:"confirmed"})),t._rpcEndpoint.includes("solana.com")&&await xa(1e3/4),p+=l,m=m.slice(l)}await Promise.all(v);{const _=Ue([Ce("instruction")]),E=Ae.Buffer.alloc(_.span);_.encode({instruction:1},E);const w=new wr().add({keys:[{pubkey:n.publicKey,isSigner:!0,isWritable:!0},{pubkey:na,isSigner:!1,isWritable:!1}],programId:s,data:E}),x="processed",A=await t.sendTransaction(w,[e,n],{preflightCommitment:x}),{context:B,value:P}=await t.confirmTransaction({signature:A,lastValidBlockHeight:w.lastValidBlockHeight,blockhash:w.recentBlockhash},x);if(P.err)throw new Error(`Transaction ${A} failed (${JSON.stringify(P)})`);for(;;){try{if(await t.getSlot({commitment:x})>B.slot)break}catch{}await new Promise(R=>setTimeout(R,Math.round(200)))}}return!0}}ja.chunkSize=932;const Qq=new Xt("BPFLoader2111111111111111111111111111111111");function tF(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var eF=Object.prototype.toString,rF=Object.keys||function(r){var t=[];for(var e in r)t.push(e);return t};function Mc(r,t){var e,n,s,i,c,l,p;if(r===!0)return"true";if(r===!1)return"false";switch(typeof r){case"object":if(r===null)return null;if(r.toJSON&&typeof r.toJSON=="function")return Mc(r.toJSON(),t);if((p=eF.call(r))==="[object Array]"){for(s="[",n=r.length-1,e=0;e-1&&(s+=Mc(r[e],!0)),s+"]"}if(p==="[object Object]"){for(n=(i=rF(r).sort()).length,s="",e=0;e1;)r/=2,t++;return t}class e4{constructor(t,e,n,s,i){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=e,this.warmup=n,this.firstNormalEpoch=s,this.firstNormalSlot=i}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t>1,n|=n>>2,n|=n>>4,n|=n>>8,n|=n>>16,1+(n|=n>>32))}(t+32+1))-Gp(32)-1;return[e,t-(this.getSlotsInEpoch(e)-32)]}{const e=t-this.firstNormalSlot,n=Math.floor(e/this.slotsPerEpoch);return[this.firstNormalEpoch+n,e%this.slotsPerEpoch]}}getFirstSlotInEpoch(t){return t<=this.firstNormalEpoch?32*(Math.pow(2,t)-1):(t-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}getLastSlotInEpoch(t){return this.getFirstSlotInEpoch(t)+this.getSlotsInEpoch(t)-1}getSlotsInEpoch(t){return t{const i=Bq(s,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...e});return this.underlyingSocket="socket"in i?i.socket:i,i},t,e,n),this.underlyingSocket=void 0}call(...t){var n;const e=(n=this.underlyingSocket)==null?void 0:n.readyState;return e===1?super.call(...t):Promise.reject(new Error("Tried to call a JSON-RPC method `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}notify(...t){var n;const e=(n=this.underlyingSocket)==null?void 0:n.readyState;return e===1?super.notify(...t):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+e+")"))}}class Yp{constructor(t){this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}isActive(){const t=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===t}static deserialize(t){const e=function(c,l){let p;try{p=c.layout.decode(l)}catch(m){throw new Error("invalid instruction; "+m)}if(p.typeIndex!==c.index)throw new Error(`invalid account data; account type mismatch ${p.typeIndex} != ${c.index}`);return p}(oF,t),n=t.length-56;xr(n>=0,"lookup table is invalid"),xr(n%32==0,"lookup table is invalid");const s=n/32,{addresses:i}=Ue([On(ar(),s,"addresses")]).decode(t.slice(56));return{deactivationSlot:e.deactivationSlot,lastExtendedSlot:e.lastExtendedSlot,lastExtendedSlotStartIndex:e.lastExtendedStartIndex,authority:e.authority.length!==0?new Xt(e.authority[0]):void 0,addresses:i.map(c=>new Xt(c))}}}const oF={index:1,layout:Ue([Ce("typeIndex"),lf("deactivationSlot"),In("lastExtendedSlot"),or("lastExtendedStartIndex"),or(),On(ar(),Qs(or(),-1),"authority")])},sF=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i,hn=Dh(wy(Xt),_e(),r=>new Xt(r)),uA=xy([_e(),Wr("base64")]),Iy=Dh(wy(Ae.Buffer),uA,r=>Ae.Buffer.from(r[0],"base64"));function Fr(r){let t,e;if(typeof r=="string")t=r;else if(r){const{commitment:n,...s}=r;t=n,e=s}return{commitment:t,config:e}}function fA(r){return ci([we({jsonrpc:Wr("2.0"),id:_e(),result:r}),we({jsonrpc:Wr("2.0"),id:_e(),error:we({code:Nh(),message:_e(),data:Ve(uu("any",()=>!0))})})])}const aF=fA(Nh());function rr(r){return Dh(fA(r),aF,t=>"error"in t?t:{...t,result:Ee(t.result,r)})}function nn(r){return rr(we({context:we({slot:jt()}),value:r}))}function Ad(r){return we({context:we({slot:jt()}),value:r})}function Xp(r,t){return r===0?new eu({header:t.header,staticAccountKeys:t.accountKeys.map(e=>new Xt(e)),recentBlockhash:t.recentBlockhash,compiledInstructions:t.instructions.map(e=>({programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:Ln.decode(e.data)})),addressTableLookups:t.addressTableLookups}):new uo(t)}const uF=we({foundation:jt(),foundationTerm:jt(),initial:jt(),taper:jt(),terminal:jt()}),fF=rr(Ie(ke(we({epoch:jt(),effectiveSlot:jt(),amount:jt(),postBalance:jt(),commission:Ve(ke(jt()))})))),cF=Ie(we({slot:jt(),prioritizationFee:jt()})),hF=we({total:jt(),validator:jt(),foundation:jt(),epoch:jt()}),lF=we({epoch:jt(),slotIndex:jt(),slotsInEpoch:jt(),absoluteSlot:jt(),blockHeight:Ve(jt()),transactionCount:Ve(jt())}),dF=we({slotsPerEpoch:jt(),leaderScheduleSlotOffset:jt(),warmup:Go(),firstNormalEpoch:jt(),firstNormalSlot:jt()}),pF=qE(_e(),Ie(jt())),fu=ke(ci([we({}),_e()])),mF=we({err:fu}),vF=Wr("receivedSignature"),gF=we({"solana-core":_e(),"feature-set":Ve(jt())}),r4=nn(we({err:ke(ci([we({}),_e()])),logs:ke(Ie(_e())),accounts:Ve(ke(Ie(ke(we({executable:Go(),owner:_e(),lamports:jt(),data:Ie(_e()),rentEpoch:Ve(jt())}))))),unitsConsumed:Ve(jt()),returnData:Ve(ke(we({programId:_e(),data:xy([_e(),Wr("base64")])})))})),yF=nn(we({byIdentity:qE(_e(),Ie(jt())),range:we({firstSlot:jt(),lastSlot:jt()})})),bF=rr(uF),wF=rr(hF),xF=rr(cF),_F=rr(lF),MF=rr(dF),EF=rr(pF),AF=rr(jt()),SF=nn(we({total:jt(),circulating:jt(),nonCirculating:jt(),nonCirculatingAccounts:Ie(hn)})),Y2=we({amount:_e(),uiAmount:ke(jt()),decimals:jt(),uiAmountString:Ve(_e())}),kF=nn(Ie(we({address:hn,amount:_e(),uiAmount:ke(jt()),decimals:jt(),uiAmountString:Ve(_e())}))),IF=nn(Ie(we({pubkey:hn,account:we({executable:Go(),owner:hn,lamports:jt(),data:Iy,rentEpoch:jt()})}))),X2=we({program:_e(),parsed:Nh(),space:jt()}),BF=nn(Ie(we({pubkey:hn,account:we({executable:Go(),owner:hn,lamports:jt(),data:X2,rentEpoch:jt()})}))),PF=nn(Ie(we({lamports:jt(),address:hn}))),nh=we({executable:Go(),owner:hn,lamports:jt(),data:Iy,rentEpoch:jt()}),RF=we({pubkey:hn,account:nh}),CF=Dh(ci([wy(Ae.Buffer),X2]),ci([uA,X2]),r=>Array.isArray(r)?Ee(r,Iy):r),J2=we({executable:Go(),owner:hn,lamports:jt(),data:CF,rentEpoch:jt()}),TF=we({pubkey:hn,account:J2}),LF=we({state:ci([Wr("active"),Wr("inactive"),Wr("activating"),Wr("deactivating")]),active:jt(),inactive:jt()}),OF=rr(Ie(we({signature:_e(),slot:jt(),err:fu,memo:ke(_e()),blockTime:Ve(ke(jt()))}))),UF=rr(Ie(we({signature:_e(),slot:jt(),err:fu,memo:ke(_e()),blockTime:Ve(ke(jt()))}))),NF=we({subscription:jt(),result:Ad(nh)}),DF=we({pubkey:hn,account:nh}),zF=we({subscription:jt(),result:Ad(DF)}),qF=we({parent:jt(),slot:jt(),root:jt()}),FF=we({subscription:jt(),result:qF}),jF=ci([we({type:ci([Wr("firstShredReceived"),Wr("completed"),Wr("optimisticConfirmation"),Wr("root")]),slot:jt(),timestamp:jt()}),we({type:Wr("createdBank"),parent:jt(),slot:jt(),timestamp:jt()}),we({type:Wr("frozen"),slot:jt(),timestamp:jt(),stats:we({numTransactionEntries:jt(),numSuccessfulTransactions:jt(),numFailedTransactions:jt(),maxTransactionsPerEntry:jt()})}),we({type:Wr("dead"),slot:jt(),timestamp:jt(),err:_e()})]),KF=we({subscription:jt(),result:jF}),$F=we({subscription:jt(),result:Ad(ci([mF,vF]))}),HF=we({subscription:jt(),result:jt()}),VF=we({pubkey:_e(),gossip:ke(_e()),tpu:ke(_e()),rpc:ke(_e()),version:ke(_e())}),n4=we({votePubkey:_e(),nodePubkey:_e(),activatedStake:jt(),epochVoteAccount:Go(),epochCredits:Ie(xy([jt(),jt(),jt()])),commission:jt(),lastVote:jt(),rootSlot:ke(jt())}),ZF=rr(we({current:Ie(n4),delinquent:Ie(n4)})),WF=ci([Wr("processed"),Wr("confirmed"),Wr("finalized")]),GF=we({slot:jt(),confirmations:ke(jt()),err:fu,confirmationStatus:Ve(WF)}),YF=nn(Ie(ke(GF))),XF=rr(jt()),cA=we({accountKey:hn,writableIndexes:Ie(jt()),readonlyIndexes:Ie(jt())}),By=we({signatures:Ie(_e()),message:we({accountKeys:Ie(_e()),header:we({numRequiredSignatures:jt(),numReadonlySignedAccounts:jt(),numReadonlyUnsignedAccounts:jt()}),instructions:Ie(we({accounts:Ie(jt()),data:_e(),programIdIndex:jt()})),recentBlockhash:_e(),addressTableLookups:Ve(Ie(cA))})}),hA=we({pubkey:hn,signer:Go(),writable:Go(),source:Ve(ci([Wr("transaction"),Wr("lookupTable")]))}),lA=we({accountKeys:Ie(hA),signatures:Ie(_e())}),i4=we({parsed:Nh(),program:_e(),programId:hn}),o4=we({accounts:Ie(hn),data:_e(),programId:hn}),dA=Dh(ci([o4,i4]),ci([we({parsed:Nh(),program:_e(),programId:_e()}),we({accounts:Ie(_e()),data:_e(),programId:_e()})]),r=>Ee(r,"accounts"in r?o4:i4)),pA=we({signatures:Ie(_e()),message:we({accountKeys:Ie(hA),instructions:Ie(dA),recentBlockhash:_e(),addressTableLookups:Ve(ke(Ie(cA)))})}),Al=we({accountIndex:jt(),mint:_e(),owner:Ve(_e()),uiTokenAmount:Y2}),mA=we({writable:Ie(hn),readonly:Ie(hn)}),Sd=we({err:fu,fee:jt(),innerInstructions:Ve(ke(Ie(we({index:jt(),instructions:Ie(we({accounts:Ie(jt()),data:_e(),programIdIndex:jt()}))})))),preBalances:Ie(jt()),postBalances:Ie(jt()),logMessages:Ve(ke(Ie(_e()))),preTokenBalances:Ve(ke(Ie(Al))),postTokenBalances:Ve(ke(Ie(Al))),loadedAddresses:Ve(mA),computeUnitsConsumed:Ve(jt())}),Py=we({err:fu,fee:jt(),innerInstructions:Ve(ke(Ie(we({index:jt(),instructions:Ie(dA)})))),preBalances:Ie(jt()),postBalances:Ie(jt()),logMessages:Ve(ke(Ie(_e()))),preTokenBalances:Ve(ke(Ie(Al))),postTokenBalances:Ve(ke(Ie(Al))),loadedAddresses:Ve(mA),computeUnitsConsumed:Ve(jt())}),Cf=ci([Wr(0),Wr("legacy")]),cu=we({pubkey:_e(),lamports:jt(),postBalance:ke(jt()),rewardType:ke(_e()),commission:Ve(ke(jt()))}),JF=rr(ke(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:jt(),transactions:Ie(we({transaction:By,meta:ke(Sd),version:Ve(Cf)})),rewards:Ve(Ie(cu)),blockTime:ke(jt()),blockHeight:ke(jt())}))),QF=rr(ke(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:jt(),rewards:Ve(Ie(cu)),blockTime:ke(jt()),blockHeight:ke(jt())}))),tj=rr(ke(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:jt(),transactions:Ie(we({transaction:lA,meta:ke(Sd),version:Ve(Cf)})),rewards:Ve(Ie(cu)),blockTime:ke(jt()),blockHeight:ke(jt())}))),ej=rr(ke(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:jt(),transactions:Ie(we({transaction:pA,meta:ke(Py),version:Ve(Cf)})),rewards:Ve(Ie(cu)),blockTime:ke(jt()),blockHeight:ke(jt())}))),rj=rr(ke(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:jt(),transactions:Ie(we({transaction:lA,meta:ke(Py),version:Ve(Cf)})),rewards:Ve(Ie(cu)),blockTime:ke(jt()),blockHeight:ke(jt())}))),nj=rr(ke(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:jt(),rewards:Ve(Ie(cu)),blockTime:ke(jt()),blockHeight:ke(jt())}))),ij=rr(ke(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:jt(),transactions:Ie(we({transaction:By,meta:ke(Sd)})),rewards:Ve(Ie(cu)),blockTime:ke(jt())}))),s4=rr(ke(we({blockhash:_e(),previousBlockhash:_e(),parentSlot:jt(),signatures:Ie(_e()),blockTime:ke(jt())}))),Jp=rr(ke(we({slot:jt(),meta:ke(Sd),blockTime:Ve(ke(jt())),transaction:By,version:Ve(Cf)}))),d0=rr(ke(we({slot:jt(),transaction:pA,meta:ke(Py),blockTime:Ve(ke(jt())),version:Ve(Cf)}))),oj=nn(we({blockhash:_e(),feeCalculator:we({lamportsPerSignature:jt()})})),sj=nn(we({blockhash:_e(),lastValidBlockHeight:jt()})),aj=nn(Go()),uj=rr(Ie(we({slot:jt(),numTransactions:jt(),numSlots:jt(),samplePeriodSecs:jt()}))),fj=nn(ke(we({feeCalculator:we({lamportsPerSignature:jt()})}))),cj=rr(_e()),hj=rr(_e()),lj=we({err:fu,logs:Ie(_e()),signature:_e()}),dj=we({result:Ad(lj),subscription:jt()}),pj={"solana-client":"js/0.0.0-development"};class $u{constructor(t){this._keypair=void 0,this._keypair=t??Y5()}static generate(){return new $u(Y5())}static fromSecretKey(t,e){if(t.byteLength!==64)throw new Error("bad secret key size");const n=t.slice(32,64);if(!e||!e.skipValidation){const s=t.slice(0,32),i=Ml(s);for(let c=0;c<32;c++)if(n[c]!==i[c])throw new Error("provided secretKey is invalid")}return new $u({publicKey:n,secretKey:t})}static fromSeed(t){const e=Ml(t),n=new Uint8Array(64);return n.set(t),n.set(e,32),new $u({publicKey:e,secretKey:n})}get publicKey(){return new Xt(this._keypair.publicKey)}get secretKey(){return new Uint8Array(this._keypair.secretKey)}}const ys=Object.freeze({CreateLookupTable:{index:0,layout:Ue([Ce("instruction"),lf("recentSlot"),or("bumpSeed")])},FreezeLookupTable:{index:1,layout:Ue([Ce("instruction")])},ExtendLookupTable:{index:2,layout:Ue([Ce("instruction"),lf(),On(ar(),Qs(Ce(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Ue([Ce("instruction")])},CloseLookupTable:{index:4,layout:Ue([Ce("instruction")])}});class Q2{constructor(){}static createLookupTable(t){const[e,n]=Xt.findProgramAddressSync([t.authority.toBuffer(),yy(BigInt(t.recentSlot),8)],this.programId),s=gr(ys.CreateLookupTable,{recentSlot:BigInt(t.recentSlot),bumpSeed:n}),i=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:an.programId,isSigner:!1,isWritable:!1}];return[new Ir({programId:this.programId,keys:i,data:s}),e]}static freezeLookupTable(t){const e=gr(ys.FreezeLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new Ir({programId:this.programId,keys:n,data:e})}static extendLookupTable(t){const e=gr(ys.ExtendLookupTable,{addresses:t.addresses.map(s=>s.toBytes())}),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return t.payer&&n.push({pubkey:t.payer,isSigner:!0,isWritable:!0},{pubkey:an.programId,isSigner:!1,isWritable:!1}),new Ir({programId:this.programId,keys:n,data:e})}static deactivateLookupTable(t){const e=gr(ys.DeactivateLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1}];return new Ir({programId:this.programId,keys:n,data:e})}static closeLookupTable(t){const e=gr(ys.CloseLookupTable),n=[{pubkey:t.lookupTable,isSigner:!1,isWritable:!0},{pubkey:t.authority,isSigner:!0,isWritable:!1},{pubkey:t.recipient,isSigner:!1,isWritable:!0}];return new Ir({programId:this.programId,keys:n,data:e})}}Q2.programId=new Xt("AddressLookupTab1e1111111111111111111111111");const Lo=Object.freeze({RequestUnits:{index:0,layout:Ue([or("instruction"),Ce("units"),Ce("additionalFee")])},RequestHeapFrame:{index:1,layout:Ue([or("instruction"),Ce("bytes")])},SetComputeUnitLimit:{index:2,layout:Ue([or("instruction"),Ce("units")])},SetComputeUnitPrice:{index:3,layout:Ue([or("instruction"),lf("microLamports")])}});class tv{constructor(){}static requestUnits(t){const e=gr(Lo.RequestUnits,t);return new Ir({keys:[],programId:this.programId,data:e})}static requestHeapFrame(t){const e=gr(Lo.RequestHeapFrame,t);return new Ir({keys:[],programId:this.programId,data:e})}static setComputeUnitLimit(t){const e=gr(Lo.SetComputeUnitLimit,t);return new Ir({keys:[],programId:this.programId,data:e})}static setComputeUnitPrice(t){const e=gr(Lo.SetComputeUnitPrice,{microLamports:BigInt(t.microLamports)});return new Ir({keys:[],programId:this.programId,data:e})}}tv.programId=new Xt("ComputeBudget111111111111111111111111111111");const a4=Ue([or("numSignatures"),or("padding"),Ni("signatureOffset"),Ni("signatureInstructionIndex"),Ni("publicKeyOffset"),Ni("publicKeyInstructionIndex"),Ni("messageDataOffset"),Ni("messageDataSize"),Ni("messageInstructionIndex")]);class kd{constructor(){}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:s,instructionIndex:i}=t;xr(e.length===32,`Public Key must be 32 bytes but received ${e.length} bytes`),xr(s.length===64,`Signature must be 64 bytes but received ${s.length} bytes`);const c=a4.span,l=c+e.length,p=l+s.length,m=Ae.Buffer.alloc(p+n.length),v=i??65535;return a4.encode({numSignatures:1,padding:0,signatureOffset:l,signatureInstructionIndex:v,publicKeyOffset:c,publicKeyInstructionIndex:v,messageDataOffset:p,messageDataSize:n.length,messageInstructionIndex:v},m),m.fill(e,c),m.fill(s,l),m.fill(n,p),new Ir({keys:[],programId:kd.programId,data:m})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:s}=t;xr(e.length===64,`Private key must be 64 bytes but received ${e.length} bytes`);try{const i=$u.fromSecretKey(e),c=i.publicKey.toBytes(),l=Ey(n,i.secretKey);return this.createInstructionWithPublicKey({publicKey:c,message:n,signature:l,instructionIndex:s})}catch(i){throw new Error(`Error creating instruction; ${i}`)}}}kd.programId=new Xt("Ed25519SigVerify111111111111111111111111111");_d.utils.isValidPrivateKey;const mj=_d.getPublicKey,Qp=Ue([or("numSignatures"),Ni("signatureOffset"),or("signatureInstructionIndex"),Ni("ethAddressOffset"),or("ethAddressInstructionIndex"),Ni("messageDataOffset"),Ni("messageDataSize"),or("messageInstructionIndex"),Or(20,"ethAddress"),Or(64,"signature"),or("recoveryId")]);class Hu{constructor(){}static publicKeyToEthAddress(t){xr(t.length===64,`Public key must be 64 bytes but received ${t.length} bytes`);try{return Ae.Buffer.from(H5(nr(t))).slice(-20)}catch(e){throw new Error(`Error constructing Ethereum address: ${e}`)}}static createInstructionWithPublicKey(t){const{publicKey:e,message:n,signature:s,recoveryId:i,instructionIndex:c}=t;return Hu.createInstructionWithEthAddress({ethAddress:Hu.publicKeyToEthAddress(e),message:n,signature:s,recoveryId:i,instructionIndex:c})}static createInstructionWithEthAddress(t){const{ethAddress:e,message:n,signature:s,recoveryId:i,instructionIndex:c=0}=t;let l;l=typeof e=="string"?e.startsWith("0x")?Ae.Buffer.from(e.substr(2),"hex"):Ae.Buffer.from(e,"hex"):e,xr(l.length===20,`Address must be 20 bytes but received ${l.length} bytes`);const p=12+l.length,m=p+s.length+1,v=Ae.Buffer.alloc(Qp.span+n.length);return Qp.encode({numSignatures:1,signatureOffset:p,signatureInstructionIndex:c,ethAddressOffset:12,ethAddressInstructionIndex:c,messageDataOffset:m,messageDataSize:n.length,messageInstructionIndex:c,signature:nr(s),ethAddress:nr(l),recoveryId:i},v),v.fill(nr(n),Qp.span),new Ir({keys:[],programId:Hu.programId,data:v})}static createInstructionWithPrivateKey(t){const{privateKey:e,message:n,instructionIndex:s}=t;xr(e.length===32,`Private key must be 32 bytes but received ${e.length} bytes`);try{const i=nr(e),c=mj(i,!1).slice(1),l=Ae.Buffer.from(H5(nr(n))),[p,m]=((v,_)=>{const E=_d.sign(v,_);return[E.toCompactRawBytes(),E.recovery]})(l,i);return this.createInstructionWithPublicKey({publicKey:c,message:n,signature:p,recoveryId:m,instructionIndex:s})}catch(i){throw new Error(`Error creating instruction; ${i}`)}}}var u4;Hu.programId=new Xt("KeccakSecp256k11111111111111111111111111111");const vA=new Xt("StakeConfig11111111111111111111111111111111");class f4{constructor(t,e){this.staker=void 0,this.withdrawer=void 0,this.staker=t,this.withdrawer=e}}class ih{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}}u4=ih,ih.default=new u4(0,0,Xt.default);const _n=Object.freeze({Initialize:{index:0,layout:Ue([Ce("instruction"),((r="authorized")=>Ue([ar("staker"),ar("withdrawer")],r))(),((r="lockup")=>Ue([xi("unixTimestamp"),xi("epoch"),ar("custodian")],r))()])},Authorize:{index:1,layout:Ue([Ce("instruction"),ar("newAuthorized"),Ce("stakeAuthorizationType")])},Delegate:{index:2,layout:Ue([Ce("instruction")])},Split:{index:3,layout:Ue([Ce("instruction"),xi("lamports")])},Withdraw:{index:4,layout:Ue([Ce("instruction"),xi("lamports")])},Deactivate:{index:5,layout:Ue([Ce("instruction")])},Merge:{index:7,layout:Ue([Ce("instruction")])},AuthorizeWithSeed:{index:8,layout:Ue([Ce("instruction"),ar("newAuthorized"),Ce("stakeAuthorizationType"),Ua("authoritySeed"),ar("authorityOwner")])}}),vj=Object.freeze({Staker:{index:0},Withdrawer:{index:1}});class Sl{constructor(){}static initialize(t){const{stakePubkey:e,authorized:n,lockup:s}=t,i=s||ih.default,c=gr(_n.Initialize,{authorized:{staker:nr(n.staker.toBuffer()),withdrawer:nr(n.withdrawer.toBuffer())},lockup:{unixTimestamp:i.unixTimestamp,epoch:i.epoch,custodian:nr(i.custodian.toBuffer())}}),l={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:na,isSigner:!1,isWritable:!1}],programId:this.programId,data:c};return new Ir(l)}static createAccountWithSeed(t){const e=new wr;e.add(an.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:s,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:s,lockup:i}))}static createAccount(t){const e=new wr;e.add(an.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.stakePubkey,lamports:t.lamports,space:this.space,programId:this.programId}));const{stakePubkey:n,authorized:s,lockup:i}=t;return e.add(this.initialize({stakePubkey:n,authorized:s,lockup:i}))}static delegate(t){const{stakePubkey:e,authorizedPubkey:n,votePubkey:s}=t,i=gr(_n.Delegate);return new wr().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!1,isWritable:!1},{pubkey:oo,isSigner:!1,isWritable:!1},{pubkey:Q0,isSigner:!1,isWritable:!1},{pubkey:vA,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static authorize(t){const{stakePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:s,stakeAuthorizationType:i,custodianPubkey:c}=t,l=gr(_n.Authorize,{newAuthorized:nr(s.toBuffer()),stakeAuthorizationType:i.index}),p=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:oo,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return c&&p.push({pubkey:c,isSigner:!1,isWritable:!1}),new wr().add({keys:p,programId:this.programId,data:l})}static authorizeWithSeed(t){const{stakePubkey:e,authorityBase:n,authoritySeed:s,authorityOwner:i,newAuthorizedPubkey:c,stakeAuthorizationType:l,custodianPubkey:p}=t,m=gr(_n.AuthorizeWithSeed,{newAuthorized:nr(c.toBuffer()),stakeAuthorizationType:l.index,authoritySeed:s,authorityOwner:nr(i.toBuffer())}),v=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:oo,isSigner:!1,isWritable:!1}];return p&&v.push({pubkey:p,isSigner:!1,isWritable:!1}),new wr().add({keys:v,programId:this.programId,data:m})}static splitInstruction(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:s,lamports:i}=t,c=gr(_n.Split,{lamports:i});return new Ir({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:c})}static split(t){const e=new wr;return e.add(an.createAccount({fromPubkey:t.authorizedPubkey,newAccountPubkey:t.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),e.add(this.splitInstruction(t))}static splitWithSeed(t){const{stakePubkey:e,authorizedPubkey:n,splitStakePubkey:s,basePubkey:i,seed:c,lamports:l}=t,p=new wr;return p.add(an.allocate({accountPubkey:s,basePubkey:i,seed:c,space:this.space,programId:this.programId})),p.add(this.splitInstruction({stakePubkey:e,authorizedPubkey:n,splitStakePubkey:s,lamports:l}))}static merge(t){const{stakePubkey:e,sourceStakePubKey:n,authorizedPubkey:s}=t,i=gr(_n.Merge);return new wr().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:oo,isSigner:!1,isWritable:!1},{pubkey:Q0,isSigner:!1,isWritable:!1},{pubkey:s,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}static withdraw(t){const{stakePubkey:e,authorizedPubkey:n,toPubkey:s,lamports:i,custodianPubkey:c}=t,l=gr(_n.Withdraw,{lamports:i}),p=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:s,isSigner:!1,isWritable:!0},{pubkey:oo,isSigner:!1,isWritable:!1},{pubkey:Q0,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return c&&p.push({pubkey:c,isSigner:!1,isWritable:!1}),new wr().add({keys:p,programId:this.programId,data:l})}static deactivate(t){const{stakePubkey:e,authorizedPubkey:n}=t,s=gr(_n.Deactivate);return new wr().add({keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:oo,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:s})}}Sl.programId=new Xt("Stake11111111111111111111111111111111111111"),Sl.space=200;class c4{constructor(t,e,n,s){this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=t,this.authorizedVoter=e,this.authorizedWithdrawer=n,this.commission=s}}const bs=Object.freeze({InitializeAccount:{index:0,layout:Ue([Ce("instruction"),((r="voteInit")=>Ue([ar("nodePubkey"),ar("authorizedVoter"),ar("authorizedWithdrawer"),or("commission")],r))()])},Authorize:{index:1,layout:Ue([Ce("instruction"),ar("newAuthorized"),Ce("voteAuthorizationType")])},Withdraw:{index:3,layout:Ue([Ce("instruction"),xi("lamports")])},AuthorizeWithSeed:{index:10,layout:Ue([Ce("instruction"),((r="voteAuthorizeWithSeedArgs")=>Ue([Ce("voteAuthorizationType"),ar("currentAuthorityDerivedKeyOwnerPubkey"),Ua("currentAuthorityDerivedKeySeed"),ar("newAuthorized")],r))()])}}),gj=Object.freeze({Voter:{index:0},Withdrawer:{index:1}});class df{constructor(){}static initializeAccount(t){const{votePubkey:e,nodePubkey:n,voteInit:s}=t,i=gr(bs.InitializeAccount,{voteInit:{nodePubkey:nr(s.nodePubkey.toBuffer()),authorizedVoter:nr(s.authorizedVoter.toBuffer()),authorizedWithdrawer:nr(s.authorizedWithdrawer.toBuffer()),commission:s.commission}}),c={keys:[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:na,isSigner:!1,isWritable:!1},{pubkey:oo,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new Ir(c)}static createAccount(t){const e=new wr;return e.add(an.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.votePubkey,lamports:t.lamports,space:this.space,programId:this.programId})),e.add(this.initializeAccount({votePubkey:t.votePubkey,nodePubkey:t.voteInit.nodePubkey,voteInit:t.voteInit}))}static authorize(t){const{votePubkey:e,authorizedPubkey:n,newAuthorizedPubkey:s,voteAuthorizationType:i}=t,c=gr(bs.Authorize,{newAuthorized:nr(s.toBuffer()),voteAuthorizationType:i.index}),l=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:oo,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return new wr().add({keys:l,programId:this.programId,data:c})}static authorizeWithSeed(t){const{currentAuthorityDerivedKeyBasePubkey:e,currentAuthorityDerivedKeyOwnerPubkey:n,currentAuthorityDerivedKeySeed:s,newAuthorizedPubkey:i,voteAuthorizationType:c,votePubkey:l}=t,p=gr(bs.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:nr(n.toBuffer()),currentAuthorityDerivedKeySeed:s,newAuthorized:nr(i.toBuffer()),voteAuthorizationType:c.index}}),m=[{pubkey:l,isSigner:!1,isWritable:!0},{pubkey:oo,isSigner:!1,isWritable:!1},{pubkey:e,isSigner:!0,isWritable:!1}];return new wr().add({keys:m,programId:this.programId,data:p})}static withdraw(t){const{votePubkey:e,authorizedWithdrawerPubkey:n,lamports:s,toPubkey:i}=t,c=gr(bs.Withdraw,{lamports:s}),l=[{pubkey:e,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return new wr().add({keys:l,programId:this.programId,data:c})}static safeWithdraw(t,e,n){if(t.lamports>e-n)throw new Error("Withdraw will leave vote account with insuffcient funds.");return df.withdraw(t)}}df.programId=new Xt("Vote111111111111111111111111111111111111111"),df.space=3731;const gA=new Xt("Va1idator1nfo111111111111111111111111111111"),yj=we({name:_e(),website:Ve(_e()),details:Ve(_e()),keybaseUsername:Ve(_e())});class Ry{constructor(t,e){this.key=void 0,this.info=void 0,this.key=t,this.info=e}static fromConfigData(t){let e=[...t];if(ti(e)!==2)return null;const n=[];for(let s=0;s<2;s++){const i=new Xt(e.slice(0,Si));e=e.slice(Si);const c=e.slice(0,1)[0]===1;e=e.slice(1),n.push({publicKey:i,isSigner:c})}if(n[0].publicKey.equals(gA)&&n[1].isSigner){const s=Ua().decode(Ae.Buffer.from(e)),i=JSON.parse(s);return DE(i,yj),new Ry(n[1].publicKey,i)}return null}}const bj=new Xt("Vote111111111111111111111111111111111111111"),wj=Ue([ar("nodePubkey"),ar("authorizedWithdrawer"),or("commission"),In(),On(Ue([In("slot"),Ce("confirmationCount")]),Qs(Ce(),-8),"votes"),or("rootSlotValid"),In("rootSlot"),In(),On(Ue([In("epoch"),ar("authorizedVoter")]),Qs(Ce(),-8),"authorizedVoters"),Ue([On(Ue([ar("authorizedPubkey"),In("epochOfLastAuthorizedSwitch"),In("targetEpoch")]),32,"buf"),In("idx"),or("isEmpty")],"priorVoters"),In(),On(Ue([In("epoch"),In("credits"),In("prevCredits")]),Qs(Ce(),-8),"epochCredits"),Ue([In("slot"),In("timestamp")],"lastTimestamp")]);class Cy{constructor(t){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=t.nodePubkey,this.authorizedWithdrawer=t.authorizedWithdrawer,this.commission=t.commission,this.rootSlot=t.rootSlot,this.votes=t.votes,this.authorizedVoters=t.authorizedVoters,this.priorVoters=t.priorVoters,this.epochCredits=t.epochCredits,this.lastTimestamp=t.lastTimestamp}static fromAccountData(t){const e=wj.decode(nr(t),4);let n=e.rootSlot;return e.rootSlotValid||(n=null),new Cy({nodePubkey:new Xt(e.nodePubkey),authorizedWithdrawer:new Xt(e.authorizedWithdrawer),commission:e.commission,votes:e.votes,rootSlot:n,authorizedVoters:e.authorizedVoters.map(xj),priorVoters:_j(e.priorVoters),epochCredits:e.epochCredits,lastTimestamp:e.lastTimestamp})}}function xj({authorizedVoter:r,epoch:t}){return{epoch:t,authorizedVoter:new Xt(r)}}function h4({authorizedPubkey:r,epochOfLastAuthorizedSwitch:t,targetEpoch:e}){return{authorizedPubkey:new Xt(r),epochOfLastAuthorizedSwitch:t,targetEpoch:e}}function _j({buf:r,idx:t,isEmpty:e}){return e?[]:[...r.slice(t+1).map(h4),...r.slice(0,t).map(h4)]}const l4={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/"}};var yA=Object.freeze({__proto__:null,Account:class{constructor(r){if(this._publicKey=void 0,this._secretKey=void 0,r){const t=nr(r);if(r.length!==64)throw new Error("bad secret key size");this._publicKey=t.slice(32,64),this._secretKey=t.slice(0,32)}else this._secretKey=nr(Kq()),this._publicKey=nr(Ml(this._secretKey))}get publicKey(){return new Xt(this._publicKey)}get secretKey(){return Ae.Buffer.concat([this._secretKey,this._publicKey],64)}},AddressLookupTableAccount:Yp,AddressLookupTableInstruction:class{constructor(){}static decodeInstructionType(r){this.checkProgramId(r.programId);const t=Ce("instruction").decode(r.data);let e;for(const[n,s]of Object.entries(ys))if(s.index==t){e=n;break}if(!e)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return e}static decodeCreateLookupTable(r){this.checkProgramId(r.programId),this.checkKeysLength(r.keys,4);const{recentSlot:t}=Br(ys.CreateLookupTable,r.data);return{authority:r.keys[1].pubkey,payer:r.keys[2].pubkey,recentSlot:Number(t)}}static decodeExtendLookupTable(r){if(this.checkProgramId(r.programId),r.keys.length<2)throw new Error(`invalid instruction; found ${r.keys.length} keys, expected at least 2`);const{addresses:t}=Br(ys.ExtendLookupTable,r.data);return{lookupTable:r.keys[0].pubkey,authority:r.keys[1].pubkey,payer:r.keys.length>2?r.keys[2].pubkey:void 0,addresses:t.map(e=>new Xt(e))}}static decodeCloseLookupTable(r){return this.checkProgramId(r.programId),this.checkKeysLength(r.keys,3),{lookupTable:r.keys[0].pubkey,authority:r.keys[1].pubkey,recipient:r.keys[2].pubkey}}static decodeFreezeLookupTable(r){return this.checkProgramId(r.programId),this.checkKeysLength(r.keys,2),{lookupTable:r.keys[0].pubkey,authority:r.keys[1].pubkey}}static decodeDeactivateLookupTable(r){return this.checkProgramId(r.programId),this.checkKeysLength(r.keys,2),{lookupTable:r.keys[0].pubkey,authority:r.keys[1].pubkey}}static checkProgramId(r){if(!r.equals(Q2.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}static checkKeysLength(r,t){if(r.length{const p={};return async m=>{const{commitment:v,config:_}=Fr(m),E=this._buildArgs([],v,void 0,_),w=t4(E);return p[w]=p[w]??(async()=>{try{const x=Ee(await this._rpcRequest("getBlockHeight",E),rr(jt()));if("error"in x)throw new De(x.error,"failed to get block height information");return x.result}finally{delete p[w]}})(),await p[w]}})(),t&&typeof t=="string"?this._commitment=t:t&&(this._commitment=t.commitment,this._confirmTransactionInitialTimeout=t.confirmTransactionInitialTimeout,e=t.wsEndpoint,n=t.httpHeaders,s=t.fetch,i=t.fetchMiddleware,c=t.disableRetryOnRateLimit,l=t.httpAgent),this._rpcEndpoint=function(p){if(/^https?:/.test(p)===!1)throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return p}(r),this._rpcWsEndpoint=e||function(p){const m=p.match(sF);if(m==null)throw TypeError(`Failed to validate endpoint URL \`${p}\``);const[v,_,E,w]=m,x=p.startsWith("https:")?"wss:":"ws:",A=E==null?null:parseInt(E.slice(1),10);return`${x}//${_}${A==null?"":`:${A+1}`}${w}`}(r),this._rpcClient=function(p,m,v,_,E,w){const x=v||nF;let A;return w!=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."),_&&(A=async(P,R)=>{const C=await new Promise((O,z)=>{try{_(P,R,(H,tt)=>O([H,tt]))}catch(H){z(H)}});return await x(...C)}),new _q(async(P,R)=>{const C={method:"POST",body:P,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},m||{},pj)};try{let O,z=5,H=500;for(;O=A?await A(p,C):await x(p,C),O.status===429&&E!==!0&&(z-=1,z!==0);)console.log(`Server responded with ${O.status} ${O.statusText}. Retrying after ${H}ms delay...`),await xa(H),H*=2;const tt=await O.text();O.ok?R(null,tt):R(new Error(`${O.status} ${O.statusText}: ${tt}`))}catch(O){O instanceof Error&&R(O)}},{})}(r,n,s,i,c,l),this._rpcRequest=function(p){return(m,v)=>new Promise((_,E)=>{p.request(m,v,(w,x)=>{w?E(w):_(x)})})}(this._rpcClient),this._rpcBatchRequest=function(p){return m=>new Promise((v,_)=>{m.length===0&&v([]);const E=m.map(w=>p.request(w.methodName,w.args));p.request(E,(w,x)=>{w?_(w):v(x)})})}(this._rpcClient),this._rpcWebSocket=new iF(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(r,t){const{commitment:e,config:n}=Fr(t),s=this._buildArgs([r.toBase58()],e,void 0,n),i=Ee(await this._rpcRequest("getBalance",s),nn(jt()));if("error"in i)throw new De(i.error,`failed to get balance for ${r.toBase58()}`);return i.result}async getBalance(r,t){return await this.getBalanceAndContext(r,t).then(e=>e.value).catch(e=>{throw new Error("failed to get balance of account "+r.toBase58()+": "+e)})}async getBlockTime(r){const t=Ee(await this._rpcRequest("getBlockTime",[r]),rr(ke(jt())));if("error"in t)throw new De(t.error,`failed to get block time for slot ${r}`);return t.result}async getMinimumLedgerSlot(){const r=Ee(await this._rpcRequest("minimumLedgerSlot",[]),rr(jt()));if("error"in r)throw new De(r.error,"failed to get minimum ledger slot");return r.result}async getFirstAvailableBlock(){const r=Ee(await this._rpcRequest("getFirstAvailableBlock",[]),AF);if("error"in r)throw new De(r.error,"failed to get first available block");return r.result}async getSupply(r){let t={};t=typeof r=="string"?{commitment:r}:r?{...r,commitment:r&&r.commitment||this.commitment}:{commitment:this.commitment};const e=Ee(await this._rpcRequest("getSupply",[t]),SF);if("error"in e)throw new De(e.error,"failed to get supply");return e.result}async getTokenSupply(r,t){const e=this._buildArgs([r.toBase58()],t),n=Ee(await this._rpcRequest("getTokenSupply",e),nn(Y2));if("error"in n)throw new De(n.error,"failed to get token supply");return n.result}async getTokenAccountBalance(r,t){const e=this._buildArgs([r.toBase58()],t),n=Ee(await this._rpcRequest("getTokenAccountBalance",e),nn(Y2));if("error"in n)throw new De(n.error,"failed to get token account balance");return n.result}async getTokenAccountsByOwner(r,t,e){const{commitment:n,config:s}=Fr(e);let i=[r.toBase58()];"mint"in t?i.push({mint:t.mint.toBase58()}):i.push({programId:t.programId.toBase58()});const c=this._buildArgs(i,n,"base64",s),l=Ee(await this._rpcRequest("getTokenAccountsByOwner",c),IF);if("error"in l)throw new De(l.error,`failed to get token accounts owned by account ${r.toBase58()}`);return l.result}async getParsedTokenAccountsByOwner(r,t,e){let n=[r.toBase58()];"mint"in t?n.push({mint:t.mint.toBase58()}):n.push({programId:t.programId.toBase58()});const s=this._buildArgs(n,e,"jsonParsed"),i=Ee(await this._rpcRequest("getTokenAccountsByOwner",s),BF);if("error"in i)throw new De(i.error,`failed to get token accounts owned by account ${r.toBase58()}`);return i.result}async getLargestAccounts(r){const t={...r,commitment:r&&r.commitment||this.commitment},e=t.filter||t.commitment?[t]:[],n=Ee(await this._rpcRequest("getLargestAccounts",e),PF);if("error"in n)throw new De(n.error,"failed to get largest accounts");return n.result}async getTokenLargestAccounts(r,t){const e=this._buildArgs([r.toBase58()],t),n=Ee(await this._rpcRequest("getTokenLargestAccounts",e),kF);if("error"in n)throw new De(n.error,"failed to get token largest accounts");return n.result}async getAccountInfoAndContext(r,t){const{commitment:e,config:n}=Fr(t),s=this._buildArgs([r.toBase58()],e,"base64",n),i=Ee(await this._rpcRequest("getAccountInfo",s),nn(ke(nh)));if("error"in i)throw new De(i.error,`failed to get info about account ${r.toBase58()}`);return i.result}async getParsedAccountInfo(r,t){const{commitment:e,config:n}=Fr(t),s=this._buildArgs([r.toBase58()],e,"jsonParsed",n),i=Ee(await this._rpcRequest("getAccountInfo",s),nn(ke(J2)));if("error"in i)throw new De(i.error,`failed to get info about account ${r.toBase58()}`);return i.result}async getAccountInfo(r,t){try{return(await this.getAccountInfoAndContext(r,t)).value}catch(e){throw new Error("failed to get info about account "+r.toBase58()+": "+e)}}async getMultipleParsedAccounts(r,t){const{commitment:e,config:n}=Fr(t),s=r.map(l=>l.toBase58()),i=this._buildArgs([s],e,"jsonParsed",n),c=Ee(await this._rpcRequest("getMultipleAccounts",i),nn(Ie(ke(J2))));if("error"in c)throw new De(c.error,`failed to get info for accounts ${s}`);return c.result}async getMultipleAccountsInfoAndContext(r,t){const{commitment:e,config:n}=Fr(t),s=r.map(l=>l.toBase58()),i=this._buildArgs([s],e,"base64",n),c=Ee(await this._rpcRequest("getMultipleAccounts",i),nn(Ie(ke(nh))));if("error"in c)throw new De(c.error,`failed to get info for accounts ${s}`);return c.result}async getMultipleAccountsInfo(r,t){return(await this.getMultipleAccountsInfoAndContext(r,t)).value}async getStakeActivation(r,t,e){const{commitment:n,config:s}=Fr(t),i=this._buildArgs([r.toBase58()],n,void 0,{...s,epoch:e??(s==null?void 0:s.epoch)}),c=Ee(await this._rpcRequest("getStakeActivation",i),rr(LF));if("error"in c)throw new De(c.error,`failed to get Stake Activation ${r.toBase58()}`);return c.result}async getProgramAccounts(r,t){const{commitment:e,config:n}=Fr(t),{encoding:s,...i}=n||{},c=this._buildArgs([r.toBase58()],e,s||"base64",i),l=await this._rpcRequest("getProgramAccounts",c),p=Ie(RF),m=i.withContext===!0?Ee(l,nn(p)):Ee(l,rr(p));if("error"in m)throw new De(m.error,`failed to get accounts owned by program ${r.toBase58()}`);return m.result}async getParsedProgramAccounts(r,t){const{commitment:e,config:n}=Fr(t),s=this._buildArgs([r.toBase58()],e,"jsonParsed",n),i=Ee(await this._rpcRequest("getProgramAccounts",s),rr(Ie(TF)));if("error"in i)throw new De(i.error,`failed to get accounts owned by program ${r.toBase58()}`);return i.result}async confirmTransaction(r,t){var s;let e,n;if(typeof r=="string")e=r;else{const i=r;if((s=i.abortSignal)!=null&&s.aborted)return Promise.reject(i.abortSignal.reason);e=i.signature}try{n=Ln.decode(e)}catch{throw new Error("signature must be base58 encoded: "+e)}return xr(n.length===64,"signature has invalid length"),typeof r=="string"?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:t||this.commitment,signature:e}):"lastValidBlockHeight"in r?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t||this.commitment,strategy:r}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:t||this.commitment,strategy:r})}getCancellationPromise(r){return new Promise((t,e)=>{r!=null&&(r.aborted?e(r.reason):r.addEventListener("abort",()=>{e(r.reason)}))})}getTransactionConfirmationPromise({commitment:r,signature:t}){let e,n,s=!1;const i=new Promise((c,l)=>{try{e=this.onSignature(t,(m,v)=>{e=void 0;const _={context:v,value:m};c({__type:rs.PROCESSED,response:_})},r);const p=new Promise(m=>{e==null?m():n=this._onSubscriptionStateChange(e,v=>{v==="subscribed"&&m()})});(async()=>{if(await p,s)return;const m=await this.getSignatureStatus(t);if(s||m==null)return;const{context:v,value:_}=m;if(_!=null)if(_!=null&&_.err)l(_.err);else{switch(r){case"confirmed":case"single":case"singleGossip":if(_.confirmationStatus==="processed")return;break;case"finalized":case"max":case"root":if(_.confirmationStatus==="processed"||_.confirmationStatus==="confirmed")return}s=!0,c({__type:rs.PROCESSED,response:{context:v,value:_}})}})()}catch(p){l(p)}});return{abortConfirmation:()=>{n&&(n(),n=void 0),e!=null&&(this.removeSignatureListener(e),e=void 0)},confirmationPromise:i}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:r,strategy:{abortSignal:t,lastValidBlockHeight:e,signature:n}}){let s=!1;const i=new Promise(v=>{const _=async()=>{try{return await this.getBlockHeight(r)}catch{return-1}};(async()=>{let E=await _();if(!s){for(;E<=e;)if(await xa(1e3),s||(E=await _(),s))return;v({__type:rs.BLOCKHEIGHT_EXCEEDED})}})()}),{abortConfirmation:c,confirmationPromise:l}=this.getTransactionConfirmationPromise({commitment:r,signature:n}),p=this.getCancellationPromise(t);let m;try{const v=await Promise.race([p,l,i]);if(v.__type!==rs.PROCESSED)throw new Z2(n);m=v.response}finally{s=!0,c()}return m}async confirmTransactionUsingDurableNonceStrategy({commitment:r,strategy:{abortSignal:t,minContextSlot:e,nonceAccountPubkey:n,nonceValue:s,signature:i}}){let c=!1;const l=new Promise(E=>{let w=s,x=null;const A=async()=>{try{const{context:B,value:P}=await this.getNonceAndContext(n,{commitment:r,minContextSlot:e});return x=B.slot,P==null?void 0:P.nonce}catch{return w}};(async()=>{if(w=await A(),!c)for(;;){if(s!==w)return void E({__type:rs.NONCE_INVALID,slotInWhichNonceDidAdvance:x});if(await xa(2e3),c||(w=await A(),c))return}})()}),{abortConfirmation:p,confirmationPromise:m}=this.getTransactionConfirmationPromise({commitment:r,signature:i}),v=this.getCancellationPromise(t);let _;try{const E=await Promise.race([v,m,l]);if(E.__type===rs.PROCESSED)_=E.response;else{let w;for(;;){const x=await this.getSignatureStatus(i);if(x==null)break;if(!(x.context.slot<(E.slotInWhichNonceDidAdvance??e))){w=x;break}await xa(400)}if(!(w!=null&&w.value))throw new Su(i);{const x=r||"finalized",{confirmationStatus:A}=w.value;switch(x){case"processed":case"recent":if(A!=="processed"&&A!=="confirmed"&&A!=="finalized")throw new Su(i);break;case"confirmed":case"single":case"singleGossip":if(A!=="confirmed"&&A!=="finalized")throw new Su(i);break;case"finalized":case"max":case"root":if(A!=="finalized")throw new Su(i)}_={context:w.context,value:{err:w.value.err}}}}}finally{c=!0,p()}return _}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:r,signature:t}){let e;const n=new Promise(l=>{let p=this._confirmTransactionInitialTimeout||6e4;switch(r){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":p=this._confirmTransactionInitialTimeout||3e4}e=setTimeout(()=>l({__type:rs.TIMED_OUT,timeoutMs:p}),p)}),{abortConfirmation:s,confirmationPromise:i}=this.getTransactionConfirmationPromise({commitment:r,signature:t});let c;try{const l=await Promise.race([i,n]);if(l.__type!==rs.PROCESSED)throw new W2(t,l.timeoutMs/1e3);c=l.response}finally{clearTimeout(e),s()}return c}async getClusterNodes(){const r=Ee(await this._rpcRequest("getClusterNodes",[]),rr(Ie(VF)));if("error"in r)throw new De(r.error,"failed to get cluster nodes");return r.result}async getVoteAccounts(r){const t=this._buildArgs([],r),e=Ee(await this._rpcRequest("getVoteAccounts",t),ZF);if("error"in e)throw new De(e.error,"failed to get vote accounts");return e.result}async getSlot(r){const{commitment:t,config:e}=Fr(r),n=this._buildArgs([],t,void 0,e),s=Ee(await this._rpcRequest("getSlot",n),rr(jt()));if("error"in s)throw new De(s.error,"failed to get slot");return s.result}async getSlotLeader(r){const{commitment:t,config:e}=Fr(r),n=this._buildArgs([],t,void 0,e),s=Ee(await this._rpcRequest("getSlotLeader",n),rr(_e()));if("error"in s)throw new De(s.error,"failed to get slot leader");return s.result}async getSlotLeaders(r,t){const e=[r,t],n=Ee(await this._rpcRequest("getSlotLeaders",e),rr(Ie(hn)));if("error"in n)throw new De(n.error,"failed to get slot leaders");return n.result}async getSignatureStatus(r,t){const{context:e,value:n}=await this.getSignatureStatuses([r],t);return xr(n.length===1),{context:e,value:n[0]}}async getSignatureStatuses(r,t){const e=[r];t&&e.push(t);const n=Ee(await this._rpcRequest("getSignatureStatuses",e),YF);if("error"in n)throw new De(n.error,"failed to get signature status");return n.result}async getTransactionCount(r){const{commitment:t,config:e}=Fr(r),n=this._buildArgs([],t,void 0,e),s=Ee(await this._rpcRequest("getTransactionCount",n),rr(jt()));if("error"in s)throw new De(s.error,"failed to get transaction count");return s.result}async getTotalSupply(r){return(await this.getSupply({commitment:r,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(r){const t=this._buildArgs([],r),e=Ee(await this._rpcRequest("getInflationGovernor",t),bF);if("error"in e)throw new De(e.error,"failed to get inflation");return e.result}async getInflationReward(r,t,e){const{commitment:n,config:s}=Fr(e),i=this._buildArgs([r.map(l=>l.toBase58())],n,void 0,{...s,epoch:t??(s==null?void 0:s.epoch)}),c=Ee(await this._rpcRequest("getInflationReward",i),fF);if("error"in c)throw new De(c.error,"failed to get inflation reward");return c.result}async getInflationRate(){const r=Ee(await this._rpcRequest("getInflationRate",[]),wF);if("error"in r)throw new De(r.error,"failed to get inflation rate");return r.result}async getEpochInfo(r){const{commitment:t,config:e}=Fr(r),n=this._buildArgs([],t,void 0,e),s=Ee(await this._rpcRequest("getEpochInfo",n),_F);if("error"in s)throw new De(s.error,"failed to get epoch info");return s.result}async getEpochSchedule(){const r=Ee(await this._rpcRequest("getEpochSchedule",[]),MF);if("error"in r)throw new De(r.error,"failed to get epoch schedule");const t=r.result;return new e4(t.slotsPerEpoch,t.leaderScheduleSlotOffset,t.warmup,t.firstNormalEpoch,t.firstNormalSlot)}async getLeaderSchedule(){const r=Ee(await this._rpcRequest("getLeaderSchedule",[]),EF);if("error"in r)throw new De(r.error,"failed to get leader schedule");return r.result}async getMinimumBalanceForRentExemption(r,t){const e=this._buildArgs([r],t),n=Ee(await this._rpcRequest("getMinimumBalanceForRentExemption",e),XF);return"error"in n?(console.warn("Unable to fetch minimum balance for rent exemption"),0):n.result}async getRecentBlockhashAndContext(r){const t=this._buildArgs([],r),e=Ee(await this._rpcRequest("getRecentBlockhash",t),oj);if("error"in e)throw new De(e.error,"failed to get recent blockhash");return e.result}async getRecentPerformanceSamples(r){const t=Ee(await this._rpcRequest("getRecentPerformanceSamples",r?[r]:[]),uj);if("error"in t)throw new De(t.error,"failed to get recent performance samples");return t.result}async getFeeCalculatorForBlockhash(r,t){const e=this._buildArgs([r],t),n=Ee(await this._rpcRequest("getFeeCalculatorForBlockhash",e),fj);if("error"in n)throw new De(n.error,"failed to get fee calculator");const{context:s,value:i}=n.result;return{context:s,value:i!==null?i.feeCalculator:null}}async getFeeForMessage(r,t){const e=nr(r.serialize()).toString("base64"),n=this._buildArgs([e],t),s=Ee(await this._rpcRequest("getFeeForMessage",n),nn(ke(jt())));if("error"in s)throw new De(s.error,"failed to get fee for message");if(s.result===null)throw new Error("invalid blockhash");return s.result}async getRecentPrioritizationFees(r){var s;const t=(s=r==null?void 0:r.lockedWritableAccounts)==null?void 0:s.map(i=>i.toBase58()),e=t!=null&&t.length?[t]:[],n=Ee(await this._rpcRequest("getRecentPrioritizationFees",e),xF);if("error"in n)throw new De(n.error,"failed to get recent prioritization fees");return n.result}async getRecentBlockhash(r){try{return(await this.getRecentBlockhashAndContext(r)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhash(r){try{return(await this.getLatestBlockhashAndContext(r)).value}catch(t){throw new Error("failed to get recent blockhash: "+t)}}async getLatestBlockhashAndContext(r){const{commitment:t,config:e}=Fr(r),n=this._buildArgs([],t,void 0,e),s=Ee(await this._rpcRequest("getLatestBlockhash",n),sj);if("error"in s)throw new De(s.error,"failed to get latest blockhash");return s.result}async isBlockhashValid(r,t){const{commitment:e,config:n}=Fr(t),s=this._buildArgs([r],e,void 0,n),i=Ee(await this._rpcRequest("isBlockhashValid",s),aj);if("error"in i)throw new De(i.error,"failed to determine if the blockhash `"+r+"`is valid");return i.result}async getVersion(){const r=Ee(await this._rpcRequest("getVersion",[]),rr(gF));if("error"in r)throw new De(r.error,"failed to get version");return r.result}async getGenesisHash(){const r=Ee(await this._rpcRequest("getGenesisHash",[]),rr(_e()));if("error"in r)throw new De(r.error,"failed to get genesis hash");return r.result}async getBlock(r,t){const{commitment:e,config:n}=Fr(t),s=this._buildArgsAtLeastConfirmed([r],e,void 0,n),i=await this._rpcRequest("getBlock",s);try{switch(n==null?void 0:n.transactionDetails){case"accounts":{const c=Ee(i,tj);if("error"in c)throw c.error;return c.result}case"none":{const c=Ee(i,QF);if("error"in c)throw c.error;return c.result}default:{const c=Ee(i,JF);if("error"in c)throw c.error;const{result:l}=c;return l?{...l,transactions:l.transactions.map(({transaction:p,meta:m,version:v})=>({meta:m,transaction:{...p,message:Xp(v,p.message)},version:v}))}:null}}}catch(c){throw new De(c,"failed to get confirmed block")}}async getParsedBlock(r,t){const{commitment:e,config:n}=Fr(t),s=this._buildArgsAtLeastConfirmed([r],e,"jsonParsed",n),i=await this._rpcRequest("getBlock",s);try{switch(n==null?void 0:n.transactionDetails){case"accounts":{const c=Ee(i,rj);if("error"in c)throw c.error;return c.result}case"none":{const c=Ee(i,nj);if("error"in c)throw c.error;return c.result}default:{const c=Ee(i,ej);if("error"in c)throw c.error;return c.result}}}catch(c){throw new De(c,"failed to get block")}}async getBlockProduction(r){let t,e;if(typeof r=="string")e=r;else if(r){const{commitment:i,...c}=r;e=i,t=c}const n=this._buildArgs([],e,"base64",t),s=Ee(await this._rpcRequest("getBlockProduction",n),yF);if("error"in s)throw new De(s.error,"failed to get block production information");return s.result}async getTransaction(r,t){const{commitment:e,config:n}=Fr(t),s=this._buildArgsAtLeastConfirmed([r],e,void 0,n),i=Ee(await this._rpcRequest("getTransaction",s),Jp);if("error"in i)throw new De(i.error,"failed to get transaction");const c=i.result;return c&&{...c,transaction:{...c.transaction,message:Xp(c.version,c.transaction.message)}}}async getParsedTransaction(r,t){const{commitment:e,config:n}=Fr(t),s=this._buildArgsAtLeastConfirmed([r],e,"jsonParsed",n),i=Ee(await this._rpcRequest("getTransaction",s),d0);if("error"in i)throw new De(i.error,"failed to get transaction");return i.result}async getParsedTransactions(r,t){const{commitment:e,config:n}=Fr(t),s=r.map(i=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([i],e,"jsonParsed",n)}));return(await this._rpcBatchRequest(s)).map(i=>{const c=Ee(i,d0);if("error"in c)throw new De(c.error,"failed to get transactions");return c.result})}async getTransactions(r,t){const{commitment:e,config:n}=Fr(t),s=r.map(i=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([i],e,void 0,n)}));return(await this._rpcBatchRequest(s)).map(i=>{const c=Ee(i,Jp);if("error"in c)throw new De(c.error,"failed to get transactions");const l=c.result;return l&&{...l,transaction:{...l.transaction,message:Xp(l.version,l.transaction.message)}}})}async getConfirmedBlock(r,t){const e=this._buildArgsAtLeastConfirmed([r],t),n=Ee(await this._rpcRequest("getConfirmedBlock",e),ij);if("error"in n)throw new De(n.error,"failed to get confirmed block");const s=n.result;if(!s)throw new Error("Confirmed block "+r+" not found");const i={...s,transactions:s.transactions.map(({transaction:c,meta:l})=>{const p=new uo(c.message);return{meta:l,transaction:{...c,message:p}}})};return{...i,transactions:i.transactions.map(({transaction:c,meta:l})=>({meta:l,transaction:wr.populate(c.message,c.signatures)}))}}async getBlocks(r,t,e){const n=this._buildArgsAtLeastConfirmed(t!==void 0?[r,t]:[r],e),s=Ee(await this._rpcRequest("getBlocks",n),rr(Ie(jt())));if("error"in s)throw new De(s.error,"failed to get blocks");return s.result}async getBlockSignatures(r,t){const e=this._buildArgsAtLeastConfirmed([r],t,void 0,{transactionDetails:"signatures",rewards:!1}),n=Ee(await this._rpcRequest("getBlock",e),s4);if("error"in n)throw new De(n.error,"failed to get block");const s=n.result;if(!s)throw new Error("Block "+r+" not found");return s}async getConfirmedBlockSignatures(r,t){const e=this._buildArgsAtLeastConfirmed([r],t,void 0,{transactionDetails:"signatures",rewards:!1}),n=Ee(await this._rpcRequest("getConfirmedBlock",e),s4);if("error"in n)throw new De(n.error,"failed to get confirmed block");const s=n.result;if(!s)throw new Error("Confirmed block "+r+" not found");return s}async getConfirmedTransaction(r,t){const e=this._buildArgsAtLeastConfirmed([r],t),n=Ee(await this._rpcRequest("getConfirmedTransaction",e),Jp);if("error"in n)throw new De(n.error,"failed to get transaction");const s=n.result;if(!s)return s;const i=new uo(s.transaction.message),c=s.transaction.signatures;return{...s,transaction:wr.populate(i,c)}}async getParsedConfirmedTransaction(r,t){const e=this._buildArgsAtLeastConfirmed([r],t,"jsonParsed"),n=Ee(await this._rpcRequest("getConfirmedTransaction",e),d0);if("error"in n)throw new De(n.error,"failed to get confirmed transaction");return n.result}async getParsedConfirmedTransactions(r,t){const e=r.map(n=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([n],t,"jsonParsed")}));return(await this._rpcBatchRequest(e)).map(n=>{const s=Ee(n,d0);if("error"in s)throw new De(s.error,"failed to get confirmed transactions");return s.result})}async getConfirmedSignaturesForAddress(r,t,e){let n={},s=await this.getFirstAvailableBlock();for(;!("until"in n)&&!(--t<=0||t0&&(n.until=c.signatures[c.signatures.length-1].toString())}catch(c){if(c instanceof Error&&c.message.includes("skipped"))continue;throw c}let i=await this.getSlot("finalized");for(;!("before"in n||++e>i);)try{const c=await this.getConfirmedBlockSignatures(e);c.signatures.length>0&&(n.before=c.signatures[c.signatures.length-1].toString())}catch(c){if(c instanceof Error&&c.message.includes("skipped"))continue;throw c}return(await this.getConfirmedSignaturesForAddress2(r,n)).map(c=>c.signature)}async getConfirmedSignaturesForAddress2(r,t,e){const n=this._buildArgsAtLeastConfirmed([r.toBase58()],e,void 0,t),s=Ee(await this._rpcRequest("getConfirmedSignaturesForAddress2",n),OF);if("error"in s)throw new De(s.error,"failed to get confirmed signatures for address");return s.result}async getSignaturesForAddress(r,t,e){const n=this._buildArgsAtLeastConfirmed([r.toBase58()],e,void 0,t),s=Ee(await this._rpcRequest("getSignaturesForAddress",n),UF);if("error"in s)throw new De(s.error,"failed to get signatures for address");return s.result}async getAddressLookupTable(r,t){const{context:e,value:n}=await this.getAccountInfoAndContext(r,t);let s=null;return n!==null&&(s=new Yp({key:r,state:Yp.deserialize(n.data)})),{context:e,value:s}}async getNonceAndContext(r,t){const{context:e,value:n}=await this.getAccountInfoAndContext(r,t);let s=null;return n!==null&&(s=El.fromAccountData(n.data)),{context:e,value:s}}async getNonce(r,t){return await this.getNonceAndContext(r,t).then(e=>e.value).catch(e=>{throw new Error("failed to get nonce for account "+r.toBase58()+": "+e)})}async requestAirdrop(r,t){const e=Ee(await this._rpcRequest("requestAirdrop",[r.toBase58(),t]),cj);if("error"in e)throw new De(e.error,`airdrop to ${r.toBase58()} failed`);return e.result}async _blockhashWithExpiryBlockHeight(r){if(!r){for(;this._pollingBlockhash;)await xa(100);const t=Date.now()-this._blockhashInfo.lastFetch>=3e4;if(this._blockhashInfo.latestBlockhash!==null&&!t)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const r=Date.now(),t=this._blockhashInfo.latestBlockhash,e=t?t.blockhash:null;for(let n=0;n<50;n++){const s=await this.getLatestBlockhash("finalized");if(e!==s.blockhash)return this._blockhashInfo={latestBlockhash:s,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},s;await xa(200)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-r}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(r){const{commitment:t,config:e}=Fr(r),n=this._buildArgs([],t,"base64",e),s=Ee(await this._rpcRequest("getStakeMinimumDelegation",n),nn(jt()));if("error"in s)throw new De(s.error,"failed to get stake minimum delegation");return s.result}async simulateTransaction(r,t,e){if("message"in r){const _=r.serialize(),E=Ae.Buffer.from(_).toString("base64");if(Array.isArray(t)||e!==void 0)throw new Error("Invalid arguments");const w=t||{};w.encoding="base64","commitment"in w||(w.commitment=this.commitment);const x=[E,w],A=Ee(await this._rpcRequest("simulateTransaction",x),r4);if("error"in A)throw new Error("failed to simulate transaction: "+A.error.message);return A.result}let n;if(r instanceof wr){let _=r;n=new wr,n.feePayer=_.feePayer,n.instructions=r.instructions,n.nonceInfo=_.nonceInfo,n.signatures=_.signatures}else n=wr.populate(r),n._message=n._json=void 0;if(t!==void 0&&!Array.isArray(t))throw new Error("Invalid arguments");const s=t;if(n.nonceInfo&&s)n.sign(...s);else{let _=this._disableBlockhashCaching;for(;;){const E=await this._blockhashWithExpiryBlockHeight(_);if(n.lastValidBlockHeight=E.lastValidBlockHeight,n.recentBlockhash=E.blockhash,!s)break;if(n.sign(...s),!n.signature)throw new Error("!signature");const w=n.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(w)&&!this._blockhashInfo.transactionSignatures.includes(w)){this._blockhashInfo.simulatedSignatures.push(w);break}_=!0}}const i=n._compile(),c=i.serialize(),l=n._serialize(c).toString("base64"),p={encoding:"base64",commitment:this.commitment};if(e){const _=(Array.isArray(e)?e:i.nonProgramIds()).map(E=>E.toBase58());p.accounts={encoding:"base64",addresses:_}}s&&(p.sigVerify=!0);const m=[l,p],v=Ee(await this._rpcRequest("simulateTransaction",m),r4);if("error"in v){let _;if("data"in v.error&&(_=v.error.data.logs,_&&Array.isArray(_))){const E=` + `,w=E+_.join(E);console.error(v.error.message,w)}throw new Ku("failed to simulate transaction: "+v.error.message,_)}return v.result}async sendTransaction(r,t,e){if("version"in r){if(t&&Array.isArray(t))throw new Error("Invalid arguments");const i=r.serialize();return await this.sendRawTransaction(i,t)}if(t===void 0||!Array.isArray(t))throw new Error("Invalid arguments");const n=t;if(r.nonceInfo)r.sign(...n);else{let i=this._disableBlockhashCaching;for(;;){const c=await this._blockhashWithExpiryBlockHeight(i);if(r.lastValidBlockHeight=c.lastValidBlockHeight,r.recentBlockhash=c.blockhash,r.sign(...n),!r.signature)throw new Error("!signature");const l=r.signature.toString("base64");if(!this._blockhashInfo.transactionSignatures.includes(l)){this._blockhashInfo.transactionSignatures.push(l);break}i=!0}}const s=r.serialize();return await this.sendRawTransaction(s,e)}async sendRawTransaction(r,t){const e=nr(r).toString("base64");return await this.sendEncodedTransaction(e,t)}async sendEncodedTransaction(r,t){const e={encoding:"base64"},n=t&&t.skipPreflight,s=t&&t.preflightCommitment||this.commitment;t&&t.maxRetries!=null&&(e.maxRetries=t.maxRetries),t&&t.minContextSlot!=null&&(e.minContextSlot=t.minContextSlot),n&&(e.skipPreflight=n),s&&(e.preflightCommitment=s);const i=[r,e],c=Ee(await this._rpcRequest("sendTransaction",i),hj);if("error"in c){let l;throw"data"in c.error&&(l=c.error.data.logs),new Ku("failed to send transaction: "+c.error.message,l)}return c.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()},5e3),this._updateSubscriptions()}_wsOnError(r){this._rpcWebSocketConnected=!1,console.error("ws error:",r.message)}_wsOnClose(r){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),r!==1e3?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach(([t,e])=>{this._setSubscription(t,{...e,state:"pending"})})):this._updateSubscriptions()}_setSubscription(r,t){var n;const e=(n=this._subscriptionsByHash[r])==null?void 0:n.state;if(this._subscriptionsByHash[r]=t,e!==t.state){const s=this._subscriptionStateChangeCallbacksByHash[r];s&&s.forEach(i=>{try{i(t.state)}catch{}})}}_onSubscriptionStateChange(r,t){var s;const e=this._subscriptionHashByClientSubscriptionId[r];if(e==null)return()=>{};const n=(s=this._subscriptionStateChangeCallbacksByHash)[e]||(s[e]=new Set);return n.add(t),()=>{n.delete(t),n.size===0&&delete this._subscriptionStateChangeCallbacksByHash[e]}}async _updateSubscriptions(){if(Object.keys(this._subscriptionsByHash).length===0)return void(this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(e){e instanceof Error&&console.log(`Error when closing socket connection: ${e.message}`)}},500)));if(this._rpcWebSocketIdleTimeout!==null&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected)return void this._rpcWebSocket.connect();const r=this._rpcWebSocketGeneration,t=()=>r===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map(async e=>{const n=this._subscriptionsByHash[e];if(n!==void 0)switch(n.state){case"pending":case"unsubscribed":if(n.callbacks.size===0)return delete this._subscriptionsByHash[e],n.state==="unsubscribed"&&delete this._subscriptionCallbacksByServerSubscriptionId[n.serverSubscriptionId],void await this._updateSubscriptions();await(async()=>{const{args:s,method:i}=n;try{this._setSubscription(e,{...n,state:"subscribing"});const c=await this._rpcWebSocket.call(i,s);this._setSubscription(e,{...n,serverSubscriptionId:c,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[c]=n.callbacks,await this._updateSubscriptions()}catch(c){if(c instanceof Error&&console.error(`${i} error for argument`,s,c.message),!t())return;this._setSubscription(e,{...n,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":n.callbacks.size===0&&await(async()=>{const{serverSubscriptionId:s,unsubscribeMethod:i}=n;if(this._subscriptionsAutoDisposedByRpc.has(s))this._subscriptionsAutoDisposedByRpc.delete(s);else{this._setSubscription(e,{...n,state:"unsubscribing"}),this._setSubscription(e,{...n,state:"unsubscribing"});try{await this._rpcWebSocket.call(i,[s])}catch(c){return c instanceof Error&&console.error(`${i} error:`,c.message),t()?(this._setSubscription(e,{...n,state:"subscribed"}),void await this._updateSubscriptions()):void 0}}this._setSubscription(e,{...n,state:"unsubscribed"}),await this._updateSubscriptions()})()}}))}_handleServerNotification(r,t){const e=this._subscriptionCallbacksByServerSubscriptionId[r];e!==void 0&&e.forEach(n=>{try{n(...t)}catch(s){console.error(s)}})}_wsOnAccountNotification(r){const{result:t,subscription:e}=Ee(r,NF);this._handleServerNotification(e,[t.value,t.context])}_makeSubscription(r,t){const e=this._nextClientSubscriptionId++,n=t4([r.method,t],!0),s=this._subscriptionsByHash[n];return s===void 0?this._subscriptionsByHash[n]={...r,args:t,callbacks:new Set([r.callback]),state:"pending"}:s.callbacks.add(r.callback),this._subscriptionHashByClientSubscriptionId[e]=n,this._subscriptionDisposeFunctionsByClientSubscriptionId[e]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[e],delete this._subscriptionHashByClientSubscriptionId[e];const i=this._subscriptionsByHash[n];xr(i!==void 0,`Could not find a \`Subscription\` when tearing down client subscription #${e}`),i.callbacks.delete(r.callback),await this._updateSubscriptions()},this._updateSubscriptions(),e}onAccountChange(r,t,e){const n=this._buildArgs([r.toBase58()],e||this._commitment||"finalized","base64");return this._makeSubscription({callback:t,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},n)}async removeAccountChangeListener(r){await this._unsubscribeClientSubscription(r,"account change")}_wsOnProgramAccountNotification(r){const{result:t,subscription:e}=Ee(r,zF);this._handleServerNotification(e,[{accountId:t.value.pubkey,accountInfo:t.value.account},t.context])}onProgramAccountChange(r,t,e,n){const s=this._buildArgs([r.toBase58()],e||this._commitment||"finalized","base64",n?{filters:n}:void 0);return this._makeSubscription({callback:t,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},s)}async removeProgramAccountChangeListener(r){await this._unsubscribeClientSubscription(r,"program account change")}onLogs(r,t,e){const n=this._buildArgs([typeof r=="object"?{mentions:[r.toString()]}:r],e||this._commitment||"finalized");return this._makeSubscription({callback:t,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},n)}async removeOnLogsListener(r){await this._unsubscribeClientSubscription(r,"logs")}_wsOnLogsNotification(r){const{result:t,subscription:e}=Ee(r,dj);this._handleServerNotification(e,[t.value,t.context])}_wsOnSlotNotification(r){const{result:t,subscription:e}=Ee(r,FF);this._handleServerNotification(e,[t])}onSlotChange(r){return this._makeSubscription({callback:r,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(r){await this._unsubscribeClientSubscription(r,"slot change")}_wsOnSlotUpdatesNotification(r){const{result:t,subscription:e}=Ee(r,KF);this._handleServerNotification(e,[t])}onSlotUpdate(r){return this._makeSubscription({callback:r,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(r){await this._unsubscribeClientSubscription(r,"slot update")}async _unsubscribeClientSubscription(r,t){const e=this._subscriptionDisposeFunctionsByClientSubscriptionId[r];e?await e():console.warn(`Ignored unsubscribe request because an active subscription with id \`${r}\` for '${t}' events could not be found.`)}_buildArgs(r,t,e,n){const s=t||this._commitment;if(s||e||n){let i={};e&&(i.encoding=e),s&&(i.commitment=s),n&&(i=Object.assign(i,n)),r.push(i)}return r}_buildArgsAtLeastConfirmed(r,t,e,n){const s=t||this._commitment;if(s&&!["confirmed","finalized"].includes(s))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(r,t,e,n)}_wsOnSignatureNotification(r){const{result:t,subscription:e}=Ee(r,$F);t.value!=="receivedSignature"&&this._subscriptionsAutoDisposedByRpc.add(e),this._handleServerNotification(e,t.value==="receivedSignature"?[{type:"received"},t.context]:[{type:"status",result:t.value},t.context])}onSignature(r,t,e){const n=this._buildArgs([r],e||this._commitment||"finalized"),s=this._makeSubscription({callback:(i,c)=>{if(i.type==="status"){t(i.result,c);try{this.removeSignatureListener(s)}catch{}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},n);return s}onSignatureWithOptions(r,t,e){const{commitment:n,...s}={...e,commitment:e&&e.commitment||this._commitment||"finalized"},i=this._buildArgs([r],n,void 0,s),c=this._makeSubscription({callback:(l,p)=>{t(l,p);try{this.removeSignatureListener(c)}catch{}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return c}async removeSignatureListener(r){await this._unsubscribeClientSubscription(r,"signature result")}_wsOnRootNotification(r){const{result:t,subscription:e}=Ee(r,HF);this._handleServerNotification(e,[t])}onRootChange(r){return this._makeSubscription({callback:r,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(r){await this._unsubscribeClientSubscription(r,"root change")}},Ed25519Program:kd,Enum:class extends V2{constructor(r){if(super(r),this.enum="",Object.keys(r).length!==1)throw new Error("Enum can only take single value");Object.keys(r).map(t=>{this.enum=t})}},EpochSchedule:e4,FeeCalculatorLayout:sA,Keypair:$u,LAMPORTS_PER_SOL:1e9,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:ys,Loader:ja,Lockup:ih,MAX_SEED_LENGTH:32,Message:uo,MessageAccountKeys:eh,MessageV0:eu,NONCE_ACCOUNT_LENGTH:rh,NonceAccount:El,PACKET_DATA_SIZE:ju,PUBLIC_KEY_LENGTH:Si,PublicKey:Xt,SIGNATURE_LENGTH_IN_BYTES:hf,SOLANA_SCHEMA:Ic,STAKE_CONFIG_ID:vA,STAKE_INSTRUCTION_LAYOUTS:_n,SYSTEM_INSTRUCTION_LAYOUTS:Ur,SYSVAR_CLOCK_PUBKEY:oo,SYSVAR_EPOCH_SCHEDULE_PUBKEY:Wq,SYSVAR_INSTRUCTIONS_PUBKEY:Gq,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:J0,SYSVAR_RENT_PUBKEY:na,SYSVAR_REWARDS_PUBKEY:Yq,SYSVAR_SLOT_HASHES_PUBKEY:Xq,SYSVAR_SLOT_HISTORY_PUBKEY:Jq,SYSVAR_STAKE_HISTORY_PUBKEY:Q0,Secp256k1Program:Hu,SendTransactionError:Ku,SolanaJSONRPCError:De,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},StakeAuthorizationLayout:vj,StakeInstruction:class{constructor(){}static decodeInstructionType(r){this.checkProgramId(r.programId);const t=Ce("instruction").decode(r.data);let e;for(const[n,s]of Object.entries(_n))if(s.index==t){e=n;break}if(!e)throw new Error("Instruction type incorrect; not a StakeInstruction");return e}static decodeInitialize(r){this.checkProgramId(r.programId),this.checkKeyLength(r.keys,2);const{authorized:t,lockup:e}=Br(_n.Initialize,r.data);return{stakePubkey:r.keys[0].pubkey,authorized:new f4(new Xt(t.staker),new Xt(t.withdrawer)),lockup:new ih(e.unixTimestamp,e.epoch,new Xt(e.custodian))}}static decodeDelegate(r){return this.checkProgramId(r.programId),this.checkKeyLength(r.keys,6),Br(_n.Delegate,r.data),{stakePubkey:r.keys[0].pubkey,votePubkey:r.keys[1].pubkey,authorizedPubkey:r.keys[5].pubkey}}static decodeAuthorize(r){this.checkProgramId(r.programId),this.checkKeyLength(r.keys,3);const{newAuthorized:t,stakeAuthorizationType:e}=Br(_n.Authorize,r.data),n={stakePubkey:r.keys[0].pubkey,authorizedPubkey:r.keys[2].pubkey,newAuthorizedPubkey:new Xt(t),stakeAuthorizationType:{index:e}};return r.keys.length>3&&(n.custodianPubkey=r.keys[3].pubkey),n}static decodeAuthorizeWithSeed(r){this.checkProgramId(r.programId),this.checkKeyLength(r.keys,2);const{newAuthorized:t,stakeAuthorizationType:e,authoritySeed:n,authorityOwner:s}=Br(_n.AuthorizeWithSeed,r.data),i={stakePubkey:r.keys[0].pubkey,authorityBase:r.keys[1].pubkey,authoritySeed:n,authorityOwner:new Xt(s),newAuthorizedPubkey:new Xt(t),stakeAuthorizationType:{index:e}};return r.keys.length>3&&(i.custodianPubkey=r.keys[3].pubkey),i}static decodeSplit(r){this.checkProgramId(r.programId),this.checkKeyLength(r.keys,3);const{lamports:t}=Br(_n.Split,r.data);return{stakePubkey:r.keys[0].pubkey,splitStakePubkey:r.keys[1].pubkey,authorizedPubkey:r.keys[2].pubkey,lamports:t}}static decodeMerge(r){return this.checkProgramId(r.programId),this.checkKeyLength(r.keys,3),Br(_n.Merge,r.data),{stakePubkey:r.keys[0].pubkey,sourceStakePubKey:r.keys[1].pubkey,authorizedPubkey:r.keys[4].pubkey}}static decodeWithdraw(r){this.checkProgramId(r.programId),this.checkKeyLength(r.keys,5);const{lamports:t}=Br(_n.Withdraw,r.data),e={stakePubkey:r.keys[0].pubkey,toPubkey:r.keys[1].pubkey,authorizedPubkey:r.keys[4].pubkey,lamports:t};return r.keys.length>5&&(e.custodianPubkey=r.keys[5].pubkey),e}static decodeDeactivate(r){return this.checkProgramId(r.programId),this.checkKeyLength(r.keys,3),Br(_n.Deactivate,r.data),{stakePubkey:r.keys[0].pubkey,authorizedPubkey:r.keys[2].pubkey}}static checkProgramId(r){if(!r.equals(Sl.programId))throw new Error("invalid instruction; programId is not StakeProgram")}static checkKeyLength(r,t){if(r.length({decode:r.decode.bind(r),encode:r.encode.bind(r)}),tl=(r=>t=>{const e=Or(r,t),{encode:n,decode:s}=Ty(e),i=e;return i.decode=(c,l)=>{const p=s(c,l);return NE(Zt.Buffer.from(p))},i.encode=(c,l,p)=>{const m=yy(c,r);return n(m,l,p)},i})(8),bA=r=>{const t=or(r),{encode:e,decode:n}=Ty(t),s=t;return s.decode=(i,c)=>!!n(i,c),s.encode=(i,c,l)=>{const p=Number(i);return e(p,c,l)},s},Rn=r=>{const t=Or(32,r),{encode:e,decode:n}=Ty(t),s=t;return s.decode=(i,c)=>{const l=n(i,c);return new Xt(l)},s.encode=(i,c,l)=>{const p=i.toBuffer();return e(p,c,l)},s};class Mj extends Error{constructor(t){super(t)}}class Ej extends Mj{constructor(){super(...arguments),this.name="TokenOwnerOffCurveError"}}var d4;(function(r){r[r.Uninitialized=0]="Uninitialized",r[r.Mint=1]="Mint",r[r.Account=2]="Account"})(d4||(d4={}));Ue([or("m"),or("n"),bA("isInitialized"),Rn("signer1"),Rn("signer2"),Rn("signer3"),Rn("signer4"),Rn("signer5"),Rn("signer6"),Rn("signer7"),Rn("signer8"),Rn("signer9"),Rn("signer10"),Rn("signer11")]).span;var p4;(function(r){r[r.Uninitialized=0]="Uninitialized",r[r.Initialized=1]="Initialized",r[r.Frozen=2]="Frozen"})(p4||(p4={}));const Aj=Ue([Rn("mint"),Rn("owner"),tl("amount"),Ce("delegateOption"),Rn("delegate"),or("state"),Ce("isNativeOption"),tl("isNative"),tl("delegatedAmount"),Ce("closeAuthorityOption"),Rn("closeAuthority")]);Aj.span;const Sj=Ue([Ce("mintAuthorityOption"),Rn("mintAuthority"),tl("supply"),or("decimals"),bA("isInitialized"),Ce("freezeAuthorityOption"),Rn("freezeAuthority")]);Sj.span;function m4(r,t,e=!1,n=kl,s=ev){if(!e&&!Xt.isOnCurve(t.toBuffer()))throw new Ej;const[i]=Xt.findProgramAddressSync([t.toBuffer(),n.toBuffer(),r.toBuffer()],s);return i}function kj(r,t,e,n,s=kl,i=ev){return function(c,l,p,m,v,_=kl,E=ev){const w=[{pubkey:c,isSigner:!0,isWritable:!0},{pubkey:l,isSigner:!1,isWritable:!0},{pubkey:p,isSigner:!1,isWritable:!1},{pubkey:m,isSigner:!1,isWritable:!1},{pubkey:an.programId,isSigner:!1,isWritable:!1},{pubkey:_,isSigner:!1,isWritable:!1}];return new Ir({keys:w,programId:E,data:v})}(r,t,e,n,Zt.Buffer.alloc(0),s,i)}var Il;(function(r){r.SymbolNotFound="SymbolNotFound",r.InvalidSubdomain="InvalidSubdomain",r.FavouriteDomainNotFound="FavouriteDomainNotFound",r.MissingParentOwner="MissingParentOwner",r.U32Overflow="U32Overflow",r.InvalidBufferLength="InvalidBufferLength",r.U64Overflow="U64Overflow",r.NoRecordData="NoRecordData",r.InvalidRecordData="InvalidRecordData",r.UnsupportedRecord="UnsupportedRecord",r.InvalidEvmAddress="InvalidEvmAddress",r.InvalidInjectiveAddress="InvalidInjectiveAddress",r.InvalidARecord="InvalidARecord",r.InvalidAAAARecord="InvalidAAAARecord",r.InvalidRecordInput="InvalidRecordInput",r.InvalidSignature="InvalidSignature",r.AccountDoesNotExist="AccountDoesNotExist",r.MultipleRegistries="MultipleRegistries",r.InvalidReverseTwitter="InvalidReverseTwitter",r.NoAccountData="NoAccountData",r.InvalidInput="InvalidInput",r.InvalidDomain="InvalidDomain",r.InvalidCustomBg="InvalidCustomBackground",r.UnsupportedSignature="UnsupportedSignature",r.RecordDoestNotSupportGuardianSig="RecordDoestNotSupportGuardianSig",r.RecordIsNotSigned="RecordIsNotSigned",r.UnsupportedSignatureType="UnsupportedSignatureType",r.InvalidSolRecordV2="InvalidSolRecordV2",r.MissingVerifier="MissingVerifier"})(Il||(Il={}));class Bl extends Error{constructor(t,e){super(e),this.name="SNSError",this.type=t,Error.captureStackTrace&&Error.captureStackTrace(this,Bl)}}class oh{constructor(t){this.tag=13,this.name=t.name,this.space=t.space,this.referrerIdxOpt=t.referrerIdxOpt}serialize(){return fy(oh.schema,this)}getInstruction(t,e,n,s,i,c,l,p,m,v,_,E,w,x,A,B,P){const R=Ae.Buffer.from(this.serialize());let C=[];return C.push({pubkey:e,isSigner:!1,isWritable:!1}),C.push({pubkey:n,isSigner:!1,isWritable:!1}),C.push({pubkey:s,isSigner:!1,isWritable:!0}),C.push({pubkey:i,isSigner:!1,isWritable:!0}),C.push({pubkey:c,isSigner:!1,isWritable:!1}),C.push({pubkey:l,isSigner:!1,isWritable:!1}),C.push({pubkey:p,isSigner:!0,isWritable:!0}),C.push({pubkey:m,isSigner:!1,isWritable:!0}),C.push({pubkey:v,isSigner:!1,isWritable:!1}),C.push({pubkey:_,isSigner:!1,isWritable:!1}),C.push({pubkey:E,isSigner:!1,isWritable:!1}),C.push({pubkey:w,isSigner:!1,isWritable:!0}),C.push({pubkey:x,isSigner:!1,isWritable:!1}),C.push({pubkey:A,isSigner:!1,isWritable:!1}),C.push({pubkey:B,isSigner:!1,isWritable:!1}),P&&C.push({pubkey:P,isSigner:!1,isWritable:!0}),new Ir({keys:C,programId:t,data:R})}}oh.schema=new Map([[oh,{kind:"struct",fields:[["tag","u8"],["name","string"],["space","u32"],["referrerIdxOpt",{kind:"option",type:"u16"}]]}]]);new Xt("nftD3vbNkNqfj2Sd3HZwbpw4BxxKWr4AjGb9X38JeZk");Ae.Buffer.from("tokenized_name");var v4;(function(r){r[r.Uninitialized=0]="Uninitialized",r[r.CentralState=1]="CentralState",r[r.ActiveRecord=2]="ActiveRecord",r[r.InactiveRecord=3]="InactiveRecord"})(v4||(v4={}));var wA={},ur={},qh=xA;function xA(r,t){if(!r)throw new Error(t||"Assertion failed")}xA.equal=function(r,t,e){if(r!=t)throw new Error(e||"Assertion failed: "+r+" != "+t)};var rv={exports:{}};typeof Object.create=="function"?rv.exports=function(r,t){t&&(r.super_=t,r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}))}:rv.exports=function(r,t){if(t){r.super_=t;var e=function(){};e.prototype=t.prototype,r.prototype=new e,r.prototype.constructor=r}};var Ij=rv.exports,Bj=qh,Pj=Ij;function Rj(r,t){return(64512&r.charCodeAt(t))==55296&&!(t<0||t+1>=r.length)&&(64512&r.charCodeAt(t+1))==56320}function g4(r){return(r>>>24|r>>>8&65280|r<<8&16711680|(255&r)<<24)>>>0}function y4(r){return r.length===1?"0"+r:r}function b4(r){return r.length===7?"0"+r:r.length===6?"00"+r:r.length===5?"000"+r:r.length===4?"0000"+r:r.length===3?"00000"+r:r.length===2?"000000"+r:r.length===1?"0000000"+r:r}ur.inherits=Pj,ur.toArray=function(r,t){if(Array.isArray(r))return r.slice();if(!r)return[];var e=[];if(typeof r=="string")if(t){if(t==="hex")for((r=r.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(r="0"+r),s=0;s>6|192,e[n++]=63&i|128):Rj(r,s)?(i=65536+((1023&i)<<10)+(1023&r.charCodeAt(++s)),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128)}else for(s=0;s>>0}return i},ur.split32=function(r,t){for(var e=new Array(4*r.length),n=0,s=0;n>>24,e[s+1]=i>>>16&255,e[s+2]=i>>>8&255,e[s+3]=255&i):(e[s+3]=i>>>24,e[s+2]=i>>>16&255,e[s+1]=i>>>8&255,e[s]=255&i)}return e},ur.rotr32=function(r,t){return r>>>t|r<<32-t},ur.rotl32=function(r,t){return r<>>32-t},ur.sum32=function(r,t){return r+t>>>0},ur.sum32_3=function(r,t,e){return r+t+e>>>0},ur.sum32_4=function(r,t,e,n){return r+t+e+n>>>0},ur.sum32_5=function(r,t,e,n,s){return r+t+e+n+s>>>0},ur.sum64=function(r,t,e,n){var s=r[t],i=n+r[t+1]>>>0,c=(i>>0,r[t+1]=i},ur.sum64_hi=function(r,t,e,n){return(t+n>>>0>>0},ur.sum64_lo=function(r,t,e,n){return t+n>>>0},ur.sum64_4_hi=function(r,t,e,n,s,i,c,l){var p=0,m=t;return p+=(m=m+n>>>0)>>0)>>0)>>0},ur.sum64_4_lo=function(r,t,e,n,s,i,c,l){return t+n+i+l>>>0},ur.sum64_5_hi=function(r,t,e,n,s,i,c,l,p,m){var v=0,_=t;return v+=(_=_+n>>>0)>>0)>>0)>>0)>>0},ur.sum64_5_lo=function(r,t,e,n,s,i,c,l,p,m){return t+n+i+l+m>>>0},ur.rotr64_hi=function(r,t,e){return(t<<32-e|r>>>e)>>>0},ur.rotr64_lo=function(r,t,e){return(r<<32-e|t>>>e)>>>0},ur.shr64_hi=function(r,t,e){return r>>>e},ur.shr64_lo=function(r,t,e){return(r<<32-e|t>>>e)>>>0};var Tf={},w4=ur,Cj=qh;function p0(){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}Tf.BlockHash=p0,p0.prototype.update=function(r,t){if(r=w4.toArray(r,t),this.pending?this.pending=this.pending.concat(r):this.pending=r,this.pendingTotal+=r.length,this.pending.length>=this._delta8){var e=(r=this.pending).length%this._delta8;this.pending=r.slice(r.length-e,r.length),this.pending.length===0&&(this.pending=null),r=w4.join32(r,0,r.length-e,this.endian);for(var n=0;n>>24&255,n[s++]=r>>>16&255,n[s++]=r>>>8&255,n[s++]=255&r}else for(n[s++]=255&r,n[s++]=r>>>8&255,n[s++]=r>>>16&255,n[s++]=r>>>24&255,n[s++]=0,n[s++]=0,n[s++]=0,n[s++]=0,i=8;i>>3},ko.g1_256=function(r){return wo(r,17)^wo(r,19)^r>>>10};var pf=ur,Tj=Tf,Lj=ko,tm=pf.rotl32,sc=pf.sum32,Oj=pf.sum32_5,Uj=Lj.ft_1,_A=Tj.BlockHash,Nj=[1518500249,1859775393,2400959708,3395469782];function Oo(){if(!(this instanceof Oo))return new Oo;_A.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}pf.inherits(Oo,_A);var Dj=Oo;Oo.blockSize=512,Oo.outSize=160,Oo.hmacStrength=80,Oo.padLength=64,Oo.prototype._update=function(r,t){for(var e=this.W,n=0;n<16;n++)e[n]=r[t+n];for(;nthis.blockSize&&(r=new this.Hash().update(r).digest()),AK(r.length<=this.blockSize);for(var t=r.length;t{try{if("test".normalize(t)!=="test")throw new Error("bad normalize")}catch{r.push(t)}}),r.length)throw new Error("missing "+r.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(r){return r.message}return null}();var ov,no;(function(r){r.DEBUG="DEBUG",r.INFO="INFO",r.WARNING="WARNING",r.ERROR="ERROR",r.OFF="OFF"})(ov||(ov={})),function(r){r.UNKNOWN_ERROR="UNKNOWN_ERROR",r.NOT_IMPLEMENTED="NOT_IMPLEMENTED",r.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",r.NETWORK_ERROR="NETWORK_ERROR",r.SERVER_ERROR="SERVER_ERROR",r.TIMEOUT="TIMEOUT",r.BUFFER_OVERRUN="BUFFER_OVERRUN",r.NUMERIC_FAULT="NUMERIC_FAULT",r.MISSING_NEW="MISSING_NEW",r.INVALID_ARGUMENT="INVALID_ARGUMENT",r.MISSING_ARGUMENT="MISSING_ARGUMENT",r.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",r.CALL_EXCEPTION="CALL_EXCEPTION",r.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",r.NONCE_EXPIRED="NONCE_EXPIRED",r.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",r.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",r.TRANSACTION_REPLACED="TRANSACTION_REPLACED",r.ACTION_REJECTED="ACTION_REJECTED"}(no||(no={}));const R4="0123456789abcdef";class tn{constructor(t){Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}_log(t,e){const n=t.toLowerCase();el[n]==null&&this.throwArgumentError("invalid log level name","logLevel",t),B4>el[n]||console.log.apply(console,e)}debug(...t){this._log(tn.levels.DEBUG,t)}info(...t){this._log(tn.levels.INFO,t)}warn(...t){this._log(tn.levels.WARNING,t)}makeError(t,e,n){if(I4)return this.makeError("censored error",e,{});e||(e=tn.errors.UNKNOWN_ERROR),n||(n={});const s=[];Object.keys(n).forEach(p=>{const m=n[p];try{if(m instanceof Uint8Array){let v="";for(let _=0;_>4],v+=R4[15&m[_]];s.push(p+"=Uint8Array(0x"+v+")")}else s.push(p+"="+JSON.stringify(m))}catch{s.push(p+"="+JSON.stringify(n[p].toString()))}}),s.push(`code=${e}`),s.push(`version=${this.version}`);const i=t;let c="";switch(e){case no.NUMERIC_FAULT:{c="NUMERIC_FAULT";const p=t;switch(p){case"overflow":case"underflow":case"division-by-zero":c+="-"+p;break;case"negative-power":case"negative-width":c+="-unsupported";break;case"unbound-bitwise-result":c+="-unbound-result"}break}case no.CALL_EXCEPTION:case no.INSUFFICIENT_FUNDS:case no.MISSING_NEW:case no.NONCE_EXPIRED:case no.REPLACEMENT_UNDERPRICED:case no.TRANSACTION_REPLACED:case no.UNPREDICTABLE_GAS_LIMIT:c=e}c&&(t+=" [ See: https://links.ethers.org/v5-errors-"+c+" ]"),s.length&&(t+=" ("+s.join(", ")+")");const l=new Error(t);return l.reason=i,l.code=e,Object.keys(n).forEach(function(p){l[p]=n[p]}),l}throwError(t,e,n){throw this.makeError(t,e,n)}throwArgumentError(t,e,n){return this.throwError(t,tn.errors.INVALID_ARGUMENT,{argument:e,value:n})}assert(t,e,n,s){t||this.throwError(e,n,s)}assertArgument(t,e,n,s){t||this.throwArgumentError(e,n,s)}checkNormalize(t){P4&&this.throwError("platform missing String.prototype.normalize",tn.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:P4})}checkSafeUint53(t,e){typeof t=="number"&&(e==null&&(e="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(e,tn.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(e,tn.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}checkArgumentCount(t,e,n){n=n?": "+n:"",te&&this.throwError("too many arguments"+n,tn.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:e})}checkNew(t,e){t!==Object&&t!=null||this.throwError("missing new",tn.errors.MISSING_NEW,{name:e.name})}checkAbstract(t,e){t===e?this.throwError("cannot instantiate abstract class "+JSON.stringify(e.name)+" directly; use a sub-class",tn.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):t!==Object&&t!=null||this.throwError("missing new",tn.errors.MISSING_NEW,{name:e.name})}static globalLogger(){return nm||(nm=new tn("logger/5.7.0")),nm}static setCensorship(t,e){if(!t&&e&&this.globalLogger().throwError("cannot permanently disable censorship",tn.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),k4){if(!t)return;this.globalLogger().throwError("error censorship permanent",tn.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}I4=!!t,k4=!!e}static setLogLevel(t){const e=el[t.toLowerCase()];e!=null?B4=e:tn.globalLogger().warn("invalid log level - "+t)}static from(t){return new tn(t)}}tn.errors=no,tn.levels=ov;const im=new tn("bytes/5.7.0");function rl(r){return r.slice||(r.slice=function(){const t=Array.prototype.slice.call(arguments);return rl(new Uint8Array(Array.prototype.slice.apply(r,t)))}),r}function C4(r){return typeof r=="number"&&r==r&&r%1==0}function IK(r,t){if(t||(t={}),typeof r=="number"){im.checkSafeUint53(r,"invalid arrayify value");const e=[];for(;r;)e.unshift(255&r),r=parseInt(String(r/256));return e.length===0&&e.push(0),rl(new Uint8Array(e))}if(t.allowMissingPrefix&&typeof r=="string"&&r.substring(0,2)!=="0x"&&(r="0x"+r),function(e){return!!e.toHexString}(r)&&(r=r.toHexString()),function(e,n){return!(typeof e!="string"||!e.match(/^0x[0-9A-Fa-f]*$/)||n&&e.length!==2+2*n)}(r)){let e=r.substring(2);e.length%2&&(t.hexPad==="left"?e="0"+e:t.hexPad==="right"?e+="0":im.throwArgumentError("hex data is odd-length","value",r));const n=[];for(let s=0;s=256)return!1}return!0}(r)?rl(new Uint8Array(r)):im.throwArgumentError("invalid arrayify value","value",r)}function BK(r){return"0x"+kK.sha256().update(IK(r)).digest("hex")}const TA=new Xt("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),PK="SPL Name Service",T4=new Xt("58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx"),v0=new Xt("jCebN34bUfdeUYJT13J1yG16XWQpt5PDx6Mse9GUqhR");new Xt("ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF");new Xt("AUoZ3YAhV3b2rZeEH93UMZHXUZcTramBvb4d9YEVySkc");new Xt("33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z");new Xt("FvPH7PrVrLGKPfqaf3xJodFTjZriqrAXXLTVWEorTFBi");new Xt("4YcexoW3r78zz16J2aqmukBLRwGq6rAvWzJpkYAXqebv");new Xt("DmSyHDSM9eSLyvoLsPvDr5fRRFZ7Bfr3h3ULvWpgQaq7");const RK=new Xt("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"),LA=[new Xt("3ogYncmMM5CmytsGCqKHydmXmKUZ6sGWvizkzqwT7zb1"),new Xt("DM1jJCkZZEwY5tmWbgvKRxsDFzXCdbfrYCCH1CtwguEs"),new Xt("ADCp4QXFajHrhy4f43pD6GJFtQLkdBY2mjS9DfCk7tNW"),new Xt("2XTgjw8yi1E3Etgj4CUyRD7Zk49gynH2U9gA5N2MY4NP"),new Xt("5oDWj8vr3vbcq9JZTtwXqrkCMZggMsDzNietvbr1BNfe"),new Xt("8kJqxAbqbPLGLMgB6FhLcnw2SiUEavx2aEGM3WQGhtJF"),new Xt("HemvJzwxvVpWBjPETpaseAH395WAxb2G73MeUfjVkK1u")],CK=new Map([["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","USDC"],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB","USDT"],["So11111111111111111111111111111111111111112","SOL"],["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp","FIDA"],["FeGn77dhg1KXRRFeSwwMiykZnZPw5JXW6naf2aQgZDQf","ETH"],["7i5KKsX2weiTkry7jA4ZwSuXGhs5eJBEjY8vVxR4pfRx","GMT"],["AFbX8oGjGpmVFywbVouvhQSRmiW2aR1mohfahi4Y2AdB","GST"],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So","MSOL"],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263","BONK"],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz","BAT"],["HZ1JovNiVvGrGNiiYvEozEVgZ58xaU3RKwX8eACQBCt3","PYTH"]]),TK=new Xt("AHtgzX45WTKfkPG53L6WYhGEXwQkN1BVknET3sVsLL8J"),LK=new Xt("GcWEQ9K78FV7LEHteFVciYApERk5YvQuFDQPk1yYJVXi");new Xt("BPeXUQDqGbzxeK1LJby6ugvCBuo7kRSEUkjD726mUVsz");new Xt("72aLKvXeV4aansAQtxKymeXDevT5ed6sCuz9iN62ugPT");new Xt("metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s");var L4={},sv=Oh(yA),Zu={};Object.defineProperty(Zu,"__esModule",{value:!0}),Zu.readBigUInt64LE=Zu.readBigInt64LE=void 0;var OK=function(){return new Error("Attempt to access memory outside buffer bounds")},UK=function(r,t,e){return new Error('The "'+r+'" argument must be of type '+t+". Received "+e)},O4=function(r,t,e){return new Error('The value of "'+r+" is out of range. It must be "+t+". Received "+e)};function av(r,t){if(typeof r!="number")throw UK(t,"number",r)}function U4(r,t){throw Math.floor(r)!==r?(av(r,"offset"),O4("offset","an integer",r)):t<0?OK():O4("offset",">= 0 and <= "+t,r)}Zu.readBigInt64LE=function(r,t){t===void 0&&(t=0),av(t,"offset");var e=r[t],n=r[t+7];e!==void 0&&n!==void 0||U4(t,r.length-8);var s=r[t+4]+r[t+5]*Math.pow(2,8)+r[t+6]*Math.pow(2,16)+(n<<24);return(BigInt(s)<0&&m[m.length-1])||A[0]!==6&&A[0]!==2)){_=0;continue}if(A[0]===3&&(!m||A[1]>m[0]&&A[1]0&&p[p.length-1])||x[0]!==6&&x[0]!==2)){v=0;continue}if(x[0]===3&&(!p||x[1]>p[0]&&x[1]{if(typeof m!="string"&&!Array.isArray(m))throw new TypeError("Expected the input to be `string | string[]`");if(v={pascalCase:!1,preserveConsecutiveUppercase:!1,...v},m=Array.isArray(m)?m.map(w=>w.trim()).filter(w=>w.length).join("-"):m.trim(),m.length===0)return"";const _=v.locale===!1?w=>w.toLowerCase():w=>w.toLocaleLowerCase(v.locale),E=v.locale===!1?w=>w.toUpperCase():w=>w.toLocaleUpperCase(v.locale);return m.length===1?v.pascalCase?E(m):_(m):(m!==_(m)&&(m=((w,x,A)=>{let B=!1,P=!1,R=!1;for(let C=0;C(e.lastIndex=0,w.replace(e,A=>x(A))))(m,_):_(m),v.pascalCase&&(m=E(m.charAt(0))+m.slice(1)),((w,x)=>(c.lastIndex=0,l.lastIndex=0,w.replace(c,(A,B)=>x(B)).replace(l,A=>x(A))))(m,E))};return g0.exports=p,g0.exports.default=p,g0.exports}var zr=Yi(uv()),We={},Be={};class Tr{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function Ly(r,t){return t.property?r+"["+t.property+"]":r}Be.Layout=Tr,Be.nameWithProperty=Ly,Be.bindConstructorLayout=function(r,t){if(typeof r!="function")throw new TypeError("Class must be constructor");if(r.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Tr))throw new TypeError("layout must be a Layout");if(t.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");r.layout_=t,t.boundConstructor_=r,t.makeDestinationObject=()=>new r,Object.defineProperty(r.prototype,"encode",{value:function(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(r,"decode",{value:function(e,n){return t.decode(e,n)},writable:!0})};class ni extends Tr{isCount(){throw new Error("ExternalLayout is abstract")}}class K4 extends ni{constructor(t,e){if(t===void 0&&(t=1),!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e){e===void 0&&(e=0);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}class fv extends ni{constructor(t,e,n){if(!(t instanceof Tr))throw new TypeError("layout must be a Layout");if(e===void 0)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof Po||this.layout instanceof ds}decode(t,e){return e===void 0&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return n===void 0&&(n=0),this.layout.encode(t,e,n+this.offset)}}class Po extends Tr{constructor(t,e){if(super(t,e),6c+s.encode(l,e,n+c),0);return this.count instanceof ni&&this.count.encode(t.length,e,n),i}}class G4 extends Tr{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce((i,c)=>i&&c instanceof Tr,!0))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const i of t)if(0>i.span&&i.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let s=-1;try{s=t.reduce((i,c)=>i+c.getSpan(),0)}catch{}super(s,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;try{n=this.fields.reduce((s,i)=>{const c=i.getSpan(t,e);return e+=c,s+c},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e){e===void 0&&(e=0);const n=this.makeDestinationObject();for(const s of this.fields)if(s.property!==void 0&&(n[s.property]=s.decode(t,e)),e+=s.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){n===void 0&&(n=0);const s=n;let i=0,c=0;for(const l of this.fields){let p=l.span;if(c=0p&&(p=l.getSpan(e,n)))}i=n,n+=p}return i+c-s}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?e=-1:0<=e&&(e+=n.span)}}}class Oy{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class Pl extends Oy{constructor(t,e){if(!(t instanceof ni&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class hv extends Tr{constructor(t,e,n){const s=t instanceof Po||t instanceof ds;if(s)t=new Pl(new fv(t));else if(t instanceof ni&&t.isCount())t=new Pl(t);else if(!(t instanceof Oy))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof Tr))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&s&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=s,this.defaultLayout=e,this.registry={};let c=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(l){return c(l)},this.configGetSourceVariant=function(l){c=l.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){let n;e===void 0&&(e=0);const s=this.discriminator,i=s.decode(t,e);let c=this.registry[i];if(c===void 0){let l=0;c=this.defaultLayout,this.usesPrefixDiscriminator&&(l=s.layout.span),n=this.makeDestinationObject(),n[s.property]=i,n[c.property]=this.defaultLayout.decode(t,e+l)}else n=c.decode(t,e);return n}encode(t,e,n){n===void 0&&(n=0);const s=this.getSourceVariant(t);if(s===void 0){const i=this.discriminator,c=this.defaultLayout;let l=0;return this.usesPrefixDiscriminator&&(l=i.layout.span),i.encode(t[i.property],e,n),l+c.encode(t[c.property],e,n+l)}return s.encode(t,e,n)}addVariant(t,e,n){const s=new OA(this,t,e,n);return this.registry[t]=s,s}getVariant(t,e){let n=t;return Zt.Buffer.isBuffer(t)&&(e===void 0&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class OA extends Tr{constructor(t,e,n,s){if(!(t instanceof hv))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&s===void 0&&(s=n,n=null),n){if(!(n instanceof Tr))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof s!="string")throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,s),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(e===void 0&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let s=0;return this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+s):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){n===void 0&&(n=0);let s=0;if(this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=s;if(this.layout&&(this.layout.encode(t[this.property],e,n+s),i+=this.layout.getSpan(e,n+s),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function Iu(r){return 0>r&&(r+=4294967296),r}class lv extends Tr{constructor(t,e,n){if(!(t instanceof Po||t instanceof ds))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof e=="string"&&n===void 0&&(n=e,e=void 0),4=e)throw new TypeError("bits must be positive integer");const s=8*t.span,i=t.fields.reduce((c,l)=>c+l.bits,0);if(e+i>s)throw new Error("bits too long for span remainder ("+(s-i)+" of "+s+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(!Number.isInteger(t)||t!==Iu(t&this.valueMask))throw new TypeError(Ly("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=Iu(t<n&&(n=this.length.decode(t,e)),n}decode(t,e){e===void 0&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let s=this.length;if(this.length instanceof ni&&(s=t.length),!Zt.Buffer.isBuffer(t)||s!==t.length)throw new TypeError(Ly("Blob.encode",this)+" requires (length "+s+") Buffer as src");if(n+s>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,s,"hex"),this.length instanceof ni&&this.length.encode(s,e,n),s}}class X4 extends Tr{constructor(t){super(-1,t)}getSpan(t,e){if(!Zt.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");e===void 0&&(e=0);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");return s.copy(e,n),e[n+i]=0,i+1}}class J4 extends Tr{constructor(t,e){if(typeof t=="string"&&e===void 0&&(e=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e){if(!Zt.Buffer.isBuffer(t))throw new TypeError("b must be a Buffer");return e===void 0&&(e=0),t.length-e}decode(t,e,n){e===void 0&&(e=0);let s=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return s.copy(e,n),i}}class Q4 extends Tr{constructor(t,e){super(0,e),this.value=t}decode(t,e,n){return this.value}encode(t,e,n){return 0}}Be.ExternalLayout=ni,Be.GreedyCount=K4,Be.OffsetLayout=fv,Be.UInt=Po,Be.UIntBE=ds,Be.Int=va,Be.IntBE=yu,Be.Float=$4,Be.FloatBE=H4,Be.Double=V4,Be.DoubleBE=Z4,Be.Sequence=W4,Be.Structure=G4,Be.UnionDiscriminator=Oy,Be.UnionLayoutDiscriminator=Pl,Be.Union=hv,Be.VariantLayout=OA,Be.BitStructure=lv,Be.BitField=Bc,Be.Boolean=UA,Be.Blob=Y4,Be.CString=X4,Be.UTF8=J4,Be.Constant=Q4,Be.greedy=(r,t)=>new K4(r,t),Be.offset=(r,t,e)=>new fv(r,t,e),Be.u8=r=>new Po(1,r),Be.u16=r=>new Po(2,r),Be.u24=r=>new Po(3,r),Be.u32=r=>new Po(4,r),Be.u40=r=>new Po(5,r),Be.u48=r=>new Po(6,r),Be.nu64=r=>new zK(r),Be.u16be=r=>new ds(2,r),Be.u24be=r=>new ds(3,r),Be.u32be=r=>new ds(4,r),Be.u40be=r=>new ds(5,r),Be.u48be=r=>new ds(6,r),Be.nu64be=r=>new qK(r),Be.s8=r=>new va(1,r),Be.s16=r=>new va(2,r),Be.s24=r=>new va(3,r),Be.s32=r=>new va(4,r),Be.s40=r=>new va(5,r),Be.s48=r=>new va(6,r),Be.ns64=r=>new FK(r),Be.s16be=r=>new yu(2,r),Be.s24be=r=>new yu(3,r),Be.s32be=r=>new yu(4,r),Be.s40be=r=>new yu(5,r),Be.s48be=r=>new yu(6,r),Be.ns64be=r=>new jK(r),Be.f32=r=>new $4(r),Be.f32be=r=>new H4(r),Be.f64=r=>new V4(r),Be.f64be=r=>new Z4(r),Be.struct=(r,t,e)=>new G4(r,t,e),Be.bits=(r,t,e)=>new lv(r,t,e),Be.seq=(r,t,e)=>new W4(r,t,e),Be.union=(r,t,e)=>new hv(r,t,e),Be.unionLayoutDiscriminator=(r,t)=>new Pl(r,t),Be.blob=(r,t)=>new Y4(r,t),Be.cstr=r=>new X4(r),Be.utf8=(r,t)=>new J4(r,t),Be.const=(r,t)=>new Q4(r,t),function(r){var t=$e&&$e.__importDefault||function(x){return x&&x.__esModule?x:{default:x}};Object.defineProperty(r,"__esModule",{value:!0}),r.map=r.array=r.rustEnum=r.str=r.vecU8=r.tagged=r.vec=r.bool=r.option=r.publicKey=r.i256=r.u256=r.i128=r.u128=r.i64=r.u64=r.struct=r.f64=r.f32=r.i32=r.u32=r.i16=r.u16=r.i8=r.u8=void 0;const e=Be,n=sv,s=t(ay);var i=Be;Object.defineProperty(r,"u8",{enumerable:!0,get:function(){return i.u8}}),Object.defineProperty(r,"i8",{enumerable:!0,get:function(){return i.s8}}),Object.defineProperty(r,"u16",{enumerable:!0,get:function(){return i.u16}}),Object.defineProperty(r,"i16",{enumerable:!0,get:function(){return i.s16}}),Object.defineProperty(r,"u32",{enumerable:!0,get:function(){return i.u32}}),Object.defineProperty(r,"i32",{enumerable:!0,get:function(){return i.s32}}),Object.defineProperty(r,"f32",{enumerable:!0,get:function(){return i.f32}}),Object.defineProperty(r,"f64",{enumerable:!0,get:function(){return i.f64}}),Object.defineProperty(r,"struct",{enumerable:!0,get:function(){return i.struct}});class c extends e.Layout{constructor(A,B,P){super(A,P),this.blob=(0,e.blob)(A),this.signed=B}decode(A,B=0){const P=new s.default(this.blob.decode(A,B),10,"le");return this.signed?P.fromTwos(8*this.span).clone():P}encode(A,B,P=0){return this.signed&&(A=A.toTwos(8*this.span)),this.blob.encode(A.toArrayLike(Zt.Buffer,"le",this.span),B,P)}}function l(x){return new c(8,!1,x)}r.u64=l,r.i64=function(x){return new c(8,!0,x)},r.u128=function(x){return new c(16,!1,x)},r.i128=function(x){return new c(16,!0,x)},r.u256=function(x){return new c(32,!1,x)},r.i256=function(x){return new c(32,!0,x)};class p extends e.Layout{constructor(A,B,P,R){super(A.span,R),this.layout=A,this.decoder=B,this.encoder=P}decode(A,B){return this.decoder(this.layout.decode(A,B))}encode(A,B,P){return this.layout.encode(this.encoder(A),B,P)}getSpan(A,B){return this.layout.getSpan(A,B)}}r.publicKey=function(x){return new p((0,e.blob)(32),A=>new n.PublicKey(A),A=>A.toBuffer(),x)};class m extends e.Layout{constructor(A,B){super(-1,B),this.layout=A,this.discriminator=(0,e.u8)()}encode(A,B,P=0){return A==null?this.discriminator.encode(0,B,P):(this.discriminator.encode(1,B,P),this.layout.encode(A,B,P+1)+1)}decode(A,B=0){const P=this.discriminator.decode(A,B);if(P===0)return null;if(P===1)return this.layout.decode(A,B+1);throw new Error("Invalid option "+this.property)}getSpan(A,B=0){const P=this.discriminator.decode(A,B);if(P===0)return 1;if(P===1)return this.layout.getSpan(A,B+1)+1;throw new Error("Invalid option "+this.property)}}function v(x){if(x===0)return!1;if(x===1)return!0;throw new Error("Invalid bool: "+x)}function _(x){return x?1:0}function E(x){const A=(0,e.u32)("length"),B=(0,e.struct)([A,(0,e.blob)((0,e.offset)(A,-A.span),"data")]);return new p(B,({data:P})=>P,P=>({data:P}),x)}r.option=function(x,A){return new m(x,A)},r.bool=function(x){return new p((0,e.u8)(),v,_,x)},r.vec=function(x,A){const B=(0,e.u32)("length"),P=(0,e.struct)([B,(0,e.seq)(x,(0,e.offset)(B,-B.span),"values")]);return new p(P,({values:R})=>R,R=>({values:R}),A)},r.tagged=function(x,A,B){const P=(0,e.struct)([l("tag"),A.replicate("data")]);return new p(P,function({tag:R,data:C}){if(!R.eq(x))throw new Error("Invalid tag, expected: "+x.toString("hex")+", got: "+R.toString("hex"));return C},R=>({tag:x,data:R}),B)},r.vecU8=E,r.str=function(x){return new p(E(),A=>A.toString("utf-8"),A=>Zt.Buffer.from(A,"utf-8"),x)},r.rustEnum=function(x,A,B){const P=(0,e.union)(B??(0,e.u8)(),A);return x.forEach((R,C)=>P.addVariant(C,R,R.property)),P},r.array=function(x,A,B){const P=(0,e.struct)([(0,e.seq)(x,A,"values")]);return new p(P,({values:R})=>R,R=>({values:R}),B)};class w extends e.Layout{constructor(A,B,P){super(A.span+B.span,P),this.keyLayout=A,this.valueLayout=B}decode(A,B){return B=B||0,[this.keyLayout.decode(A,B),this.valueLayout.decode(A,B+this.keyLayout.getSpan(A,B))]}encode(A,B,P){P=P||0;const R=this.keyLayout.encode(A[0],B,P);return R+this.valueLayout.encode(A[1],B,P+R)}getSpan(A,B){return this.keyLayout.getSpan(A,B)+this.valueLayout.getSpan(A,B)}}r.map=function(x,A,B){const P=(0,e.u32)("length"),R=(0,e.struct)([P,(0,e.seq)(new w(x,A),(0,e.offset)(P,-P.span),"values")]);return new p(R,({values:C})=>new Map(C),C=>({values:Array.from(C.entries())}),B)}}(We);function Of(r){let t=r.length;for(;--t>=0;)r[t]=0}const KK=30,$K=new Array(576);Of($K);const HK=new Array(60);Of(HK);const VK=new Array(512);Of(VK);const ZK=new Array(256);Of(ZK);const WK=new Array(29);Of(WK);const GK=new Array(KK);Of(GK);var dv=(r,t,e,n)=>{let s=65535&r|0,i=r>>>16&65535|0,c=0;for(;e!==0;){c=e>2e3?2e3:e,e-=c;do s=s+t[n++]|0,i=i+s|0;while(--c);s%=65521,i%=65521}return s|i<<16|0};const YK=new Uint32Array((()=>{let r,t=[];for(var e=0;e<256;e++){r=e;for(var n=0;n<8;n++)r=1&r?3988292384^r>>>1:r>>>1;t[e]=r}return t})());var xo=(r,t,e,n)=>{const s=YK,i=n+e;r^=-1;for(let c=n;c>>8^s[255&(r^t[c])];return-1^r},pv={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"},Uy={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 XK=(r,t)=>Object.prototype.hasOwnProperty.call(r,t);var NA={assign:function(r){const t=Array.prototype.slice.call(arguments,1);for(;t.length;){const e=t.shift();if(e){if(typeof e!="object")throw new TypeError(e+"must be non-object");for(const n in e)XK(e,n)&&(r[n]=e[n])}}return r},flattenChunks:r=>{let t=0;for(let n=0,s=r.length;n=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;sh[254]=sh[254]=1;var mv={string2buf:r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let t,e,n,s,i,c=r.length,l=0;for(s=0;s>>6,t[i++]=128|63&e):e<65536?(t[i++]=224|e>>>12,t[i++]=128|e>>>6&63,t[i++]=128|63&e):(t[i++]=240|e>>>18,t[i++]=128|e>>>12&63,t[i++]=128|e>>>6&63,t[i++]=128|63&e);return t},buf2string:(r,t)=>{const e=t||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,t));let n,s;const i=new Array(2*e);for(s=0,n=0;n4)i[s++]=65533,n+=l-1;else{for(c&=l===2?31:l===3?15:7;l>1&&n1?i[s++]=65533:c<65536?i[s++]=c:(c-=65536,i[s++]=55296|c>>10&1023,i[s++]=56320|1023&c)}}return((c,l)=>{if(l<65534&&c.subarray&&DA)return String.fromCharCode.apply(null,c.length===l?c:c.subarray(0,l));let p="";for(let m=0;m{(t=t||r.length)>r.length&&(t=r.length);let e=t-1;for(;e>=0&&(192&r[e])==128;)e--;return e<0||e===0?t:e+sh[r[e]]>t?e:t}},JK=function(){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};const y0=16209;var QK=function(r,t){let e,n,s,i,c,l,p,m,v,_,E,w,x,A,B,P,R,C,O,z,H,tt,nt,G;const M=r.state;e=r.next_in,nt=r.input,n=e+(r.avail_in-5),s=r.next_out,G=r.output,i=s-(t-r.avail_out),c=s+(r.avail_out-257),l=M.dmax,p=M.wsize,m=M.whave,v=M.wnext,_=M.window,E=M.hold,w=M.bits,x=M.lencode,A=M.distcode,B=(1<>>24,E>>>=C,w-=C,C=R>>>16&255,C===0)G[s++]=65535&R;else{if(!(16&C)){if(!(64&C)){R=x[(65535&R)+(E&(1<>>=C,w-=C),w<15&&(E+=nt[e++]<>>24,E>>>=C,w-=C,C=R>>>16&255,!(16&C)){if(!(64&C)){R=A[(65535&R)+(E&(1<l){r.msg="invalid distance too far back",M.mode=y0;break t}if(E>>>=C,w-=C,C=s-i,z>C){if(C=z-C,C>m&&M.sane){r.msg="invalid distance too far back",M.mode=y0;break t}if(H=0,tt=_,v===0){if(H+=p-C,C2;)G[s++]=tt[H++],G[s++]=tt[H++],G[s++]=tt[H++],O-=3;O&&(G[s++]=tt[H++],O>1&&(G[s++]=tt[H++]))}else{H=s-z;do G[s++]=G[H++],G[s++]=G[H++],G[s++]=G[H++],O-=3;while(O>2);O&&(G[s++]=G[H++],O>1&&(G[s++]=G[H++]))}break}}break}}while(e>3,e-=O,w-=O<<3,E&=(1<{const p=l.bits;let m,v,_,E,w,x,A=0,B=0,P=0,R=0,C=0,O=0,z=0,H=0,tt=0,nt=0,G=null;const M=new Uint16Array(16),d=new Uint16Array(16);let o,a,f,h=null;for(A=0;A<=b0;A++)M[A]=0;for(B=0;B=1&&M[R]===0;R--);if(C>R&&(C=R),R===0)return s[i++]=20971520,s[i++]=20971520,l.bits=1,0;for(P=1;P0&&(r===0||R!==1))return-1;for(d[1]=0,A=1;A852||r===2&&tt>592)return 1;for(;;){o=A-z,c[B]+1=x?(a=h[c[B]-x],f=G[c[B]-x]):(a=96,f=0),m=1<>z)+v]=o<<24|a<<16|f|0;while(v!==0);for(m=1<>=1;if(m!==0?(nt&=m-1,nt+=m):nt=0,B++,--M[A]==0){if(A===R)break;A=t[e+c[B]]}if(A>C&&(nt&E)!==_){for(z===0&&(z=C),w+=P,O=A-z,H=1<852||r===2&&tt>592)return 1;_=nt&E,s[_]=C<<24|O<<16|w-i|0}}return nt!==0&&(s[w+nt]=A-z<<24|64<<16|0),l.bits=C,0};const{Z_FINISH:t8,Z_BLOCK:i$,Z_TREES:w0,Z_OK:ru,Z_STREAM_END:o$,Z_NEED_DICT:s$,Z_STREAM_ERROR:Vi,Z_DATA_ERROR:zA,Z_MEM_ERROR:qA,Z_BUF_ERROR:a$,Z_DEFLATED:e8}=Uy,Pd=16180,Rl=16190,ns=16191,om=16192,sm=16194,x0=16199,_0=16200,am=16206,jr=16209,r8=r=>(r>>>24&255)+(r>>>8&65280)+((65280&r)<<8)+((255&r)<<24);function u$(){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 hu=r=>{if(!r)return 1;const t=r.state;return!t||t.strm!==r||t.mode16211?1:0},FA=r=>{if(hu(r))return Vi;const t=r.state;return r.total_in=r.total_out=t.total=0,r.msg="",t.wrap&&(r.adler=1&t.wrap),t.mode=Pd,t.last=0,t.havedict=0,t.flags=-1,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Int32Array(852),t.distcode=t.distdyn=new Int32Array(592),t.sane=1,t.back=-1,ru},jA=r=>{if(hu(r))return Vi;const t=r.state;return t.wsize=0,t.whave=0,t.wnext=0,FA(r)},KA=(r,t)=>{let e;if(hu(r))return Vi;const n=r.state;return t<0?(e=0,t=-t):(e=5+(t>>4),t<48&&(t&=15)),t&&(t<8||t>15)?Vi:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=e,n.wbits=t,jA(r))},n8=(r,t)=>{if(!r)return Vi;const e=new u$;r.state=e,e.strm=r,e.window=null,e.mode=Pd;const n=KA(r,t);return n!==ru&&(r.state=null),n};let um,fm,i8=!0;const f$=r=>{if(i8){um=new Int32Array(512),fm=new Int32Array(32);let t=0;for(;t<144;)r.lens[t++]=8;for(;t<256;)r.lens[t++]=9;for(;t<280;)r.lens[t++]=7;for(;t<288;)r.lens[t++]=8;for(Pc(1,r.lens,0,288,um,0,r.work,{bits:9}),t=0;t<32;)r.lens[t++]=5;Pc(2,r.lens,0,32,fm,0,r.work,{bits:5}),i8=!1}r.lencode=um,r.lenbits=9,r.distcode=fm,r.distbits=5},$A=(r,t,e,n)=>{let s;const i=r.state;return i.window===null&&(i.wsize=1<=i.wsize?(i.window.set(t.subarray(e-i.wsize,e),0),i.wnext=0,i.whave=i.wsize):(s=i.wsize-i.wnext,s>n&&(s=n),i.window.set(t.subarray(e-n,e-n+s),i.wnext),(n-=s)?(i.window.set(t.subarray(e-n,e),0),i.wnext=n,i.whave=i.wsize):(i.wnext+=s,i.wnext===i.wsize&&(i.wnext=0),i.whave{let e,n,s,i,c,l,p,m,v,_,E,w,x,A,B,P,R,C,O,z,H,tt,nt=0;const G=new Uint8Array(4);let M,d;const o=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(hu(r)||!r.output||!r.input&&r.avail_in!==0)return Vi;e=r.state,e.mode===ns&&(e.mode=om),c=r.next_out,s=r.output,p=r.avail_out,i=r.next_in,n=r.input,l=r.avail_in,m=e.hold,v=e.bits,_=l,E=p,tt=ru;t:for(;;)switch(e.mode){case Pd:if(e.wrap===0){e.mode=om;break}for(;v<16;){if(l===0)break t;l--,m+=n[i++]<>>8&255,e.check=xo(e.check,G,2,0),m=0,v=0,e.mode=16181;break}if(e.head&&(e.head.done=!1),!(1&e.wrap)||(((255&m)<<8)+(m>>8))%31){r.msg="incorrect header check",e.mode=jr;break}if((15&m)!==e8){r.msg="unknown compression method",e.mode=jr;break}if(m>>>=4,v-=4,H=8+(15&m),e.wbits===0&&(e.wbits=H),H>15||H>e.wbits){r.msg="invalid window size",e.mode=jr;break}e.dmax=1<>8&1),512&e.flags&&4&e.wrap&&(G[0]=255&m,G[1]=m>>>8&255,e.check=xo(e.check,G,2,0)),m=0,v=0,e.mode=16182;case 16182:for(;v<32;){if(l===0)break t;l--,m+=n[i++]<>>8&255,G[2]=m>>>16&255,G[3]=m>>>24&255,e.check=xo(e.check,G,4,0)),m=0,v=0,e.mode=16183;case 16183:for(;v<16;){if(l===0)break t;l--,m+=n[i++]<>8),512&e.flags&&4&e.wrap&&(G[0]=255&m,G[1]=m>>>8&255,e.check=xo(e.check,G,2,0)),m=0,v=0,e.mode=16184;case 16184:if(1024&e.flags){for(;v<16;){if(l===0)break t;l--,m+=n[i++]<>>8&255,e.check=xo(e.check,G,2,0)),m=0,v=0}else e.head&&(e.head.extra=null);e.mode=16185;case 16185:if(1024&e.flags&&(w=e.length,w>l&&(w=l),w&&(e.head&&(H=e.head.extra_len-e.length,e.head.extra||(e.head.extra=new Uint8Array(e.head.extra_len)),e.head.extra.set(n.subarray(i,i+w),H)),512&e.flags&&4&e.wrap&&(e.check=xo(e.check,n,w,i)),l-=w,i+=w,e.length-=w),e.length))break t;e.length=0,e.mode=16186;case 16186:if(2048&e.flags){if(l===0)break t;w=0;do H=n[i+w++],e.head&&H&&e.length<65536&&(e.head.name+=String.fromCharCode(H));while(H&&w>9&1,e.head.done=!0),r.adler=e.check=0,e.mode=ns;break;case 16189:for(;v<32;){if(l===0)break t;l--,m+=n[i++]<>>=7&v,v-=7&v,e.mode=am;break}for(;v<3;){if(l===0)break t;l--,m+=n[i++]<>>=1,v-=1,3&m){case 0:e.mode=16193;break;case 1:if(f$(e),e.mode=x0,t===w0){m>>>=2,v-=2;break t}break;case 2:e.mode=16196;break;case 3:r.msg="invalid block type",e.mode=jr}m>>>=2,v-=2;break;case 16193:for(m>>>=7&v,v-=7&v;v<32;){if(l===0)break t;l--,m+=n[i++]<>>16^65535)){r.msg="invalid stored block lengths",e.mode=jr;break}if(e.length=65535&m,m=0,v=0,e.mode=sm,t===w0)break t;case sm:e.mode=16195;case 16195:if(w=e.length,w){if(w>l&&(w=l),w>p&&(w=p),w===0)break t;s.set(n.subarray(i,i+w),c),l-=w,i+=w,p-=w,c+=w,e.length-=w;break}e.mode=ns;break;case 16196:for(;v<14;){if(l===0)break t;l--,m+=n[i++]<>>=5,v-=5,e.ndist=1+(31&m),m>>>=5,v-=5,e.ncode=4+(15&m),m>>>=4,v-=4,e.nlen>286||e.ndist>30){r.msg="too many length or distance symbols",e.mode=jr;break}e.have=0,e.mode=16197;case 16197:for(;e.have>>=3,v-=3}for(;e.have<19;)e.lens[o[e.have++]]=0;if(e.lencode=e.lendyn,e.lenbits=7,M={bits:e.lenbits},tt=Pc(0,e.lens,0,19,e.lencode,0,e.work,M),e.lenbits=M.bits,tt){r.msg="invalid code lengths set",e.mode=jr;break}e.have=0,e.mode=16198;case 16198:for(;e.have>>24,P=nt>>>16&255,R=65535&nt,!(B<=v);){if(l===0)break t;l--,m+=n[i++]<>>=B,v-=B,e.lens[e.have++]=R;else{if(R===16){for(d=B+2;v>>=B,v-=B,e.have===0){r.msg="invalid bit length repeat",e.mode=jr;break}H=e.lens[e.have-1],w=3+(3&m),m>>>=2,v-=2}else if(R===17){for(d=B+3;v>>=B,v-=B,H=0,w=3+(7&m),m>>>=3,v-=3}else{for(d=B+7;v>>=B,v-=B,H=0,w=11+(127&m),m>>>=7,v-=7}if(e.have+w>e.nlen+e.ndist){r.msg="invalid bit length repeat",e.mode=jr;break}for(;w--;)e.lens[e.have++]=H}}if(e.mode===jr)break;if(e.lens[256]===0){r.msg="invalid code -- missing end-of-block",e.mode=jr;break}if(e.lenbits=9,M={bits:e.lenbits},tt=Pc(1,e.lens,0,e.nlen,e.lencode,0,e.work,M),e.lenbits=M.bits,tt){r.msg="invalid literal/lengths set",e.mode=jr;break}if(e.distbits=6,e.distcode=e.distdyn,M={bits:e.distbits},tt=Pc(2,e.lens,e.nlen,e.ndist,e.distcode,0,e.work,M),e.distbits=M.bits,tt){r.msg="invalid distances set",e.mode=jr;break}if(e.mode=x0,t===w0)break t;case x0:e.mode=_0;case _0:if(l>=6&&p>=258){r.next_out=c,r.avail_out=p,r.next_in=i,r.avail_in=l,e.hold=m,e.bits=v,QK(r,E),c=r.next_out,s=r.output,p=r.avail_out,i=r.next_in,n=r.input,l=r.avail_in,m=e.hold,v=e.bits,e.mode===ns&&(e.back=-1);break}for(e.back=0;nt=e.lencode[m&(1<>>24,P=nt>>>16&255,R=65535&nt,!(B<=v);){if(l===0)break t;l--,m+=n[i++]<>C)],B=nt>>>24,P=nt>>>16&255,R=65535&nt,!(C+B<=v);){if(l===0)break t;l--,m+=n[i++]<>>=C,v-=C,e.back+=C}if(m>>>=B,v-=B,e.back+=B,e.length=R,P===0){e.mode=16205;break}if(32&P){e.back=-1,e.mode=ns;break}if(64&P){r.msg="invalid literal/length code",e.mode=jr;break}e.extra=15&P,e.mode=16201;case 16201:if(e.extra){for(d=e.extra;v>>=e.extra,v-=e.extra,e.back+=e.extra}e.was=e.length,e.mode=16202;case 16202:for(;nt=e.distcode[m&(1<>>24,P=nt>>>16&255,R=65535&nt,!(B<=v);){if(l===0)break t;l--,m+=n[i++]<>C)],B=nt>>>24,P=nt>>>16&255,R=65535&nt,!(C+B<=v);){if(l===0)break t;l--,m+=n[i++]<>>=C,v-=C,e.back+=C}if(m>>>=B,v-=B,e.back+=B,64&P){r.msg="invalid distance code",e.mode=jr;break}e.offset=R,e.extra=15&P,e.mode=16203;case 16203:if(e.extra){for(d=e.extra;v>>=e.extra,v-=e.extra,e.back+=e.extra}if(e.offset>e.dmax){r.msg="invalid distance too far back",e.mode=jr;break}e.mode=16204;case 16204:if(p===0)break t;if(w=E-p,e.offset>w){if(w=e.offset-w,w>e.whave&&e.sane){r.msg="invalid distance too far back",e.mode=jr;break}w>e.wnext?(w-=e.wnext,x=e.wsize-w):x=e.wnext-w,w>e.length&&(w=e.length),A=e.window}else A=s,x=c-e.offset,w=e.length;w>p&&(w=p),p-=w,e.length-=w;do s[c++]=A[x++];while(--w);e.length===0&&(e.mode=_0);break;case 16205:if(p===0)break t;s[c++]=e.length,p--,e.mode=_0;break;case am:if(e.wrap){for(;v<32;){if(l===0)break t;l--,m|=n[i++]<{if(hu(r))return Vi;let t=r.state;return t.window&&(t.window=null),r.state=null,ru},l$=(r,t)=>{if(hu(r))return Vi;const e=r.state;return 2&e.wrap?(e.head=t,t.done=!1,ru):Vi},d$=(r,t)=>{const e=t.length;let n,s,i;return hu(r)?Vi:(n=r.state,n.wrap!==0&&n.mode!==Rl?Vi:n.mode===Rl&&(s=1,s=dv(s,t,e,0),s!==n.check)?zA:(i=$A(r,t,e,e),i?(n.mode=16210,qA):(n.havedict=1,ru)))},ps={inflateReset:jA,inflateReset2:KA,inflateResetKeep:FA,inflateInit:r=>n8(r,15),inflateInit2:n8,inflate:c$,inflateEnd:h$,inflateGetHeader:l$,inflateSetDictionary:d$,inflateInfo:"pako inflate (from Nodeca project)"},p$=function(){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};const HA=Object.prototype.toString,{Z_NO_FLUSH:m$,Z_FINISH:v$,Z_OK:Rc,Z_STREAM_END:cm,Z_NEED_DICT:hm,Z_STREAM_ERROR:g$,Z_DATA_ERROR:o8,Z_MEM_ERROR:y$}=Uy;function Cc(r){this.options=NA.assign({chunkSize:65536,windowBits:15,to:""},r||{});const t=this.options;t.raw&&t.windowBits>=0&&t.windowBits<16&&(t.windowBits=-t.windowBits,t.windowBits===0&&(t.windowBits=-15)),!(t.windowBits>=0&&t.windowBits<16)||r&&r.windowBits||(t.windowBits+=32),t.windowBits>15&&t.windowBits<48&&!(15&t.windowBits)&&(t.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new JK,this.strm.avail_out=0;let e=ps.inflateInit2(this.strm,t.windowBits);if(e!==Rc)throw new Error(pv[e]);if(this.header=new p$,ps.inflateGetHeader(this.strm,this.header),t.dictionary&&(typeof t.dictionary=="string"?t.dictionary=mv.string2buf(t.dictionary):HA.call(t.dictionary)==="[object ArrayBuffer]"&&(t.dictionary=new Uint8Array(t.dictionary)),t.raw&&(e=ps.inflateSetDictionary(this.strm,t.dictionary),e!==Rc)))throw new Error(pv[e])}function lm(r,t){const e=new Cc(t);if(e.push(r),e.err)throw e.msg||pv[e.err];return e.result}Cc.prototype.push=function(r,t){const e=this.strm,n=this.options.chunkSize,s=this.options.dictionary;let i,c,l;if(this.ended)return!1;for(c=t===~~t?t:t===!0?v$:m$,HA.call(r)==="[object ArrayBuffer]"?e.input=new Uint8Array(r):e.input=r,e.next_in=0,e.avail_in=e.input.length;;){for(e.avail_out===0&&(e.output=new Uint8Array(n),e.next_out=0,e.avail_out=n),i=ps.inflate(e,c),i===hm&&s&&(i=ps.inflateSetDictionary(e,s),i===Rc?i=ps.inflate(e,c):i===o8&&(i=hm));e.avail_in>0&&i===cm&&e.state.wrap>0&&r[e.next_in]!==0;)ps.inflateReset(e),i=ps.inflate(e,c);switch(i){case g$:case o8:case hm:case y$:return this.onEnd(i),this.ended=!0,!1}if(l=e.avail_out,e.next_out&&(e.avail_out===0||i===cm))if(this.options.to==="string"){let p=mv.utf8border(e.output,e.next_out),m=e.next_out-p,v=mv.buf2string(e.output,p);e.next_out=m,e.avail_out=n-m,m&&e.output.set(e.output.subarray(p,p+m),0),this.onData(v)}else this.onData(e.output.length===e.next_out?e.output:e.output.subarray(0,e.next_out));if(i!==Rc||l!==0){if(i===cm)return i=ps.inflateEnd(this.strm),this.onEnd(i),this.ended=!0,!0;if(e.avail_in===0)break}}return!0},Cc.prototype.onData=function(r){this.chunks.push(r)},Cc.prototype.onEnd=function(r){r===Rc&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=NA.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};var b$={Inflate:Cc,inflate:lm,inflateRaw:function(r,t){return(t=t||{}).raw=!0,lm(r,t)},ungzip:lm,constants:Uy};const{Inflate:lG,inflate:w$,inflateRaw:dG,ungzip:pG}=b$;var x$=w$,_$=Yi(_y());const cc=r=>"version"in r;var M$=Object.freeze({__proto__:null,encode:function(r){return r.reduce((t,e)=>t+e.toString(16).padStart(2,"0"),"0x")},decode:function(r){r.indexOf("0x")===0&&(r=r.substr(2)),r.length%2==1&&(r="0"+r);let t=r.match(/.{2}/g);return t===null?Ae.Buffer.from([]):Ae.Buffer.from(t.map(e=>parseInt(e,16)))}});function VA(r){return new TextDecoder("utf-8").decode(r)}function ZA(r){return new TextEncoder().encode(r)}var E$=Object.freeze({__proto__:null,decode:VA,encode:ZA});function vv(r){return Wu.encode(r)}var A$=Object.freeze({__proto__:null,encode:vv,decode:function(r){return Wu.decode(r)}});function WA(r){return Ae.Buffer.from(YM(r))}var S$=Object.freeze({__proto__:null,encode:function(r){return U2(r)},decode:WA}),k$=Object.freeze({__proto__:null,hex:M$,utf8:E$,bs58:A$,base64:S$});function GA(r){const t=new Map;return r.errors&&r.errors.forEach(e=>{var n;let s=(n=e.msg)!==null&&n!==void 0?n:e.name;t.set(e.code,s)}),t}function YA(r,...t){if(r.args.length!=t.length)throw new Error("Invalid argument length");const e={};let n=0;return r.args.forEach(s=>{e[s.name]=t[n],n+=1}),e}function Ny(r,t={}){r.forEach(e=>{if("accounts"in e)Ny(e.accounts,t[e.name]);else if(t[e.name]===void 0)throw new Error(`Invalid arguments: ${e.name} not provided.`)})}function ai(r){return r instanceof Xt?r:new Xt(r)}class I$ extends TypeError{constructor(t,e){let n;const{message:s,...i}=t,{path:c}=t;super(c.length===0?s:"At path: "+c.join(".")+" -- "+s),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,i),this.name=this.constructor.name,this.failures=()=>{var l;return(l=n)!=null?l:n=[t,...e()]}}}function Gu(r){return typeof r=="object"&&r!=null}function ia(r){return typeof r=="string"?JSON.stringify(r):""+r}function B$(r,t,e,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:s,branch:i}=t,{type:c}=e,{refinement:l,message:p="Expected a value of type `"+c+"`"+(l?" with refinement `"+l+"`":"")+", but received: `"+ia(n)+"`"}=r;return{value:n,type:c,refinement:l,key:s[s.length-1],path:s,branch:i,...r,message:p}}function*s8(r,t,e,n){(function(s){return Gu(s)&&typeof s[Symbol.iterator]=="function"})(r)||(r=[r]);for(const s of r){const i=B$(s,t,e,n);i&&(yield i)}}function*Dy(r,t,e){e===void 0&&(e={});const{path:n=[],branch:s=[r],coerce:i=!1,mask:c=!1}=e,l={path:n,branch:s};if(i&&(r=t.coercer(r,l),c&&t.type!=="type"&&Gu(t.schema)&&Gu(r)&&!Array.isArray(r)))for(const m in r)t.schema[m]===void 0&&delete r[m];let p=!0;for(const m of t.validator(r,l))p=!1,yield[m,void 0];for(let[m,v,_]of t.entries(r,l)){const E=Dy(v,_,{path:m===void 0?n:[...n,m],branch:m===void 0?s:[...s,v],coerce:i,mask:c});for(const w of E)w[0]?(p=!1,yield[w[0],void 0]):i&&(v=w[1],m===void 0?r=v:r instanceof Map?r.set(m,v):r instanceof Set?r.add(v):Gu(r)&&(r[m]=v))}if(p)for(const m of t.refiner(r,l))p=!1,yield[m,void 0];p&&(yield[void 0,r])}class ua{constructor(t){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:e,schema:n,validator:s,refiner:i,coercer:c=p=>p,entries:l=function*(){}}=t;this.type=e,this.schema=n,this.entries=l,this.coercer=c,this.validator=s?(p,m)=>s8(s(p,m),m,this,p):()=>[],this.refiner=i?(p,m)=>s8(i(p,m),m,this,p):()=>[]}assert(t){return function(e,n){const s=Tc(e,n);if(s[0])throw s[0]}(t,this)}create(t){return zy(t,this)}is(t){return XA(t,this)}mask(t){return function(e,n){const s=Tc(e,n,{coerce:!0,mask:!0});if(s[0])throw s[0];return s[1]}(t,this)}validate(t,e){return e===void 0&&(e={}),Tc(t,this,e)}}function zy(r,t){const e=Tc(r,t,{coerce:!0});if(e[0])throw e[0];return e[1]}function XA(r,t){return!Tc(r,t)[0]}function Tc(r,t,e){e===void 0&&(e={});const n=Dy(r,t,e),s=function(i){const{done:c,value:l}=i.next();return c?void 0:l}(n);return s[0]?[new I$(s[0],function*(){for(const c of n)c[0]&&(yield c[0])}),void 0]:[void 0,s[1]]}function Fh(r,t){return new ua({type:r,schema:null,validator:t})}function dm(r){return new ua({type:"array",schema:r,*entries(t){if(r&&Array.isArray(t))for(const[e,n]of t.entries())yield[e,n,r]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||"Expected an array value, but received: "+ia(t)})}function a8(r){const t=ia(r),e=typeof r;return new ua({type:"literal",schema:e==="string"||e==="number"||e==="boolean"?r:null,validator:n=>n===r||"Expected the literal `"+t+"`, but received: "+ia(n)})}function M0(r){return new ua({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function E0(){return Fh("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+ia(r))}function nl(r){return new ua({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function Na(){return Fh("string",r=>typeof r=="string"||"Expected a string, but received: "+ia(r))}function Ks(r){const t=Object.keys(r);return new ua({type:"type",schema:r,*entries(e){if(Gu(e))for(const n of t)yield[n,e[n],r[n]]},validator:e=>Gu(e)||"Expected an object, but received: "+ia(e)})}function JA(r){const t=r.map(e=>e.type).join(" | ");return new ua({type:"union",schema:null,coercer(e,n){return(r.find(i=>{const[c]=i.validate(e,{coerce:!0});return!c})||qy()).coercer(e,n)},validator(e,n){const s=[];for(const i of r){const[...c]=Dy(e,i,n),[l]=c;if(!l[0])return[];for(const[p]of c)p&&s.push(p)}return["Expected the value to satisfy a union of `"+t+"`, but received: "+ia(e),...s]}})}function qy(){return Fh("unknown",()=>!0)}const u8=99;async function gv(r,t,e){if(t.length<=u8)return await f8(r,t,e);{const n=function(s,i){return Array.apply(0,new Array(Math.ceil(s.length/i))).map((c,l)=>s.slice(l*i,(l+1)*i))}(t,u8);return(await Promise.all(n.map(s=>f8(r,s,e)))).flat()}}async function f8(r,t,e){const n=e??r.commitment,{value:s,context:i}=await r.getMultipleAccountsInfoAndContext(t,n);return s.map((c,l)=>c===null?null:{publicKey:t[l],account:c,context:i})}async function QA(r,t,e,n,s){var i;e&&e.length>0&&t.sign(...e);const c=t._compile(),l=c.serialize(),p=t._serialize(l).toString("base64"),m={encoding:"base64",commitment:n??r.commitment};if(s){const E=(Array.isArray(s)?s:c.nonProgramIds()).map(w=>w.toBase58());m.accounts={encoding:"base64",addresses:E}}e&&(m.sigVerify=!0);const v=[p,m],_=zy(await r._rpcRequest("simulateTransaction",v),C$);if("error"in _){let E;if("data"in _.error&&(E=(i=_.error.data)===null||i===void 0?void 0:i.logs,E&&Array.isArray(E))){const w=` + `,x=w+E.join(w);console.error(_.error.message,x)}throw new Ku("failed to simulate transaction: "+_.error.message,E)}return _.result}function P$(r){return function(t,e,n){return new ua({...t,coercer:(s,i)=>XA(s,e)?t.coercer(n(s,i),i):t.coercer(s,i)})}(tS(r),R$,t=>"error"in t?t:{...t,result:zy(t.result,r)})}const R$=tS(qy());function tS(r){return JA([Ks({jsonrpc:a8("2.0"),id:Na(),result:r}),Ks({jsonrpc:a8("2.0"),id:Na(),error:Ks({code:qy(),message:Na(),data:nl(Fh("any",()=>!0))})})])}const C$=(c8=Ks({err:M0(JA([Ks({}),Na()])),logs:M0(dm(Na())),accounts:nl(M0(dm(M0(Ks({executable:Fh("boolean",r=>typeof r=="boolean"),owner:Na(),lamports:E0(),data:dm(Na()),rentEpoch:nl(E0())}))))),unitsConsumed:nl(E0())}),P$(Ks({context:Ks({slot:E0()}),value:c8})));var c8,T$=Object.freeze({__proto__:null,invoke:async function(r,t,e,n){r=ai(r),n||(n=ah());const s=new wr;if(s.add(new Ir({programId:r,keys:t??[],data:e})),n.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");return await n.sendAndConfirm(s,[])},getMultipleAccounts:async function(r,t,e){return(await gv(r,t,e)).map(n=>n?{publicKey:n.publicKey,account:n.account}:null)},getMultipleAccountsAndContext:gv,simulateTransaction:QA});class eS{constructor(t,e,n){this.connection=t,this.wallet=e,this.opts=n,this.publicKey=e==null?void 0:e.publicKey}static defaultOptions(){return{preflightCommitment:"processed",commitment:"processed"}}static local(t,e){throw new Error("Provider local is not available on browser.")}static env(){throw new Error("Provider env is not available on browser.")}async sendAndConfirm(t,e,n){var s,i,c,l;if(n===void 0&&(n=this.opts),cc(t))e&&t.sign(e);else if(t.feePayer=(s=t.feePayer)!==null&&s!==void 0?s:this.wallet.publicKey,t.recentBlockhash=(await this.connection.getLatestBlockhash(n.preflightCommitment)).blockhash,e)for(const m of e)t.partialSign(m);const p=(t=await this.wallet.signTransaction(t)).serialize();try{return await h8(this.connection,p,n)}catch(m){if(m instanceof yv){const v=vv(cc(t)?((i=t.signatures)===null||i===void 0?void 0:i[0])||new Uint8Array:(c=t.signature)!==null&&c!==void 0?c:new Uint8Array),_=await this.connection.getTransaction(v,{commitment:"confirmed"});if(_){const E=(l=_.meta)===null||l===void 0?void 0:l.logMessages;throw E?new Ku(m.message,E):m}throw m}throw m}}async sendAll(t,e){var n,s,i;e===void 0&&(e=this.opts);const c=(await this.connection.getLatestBlockhash(e.preflightCommitment)).blockhash;let l=t.map(v=>{var _,E;if(cc(v.tx)){let w=v.tx;return v.signers&&w.sign(v.signers),w}{let w=v.tx,x=(_=v.signers)!==null&&_!==void 0?_:[];return w.feePayer=(E=w.feePayer)!==null&&E!==void 0?E:this.wallet.publicKey,w.recentBlockhash=c,x.forEach(A=>{w.partialSign(A)}),w}});const p=await this.wallet.signAllTransactions(l),m=[];for(let v=0;vm.startsWith("Program log: AnchorError"));if(e===-1)return null;const n=t[e],s=[n];let i;if(e+11)return null;s=l[0].match(/([0-9]+)/g)[0]}try{i=parseInt(s)}catch{return null}let c=e.get(i);return c!==void 0?new fh(i,c,t.logs):(c=nS.get(i),c!==void 0?new fh(i,c,t.logs):null)}get program(){var t;return(t=this._programErrorStack)===null||t===void 0?void 0:t.stack[this._programErrorStack.stack.length-1]}get programErrorStack(){var t;return(t=this._programErrorStack)===null||t===void 0?void 0:t.stack}toString(){return this.msg}}function jy(r,t){Fy("debug-logs")&&console.log("Translating error:",r);const e=Yu.parse(r.logs);if(e)return e;const n=fh.parse(r,t);if(n)return n;if(r.logs){const s={get:function(i,c){return c==="programErrorStack"?i.programErrorStack.stack:c==="program"?i.programErrorStack.stack[r.programErrorStack.stack.length-1]:Reflect.get(...arguments)}};return r.programErrorStack=Uf.parse(r.logs),new Proxy(r,s)}return r}const qe={InstructionMissing:100,InstructionFallbackNotFound:101,InstructionDidNotDeserialize:102,InstructionDidNotSerialize:103,IdlInstructionStub:1e3,IdlInstructionInvalidProgram:1001,ConstraintMut:2e3,ConstraintHasOne:2001,ConstraintSigner:2002,ConstraintRaw:2003,ConstraintOwner:2004,ConstraintRentExempt:2005,ConstraintSeeds:2006,ConstraintExecutable:2007,ConstraintState:2008,ConstraintAssociated:2009,ConstraintAssociatedInit:2010,ConstraintClose:2011,ConstraintAddress:2012,ConstraintZero:2013,ConstraintTokenMint:2014,ConstraintTokenOwner:2015,ConstraintMintMintAuthority:2016,ConstraintMintFreezeAuthority:2017,ConstraintMintDecimals:2018,ConstraintSpace:2019,ConstraintAccountIsNone:2020,RequireViolated:2500,RequireEqViolated:2501,RequireKeysEqViolated:2502,RequireNeqViolated:2503,RequireKeysNeqViolated:2504,RequireGtViolated:2505,RequireGteViolated:2506,AccountDiscriminatorAlreadySet:3e3,AccountDiscriminatorNotFound:3001,AccountDiscriminatorMismatch:3002,AccountDidNotDeserialize:3003,AccountDidNotSerialize:3004,AccountNotEnoughKeys:3005,AccountNotMutable:3006,AccountOwnedByWrongProgram:3007,InvalidProgramId:3008,InvalidProgramExecutable:3009,AccountNotSigner:3010,AccountNotSystemOwned:3011,AccountNotInitialized:3012,AccountNotProgramData:3013,AccountNotAssociatedTokenAccount:3014,AccountSysvarMismatch:3015,AccountReallocExceedsLimit:3016,AccountDuplicateReallocs:3017,DeclaredProgramIdMismatch:4100,Deprecated:5e3},nS=new Map([[qe.InstructionMissing,"8 byte instruction identifier not provided"],[qe.InstructionFallbackNotFound,"Fallback functions are not supported"],[qe.InstructionDidNotDeserialize,"The program could not deserialize the given instruction"],[qe.InstructionDidNotSerialize,"The program could not serialize the given instruction"],[qe.IdlInstructionStub,"The program was compiled without idl instructions"],[qe.IdlInstructionInvalidProgram,"The transaction was given an invalid program for the IDL instruction"],[qe.ConstraintMut,"A mut constraint was violated"],[qe.ConstraintHasOne,"A has one constraint was violated"],[qe.ConstraintSigner,"A signer constraint was violated"],[qe.ConstraintRaw,"A raw constraint was violated"],[qe.ConstraintOwner,"An owner constraint was violated"],[qe.ConstraintRentExempt,"A rent exemption constraint was violated"],[qe.ConstraintSeeds,"A seeds constraint was violated"],[qe.ConstraintExecutable,"An executable constraint was violated"],[qe.ConstraintState,"Deprecated Error, feel free to replace with something else"],[qe.ConstraintAssociated,"An associated constraint was violated"],[qe.ConstraintAssociatedInit,"An associated init constraint was violated"],[qe.ConstraintClose,"A close constraint was violated"],[qe.ConstraintAddress,"An address constraint was violated"],[qe.ConstraintZero,"Expected zero account discriminant"],[qe.ConstraintTokenMint,"A token mint constraint was violated"],[qe.ConstraintTokenOwner,"A token owner constraint was violated"],[qe.ConstraintMintMintAuthority,"A mint mint authority constraint was violated"],[qe.ConstraintMintFreezeAuthority,"A mint freeze authority constraint was violated"],[qe.ConstraintMintDecimals,"A mint decimals constraint was violated"],[qe.ConstraintSpace,"A space constraint was violated"],[qe.ConstraintAccountIsNone,"A required account for the constraint is None"],[qe.RequireViolated,"A require expression was violated"],[qe.RequireEqViolated,"A require_eq expression was violated"],[qe.RequireKeysEqViolated,"A require_keys_eq expression was violated"],[qe.RequireNeqViolated,"A require_neq expression was violated"],[qe.RequireKeysNeqViolated,"A require_keys_neq expression was violated"],[qe.RequireGtViolated,"A require_gt expression was violated"],[qe.RequireGteViolated,"A require_gte expression was violated"],[qe.AccountDiscriminatorAlreadySet,"The account discriminator was already set on this account"],[qe.AccountDiscriminatorNotFound,"No 8 byte discriminator was found on the account"],[qe.AccountDiscriminatorMismatch,"8 byte discriminator did not match what was expected"],[qe.AccountDidNotDeserialize,"Failed to deserialize the account"],[qe.AccountDidNotSerialize,"Failed to serialize the account"],[qe.AccountNotEnoughKeys,"Not enough account keys given to the instruction"],[qe.AccountNotMutable,"The given account is not mutable"],[qe.AccountOwnedByWrongProgram,"The given account is owned by a different program than expected"],[qe.InvalidProgramId,"Program ID was not as expected"],[qe.InvalidProgramExecutable,"Program account is not executable"],[qe.AccountNotSigner,"The given account did not sign"],[qe.AccountNotSystemOwned,"The given account is not owned by the system program"],[qe.AccountNotInitialized,"The program expected this account to be already initialized"],[qe.AccountNotProgramData,"The given account is not a program data account"],[qe.AccountNotAssociatedTokenAccount,"The given account is not the associated token account"],[qe.AccountSysvarMismatch,"The given public key does not match the required sysvar"],[qe.AccountReallocExceedsLimit,"The account reallocation exceeds the MAX_PERMITTED_DATA_INCREASE limit"],[qe.AccountDuplicateReallocs,"The account was duplicated for more than one reallocation"],[qe.DeclaredProgramIdMismatch,"The declared program id does not match the actual program id"],[qe.Deprecated,"The API being used is deprecated and should no longer be used"]]);var wv=function(){return wv=Object.assign||function(r){for(var t,e=1,n=arguments.length;ec.name===s);if(i.length!==1)throw new uh(`Type not found: ${JSON.stringify(t)}`);return Mi.typeDefLayout(i[0],e,n)}if("array"in t.type){let s=t.type.array[0],i=t.type.array[1],c=Mi.fieldLayout({name:void 0,type:s},e);return We.array(c,i,n)}throw new Error(`Not yet implemented: ${t}`)}}static typeDefLayout(t,e=[],n){if(t.type.kind==="struct"){const s=t.type.fields.map(i=>Mi.fieldLayout(i,e));return We.struct(s,n)}if(t.type.kind==="enum"){let s=t.type.variants.map(i=>{const c=zr(i.name);if(i.fields===void 0)return We.struct([],c);const l=i.fields.map((p,m)=>p.hasOwnProperty("name")?Mi.fieldLayout(p,e):Mi.fieldLayout({type:p,name:m.toString()},e));return We.struct(l,c)});return n!==void 0?We.rustEnum(s).replicate(n):We.rustEnum(s,n)}throw new Error(`Unknown type kint: ${t}`)}}const d8="global";class Rd{constructor(t){this.idl=t,this.ixLayout=Rd.parseIxLayout(t);const e=new Map;t.instructions.forEach(n=>{const s=p8(d8,n.name);e.set(Wu.encode(s),{layout:this.ixLayout.get(n.name),name:n.name})}),this.sighashLayouts=e}encode(t,e){return this._encode(d8,t,e)}_encode(t,e,n){const s=Ae.Buffer.alloc(1e3),i=zr(e),c=this.ixLayout.get(i);if(!c)throw new Error(`Unknown method: ${i}`);const l=c.encode(n,s),p=s.slice(0,l);return Ae.Buffer.concat([p8(t,e),p])}static parseIxLayout(t){const e=t.instructions.map(n=>{let s=n.args.map(c=>{var l,p;return Mi.fieldLayout(c,Array.from([...(l=t.accounts)!==null&&l!==void 0?l:[],...(p=t.types)!==null&&p!==void 0?p:[]]))});const i=zr(n.name);return[i,We.struct(s,i)]});return new Map(e)}decode(t,e="hex"){typeof t=="string"&&(t=e==="hex"?Ae.Buffer.from(t,"hex"):Wu.decode(t));let n=Wu.encode(t.slice(0,8)),s=t.slice(8);const i=this.sighashLayouts.get(n);return i?{data:i.layout.decode(s),name:i.name}:null}format(t,e){return fs.format(t,e,this.idl)}}class fs{static format(t,e,n){const s=n.instructions.filter(l=>t.name===l.name)[0];if(s===void 0)return console.error("Invalid instruction given"),null;const i=s.args.map(l=>({name:l.name,type:fs.formatIdlType(l.type),data:fs.formatIdlData(l,t.data[l.name],n.types)})),c=fs.flattenIdlAccounts(s.accounts);return{args:i,accounts:e.map((l,p)=>p`;if("option"in t)return`Option<${this.formatIdlType(t.option)}>`;if("defined"in t)return t.defined;if("array"in t)return`Array<${t.array[0]}; ${t.array[1]}>`;throw new Error(`Unknown IDL type: ${t}`)}static formatIdlData(t,e,n){if(typeof t.type=="string")return e.toString();if(t.type.hasOwnProperty("vec"))return"["+e.map(s=>this.formatIdlData({name:"",type:t.type.vec},s)).join(", ")+"]";if(t.type.hasOwnProperty("option"))return e===null?"null":this.formatIdlData({name:"",type:t.type.option},e,n);if(t.type.hasOwnProperty("defined")){if(n===void 0)throw new Error("User defined types not provided");const s=n.filter(i=>i.name===t.type.defined);if(s.length!==1)throw new Error(`Type not found: ${t.type.defined}`);return fs.formatIdlDataDefined(s[0],e,n)}return"unknown"}static formatIdlDataDefined(t,e,n){if(t.type.kind==="struct"){const s=t.type;return"{ "+Object.keys(e).map(c=>{const l=s.fields.filter(p=>p.name===c)[0];if(l===void 0)throw new Error("Unable to find type");return c+": "+fs.formatIdlData(l,e[c],n)}).join(", ")+" }"}if(t.type.variants.length===0)return"{}";if(t.type.variants[0].name){const s=t.type.variants,i=Object.keys(e)[0],c=e[i],l=Object.keys(c).map(m=>{var v;const _=c[m],E=(v=s[i])===null||v===void 0?void 0:v.filter(w=>w.name===m)[0];if(E===void 0)throw new Error("Unable to find variant");return m+": "+fs.formatIdlData(E,_,n)}).join(", "),p=zr(i,{pascalCase:!0});return l.length===0?p:`${p} { ${l} }`}return"Tuple formatting not yet implemented"}static flattenIdlAccounts(t,e){return t.map(n=>{const s=function(i){const c=i.replace(/([A-Z])/g," $1");return c.charAt(0).toUpperCase()+c.slice(1)}(n.name);if(n.hasOwnProperty("accounts")){const i=e?`${e} > ${s}`:s;return fs.flattenIdlAccounts(n.accounts,i)}return{...n,name:e?`${e} > ${s}`:s}}).flat()}}function p8(r,t){var e;let n=`${r}:${e===void 0&&(e={}),q$(t,wv({delimiter:"_"},e))}`;return Ae.Buffer.from(tu(n).slice(0,8))}function Ky(r,t){if(t.type.kind==="enum"){const e=t.type.variants.map(n=>n.fields?n.fields.map(s=>Lc(r,typeof s=="object"&&"name"in s?s.type:s)).reduce((s,i)=>s+i,0):0);return Math.max(...e)+1}return t.type.fields.map(e=>Lc(r,e.type)).reduce((e,n)=>e+n,0)}function Lc(r,t){var e,n;switch(t){case"bool":case"u8":case"i8":case"bytes":case"string":return 1;case"i16":case"u16":return 2;case"u32":case"i32":case"f32":return 4;case"u64":case"i64":case"f64":return 8;case"u128":case"i128":return 16;case"u256":case"i256":case"publicKey":return 32;default:if("vec"in t)return 1;if("option"in t)return 1+Lc(r,t.option);if("coption"in t)return 4+Lc(r,t.coption);if("defined"in t){const s=(n=(e=r.types)===null||e===void 0?void 0:e.filter(i=>i.name===t.defined))!==null&&n!==void 0?n:[];if(s.length!==1)throw new uh(`Type not found: ${JSON.stringify(t)}`);return Ky(r,s[0])}if("array"in t){let s=t.array[0],i=t.array[1];return Lc(r,s)*i}throw new Error(`Invalid type ${JSON.stringify(t)}`)}}const Cl=8;function iS(r){return Zt.Buffer.from(tu(r).slice(0,Cl))}class Da{constructor(t){if(t.accounts===void 0)return void(this.accountLayouts=new Map);const e=t.accounts.map(n=>[n.name,Mi.typeDefLayout(n,t.types)]);this.accountLayouts=new Map(e),this.idl=t}async encode(t,e){const n=Ae.Buffer.alloc(1e3),s=this.accountLayouts.get(t);if(!s)throw new Error(`Unknown account: ${t}`);const i=s.encode(e,n);let c=n.slice(0,i),l=Da.accountDiscriminator(t);return Ae.Buffer.concat([l,c])}decode(t,e){if(Da.accountDiscriminator(t).compare(e.slice(0,8)))throw new Error("Invalid account discriminator");return this.decodeUnchecked(t,e)}decodeAny(t){const e=t.slice(0,8),n=Array.from(this.accountLayouts.keys()).find(s=>Da.accountDiscriminator(s).equals(e));if(!n)throw new Error("Account descriminator not found");return this.decodeUnchecked(n,t)}decodeUnchecked(t,e){const n=e.subarray(Cl),s=this.accountLayouts.get(t);if(!s)throw new Error(`Unknown account: ${t}`);return s.decode(n)}memcmp(t,e){const n=Da.accountDiscriminator(t);return{offset:0,bytes:Wu.encode(e?Ae.Buffer.concat([n,e]):n)}}size(t){var e;return Cl+((e=Ky(this.idl,t))!==null&&e!==void 0?e:0)}static accountDiscriminator(t){return iS(`account:${zr(t,{pascalCase:!0,preserveConsecutiveUppercase:!0})}`)}}class oS{constructor(t){if(t.events===void 0)return void(this.layouts=new Map);const e=t.events.map(n=>{let s={name:n.name,type:{kind:"struct",fields:n.fields.map(i=>({name:i.name,type:i.type}))}};return[n.name,Mi.typeDefLayout(s,t.types)]});this.layouts=new Map(e),this.discriminators=new Map(t.events===void 0?[]:t.events.map(n=>[U2(sS(n.name)),n.name]))}decode(t){let e;try{e=Ae.Buffer.from(YM(t))}catch{return null}const n=U2(e.slice(0,8)),s=this.discriminators.get(n);if(s===void 0)return null;const i=this.layouts.get(s);if(!i)throw new Error(`Unknown event: ${s}`);return{data:i.decode(e.slice(8)),name:s}}}function sS(r){return iS(`event:${r}`)}class F${constructor(t){if(t.types===void 0)return void(this.typeLayouts=new Map);const e=t.types.map(n=>[n.name,Mi.typeDefLayout(n,t.types)]);this.typeLayouts=new Map(e),this.idl=t}encode(t,e){const n=Ae.Buffer.alloc(1e3),s=this.typeLayouts.get(t);if(!s)throw new Error(`Unknown type: ${t}`);const i=s.encode(e,n);return n.slice(0,i)}decode(t,e){const n=this.typeLayouts.get(t);if(!n)throw new Error(`Unknown type: ${t}`);return n.decode(e)}}class $y{constructor(t){this.instruction=new Rd(t),this.accounts=new Da(t),this.events=new oS(t),this.types=new F$(t)}}var j$=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof Zt.global<"u"?Zt.global:typeof self<"u"?self:{};function K$(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}class li{constructor(t,e){if(!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=e}makeDestinationObject(){return{}}decode(t,e){throw new Error("Layout is abstract")}encode(t,e,n){throw new Error("Layout is abstract")}getSpan(t,e){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}var Cd=li;class za extends li{isCount(){throw new Error("ExternalLayout is abstract")}}class aS extends za{constructor(t,e,n){if(!(t instanceof li))throw new TypeError("layout must be a Layout");if(e===void 0)e=0;else if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof Td||this.layout instanceof uS}decode(t,e){return e===void 0&&(e=0),this.layout.decode(t,e+this.offset)}encode(t,e,n){return n===void 0&&(n=0),this.layout.encode(t,e,n+this.offset)}}class Td extends li{constructor(t,e){if(super(t,e),6i&&c instanceof li,!0))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const i of t)if(0>i.span&&i.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let s=-1;try{s=t.reduce((i,c)=>i+c.getSpan(),0)}catch{}super(s,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;try{n=this.fields.reduce((s,i)=>{const c=i.getSpan(t,e);return e+=c,s+c},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e){e===void 0&&(e=0);const n=this.makeDestinationObject();for(const s of this.fields)if(s.property!==void 0&&(n[s.property]=s.decode(t,e)),e+=s.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n){n===void 0&&(n=0);const s=n;let i=0,c=0;for(const l of this.fields){let p=l.span;if(c=0p&&(p=l.getSpan(e,n)))}i=n,n+=p}return i+c-s}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?e=-1:0<=e&&(e+=n.span)}}}class hS{constructor(t){this.property=t}decode(){throw new Error("UnionDiscriminator is abstract")}encode(){throw new Error("UnionDiscriminator is abstract")}}class m8 extends hS{constructor(t,e){if(!(t instanceof za&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}class lS extends li{constructor(t,e,n){const s=t instanceof Td||t instanceof uS;if(s)t=new m8(new aS(t));else if(t instanceof za&&t.isCount())t=new m8(t);else if(!(t instanceof hS))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(e===void 0&&(e=null),!(e===null||e instanceof li))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&s&&(i+=t.layout.span)),super(i,n),this.discriminator=t,this.usesPrefixDiscriminator=s,this.defaultLayout=e,this.registry={};let c=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(l){return c(l)},this.configGetSourceVariant=function(l){c=l.bind(this)}}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(t.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&t.hasOwnProperty(this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||t.hasOwnProperty(e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(t.hasOwnProperty(n.property))return n}throw new Error("unable to infer src variant")}decode(t,e){let n;e===void 0&&(e=0);const s=this.discriminator,i=s.decode(t,e);let c=this.registry[i];if(c===void 0){let l=0;c=this.defaultLayout,this.usesPrefixDiscriminator&&(l=s.layout.span),n=this.makeDestinationObject(),n[s.property]=i,n[c.property]=this.defaultLayout.decode(t,e+l)}else n=c.decode(t,e);return n}encode(t,e,n){n===void 0&&(n=0);const s=this.getSourceVariant(t);if(s===void 0){const i=this.discriminator,c=this.defaultLayout;let l=0;return this.usesPrefixDiscriminator&&(l=i.layout.span),i.encode(t[i.property],e,n),l+c.encode(t[c.property],e,n+l)}return s.encode(t,e,n)}addVariant(t,e,n){const s=new Z$(this,t,e,n);return this.registry[t]=s,s}getVariant(t,e){let n=t;return Zt.Buffer.isBuffer(t)&&(e===void 0&&(e=0),n=this.discriminator.decode(t,e)),this.registry[n]}}class Z$ extends li{constructor(t,e,n,s){if(!(t instanceof lS))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&s===void 0&&(s=n,n=null),n){if(!(n instanceof li))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof s!="string")throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,s),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e){if(0<=this.span)return this.span;e===void 0&&(e=0);let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(t,e+n)}decode(t,e){const n=this.makeDestinationObject();if(e===void 0&&(e=0),this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let s=0;return this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+s):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n){n===void 0&&(n=0);let s=0;if(this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout&&!t.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=s;if(this.layout&&(this.layout.encode(t[this.property],e,n+s),i+=this.layout.getSpan(e,n+s),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}class W$ extends li{constructor(t,e){if(!(t instanceof za&&t.isCount()||Number.isInteger(t)&&0<=t))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let n=-1;t instanceof za||(n=t),super(n,e),this.length=t}getSpan(t,e){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),n}decode(t,e){e===void 0&&(e=0);let n=this.span;return 0>n&&(n=this.length.decode(t,e)),t.slice(e,e+n)}encode(t,e,n){let s=this.length;if(this.length instanceof za&&(s=t.length),!Zt.Buffer.isBuffer(t)||s!==t.length)throw new TypeError(function(i,c){return c.property?i+"["+c.property+"]":i}("Blob.encode",this)+" requires (length "+s+") Buffer as src");if(n+s>e.length)throw new RangeError("encoding overruns Buffer");return e.write(t.toString("hex"),n,s,"hex"),this.length instanceof za&&this.length.encode(s,e,n),s}}var G$=(r,t,e)=>new aS(r,t,e),_s=r=>new Td(4,r),is=r=>new H$(r),dn=(r,t,e)=>new V$(r,t,e),dS=(r,t,e)=>new lS(r,t,e),jh=(r,t)=>new W$(r,t);class Y${constructor(t){}encode(t,e){switch(zr(t)){case"createAccount":return function({lamports:n,space:s,owner:i}){return Ri({createAccount:{lamports:n,space:s,owner:i.toBuffer()}})}(e);case"assign":return function({owner:n}){return Ri({assign:{owner:n.toBuffer()}})}(e);case"transfer":return function({lamports:n}){return Ri({transfer:{lamports:n}})}(e);case"createAccountWithSeed":return function({base:n,seed:s,lamports:i,space:c,owner:l}){return Ri({createAccountWithSeed:{base:n.toBuffer(),seed:s,lamports:i,space:c,owner:l.toBuffer()}},wn.getVariant(3).span+s.length)}(e);case"advanceNonceAccount":return function({authorized:n}){return Ri({advanceNonceAccount:{authorized:n.toBuffer()}})}(e);case"withdrawNonceAccount":return function({lamports:n}){return Ri({withdrawNonceAccount:{lamports:n}})}(e);case"initializeNonceAccount":return function({authorized:n}){return Ri({initializeNonceAccount:{authorized:n.toBuffer()}})}(e);case"authorizeNonceAccount":return function({authorized:n}){return Ri({authorizeNonceAccount:{authorized:n.toBuffer()}})}(e);case"allocate":return function({space:n}){return Ri({allocate:{space:n}})}(e);case"allocateWithSeed":return function({base:n,seed:s,space:i,owner:c}){return Ri({allocateWithSeed:{base:n.toBuffer(),seed:s,space:i,owner:c.toBuffer()}},wn.getVariant(9).span+s.length)}(e);case"assignWithSeed":return function({base:n,seed:s,owner:i}){return Ri({assignWithSeed:{base:n.toBuffer(),seed:s,owner:i.toBuffer()}},wn.getVariant(10).span+s.length)}(e);case"transferWithSeed":return function({lamports:n,seed:s,owner:i}){return Ri({transferWithSeed:{lamports:n,seed:s,owner:i.toBuffer()}},wn.getVariant(11).span+s.length)}(e);default:throw new Error(`Invalid instruction: ${t}`)}}encodeState(t,e){throw new Error("System does not have state")}}class X$ extends Cd{constructor(t){super(-1,t),this.property=t,this.layout=dn([_s("length"),_s("lengthPadding"),jh(G$(_s(),-8),"chars")],this.property)}encode(t,e,n=0){if(t==null)return this.layout.span;const s={chars:Zt.Buffer.from(t,"utf8")};return this.layout.encode(s,e,n)}decode(t,e=0){return this.layout.decode(t,e).chars.toString()}getSpan(t,e=0){return _s().span+_s().span+new Jc(new Uint8Array(t).slice(e,e+4),10,"le").toNumber()}}function A0(r){return new X$(r)}function Pi(r){return jh(32,r)}const wn=dS(_s("instruction"));function Ri(r,t){const e=Zt.Buffer.alloc(t??J$),n=wn.encode(r,e);return t===void 0?e.slice(0,n):e}wn.addVariant(0,dn([is("lamports"),is("space"),Pi("owner")]),"createAccount"),wn.addVariant(1,dn([Pi("owner")]),"assign"),wn.addVariant(2,dn([is("lamports")]),"transfer"),wn.addVariant(3,dn([Pi("base"),A0("seed"),is("lamports"),is("space"),Pi("owner")]),"createAccountWithSeed"),wn.addVariant(4,dn([Pi("authorized")]),"advanceNonceAccount"),wn.addVariant(5,dn([is("lamports")]),"withdrawNonceAccount"),wn.addVariant(6,dn([Pi("authorized")]),"initializeNonceAccount"),wn.addVariant(7,dn([Pi("authorized")]),"authorizeNonceAccount"),wn.addVariant(8,dn([is("space")]),"allocate"),wn.addVariant(9,dn([Pi("base"),A0("seed"),is("space"),Pi("owner")]),"allocateWithSeed"),wn.addVariant(10,dn([Pi("base"),A0("seed"),Pi("owner")]),"assignWithSeed"),wn.addVariant(11,dn([is("lamports"),A0("seed"),Pi("owner")]),"transferWithSeed");const J$=Math.max(...Object.values(wn.registry).map(r=>r.span));class Q${constructor(t){this.idl=t}async encode(t,e){if(t==="nonce"){const n=Zt.Buffer.alloc(rh),s=g8.encode(e,n);return n.slice(0,s)}throw new Error(`Invalid account name: ${t}`)}decode(t,e){return this.decodeUnchecked(t,e)}decodeUnchecked(t,e){if(t==="nonce")return function(n){return g8.decode(n)}(e);throw new Error(`Invalid account name: ${t}`)}memcmp(t,e){if(t==="nonce")return{dataSize:rh};throw new Error(`Invalid account name: ${t}`)}size(t){var e;return(e=Ky(this.idl,t))!==null&&e!==void 0?e:0}}class tH extends Cd{constructor(t,e,n,s){super(t.span,s),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}function v8(r){return new tH(jh(32),t=>new Xt(t),t=>t.toBuffer(),r)}const g8=dn([_s("version"),_s("state"),v8("authorizedPubkey"),v8("nonce"),dn([(y8="lamportsPerSignature",new $$(y8))],"feeCalculator")]);var y8;class eH{constructor(t){}decode(t){throw new Error("System program does not have events")}}class rH{constructor(t){}encode(t,e){throw new Error("System does not have user-defined types")}decode(t,e){throw new Error("System does not have user-defined types")}}class pS{constructor(t){this.instruction=new Y$(t),this.accounts=new Q$(t),this.events=new eH(t),this.types=new rH(t)}}var nH=Object.freeze({__proto__:null,hash:function(r){return new TextDecoder().decode(tu(r))}});function mS(r,...t){let e=[Ae.Buffer.from([97,110,99,104,111,114])];t.forEach(s=>{e.push(s instanceof Ae.Buffer?s:ai(s).toBuffer())});const[n]=Xt.findProgramAddressSync(e,ai(r));return n}var iH=Object.freeze({__proto__:null,createWithSeedSync:function(r,t,e){const n=Ae.Buffer.concat([r.toBuffer(),Ae.Buffer.from(t),e.toBuffer()]);return new Xt(tu(n))},associated:mS});const Mv=new Xt("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),Ev=new Xt("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");var oH=Object.freeze({__proto__:null,TOKEN_PROGRAM_ID:Mv,ASSOCIATED_PROGRAM_ID:Ev,associatedAddress:function({mint:r,owner:t}){return Xt.findProgramAddressSync([t.toBuffer(),Mv.toBuffer(),r.toBuffer()],Ev)[0]}}),Av={exports:{}};(function(r,t){var e=typeof self<"u"?self:j$,n=function(){function i(){this.fetch=!1,this.DOMException=e.DOMException}return i.prototype=e,new i}();(function(i){(function(c){var l="URLSearchParams"in i,p="Symbol"in i&&"iterator"in Symbol,m="FileReader"in i&&"Blob"in i&&function(){try{return new Blob,!0}catch{return!1}}(),v="FormData"in i,_="ArrayBuffer"in i;if(_)var E=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],w=ArrayBuffer.isView||function(a){return a&&E.indexOf(Object.prototype.toString.call(a))>-1};function x(a){if(typeof a!="string"&&(a=String(a)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(a))throw new TypeError("Invalid character in header field name");return a.toLowerCase()}function A(a){return typeof a!="string"&&(a=String(a)),a}function B(a){var f={next:function(){var h=a.shift();return{done:h===void 0,value:h}}};return p&&(f[Symbol.iterator]=function(){return f}),f}function P(a){this.map={},a instanceof P?a.forEach(function(f,h){this.append(h,f)},this):Array.isArray(a)?a.forEach(function(f){this.append(f[0],f[1])},this):a&&Object.getOwnPropertyNames(a).forEach(function(f){this.append(f,a[f])},this)}function R(a){if(a.bodyUsed)return Promise.reject(new TypeError("Already read"));a.bodyUsed=!0}function C(a){return new Promise(function(f,h){a.onload=function(){f(a.result)},a.onerror=function(){h(a.error)}})}function O(a){var f=new FileReader,h=C(f);return f.readAsArrayBuffer(a),h}function z(a){if(a.slice)return a.slice(0);var f=new Uint8Array(a.byteLength);return f.set(new Uint8Array(a)),f.buffer}function H(){return this.bodyUsed=!1,this._initBody=function(a){var f;this._bodyInit=a,a?typeof a=="string"?this._bodyText=a:m&&Blob.prototype.isPrototypeOf(a)?this._bodyBlob=a:v&&FormData.prototype.isPrototypeOf(a)?this._bodyFormData=a:l&&URLSearchParams.prototype.isPrototypeOf(a)?this._bodyText=a.toString():_&&m&&(f=a)&&DataView.prototype.isPrototypeOf(f)?(this._bodyArrayBuffer=z(a.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):_&&(ArrayBuffer.prototype.isPrototypeOf(a)||w(a))?this._bodyArrayBuffer=z(a):this._bodyText=a=Object.prototype.toString.call(a):this._bodyText="",this.headers.get("content-type")||(typeof a=="string"?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):l&&URLSearchParams.prototype.isPrototypeOf(a)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},m&&(this.blob=function(){var a=R(this);if(a)return a;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?R(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(O)}),this.text=function(){var a=R(this);if(a)return a;if(this._bodyBlob)return function(f){var h=new FileReader,g=C(h);return h.readAsText(f),g}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function(f){for(var h=new Uint8Array(f),g=new Array(h.length),S=0;S-1?g:h),this.mode=f.mode||this.mode||null,this.signal=f.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&S)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(S)}function G(a){var f=new FormData;return a.trim().split("&").forEach(function(h){if(h){var g=h.split("="),S=g.shift().replace(/\+/g," "),I=g.join("=").replace(/\+/g," ");f.append(decodeURIComponent(S),decodeURIComponent(I))}}),f}function M(a,f){f||(f={}),this.type="default",this.status=f.status===void 0?200:f.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in f?f.statusText:"OK",this.headers=new P(f.headers),this.url=f.url||"",this._initBody(a)}nt.prototype.clone=function(){return new nt(this,{body:this._bodyInit})},H.call(nt.prototype),H.call(M.prototype),M.prototype.clone=function(){return new M(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new P(this.headers),url:this.url})},M.error=function(){var a=new M(null,{status:0,statusText:""});return a.type="error",a};var d=[301,302,303,307,308];M.redirect=function(a,f){if(d.indexOf(f)===-1)throw new RangeError("Invalid status code");return new M(null,{status:f,headers:{location:a}})},c.DOMException=i.DOMException;try{new c.DOMException}catch{c.DOMException=function(f,h){this.message=f,this.name=h;var g=Error(f);this.stack=g.stack},c.DOMException.prototype=Object.create(Error.prototype),c.DOMException.prototype.constructor=c.DOMException}function o(a,f){return new Promise(function(h,g){var S=new nt(a,f);if(S.signal&&S.signal.aborted)return g(new c.DOMException("Aborted","AbortError"));var I=new XMLHttpRequest;function y(){I.abort()}I.onload=function(){var u,b,D={status:I.status,statusText:I.statusText,headers:(u=I.getAllResponseHeaders()||"",b=new P,u.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(F){var q=F.split(":"),it=q.shift().trim();if(it){var at=q.join(":").trim();b.append(it,at)}}),b)};D.url="responseURL"in I?I.responseURL:D.headers.get("X-Request-URL");var Z="response"in I?I.response:I.responseText;h(new M(Z,D))},I.onerror=function(){g(new TypeError("Network request failed"))},I.ontimeout=function(){g(new TypeError("Network request failed"))},I.onabort=function(){g(new c.DOMException("Aborted","AbortError"))},I.open(S.method,S.url,!0),S.credentials==="include"?I.withCredentials=!0:S.credentials==="omit"&&(I.withCredentials=!1),"responseType"in I&&m&&(I.responseType="blob"),S.headers.forEach(function(u,b){I.setRequestHeader(b,u)}),S.signal&&(S.signal.addEventListener("abort",y),I.onreadystatechange=function(){I.readyState===4&&S.signal.removeEventListener("abort",y)}),I.send(S._bodyInit===void 0?null:S._bodyInit)})}o.polyfill=!0,i.fetch||(i.fetch=o,i.Headers=P,i.Request=nt,i.Response=M),c.Headers=P,c.Request=nt,c.Response=M,c.fetch=o,Object.defineProperty(c,"__esModule",{value:!0})})({})})(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var s=n;(t=s.fetch).default=s.fetch,t.fetch=s.fetch,t.Headers=s.Headers,t.Request=s.Request,t.Response=s.Response,r.exports=t})(Av,Av.exports);var sH=K$(Av.exports);async function b8(r,t){const e=await r.getAccountInfo(t);if(e===null)throw new Error("program account not found");const{program:n}=Sv(e.data),s=await r.getAccountInfo(n.programdataAddress);if(s===null)throw new Error("program data account not found");const{programData:i}=Sv(s.data);return i}const aH=We.rustEnum([We.struct([],"uninitialized"),We.struct([We.option(We.publicKey(),"authorityAddress")],"buffer"),We.struct([We.publicKey("programdataAddress")],"program"),We.struct([We.u64("slot"),We.option(We.publicKey(),"upgradeAuthorityAddress")],"programData")],void 0,We.u32());function Sv(r){return aH.decode(r)}var uH=Object.freeze({__proto__:null,verifiedBuild:async function(r,t,e=5){const n=`https://api.apr.dev/api/v0/program/${t.toString()}/latest?limit=${e}`,[s,i]=await Promise.all([b8(r,t),sH(n)]),c=(await i.json()).filter(p=>!p.aborted&&p.state==="Built"&&p.verified==="Verified");if(c.length===0)return null;const l=c[0];return s.slot.toNumber()!==l.verified_slot?null:l},fetchData:b8,decodeUpgradeableLoaderState:Sv}),fH=Object.freeze({__proto__:null,sha256:nH,rpc:T$,publicKey:iH,bytes:k$,token:oH,features:U$,registry:uH});function cH(r){return"accounts"in r}const hH=We.struct([We.publicKey("authority"),We.vecU8("data")]);function Kh(r,t){var e,n;let s={};const i=r.args?r.args.length:0;if(t.length>i){if(t.length!==i+1)throw new Error(`provided too many arguments ${t} to instruction ${r==null?void 0:r.name} expecting: ${(n=(e=r.args)===null||e===void 0?void 0:e.map(c=>c.name))!==null&&n!==void 0?n:[]}`);s=t.pop()}return[t,s]}class Tl{static build(t,e,n){if(t.name==="_inner")throw new uh("the _inner name is reserved");const s=(...i)=>{const[c,l]=Kh(t,[...i]);Ny(t.accounts,l.accounts);const p=s.accounts(l.accounts);return l.remainingAccounts!==void 0&&p.push(...l.remainingAccounts),Fy("debug-logs")&&console.log("Outgoing account metas:",p),new Ir({keys:p,programId:n,data:e(t.name,YA(t,...c))})};return s.accounts=i=>Tl.accountsArray(i,t.accounts,n,t.name),s}static accountsArray(t,e,n,s){return t?e.map(i=>{if(("accounts"in i?i.accounts:void 0)!==void 0){const c=t[i.name];return Tl.accountsArray(c,i.accounts,n,s).flat()}{const c=i;let l;try{l=ai(t[i.name])}catch{throw new Error(`Wrong input type for account "${i.name}" in the instruction accounts object${s!==void 0?' for instruction "'+s+'"':""}. Expected PublicKey or string.`)}const p=c.isOptional&&l.equals(n);return{pubkey:l,isWritable:c.isMut&&!p,isSigner:c.isSigner&&!p}}}).flat():[]}}class lH{static build(t,e){return(...n)=>{var s,i,c;const[,l]=Kh(t,[...n]),p=new wr;if(l.preInstructions&&l.instructions)throw new Error("instructions is deprecated, use preInstructions");return(s=l.preInstructions)===null||s===void 0||s.forEach(m=>p.add(m)),(i=l.instructions)===null||i===void 0||i.forEach(m=>p.add(m)),p.add(e(...n)),(c=l.postInstructions)===null||c===void 0||c.forEach(m=>p.add(m)),p}}}class dH{static build(t,e,n,s){return async(...i)=>{var c;const l=e(...i),[,p]=Kh(t,[...i]);if(s.sendAndConfirm===void 0)throw new Error("This function requires 'Provider.sendAndConfirm' to be implemented.");try{return await s.sendAndConfirm(l,(c=p.signers)!==null&&c!==void 0?c:[],p.options)}catch(m){throw jy(m,n)}}}}class pH{static build(t,e,n,s){var i;const c={};return(i=t.accounts)===null||i===void 0||i.forEach(l=>{const p=zr(l.name);c[p]=new vS(t,l,n,s,e)}),c}}class vS{get size(){return this._size}get programId(){return this._programId}get provider(){return this._provider}get coder(){return this._coder}get idlAccount(){return this._idlAccount}constructor(t,e,n,s,i){this._idlAccount=e,this._programId=n,this._provider=s??ah(),this._coder=i??new $y(t),this._size=this._coder.accounts.size(e)}async fetchNullable(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);return n}async fetchNullableAndContext(t,e){const n=await this.getAccountInfoAndContext(t,e),{value:s,context:i}=n;return{data:s&&s.data.length!==0?this._coder.accounts.decode(this._idlAccount.name,s.data):null,context:i}}async fetch(t,e){const{data:n}=await this.fetchNullableAndContext(t,e);if(n===null)throw new Error(`Account does not exist or has no data ${t.toString()}`);return n}async fetchAndContext(t,e){const{data:n,context:s}=await this.fetchNullableAndContext(t,e);if(n===null)throw new Error(`Account does not exist ${t.toString()}`);return{data:n,context:s}}async fetchMultiple(t,e){return(await this.fetchMultipleAndContext(t,e)).map(n=>n?n.data:null)}async fetchMultipleAndContext(t,e){return(await gv(this._provider.connection,t.map(n=>ai(n)),e)).map(n=>{if(n==null)return null;const{account:s,context:i}=n;return{data:this._coder.accounts.decode(this._idlAccount.name,s.data),context:i}})}async all(t){const e=this.coder.accounts.memcmp(this._idlAccount.name,t instanceof Zt.Buffer?t:void 0),n=[];return(e==null?void 0:e.offset)!=null&&(e==null?void 0:e.bytes)!=null&&n.push({memcmp:{offset:e.offset,bytes:e.bytes}}),(e==null?void 0:e.dataSize)!=null&&n.push({dataSize:e.dataSize}),(await this._provider.connection.getProgramAccounts(this._programId,{commitment:this._provider.connection.commitment,filters:[...n,...Array.isArray(t)?t:[]]})).map(({pubkey:s,account:i})=>({publicKey:s,account:this._coder.accounts.decode(this._idlAccount.name,i.data)}))}subscribe(t,e){const n=hc.get(t.toString());if(n)return n.ee;const s=new _$;t=ai(t);const i=this._provider.connection.onAccountChange(t,c=>{const l=this._coder.accounts.decode(this._idlAccount.name,c.data);s.emit("change",l)},e);return hc.set(t.toString(),{ee:s,listener:i}),s}async unsubscribe(t){let e=hc.get(t.toString());e?hc&&await this._provider.connection.removeAccountChangeListener(e.listener).then(()=>{hc.delete(t.toString())}).catch(console.error):console.warn("Address is not subscribed")}async createInstruction(t,e){const n=this.size;if(this._provider.publicKey===void 0)throw new Error("This function requires the Provider interface implementor to have a 'publicKey' field.");return an.createAccount({fromPubkey:this._provider.publicKey,newAccountPubkey:t.publicKey,space:e??n,lamports:await this._provider.connection.getMinimumBalanceForRentExemption(e??n),programId:this._programId})}async associated(...t){const e=await this.associatedAddress(...t);return await this.fetch(e)}async associatedAddress(...t){return await mS(this._programId,...t)}async getAccountInfo(t,e){return await this._provider.connection.getAccountInfo(ai(t),e)}async getAccountInfoAndContext(t,e){return await this._provider.connection.getAccountInfoAndContext(ai(t),e)}}const hc=new Map,w8="Program log: ",mH="Program data: ";class gS{constructor(t,e,n){this._programId=t,this._provider=e,this._eventParser=new Hy(t,n),this._eventCallbacks=new Map,this._eventListeners=new Map,this._listenerIdCount=0}addEventListener(t,e){var n;let s=this._listenerIdCount;return this._listenerIdCount+=1,this._eventListeners.has(t)||this._eventListeners.set(t,[]),this._eventListeners.set(t,((n=this._eventListeners.get(t))!==null&&n!==void 0?n:[]).concat(s)),this._eventCallbacks.set(s,[t,e]),this._onLogsSubscriptionId!==void 0||(this._onLogsSubscriptionId=this._provider.connection.onLogs(this._programId,(i,c)=>{if(!i.err)for(const l of this._eventParser.parseLogs(i.logs)){const p=this._eventListeners.get(l.name);p&&p.forEach(m=>{const v=this._eventCallbacks.get(m);if(v){const[,_]=v;_(l.data,c.slot,i.signature)}})}})),s}async removeEventListener(t){const e=this._eventCallbacks.get(t);if(!e)throw new Error(`Event listener ${t} doesn't exist!`);const[n]=e;let s=this._eventListeners.get(n);if(!s)throw new Error(`Event listeners don't exist for ${n}!`);if(this._eventCallbacks.delete(t),s=s.filter(i=>i!==t),this._eventListeners.set(n,s),s.length===0&&this._eventListeners.delete(n),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 Hy{constructor(t,e){this.coder=e,this.programId=t}*parseLogs(t,e=!1){const n=new gH(t),s=new vH;let i=n.next();for(;i!==null;){let[c,l,p]=this.handleLog(s,i,e);c&&(yield c),l&&s.push(l),p&&s.pop(),i=n.next()}}handleLog(t,e,n){return t.stack.length>0&&t.program()===this.programId.toString()?this.handleProgramLog(e,n):[null,...this.handleSystemLog(e)]}handleProgramLog(t,e){if(t.startsWith(w8)||t.startsWith(mH)){const n=t.startsWith(w8)?t.slice(13):t.slice(14),s=this.coder.events.decode(n);if(e&&s===null)throw new Error(`Unable to decode event ${n}`);return[s,null,!1]}return[null,...this.handleSystemLog(t)]}handleSystemLog(t){const e=t.split(":")[0];return e.match(/^Program (.*) success/g)!==null?[null,!0]:e.startsWith(`Program ${this.programId.toString()} invoke`)?[this.programId.toString(),!1]:e.includes("invoke")?["cpi",!1]:[null,!1]}}class vH{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(t){this.stack.push(t)}pop(){if(!this.stack.length)throw new Error("Expected the stack to have elements");this.stack.pop()}}class gH{constructor(t){this.logs=t}next(){if(this.logs.length===0)return null;let t=this.logs[0];return this.logs=this.logs.slice(1),t}}class yH{static build(t,e,n,s,i,c,l){return async(...p)=>{var m;const v=e(...p),[,_]=Kh(t,[...p]);let E;if(s.simulate===void 0)throw new Error("This function requires 'Provider.simulate' to be implemented.");try{E=await s.simulate(v,_.signers,(m=_.options)===null||m===void 0?void 0:m.commitment)}catch(A){throw jy(A,n)}if(E===void 0)throw new Error("Unable to simulate transaction");const w=E.logs;if(!w)throw new Error("Simulated logs not found");const x=[];if(l.events){let A=new Hy(c,i);for(const B of A.parseLogs(w))x.push(B)}return{events:x,raw:w}}}}function pm(r){return new yS(jh(8),t=>Vy.fromBuffer(t),t=>t.toBuffer(),r)}function S0(r){return new yS(jh(32),t=>new Xt(t),t=>t.toBuffer(),r)}function mm(r,t){return new bH(r,t)}class yS extends Cd{constructor(t,e,n,s){super(t.span,s),this.layout=t,this.decoder=e,this.encoder=n}decode(t,e){return this.decoder(this.layout.decode(t,e))}encode(t,e,n){return this.layout.encode(this.encoder(t),e,n)}getSpan(t,e){return this.layout.getSpan(t,e)}}class bH extends Cd{constructor(t,e){super(-1,e),this.layout=t,this.discriminator=_s()}encode(t,e,n=0){return t==null?this.layout.span+this.discriminator.encode(0,e,n):(this.discriminator.encode(1,e,n),this.layout.encode(t,e,n+4)+4)}decode(t,e=0){const n=this.discriminator.decode(t,e);if(n===0)return null;if(n===1)return this.layout.decode(t,e+4);throw new Error("Invalid coption "+this.layout.property)}getSpan(t,e=0){return this.layout.getSpan(t,e+4)+4}}class Vy extends Jc{toBuffer(){const t=super.toArray().reverse(),e=Zt.Buffer.from(t);if(e.length===8)return e;if(e.length>=8)throw new Error("u64 too large");const n=Zt.Buffer.alloc(8);return e.copy(n),n}static fromBuffer(t){if(t.length!==8)throw new Error(`Invalid buffer length: ${t.length}`);return new Vy([...t].reverse().map(e=>`00${e.toString(16)}`.slice(-2)).join(""),16)}}const wH=dn([S0("mint"),S0("owner"),pm("amount"),mm(S0(),"delegate"),(r=>{const t=dS((e=>new Td(1,e))("discriminator"),null,"state");return t.addVariant(0,dn([]),"uninitialized"),t.addVariant(1,dn([]),"initialized"),t.addVariant(2,dn([]),"frozen"),t})(),mm(pm(),"isNative"),pm("delegatedAmount"),mm(S0(),"closeAuthority")]);class ch{constructor(t,e,n,s,i,c,l,p){this._accounts=e,this._provider=n,this._programId=s,this._idlIx=i,this._idlTypes=l,this._customResolver=p,this._args=t,this._accountStore=new xH(n,c,this._programId)}args(t){this._args=t}async resolve(){for(await this.resolveConst(this._idlIx.accounts),this._resolveEventCpi(this._idlIx.accounts);await this.resolvePdas(this._idlIx.accounts)+await this.resolveRelations(this._idlIx.accounts)+await this.resolveCustom()>0;);}async resolveCustom(){if(this._customResolver){const{accounts:t,resolved:e}=await this._customResolver({args:this._args,accounts:this._accounts,provider:this._provider,programId:this._programId,idlIx:this._idlIx});return this._accounts=t,e}return 0}resolveOptionalsHelper(t,e){const n={};for(const s of e){const i=s.name,c=t[i];c!==void 0&&(wS(c)?cH(s)?n[i]=this.resolveOptionalsHelper(c,s.accounts):n[i]=xS(c,!0):c!==null?n[i]=ai(c):s.isOptional&&(n[i]=this._programId))}return n}resolveOptionals(t){Object.assign(this._accounts,this.resolveOptionalsHelper(t,this._idlIx.accounts))}get(t){const e=t.reduce((n,s)=>n&&n[s],this._accounts);if(e&&e.toBase58)return e}set(t,e){let n=this._accounts;t.forEach((s,i)=>{i==t.length-1&&(n[s]=e),n[s]=n[s]||{},n=n[s]})}async resolveConst(t,e=[]){for(let n=0;n0&&!this.get([...e,p])&&await this.autoPopulatePda(l,e)&&(n+=1)}return n}async resolveRelations(t,e=[]){let n=0;for(let s=0;s!this.get([...e,zr(E)]));if(n+=_.length,_.length>0){const E=await this._accountStore.fetchAccount({publicKey:v});await Promise.all(_.map(async w=>{const x=zr(w);return this.set([...e,x],E[x]),E[x]}))}}}return n}async autoPopulatePda(t,e=[]){if(!t.pda||!t.pda.seeds)throw new Error("Must have seeds");const n=await Promise.all(t.pda.seeds.map(c=>this.toBuffer(c,e)));if(n.some(c=>c===void 0))return;const s=await this.parseProgramId(t,e);if(!s)return;const[i]=await Xt.findProgramAddress(n,s);this.set([...e,zr(t.name)],i)}async parseProgramId(t,e=[]){var n;if(!(!((n=t.pda)===null||n===void 0)&&n.programId))return this._programId;switch(t.pda.programId.kind){case"const":return new Xt(this.toBufferConst(t.pda.programId.value));case"arg":return this.argValue(t.pda.programId);case"account":return await this.accountValue(t.pda.programId,e);default:throw new Error(`Unexpected program seed kind: ${t.pda.programId.kind}`)}}async toBuffer(t,e=[]){switch(t.kind){case"const":return this.toBufferConst(t);case"arg":return await this.toBufferArg(t);case"account":return await this.toBufferAccount(t,e);default:throw new Error(`Unexpected seed kind: ${t.kind}`)}}getType(t,e=[]){if(e.length>0&&t.defined){const n=this._idlTypes.find(i=>i.name===t.defined);if(!n)throw new Error(`Cannot find type ${t.defined}`);const s=n.type.fields.find(i=>i.name===e[0]);return this.getType(s.type,e.slice(1))}return t}toBufferConst(t){return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),t.value)}async toBufferArg(t){const e=this.argValue(t);if(e!==void 0)return this.toBufferValue(this.getType(t.type,(t.path||"").split(".").slice(1)),e)}argValue(t){const e=t.path.split("."),n=zr(e[0]),s=this._idlIx.args.findIndex(i=>i.name===n);if(s===-1)throw new Error(`Unable to find argument for seed: ${n}`);return e.slice(1).reduce((i,c)=>(i||{})[c],this._args[s])}async toBufferAccount(t,e=[]){const n=await this.accountValue(t,e);if(n)return this.toBufferValue(t.type,n)}async accountValue(t,e=[]){const n=t.path.split("."),s=n[0],i=this.get([...e,zr(s)]);if(i===null)throw new Error("fieldPubkey is null");if(n.length===1)return i;const c=await this._accountStore.fetchAccount({publicKey:i,name:t.account});return this.parseAccountValue(c,n.slice(1))}parseAccountValue(t,e){let n;for(;e.length>0;)n=t[zr(e[0])],e=e.slice(1);return n}toBufferValue(t,e){switch(t){case"u8":return Zt.Buffer.from([e]);case"u16":let n=Zt.Buffer.alloc(2);return n.writeUInt16LE(e),n;case"u32":let s=Zt.Buffer.alloc(4);return s.writeUInt32LE(e),s;case"u64":let i=Zt.Buffer.alloc(8);return i.writeBigUInt64LE(BigInt(e)),i;case"string":return Zt.Buffer.from(ZA(e));case"publicKey":return e.toBuffer();default:if(t.array)return Zt.Buffer.from(e);throw new Error(`Unexpected seed type: ${t}`)}}}ch.CONST_ACCOUNTS={associatedTokenProgram:Ev,rent:na,systemProgram:an.programId,tokenProgram:Mv,clock:oo};class xH{constructor(t,e,n){this._provider=t,this._programId=n,this._cache=new Map,this._idls={},this._idls[n.toBase58()]=e}async ensureIdl(t){if(!this._idls[t.toBase58()]){const e=await nu.fetchIdl(t,this._provider);if(e){const n=new nu(e,t,this._provider);this._idls[t.toBase58()]=n.account}}return this._idls[t.toBase58()]}async fetchAccount({publicKey:t,name:e,programId:n=this._programId}){const s=t.toString();if(!this._cache.has(s))if(e==="TokenAccount"){const i=await this._provider.connection.getAccountInfo(t);if(i===null)throw new Error(`invalid account info for ${s}`);const c=function(l){return wH.decode(l)}(i.data);this._cache.set(s,c)}else if(e){const i=await this.ensureIdl(n);if(i){const c=i[zr(e)];if(c){const l=await c.fetch(t);this._cache.set(s,l)}}}else{const i=await this._provider.connection.getAccountInfo(t);if(i===null)throw new Error(`invalid account info for ${s}`);const c=i.data,l=await this.ensureIdl(i.owner);if(l){const p=Object.values(l)[0];if(!p)throw new Error("No accounts for this program");const m=p.coder.accounts.decodeAny(c);this._cache.set(s,m)}}return this._cache.get(s)}}class bS{static build(t,e,n,s,i,c,l,p,m,v,_){return(...E)=>new _H(E,s,i,c,l,p,t,e,n,m,v,_)}}function wS(r){return typeof r=="object"&&r!==null&&!("_bn"in r)}function xS(r,t){const e={};for(const n in r){const s=r[n];if(s!==null)e[n]=wS(s)?xS(s,!0):ai(s);else if(t)throw new Error("Failed to resolve optionals due to IDL type mismatch with input accounts!")}return e}class _H{constructor(t,e,n,s,i,c,l,p,m,v,_,E){this._ixFn=e,this._txFn=n,this._rpcFn=s,this._simulateFn=i,this._viewFn=c,this._programId=p,this._accounts={},this._remainingAccounts=[],this._signers=[],this._preInstructions=[],this._postInstructions=[],this._autoResolveAccounts=!0,this._args=t,this._accountsResolver=new ch(t,this._accounts,l,p,m,v,_,E)}args(t){this._args=t,this._accountsResolver.args(t)}async pubkeys(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._accounts}accounts(t){return this._autoResolveAccounts=!0,this._accountsResolver.resolveOptionals(t),this}accountsStrict(t){return this._autoResolveAccounts=!1,this._accountsResolver.resolveOptionals(t),this}signers(t){return this._signers=this._signers.concat(t),this}remainingAccounts(t){return this._remainingAccounts=this._remainingAccounts.concat(t),this}preInstructions(t){return this._preInstructions=this._preInstructions.concat(t),this}postInstructions(t){return this._postInstructions=this._postInstructions.concat(t),this}async rpc(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._rpcFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async rpcAndKeys(t){return{pubkeys:await this.pubkeys(),signature:await this.rpc(t)}}async view(t){if(this._autoResolveAccounts&&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:t})}async simulate(t){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._simulateFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions,options:t})}async instruction(){return this._autoResolveAccounts&&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:await this._signers}}async transaction(){return this._autoResolveAccounts&&await this._accountsResolver.resolve(),this._txFn(...this._args,{accounts:this._accounts,signers:this._signers,remainingAccounts:this._remainingAccounts,preInstructions:this._preInstructions,postInstructions:this._postInstructions})}}class MH{static build(t,e,n,s){const i=e.accounts.find(l=>l.isMut),c=!!e.returns;if(!(i||!c))return async(...l)=>{var p,m;let v=await n(...l);const _=`Program return: ${t} `;let E=v.raw.find(A=>A.startsWith(_));if(!E)throw new Error("View expected return log");let w=WA(E.slice(_.length)),x=e.returns;if(!x)throw new Error("View expected return type");return Mi.fieldLayout({type:x},Array.from([...(p=s.accounts)!==null&&p!==void 0?p:[],...(m=s.types)!==null&&m!==void 0?m:[]])).decode(w)}}}class EH{static build(t,e,n,s,i){const c={},l={},p={},m={},v={},_={},E=GA(t),w=t.accounts?pH.build(t,e,n,s):{};return t.instructions.forEach(x=>{const A=Tl.build(x,(H,tt)=>e.instruction.encode(H,tt),n),B=lH.build(x,A),P=dH.build(x,B,E,s),R=yH.build(x,B,E,s,e,n,t),C=MH.build(n,x,R,t),O=bS.build(s,n,x,A,B,P,R,C,w,t.types||[],i&&i(x)),z=zr(x.name);l[z]=A,p[z]=B,c[z]=P,m[z]=R,v[z]=O,C&&(_[z]=C)}),[c,l,p,w,m,v,_]}}class nu{get programId(){return this._programId}get idl(){return this._idl}get coder(){return this._coder}get provider(){return this._provider}constructor(t,e,n,s,i){e=ai(e),n||(n=ah()),this._idl=t,this._provider=n,this._programId=e,this._coder=s??new $y(t),this._events=new gS(this._programId,n,this._coder);const[c,l,p,m,v,_,E]=EH.build(t,this._coder,e,n,i??(()=>{}));this.rpc=c,this.instruction=l,this.transaction=p,this.account=m,this.simulate=v,this.methods=_,this.views=E}static async at(t,e){const n=ai(t),s=await nu.fetchIdl(n,e);if(!s)throw new Error(`IDL not found for program: ${t.toString()}`);return new nu(s,n,e)}static async fetchIdl(t,e){e=e??ah();const n=ai(t),s=await async function(p){const m=(await Xt.findProgramAddress([],p))[0];return await Xt.createWithSeed(m,"anchor:idl",p)}(n),i=await e.connection.getAccountInfo(s);if(!i)return null;let c=function(p){return hH.decode(p)}(i.data.slice(8));const l=x$(c.data);return JSON.parse(VA(l))}addEventListener(t,e){return this._events.addEventListener(t,e)}async removeEventListener(t){return await this._events.removeEventListener(t)}}const AH=new Xt("11111111111111111111111111111111");function SH(r){return new nu(x8,AH,r,new pS(x8))}const x8={version:"0.1.0",name:"system_program",instructions:[{name:"createAccount",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!0}],args:[{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assign",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"owner",type:"publicKey"}]},{name:"transfer",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"}]},{name:"createAccountWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!0},{name:"to",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"lamports",type:"u64"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"advanceNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"withdrawNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"to",isMut:!0,isSigner:!1},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"lamports",type:"u64"}]},{name:"initializeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!0},{name:"recentBlockhashes",isMut:!1,isSigner:!1},{name:"rent",isMut:!1,isSigner:!1}],args:[{name:"authorized",type:"publicKey"}]},{name:"authorizeNonceAccount",accounts:[{name:"nonce",isMut:!0,isSigner:!1},{name:"authorized",isMut:!1,isSigner:!0}],args:[{name:"authorized",type:"publicKey"}]},{name:"allocate",accounts:[{name:"pubkey",isMut:!0,isSigner:!0}],args:[{name:"space",type:"u64"}]},{name:"allocateWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"space",type:"u64"},{name:"owner",type:"publicKey"}]},{name:"assignWithSeed",accounts:[{name:"account",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0}],args:[{name:"base",type:"publicKey"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]},{name:"transferWithSeed",accounts:[{name:"from",isMut:!0,isSigner:!1},{name:"base",isMut:!1,isSigner:!0},{name:"to",isMut:!0,isSigner:!1}],args:[{name:"lamports",type:"u64"},{name:"seed",type:"string"},{name:"owner",type:"publicKey"}]}],accounts:[{name:"nonce",type:{kind:"struct",fields:[{name:"version",type:"u32"},{name:"state",type:"u32"},{name:"authorizedPubkey",type:"publicKey"},{name:"nonce",type:"publicKey"},{name:"feeCalculator",type:{defined:"FeeCalculator"}}]}}],types:[{name:"FeeCalculator",type:{kind:"struct",fields:[{name:"lamportsPerSignature",type:"u64"}]}}]};var _8,_S=Oh(Object.freeze({__proto__:null,web3:yA,AccountClient:vS,AnchorError:Yu,AnchorProvider:eS,BorshAccountsCoder:Da,BorshCoder:$y,BorshEventCoder:oS,BorshInstructionCoder:Rd,DISCRIMINATOR_SIZE:Cl,EventManager:gS,EventParser:Hy,IdlError:uh,LangErrorCode:qe,LangErrorMessage:nS,MethodsBuilderFactory:bS,Native:class{static system(r){return SH(r)}},Program:nu,ProgramError:fh,ProgramErrorStack:Uf,SystemCoder:pS,eventDiscriminator:sS,getProvider:ah,parseIdlErrors:GA,setProvider:function(r){bv=r},splitArgsAndCtx:Kh,toInstruction:YA,translateAddress:ai,translateError:jy,utils:fH,validateAccounts:Ny,BN:Jc})),lc={},dc={},M8,pc={};function kH(){if(M8)return pc;M8=1;var r=$e&&$e.__awaiter||function(n,s,i,c){return new(i||(i=Promise))(function(l,p){function m(E){try{_(c.next(E))}catch(w){p(w)}}function v(E){try{_(c.throw(E))}catch(w){p(w)}}function _(E){E.done?l(E.value):function(w){return w instanceof i?w:new i(function(x){x(w)})}(E.value).then(m,v)}_((c=c.apply(n,s||[])).next())})},t=$e&&$e.__generator||function(n,s){var i,c,l,p,m={label:0,sent:function(){if(1&l[0])throw l[1];return l[1]},trys:[],ops:[]};return p={next:v(0),throw:v(1),return:v(2)},typeof Symbol=="function"&&(p[Symbol.iterator]=function(){return this}),p;function v(_){return function(E){return function(w){if(i)throw new TypeError("Generator is already executing.");for(;m;)try{if(i=1,c&&(l=2&w[0]?c.return:w[0]?c.throw||((l=c.return)&&l.call(c),0):c.next)&&!(l=l.call(c,w[1])).done)return l;switch(c=0,l&&(w=[2&w[0],l.value]),w[0]){case 0:case 1:l=w;break;case 4:return m.label++,{value:w[1],done:!1};case 5:m.label++,c=w[1],w=[0];continue;case 7:w=m.ops.pop(),m.trys.pop();continue;default:if(l=m.trys,!((l=l.length>0&&l[l.length-1])||w[0]!==6&&w[0]!==2)){m=0;continue}if(w[0]===3&&(!l||w[1]>l[0]&&w[1]=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),e=0;e>>0,B=new Uint8Array(A);_[E];){var P=t[_.charCodeAt(E)];if(P===255)return;for(var R=0,C=A-1;(P!==0||R>>0,B[C]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");x=R,E++}for(var O=A-x;O!==A&&B[O]===0;)O++;for(var z=new Uint8Array(w+(A-O)),H=w;O!==A;)z[H++]=B[O++];return z}return{encode:function(_){if(_ instanceof Uint8Array||(ArrayBuffer.isView(_)?_=new Uint8Array(_.buffer,_.byteOffset,_.byteLength):Array.isArray(_)&&(_=Uint8Array.from(_))),!(_ instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(_.length===0)return"";for(var E=0,w=0,x=0,A=_.length;x!==A&&_[x]===0;)x++,E++;for(var B=(A-x)*m+1>>>0,P=new Uint8Array(B);x!==A;){for(var R=_[x],C=0,O=B-1;(R!==0||C>>0,P[O]=R%c>>>0,R=R/c>>>0;if(R!==0)throw new Error("Non-zero carry");w=C,x++}for(var z=B-w;z!==B&&P[z]===0;)z++;for(var H=l.repeat(E);z464)throw new Error("The metadata is too long");var H=x.subarray(0,R);return c.Buffer.concat([P,H])}var tt=B.encode(w,x);return H=x.subarray(0,tt),c.Buffer.concat([P,H])},_.parseIxLayout=function(E){var w=E.instructions.map(function(x){var A=x.args.map(function(P){var R,C;return m.IdlCoder.fieldLayout(P,Array.from(n(n([],(R=E.accounts)!==null&&R!==void 0?R:[]),(C=E.types)!==null&&C!==void 0?C:[])))}),B=l.default(x.name);return[B,p.struct(A,B)]});return new Map(w)},_.prototype.decode=function(E,w){w===void 0&&(w="hex"),typeof E=="string"&&(E=w==="hex"?c.Buffer.from(E,"hex"):c.Buffer.from(i.default.decode(E)));var x=i.default.encode(E.subarray(0,this.discriminatorLength)),A=E.subarray(this.discriminatorLength),B=this.discriminatorLayouts.get(x);if(!B)return null;if(B.name==="updProduct"||B.name==="addProduct"){for(var P={},R=0;Rr.MAX_SLOT_DIFFERENCE&&(pt=t.Unknown),pt===t.Trading&&(R=yt.price,C=yt.confidence);for(var Ft=[],lt=240;Ft.length0?s-4:s;for(e=0;e>16&255,c[l++]=t>>8&255,c[l++]=255&t;return i===2&&(t=Oi[r.charCodeAt(e)]<<2|Oi[r.charCodeAt(e+1)]>>4,c[l++]=255&t),i===1&&(t=Oi[r.charCodeAt(e)]<<10|Oi[r.charCodeAt(e+1)]<<4|Oi[r.charCodeAt(e+2)]>>2,c[l++]=t>>8&255,c[l++]=255&t),c},fromByteArray:function(r){for(var t,e=r.length,n=e%3,s=[],i=16383,c=0,l=e-n;cl?l:c+i));return n===1?(t=r[e-1],s.push(No[t>>2]+No[t<<4&63]+"==")):n===2&&(t=(r[e-2]<<8)+r[e-1],s.push(No[t>>10]+No[t>>4&63]+No[t<<2&63]+"=")),s.join("")}},No=[],Oi=[],TH=typeof Uint8Array<"u"?Uint8Array:Array,L8="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bu=0;bu<64;++bu)No[bu]=L8[bu],Oi[L8.charCodeAt(bu)]=bu;function O8(r){var t=r.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=r.indexOf("=");return e===-1&&(e=t),[e,e===t?0:4-e%4]}function LH(r,t,e){for(var n,s,i=[],c=t;c>18&63]+No[s>>12&63]+No[s>>6&63]+No[63&s]);return i.join("")}Oi["-".charCodeAt(0)]=62,Oi["_".charCodeAt(0)]=63;var vm={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */function U8(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function AS(r,...t){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(r.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${r.length}`)}function Ll(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}vm.read=function(r,t,e,n,s){var i,c,l=8*s-n-1,p=(1<>1,v=-7,_=e?s-1:0,E=e?-1:1,w=r[t+_];for(_+=E,i=w&(1<<-v)-1,w>>=-v,v+=l;v>0;i=256*i+r[t+_],_+=E,v-=8);for(c=i&(1<<-v)-1,i>>=-v,v+=n;v>0;c=256*c+r[t+_],_+=E,v-=8);if(i===0)i=1-m;else{if(i===p)return c?NaN:1/0*(w?-1:1);c+=Math.pow(2,n),i-=m}return(w?-1:1)*c*Math.pow(2,i-n)},vm.write=function(r,t,e,n,s,i){var c,l,p,m=8*i-s-1,v=(1<>1,E=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=n?0:i-1,x=n?1:-1,A=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(l=isNaN(t)?1:0,c=v):(c=Math.floor(Math.log(t)/Math.LN2),t*(p=Math.pow(2,-c))<1&&(c--,p*=2),(t+=c+_>=1?E/p:E*Math.pow(2,1-_))*p>=2&&(c++,p/=2),c+_>=v?(l=0,c=v):c+_>=1?(l=(t*p-1)*Math.pow(2,s),c+=_):(l=t*Math.pow(2,_-1)*Math.pow(2,s),c=0));s>=8;r[e+w]=255&l,w+=x,l/=256,s-=8);for(c=c<0;r[e+w]=255&c,w+=x,c/=256,m-=8);r[e+w-x]|=128*A},function(r){const t=CH,e=vm,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;r.Buffer=c,r.SlowBuffer=function(k){return+k!=k&&(k=0),c.alloc(+k)},r.INSPECT_MAX_BYTES=50;const s=2147483647;function i(k){if(k>s)throw new RangeError('The value "'+k+'" is invalid for option "size"');const T=new Uint8Array(k);return Object.setPrototypeOf(T,c.prototype),T}function c(k,T,L){if(typeof k=="number"){if(typeof T=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return m(k)}return l(k,T,L)}function l(k,T,L){if(typeof k=="string")return function(Q,ot){if(typeof ot=="string"&&ot!==""||(ot="utf8"),!c.isEncoding(ot))throw new TypeError("Unknown encoding: "+ot);const qt=0|w(Q,ot);let It=i(qt);const xt=It.write(Q,ot);return xt!==qt&&(It=It.slice(0,xt)),It}(k,T);if(ArrayBuffer.isView(k))return function(Q){if(Ft(Q,Uint8Array)){const ot=new Uint8Array(Q);return _(ot.buffer,ot.byteOffset,ot.byteLength)}return v(Q)}(k);if(k==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k);if(Ft(k,ArrayBuffer)||k&&Ft(k.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ft(k,SharedArrayBuffer)||k&&Ft(k.buffer,SharedArrayBuffer)))return _(k,T,L);if(typeof k=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const j=k.valueOf&&k.valueOf();if(j!=null&&j!==k)return c.from(j,T,L);const rt=function(Q){if(c.isBuffer(Q)){const ot=0|E(Q.length),qt=i(ot);return qt.length===0||Q.copy(qt,0,0,ot),qt}return Q.length!==void 0?typeof Q.length!="number"||lt(Q.length)?i(0):v(Q):Q.type==="Buffer"&&Array.isArray(Q.data)?v(Q.data):void 0}(k);if(rt)return rt;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof k[Symbol.toPrimitive]=="function")return c.from(k[Symbol.toPrimitive]("string"),T,L);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof k)}function p(k){if(typeof k!="number")throw new TypeError('"size" argument must be of type number');if(k<0)throw new RangeError('The value "'+k+'" is invalid for option "size"')}function m(k){return p(k),i(k<0?0:0|E(k))}function v(k){const T=k.length<0?0:0|E(k.length),L=i(T);for(let j=0;j=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return 0|k}function w(k,T){if(c.isBuffer(k))return k.length;if(ArrayBuffer.isView(k)||Ft(k,ArrayBuffer))return k.byteLength;if(typeof k!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof k);const L=k.length,j=arguments.length>2&&arguments[2]===!0;if(!j&&L===0)return 0;let rt=!1;for(;;)switch(T){case"ascii":case"latin1":case"binary":return L;case"utf8":case"utf-8":return Bt(k).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*L;case"hex":return L>>>1;case"base64":return yt(k).length;default:if(rt)return j?-1:Bt(k).length;T=(""+T).toLowerCase(),rt=!0}}function x(k,T,L){let j=!1;if((T===void 0||T<0)&&(T=0),T>this.length||((L===void 0||L>this.length)&&(L=this.length),L<=0)||(L>>>=0)<=(T>>>=0))return"";for(k||(k="utf8");;)switch(k){case"hex":return o(this,T,L);case"utf8":case"utf-8":return nt(this,T,L);case"ascii":return M(this,T,L);case"latin1":case"binary":return d(this,T,L);case"base64":return tt(this,T,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return a(this,T,L);default:if(j)throw new TypeError("Unknown encoding: "+k);k=(k+"").toLowerCase(),j=!0}}function A(k,T,L){const j=k[T];k[T]=k[L],k[L]=j}function B(k,T,L,j,rt){if(k.length===0)return-1;if(typeof L=="string"?(j=L,L=0):L>2147483647?L=2147483647:L<-2147483648&&(L=-2147483648),lt(L=+L)&&(L=rt?0:k.length-1),L<0&&(L=k.length+L),L>=k.length){if(rt)return-1;L=k.length-1}else if(L<0){if(!rt)return-1;L=0}if(typeof T=="string"&&(T=c.from(T,j)),c.isBuffer(T))return T.length===0?-1:P(k,T,L,j,rt);if(typeof T=="number")return T&=255,typeof Uint8Array.prototype.indexOf=="function"?rt?Uint8Array.prototype.indexOf.call(k,T,L):Uint8Array.prototype.lastIndexOf.call(k,T,L):P(k,[T],L,j,rt);throw new TypeError("val must be string, number or Buffer")}function P(k,T,L,j,rt){let Q,ot=1,qt=k.length,It=T.length;if(j!==void 0&&((j=String(j).toLowerCase())==="ucs2"||j==="ucs-2"||j==="utf16le"||j==="utf-16le")){if(k.length<2||T.length<2)return-1;ot=2,qt/=2,It/=2,L/=2}function xt(Qt,Ct){return ot===1?Qt[Ct]:Qt.readUInt16BE(Ct*ot)}if(rt){let Qt=-1;for(Q=L;Qqt&&(L=qt-It),Q=L;Q>=0;Q--){let Qt=!0;for(let Ct=0;Ctrt&&(j=rt):j=rt;const Q=T.length;let ot;for(j>Q/2&&(j=Q/2),ot=0;ot>8,It=ot%256,xt.push(It),xt.push(qt);return xt}(T,k.length-L),k,L,j)}function tt(k,T,L){return T===0&&L===k.length?t.fromByteArray(k):t.fromByteArray(k.slice(T,L))}function nt(k,T,L){L=Math.min(k.length,L);const j=[];let rt=T;for(;rt239?4:Q>223?3:Q>191?2:1;if(rt+qt<=L){let It,xt,Qt,Ct;switch(qt){case 1:Q<128&&(ot=Q);break;case 2:It=k[rt+1],(192&It)==128&&(Ct=(31&Q)<<6|63&It,Ct>127&&(ot=Ct));break;case 3:It=k[rt+1],xt=k[rt+2],(192&It)==128&&(192&xt)==128&&(Ct=(15&Q)<<12|(63&It)<<6|63&xt,Ct>2047&&(Ct<55296||Ct>57343)&&(ot=Ct));break;case 4:It=k[rt+1],xt=k[rt+2],Qt=k[rt+3],(192&It)==128&&(192&xt)==128&&(192&Qt)==128&&(Ct=(15&Q)<<18|(63&It)<<12|(63&xt)<<6|63&Qt,Ct>65535&&Ct<1114112&&(ot=Ct))}}ot===null?(ot=65533,qt=1):ot>65535&&(ot-=65536,j.push(ot>>>10&1023|55296),ot=56320|1023&ot),j.push(ot),rt+=qt}return function(Q){const ot=Q.length;if(ot<=G)return String.fromCharCode.apply(String,Q);let qt="",It=0;for(;It"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."),Object.defineProperty(c.prototype,"parent",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.buffer}}),Object.defineProperty(c.prototype,"offset",{enumerable:!0,get:function(){if(c.isBuffer(this))return this.byteOffset}}),c.poolSize=8192,c.from=function(k,T,L){return l(k,T,L)},Object.setPrototypeOf(c.prototype,Uint8Array.prototype),Object.setPrototypeOf(c,Uint8Array),c.alloc=function(k,T,L){return function(j,rt,Q){return p(j),j<=0?i(j):rt!==void 0?typeof Q=="string"?i(j).fill(rt,Q):i(j).fill(rt):i(j)}(k,T,L)},c.allocUnsafe=function(k){return m(k)},c.allocUnsafeSlow=function(k){return m(k)},c.isBuffer=function(k){return k!=null&&k._isBuffer===!0&&k!==c.prototype},c.compare=function(k,T){if(Ft(k,Uint8Array)&&(k=c.from(k,k.offset,k.byteLength)),Ft(T,Uint8Array)&&(T=c.from(T,T.offset,T.byteLength)),!c.isBuffer(k)||!c.isBuffer(T))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(k===T)return 0;let L=k.length,j=T.length;for(let rt=0,Q=Math.min(L,j);rtj.length?(c.isBuffer(Q)||(Q=c.from(Q)),Q.copy(j,rt)):Uint8Array.prototype.set.call(j,Q,rt);else{if(!c.isBuffer(Q))throw new TypeError('"list" argument must be an Array of Buffers');Q.copy(j,rt)}rt+=Q.length}return j},c.byteLength=w,c.prototype._isBuffer=!0,c.prototype.swap16=function(){const k=this.length;if(k%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let T=0;TT&&(k+=" ... "),""},n&&(c.prototype[n]=c.prototype.inspect),c.prototype.compare=function(k,T,L,j,rt){if(Ft(k,Uint8Array)&&(k=c.from(k,k.offset,k.byteLength)),!c.isBuffer(k))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof k);if(T===void 0&&(T=0),L===void 0&&(L=k?k.length:0),j===void 0&&(j=0),rt===void 0&&(rt=this.length),T<0||L>k.length||j<0||rt>this.length)throw new RangeError("out of range index");if(j>=rt&&T>=L)return 0;if(j>=rt)return-1;if(T>=L)return 1;if(this===k)return 0;let Q=(rt>>>=0)-(j>>>=0),ot=(L>>>=0)-(T>>>=0);const qt=Math.min(Q,ot),It=this.slice(j,rt),xt=k.slice(T,L);for(let Qt=0;Qt>>=0,isFinite(L)?(L>>>=0,j===void 0&&(j="utf8")):(j=L,L=void 0)}const rt=this.length-T;if((L===void 0||L>rt)&&(L=rt),k.length>0&&(L<0||T<0)||T>this.length)throw new RangeError("Attempt to write outside buffer bounds");j||(j="utf8");let Q=!1;for(;;)switch(j){case"hex":return R(this,k,T,L);case"utf8":case"utf-8":return C(this,k,T,L);case"ascii":case"latin1":case"binary":return O(this,k,T,L);case"base64":return z(this,k,T,L);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return H(this,k,T,L);default:if(Q)throw new TypeError("Unknown encoding: "+j);j=(""+j).toLowerCase(),Q=!0}},c.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const G=4096;function M(k,T,L){let j="";L=Math.min(k.length,L);for(let rt=T;rtj)&&(L=j);let rt="";for(let Q=T;QL)throw new RangeError("Trying to access beyond buffer length")}function h(k,T,L,j,rt,Q){if(!c.isBuffer(k))throw new TypeError('"buffer" argument must be a Buffer instance');if(T>rt||Tk.length)throw new RangeError("Index out of range")}function g(k,T,L,j,rt){F(T,j,rt,k,L,7);let Q=Number(T&BigInt(4294967295));k[L++]=Q,Q>>=8,k[L++]=Q,Q>>=8,k[L++]=Q,Q>>=8,k[L++]=Q;let ot=Number(T>>BigInt(32)&BigInt(4294967295));return k[L++]=ot,ot>>=8,k[L++]=ot,ot>>=8,k[L++]=ot,ot>>=8,k[L++]=ot,L}function S(k,T,L,j,rt){F(T,j,rt,k,L,7);let Q=Number(T&BigInt(4294967295));k[L+7]=Q,Q>>=8,k[L+6]=Q,Q>>=8,k[L+5]=Q,Q>>=8,k[L+4]=Q;let ot=Number(T>>BigInt(32)&BigInt(4294967295));return k[L+3]=ot,ot>>=8,k[L+2]=ot,ot>>=8,k[L+1]=ot,ot>>=8,k[L]=ot,L+8}function I(k,T,L,j,rt,Q){if(L+j>k.length)throw new RangeError("Index out of range");if(L<0)throw new RangeError("Index out of range")}function y(k,T,L,j,rt){return T=+T,L>>>=0,rt||I(k,0,L,4),e.write(k,T,L,j,23,4),L+4}function u(k,T,L,j,rt){return T=+T,L>>>=0,rt||I(k,0,L,8),e.write(k,T,L,j,52,8),L+8}c.prototype.slice=function(k,T){const L=this.length;(k=~~k)<0?(k+=L)<0&&(k=0):k>L&&(k=L),(T=T===void 0?L:~~T)<0?(T+=L)<0&&(T=0):T>L&&(T=L),T>>=0,T>>>=0,L||f(k,T,this.length);let j=this[k],rt=1,Q=0;for(;++Q>>=0,T>>>=0,L||f(k,T,this.length);let j=this[k+--T],rt=1;for(;T>0&&(rt*=256);)j+=this[k+--T]*rt;return j},c.prototype.readUint8=c.prototype.readUInt8=function(k,T){return k>>>=0,T||f(k,1,this.length),this[k]},c.prototype.readUint16LE=c.prototype.readUInt16LE=function(k,T){return k>>>=0,T||f(k,2,this.length),this[k]|this[k+1]<<8},c.prototype.readUint16BE=c.prototype.readUInt16BE=function(k,T){return k>>>=0,T||f(k,2,this.length),this[k]<<8|this[k+1]},c.prototype.readUint32LE=c.prototype.readUInt32LE=function(k,T){return k>>>=0,T||f(k,4,this.length),(this[k]|this[k+1]<<8|this[k+2]<<16)+16777216*this[k+3]},c.prototype.readUint32BE=c.prototype.readUInt32BE=function(k,T){return k>>>=0,T||f(k,4,this.length),16777216*this[k]+(this[k+1]<<16|this[k+2]<<8|this[k+3])},c.prototype.readBigUInt64LE=Tt(function(k){q(k>>>=0,"offset");const T=this[k],L=this[k+7];T!==void 0&&L!==void 0||it(k,this.length-8);const j=T+256*this[++k]+65536*this[++k]+this[++k]*2**24,rt=this[++k]+256*this[++k]+65536*this[++k]+L*2**24;return BigInt(j)+(BigInt(rt)<>>=0,"offset");const T=this[k],L=this[k+7];T!==void 0&&L!==void 0||it(k,this.length-8);const j=T*2**24+65536*this[++k]+256*this[++k]+this[++k],rt=this[++k]*2**24+65536*this[++k]+256*this[++k]+L;return(BigInt(j)<>>=0,T>>>=0,L||f(k,T,this.length);let j=this[k],rt=1,Q=0;for(;++Q=rt&&(j-=Math.pow(2,8*T)),j},c.prototype.readIntBE=function(k,T,L){k>>>=0,T>>>=0,L||f(k,T,this.length);let j=T,rt=1,Q=this[k+--j];for(;j>0&&(rt*=256);)Q+=this[k+--j]*rt;return rt*=128,Q>=rt&&(Q-=Math.pow(2,8*T)),Q},c.prototype.readInt8=function(k,T){return k>>>=0,T||f(k,1,this.length),128&this[k]?-1*(255-this[k]+1):this[k]},c.prototype.readInt16LE=function(k,T){k>>>=0,T||f(k,2,this.length);const L=this[k]|this[k+1]<<8;return 32768&L?4294901760|L:L},c.prototype.readInt16BE=function(k,T){k>>>=0,T||f(k,2,this.length);const L=this[k+1]|this[k]<<8;return 32768&L?4294901760|L:L},c.prototype.readInt32LE=function(k,T){return k>>>=0,T||f(k,4,this.length),this[k]|this[k+1]<<8|this[k+2]<<16|this[k+3]<<24},c.prototype.readInt32BE=function(k,T){return k>>>=0,T||f(k,4,this.length),this[k]<<24|this[k+1]<<16|this[k+2]<<8|this[k+3]},c.prototype.readBigInt64LE=Tt(function(k){q(k>>>=0,"offset");const T=this[k],L=this[k+7];T!==void 0&&L!==void 0||it(k,this.length-8);const j=this[k+4]+256*this[k+5]+65536*this[k+6]+(L<<24);return(BigInt(j)<>>=0,"offset");const T=this[k],L=this[k+7];T!==void 0&&L!==void 0||it(k,this.length-8);const j=(T<<24)+65536*this[++k]+256*this[++k]+this[++k];return(BigInt(j)<>>=0,T||f(k,4,this.length),e.read(this,k,!0,23,4)},c.prototype.readFloatBE=function(k,T){return k>>>=0,T||f(k,4,this.length),e.read(this,k,!1,23,4)},c.prototype.readDoubleLE=function(k,T){return k>>>=0,T||f(k,8,this.length),e.read(this,k,!0,52,8)},c.prototype.readDoubleBE=function(k,T){return k>>>=0,T||f(k,8,this.length),e.read(this,k,!1,52,8)},c.prototype.writeUintLE=c.prototype.writeUIntLE=function(k,T,L,j){k=+k,T>>>=0,L>>>=0,j||h(this,k,T,L,Math.pow(2,8*L)-1,0);let rt=1,Q=0;for(this[T]=255&k;++Q>>=0,L>>>=0,j||h(this,k,T,L,Math.pow(2,8*L)-1,0);let rt=L-1,Q=1;for(this[T+rt]=255&k;--rt>=0&&(Q*=256);)this[T+rt]=k/Q&255;return T+L},c.prototype.writeUint8=c.prototype.writeUInt8=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,1,255,0),this[T]=255&k,T+1},c.prototype.writeUint16LE=c.prototype.writeUInt16LE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,2,65535,0),this[T]=255&k,this[T+1]=k>>>8,T+2},c.prototype.writeUint16BE=c.prototype.writeUInt16BE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,2,65535,0),this[T]=k>>>8,this[T+1]=255&k,T+2},c.prototype.writeUint32LE=c.prototype.writeUInt32LE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,4,4294967295,0),this[T+3]=k>>>24,this[T+2]=k>>>16,this[T+1]=k>>>8,this[T]=255&k,T+4},c.prototype.writeUint32BE=c.prototype.writeUInt32BE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,4,4294967295,0),this[T]=k>>>24,this[T+1]=k>>>16,this[T+2]=k>>>8,this[T+3]=255&k,T+4},c.prototype.writeBigUInt64LE=Tt(function(k,T=0){return g(this,k,T,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeBigUInt64BE=Tt(function(k,T=0){return S(this,k,T,BigInt(0),BigInt("0xffffffffffffffff"))}),c.prototype.writeIntLE=function(k,T,L,j){if(k=+k,T>>>=0,!j){const qt=Math.pow(2,8*L-1);h(this,k,T,L,qt-1,-qt)}let rt=0,Q=1,ot=0;for(this[T]=255&k;++rt>0)-ot&255;return T+L},c.prototype.writeIntBE=function(k,T,L,j){if(k=+k,T>>>=0,!j){const qt=Math.pow(2,8*L-1);h(this,k,T,L,qt-1,-qt)}let rt=L-1,Q=1,ot=0;for(this[T+rt]=255&k;--rt>=0&&(Q*=256);)k<0&&ot===0&&this[T+rt+1]!==0&&(ot=1),this[T+rt]=(k/Q>>0)-ot&255;return T+L},c.prototype.writeInt8=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,1,127,-128),k<0&&(k=255+k+1),this[T]=255&k,T+1},c.prototype.writeInt16LE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,2,32767,-32768),this[T]=255&k,this[T+1]=k>>>8,T+2},c.prototype.writeInt16BE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,2,32767,-32768),this[T]=k>>>8,this[T+1]=255&k,T+2},c.prototype.writeInt32LE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,4,2147483647,-2147483648),this[T]=255&k,this[T+1]=k>>>8,this[T+2]=k>>>16,this[T+3]=k>>>24,T+4},c.prototype.writeInt32BE=function(k,T,L){return k=+k,T>>>=0,L||h(this,k,T,4,2147483647,-2147483648),k<0&&(k=4294967295+k+1),this[T]=k>>>24,this[T+1]=k>>>16,this[T+2]=k>>>8,this[T+3]=255&k,T+4},c.prototype.writeBigInt64LE=Tt(function(k,T=0){return g(this,k,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeBigInt64BE=Tt(function(k,T=0){return S(this,k,T,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),c.prototype.writeFloatLE=function(k,T,L){return y(this,k,T,!0,L)},c.prototype.writeFloatBE=function(k,T,L){return y(this,k,T,!1,L)},c.prototype.writeDoubleLE=function(k,T,L){return u(this,k,T,!0,L)},c.prototype.writeDoubleBE=function(k,T,L){return u(this,k,T,!1,L)},c.prototype.copy=function(k,T,L,j){if(!c.isBuffer(k))throw new TypeError("argument should be a Buffer");if(L||(L=0),j||j===0||(j=this.length),T>=k.length&&(T=k.length),T||(T=0),j>0&&j=this.length)throw new RangeError("Index out of range");if(j<0)throw new RangeError("sourceEnd out of bounds");j>this.length&&(j=this.length),k.length-T>>=0,L=L===void 0?this.length:L>>>0,k||(k=0),typeof k=="number")for(rt=T;rt=j+4;L-=3)T=`_${k.slice(L-3,L)}${T}`;return`${k.slice(0,L)}${T}`}function F(k,T,L,j,rt,Q){if(k>L||k3?T===0||T===BigInt(0)?`>= 0${ot} and < 2${ot} ** ${8*(Q+1)}${ot}`:`>= -(2${ot} ** ${8*(Q+1)-1}${ot}) and < 2 ** ${8*(Q+1)-1}${ot}`:`>= ${T}${ot} and <= ${L}${ot}`,new b.ERR_OUT_OF_RANGE("value",qt,k)}(function(ot,qt,It){q(qt,"offset"),ot[qt]!==void 0&&ot[qt+It]!==void 0||it(qt,ot.length-(It+1))})(j,rt,Q)}function q(k,T){if(typeof k!="number")throw new b.ERR_INVALID_ARG_TYPE(T,"number",k)}function it(k,T,L){throw Math.floor(k)!==k?(q(k,L),new b.ERR_OUT_OF_RANGE(L||"offset","an integer",k)):T<0?new b.ERR_BUFFER_OUT_OF_BOUNDS:new b.ERR_OUT_OF_RANGE(L||"offset",`>= ${L?1:0} and <= ${T}`,k)}D("ERR_BUFFER_OUT_OF_BOUNDS",function(k){return k?`${k} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),D("ERR_INVALID_ARG_TYPE",function(k,T){return`The "${k}" argument must be of type number. Received type ${typeof T}`},TypeError),D("ERR_OUT_OF_RANGE",function(k,T,L){let j=`The value of "${k}" is out of range.`,rt=L;return Number.isInteger(L)&&Math.abs(L)>2**32?rt=Z(String(L)):typeof L=="bigint"&&(rt=String(L),(L>BigInt(2)**BigInt(32)||L<-(BigInt(2)**BigInt(32)))&&(rt=Z(rt)),rt+="n"),j+=` It must be ${T}. Received ${rt}`,j},RangeError);const at=/[^+/0-9A-Za-z-_]/g;function Bt(k,T){let L;T=T||1/0;const j=k.length;let rt=null;const Q=[];for(let ot=0;ot55295&&L<57344){if(!rt){if(L>56319){(T-=3)>-1&&Q.push(239,191,189);continue}if(ot+1===j){(T-=3)>-1&&Q.push(239,191,189);continue}rt=L;continue}if(L<56320){(T-=3)>-1&&Q.push(239,191,189),rt=L;continue}L=65536+(rt-55296<<10|L-56320)}else rt&&(T-=3)>-1&&Q.push(239,191,189);if(rt=null,L<128){if((T-=1)<0)break;Q.push(L)}else if(L<2048){if((T-=2)<0)break;Q.push(L>>6|192,63&L|128)}else if(L<65536){if((T-=3)<0)break;Q.push(L>>12|224,L>>6&63|128,63&L|128)}else{if(!(L<1114112))throw new Error("Invalid code point");if((T-=4)<0)break;Q.push(L>>18|240,L>>12&63|128,L>>6&63|128,63&L|128)}}return Q}function yt(k){return t.toByteArray(function(T){if((T=(T=T.split("=")[0]).trim().replace(at,"")).length<2)return"";for(;T.length%4!=0;)T+="=";return T}(k))}function pt(k,T,L,j){let rt;for(rt=0;rt=T.length||rt>=k.length);++rt)T[rt+L]=k[rt];return rt}function Ft(k,T){return k instanceof T||k!=null&&k.constructor!=null&&k.constructor.name!=null&&k.constructor.name===T.name}function lt(k){return k!=k}const ct=function(){const k="0123456789abcdef",T=new Array(256);for(let L=0;L<16;++L){const j=16*L;for(let rt=0;rt<16;++rt)T[j+rt]=k[L]+k[rt]}return T}();function Tt(k){return typeof BigInt>"u"?kt:k}function kt(){throw new Error("BigInt not supported")}}(Vr);const gm=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,SS=r=>r instanceof Uint8Array,ym=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),_o=(r,t)=>r<<32-t|r>>>t;if(new Uint8Array(new Uint32Array([287454020]).buffer)[0]!==68)throw new Error("Non little-endian hardware is not supported");function Gy(r){if(typeof r=="string"&&(r=function(t){if(typeof t!="string")throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array(new TextEncoder().encode(t))}(r)),!SS(r))throw new Error("expected Uint8Array, got "+typeof r);return r}class kS{clone(){return this._cloneInto()}}function IS(r){const t=n=>r().update(Gy(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function BS(r=32){if(gm&&typeof gm.getRandomValues=="function")return gm.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}class PS extends kS{constructor(t,e,n,s){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=ym(this.buffer)}update(t){Ll(this);const{view:e,buffer:n,blockLen:s}=this,i=(t=Gy(t)).length;for(let c=0;cs-c&&(this.process(n,0),c=0);for(let _=c;_>A&B),R=Number(w&B),C=x?4:0,O=x?0:4;_.setUint32(E+C,P,x),_.setUint32(E+O,R,x)})(n,s-8,BigInt(8*this.length),i),this.process(n,0);const l=ym(t),p=this.outputLen;if(p%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const m=p/4,v=this.get();if(m>v.length)throw new Error("_sha2: outputLen bigger than state");for(let _=0;_>kv&k0)}:{h:0|Number(r>>kv&k0),l:0|Number(r&k0)}}const OH={fromBig:N8,split:function(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let s=0;sBigInt(r>>>0)<>>0),shrSH:(r,t,e)=>r>>>e,shrSL:(r,t,e)=>r<<32-e|t>>>e,rotrSH:(r,t,e)=>r>>>e|t<<32-e,rotrSL:(r,t,e)=>r<<32-e|t>>>e,rotrBH:(r,t,e)=>r<<64-e|t>>>e-32,rotrBL:(r,t,e)=>r>>>e-32|t<<64-e,rotr32H:(r,t)=>t,rotr32L:(r,t)=>r,rotlSH:(r,t,e)=>r<>>32-e,rotlSL:(r,t,e)=>t<>>32-e,rotlBH:(r,t,e)=>t<>>64-e,rotlBL:(r,t,e)=>r<>>64-e,add:function(r,t,e,n){const s=(t>>>0)+(n>>>0);return{h:r+e+(s/2**32|0)|0,l:0|s}},add3L:(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),add3H:(r,t,e,n)=>t+e+n+(r/2**32|0)|0,add4L:(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),add4H:(r,t,e,n,s)=>t+e+n+s+(r/2**32|0)|0,add5H:(r,t,e,n,s,i)=>t+e+n+s+i+(r/2**32|0)|0,add5L:(r,t,e,n,s)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(s>>>0)};var er=OH;const[UH,NH]=er.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(r=>BigInt(r))),Ds=new Uint32Array(80),zs=new Uint32Array(80);class DH extends PS{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:t,Al:e,Bh:n,Bl:s,Ch:i,Cl:c,Dh:l,Dl:p,Eh:m,El:v,Fh:_,Fl:E,Gh:w,Gl:x,Hh:A,Hl:B}=this;return[t,e,n,s,i,c,l,p,m,v,_,E,w,x,A,B]}set(t,e,n,s,i,c,l,p,m,v,_,E,w,x,A,B){this.Ah=0|t,this.Al=0|e,this.Bh=0|n,this.Bl=0|s,this.Ch=0|i,this.Cl=0|c,this.Dh=0|l,this.Dl=0|p,this.Eh=0|m,this.El=0|v,this.Fh=0|_,this.Fl=0|E,this.Gh=0|w,this.Gl=0|x,this.Hh=0|A,this.Hl=0|B}process(t,e){for(let C=0;C<16;C++,e+=4)Ds[C]=t.getUint32(e),zs[C]=t.getUint32(e+=4);for(let C=16;C<80;C++){const O=0|Ds[C-15],z=0|zs[C-15],H=er.rotrSH(O,z,1)^er.rotrSH(O,z,8)^er.shrSH(O,z,7),tt=er.rotrSL(O,z,1)^er.rotrSL(O,z,8)^er.shrSL(O,z,7),nt=0|Ds[C-2],G=0|zs[C-2],M=er.rotrSH(nt,G,19)^er.rotrBH(nt,G,61)^er.shrSH(nt,G,6),d=er.rotrSL(nt,G,19)^er.rotrBL(nt,G,61)^er.shrSL(nt,G,6),o=er.add4L(tt,d,zs[C-7],zs[C-16]),a=er.add4H(o,H,M,Ds[C-7],Ds[C-16]);Ds[C]=0|a,zs[C]=0|o}let{Ah:n,Al:s,Bh:i,Bl:c,Ch:l,Cl:p,Dh:m,Dl:v,Eh:_,El:E,Fh:w,Fl:x,Gh:A,Gl:B,Hh:P,Hl:R}=this;for(let C=0;C<80;C++){const O=er.rotrSH(_,E,14)^er.rotrSH(_,E,18)^er.rotrBH(_,E,41),z=er.rotrSL(_,E,14)^er.rotrSL(_,E,18)^er.rotrBL(_,E,41),H=_&w^~_&A,tt=E&x^~E&B,nt=er.add5L(R,z,tt,NH[C],zs[C]),G=er.add5H(nt,P,O,H,UH[C],Ds[C]),M=0|nt,d=er.rotrSH(n,s,28)^er.rotrBH(n,s,34)^er.rotrBH(n,s,39),o=er.rotrSL(n,s,28)^er.rotrBL(n,s,34)^er.rotrBL(n,s,39),a=n&i^n&l^i&l,f=s&c^s&p^c&p;P=0|A,R=0|B,A=0|w,B=0|x,w=0|_,x=0|E,{h:_,l:E}=er.add(0|m,0|v,0|G,0|M),m=0|l,v=0|p,l=0|i,p=0|c,i=0|n,c=0|s;const h=er.add3L(M,o,f);n=er.add3H(h,G,d,a),s=0|h}({h:n,l:s}=er.add(0|this.Ah,0|this.Al,0|n,0|s)),{h:i,l:c}=er.add(0|this.Bh,0|this.Bl,0|i,0|c),{h:l,l:p}=er.add(0|this.Ch,0|this.Cl,0|l,0|p),{h:m,l:v}=er.add(0|this.Dh,0|this.Dl,0|m,0|v),{h:_,l:E}=er.add(0|this.Eh,0|this.El,0|_,0|E),{h:w,l:x}=er.add(0|this.Fh,0|this.Fl,0|w,0|x),{h:A,l:B}=er.add(0|this.Gh,0|this.Gl,0|A,0|B),{h:P,l:R}=er.add(0|this.Hh,0|this.Hl,0|P,0|R),this.set(n,s,i,c,l,p,m,v,_,E,w,x,A,B,P,R)}roundClean(){Ds.fill(0),zs.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 zH=IS(()=>new DH),D8=BigInt(0),il=BigInt(1),qH=BigInt(2),Ld=r=>r instanceof Uint8Array,FH=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function $a(r){if(!Ld(r))throw new Error("Uint8Array expected");let t="";for(let e=0;en+s.length,0));let e=0;return r.forEach(n=>{if(!Ld(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}const Xy=r=>(qH<new Uint8Array(r),q8=r=>Uint8Array.from(r);function RS(r,t,e){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let n=bm(r),s=bm(r),i=0;const c=()=>{n.fill(1),s.fill(0),i=0},l=(...v)=>e(s,n,...v),p=(v=bm())=>{s=l(q8([0]),v),n=l(),v.length!==0&&(s=l(q8([1]),v),n=l())},m=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let v=0;const _=[];for(;v{let E;for(c(),p(v);!(E=_(m()));)p();return c(),E}}const jH={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||r instanceof Uint8Array,isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function gf(r,t,e={}){const n=(s,i,c)=>{const l=jH[i];if(typeof l!="function")throw new Error(`Invalid validator "${i}", expected function`);const p=r[s];if(!(c&&p===void 0||l(p,r)))throw new Error(`Invalid param ${String(s)}=${p} (${typeof p}), expected ${i}`)};for(const[s,i]of Object.entries(t))n(s,i,!1);for(const[s,i]of Object.entries(e))n(s,i,!0);return r}var KH=Object.freeze({__proto__:null,bytesToHex:$a,numberToHexUnpadded:z8,hexToNumber:Yy,hexToBytes:vf,bytesToNumberBE:Aa,bytesToNumberLE:Xu,numberToBytesBE:Ju,numberToBytesLE:hh,numberToVarBytesBE:function(r){return vf(z8(r))},ensureBytes:pn,concatBytes:Ha,equalBytes:function(r,t){if(r.length!==t.length)return!1;for(let e=0;eD8;r>>=il,t+=1);return t},bitGet:function(r,t){return r>>BigInt(t)&il},bitSet:(r,t,e)=>r|(e?il:D8)<=Mn?e:t+e}function HH(r,t,e){if(e<=Mn||t 0");if(e===Hr)return Mn;let n=Hr;for(;t>Mn;)t&Hr&&(n=n*r%e),r=r*r%e,t>>=Hr;return n}function rn(r,t,e){let n=r;for(;t-- >Mn;)n*=n,n%=e;return n}function Iv(r,t){if(r===Mn||t<=Mn)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=$r(r,t),n=t,s=Mn,i=Hr;for(;e!==Mn;){const c=n%e,l=s-i*(n/e);n=e,e=c,s=i,i=l}if(n!==Hr)throw new Error("invert: does not exist");return $r(s,t)}BigInt(9),BigInt(16);const VH=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function CS(r,t){const e=t!==void 0?t:r.toString(2).length;return{nBitLength:e,nByteLength:Math.ceil(e/8)}}function TS(r,t,e=!1,n={}){if(r<=Mn)throw new Error(`Expected Field ORDER > 0, got ${r}`);const{nBitLength:s,nByteLength:i}=CS(r,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const c=function(p){if(p%wm===$H){const m=(p+Hr)/wm;return function(v,_){const E=v.pow(_,m);if(!v.eql(v.sqr(E),_))throw new Error("Cannot find square root");return E}}if(p%j8===F8){const m=(p-F8)/j8;return function(v,_){const E=v.mul(_,ga),w=v.pow(E,m),x=v.mul(_,w),A=v.mul(v.mul(x,ga),w),B=v.mul(x,v.sub(A,v.ONE));if(!v.eql(v.sqr(B),_))throw new Error("Cannot find square root");return B}}return function(m){const v=(m-Hr)/ga;let _,E,w;for(_=m-Hr,E=0;_%ga===Mn;_/=ga,E++);for(w=ga;w$r(p,r),isValid:p=>{if(typeof p!="bigint")throw new Error("Invalid field element: expected bigint, got "+typeof p);return Mn<=p&&pp===Mn,isOdd:p=>(p&Hr)===Hr,neg:p=>$r(-p,r),eql:(p,m)=>p===m,sqr:p=>$r(p*p,r),add:(p,m)=>$r(p+m,r),sub:(p,m)=>$r(p-m,r),mul:(p,m)=>$r(p*m,r),pow:(p,m)=>function(v,_,E){if(E 0");if(E===Mn)return v.ONE;if(E===Hr)return _;let w=v.ONE,x=_;for(;E>Mn;)E&Hr&&(w=v.mul(w,x)),x=v.sqr(x),E>>=Hr;return w}(l,p,m),div:(p,m)=>$r(p*Iv(m,r),r),sqrN:p=>p*p,addN:(p,m)=>p+m,subN:(p,m)=>p-m,mulN:(p,m)=>p*m,inv:p=>Iv(p,r),sqrt:n.sqrt||(p=>c(l,p)),invertBatch:p=>function(m,v){const _=new Array(v.length),E=v.reduce((x,A,B)=>m.is0(A)?x:(_[B]=x,m.mul(x,A)),m.ONE),w=m.inv(E);return v.reduceRight((x,A,B)=>m.is0(A)?x:(_[B]=m.mul(x,_[B]),m.mul(x,A)),w),_}(l,p),cmov:(p,m,v)=>v?m:p,toBytes:p=>e?hh(p,i):Ju(p,i),fromBytes:p=>{if(p.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${p.length}`);return e?Xu(p):Aa(p)}});return Object.freeze(l)}function LS(r){if(typeof r!="bigint")throw new Error("field order must be bigint");const t=r.toString(2).length;return Math.ceil(t/8)}function K8(r){const t=LS(r);return t+Math.ceil(t/2)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ZH=BigInt(0),xm=BigInt(1);function OS(r,t){const e=(s,i)=>{const c=i.negate();return s?c:i},n=s=>({windows:Math.ceil(t/s)+1,windowSize:2**(s-1)});return{constTimeNegate:e,unsafeLadder(s,i){let c=r.ZERO,l=s;for(;i>ZH;)i&xm&&(c=c.add(l)),l=l.double(),i>>=xm;return c},precomputeWindow(s,i){const{windows:c,windowSize:l}=n(i),p=[];let m=s,v=m;for(let _=0;_>=w,B>p&&(B-=E,c+=xm);const P=A,R=A+Math.abs(B)-1,C=x%2!=0,O=B<0;B===0?v=v.add(e(C,i[P])):m=m.add(e(O,i[R]))}return{p:m,f:v}},wNAFCached(s,i,c,l){const p=s._WINDOW_SIZE||1;let m=i.get(s);return m||(m=this.precomputeWindow(s,p),p!==1&&i.set(s,l(m))),this.wNAF(p,m,c)}}}function Bv(r){return gf(r.Fp,VH.reduce((t,e)=>(t[e]="function",t),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),gf(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...CS(r.n,r.nBitLength),...r,p:r.Fp.ORDER});/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */}const to=BigInt(0),vi=BigInt(1),I0=BigInt(2),WH=BigInt(8),GH={zip215:!0};/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Pv=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),$8=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const YH=BigInt(1),Rv=BigInt(2),XH=BigInt(5),H8=BigInt(10),JH=BigInt(20),QH=BigInt(40),V8=BigInt(80),cs=TS(Pv,void 0,!0),tV={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:cs,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:zH,randomBytes:BS,adjustScalarBytes:function(r){return r[0]&=248,r[31]&=127,r[31]|=64,r},uvRatio:function(r,t){const e=Pv,n=$r(t*t*t,e),s=function(E){const w=Pv,x=E*E%w*E%w,A=rn(x,Rv,w)*x%w,B=rn(A,YH,w)*E%w,P=rn(B,XH,w)*B%w,R=rn(P,H8,w)*P%w,C=rn(R,JH,w)*R%w,O=rn(C,QH,w)*C%w,z=rn(O,V8,w)*O%w,H=rn(z,V8,w)*O%w,tt=rn(H,H8,w)*P%w;return{pow_p_5_8:rn(tt,Rv,w)*E%w,b2:x}}(r*$r(n*n*t,e)).pow_p_5_8;let i=$r(r*n*s,e);const c=$r(t*i*i,e),l=i,p=$r(i*$8,e),m=c===r,v=c===$r(-r,e),_=c===$r(-r*$8,e);return m&&(i=l),(v||_)&&(i=p),($r(i,e)&Hr)===Hr&&(i=$r(-i,e)),{isValid:m||v,value:i}}},eV=function(r){const t=function(f){const h=Bv(f);return gf(f,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...h})}(r),{Fp:e,n,prehash:s,hash:i,randomBytes:c,nByteLength:l,h:p}=t,m=I0<{try{return{isValid:!0,value:e.sqrt(f*e.inv(h))}}catch{return{isValid:!1,value:to}}}),E=t.adjustScalarBytes||(f=>f),w=t.domain||((f,h,g)=>{if(h.length||g)throw new Error("Contexts/pre-hash are not supported");return f}),x=f=>typeof f=="bigint"&&tox(f)&&x(h)&&ff===to||A(f,m);function P(f,h){if(A(f,h))return f;throw new Error(`Expected valid scalar < ${h}, got ${typeof f} ${f}`)}function R(f){return f===to?f:P(f,n)}const C=new Map;function O(f){if(!(f instanceof z))throw new Error("ExtendedPoint expected")}class z{constructor(h,g,S,I){if(this.ex=h,this.ey=g,this.ez=S,this.et=I,!B(h))throw new Error("x required");if(!B(g))throw new Error("y required");if(!B(S))throw new Error("z required");if(!B(I))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(h){if(h instanceof z)throw new Error("extended point not allowed");const{x:g,y:S}=h||{};if(!B(g)||!B(S))throw new Error("invalid affine point");return new z(g,S,vi,v(g*S))}static normalizeZ(h){const g=e.invertBatch(h.map(S=>S.ez));return h.map((S,I)=>S.toAffine(g[I])).map(z.fromAffine)}_setWindowSize(h){this._WINDOW_SIZE=h,C.delete(this)}assertValidity(){const{a:h,d:g}=t;if(this.is0())throw new Error("bad point: ZERO");const{ex:S,ey:I,ez:y,et:u}=this,b=v(S*S),D=v(I*I),Z=v(y*y),F=v(Z*Z),q=v(b*h);if(v(Z*v(q+D))!==v(F+v(g*v(b*D))))throw new Error("bad point: equation left != right (1)");if(v(S*I)!==v(y*u))throw new Error("bad point: equation left != right (2)")}equals(h){O(h);const{ex:g,ey:S,ez:I}=this,{ex:y,ey:u,ez:b}=h,D=v(g*b),Z=v(y*I),F=v(S*b),q=v(u*I);return D===Z&&F===q}is0(){return this.equals(z.ZERO)}negate(){return new z(v(-this.ex),this.ey,this.ez,v(-this.et))}double(){const{a:h}=t,{ex:g,ey:S,ez:I}=this,y=v(g*g),u=v(S*S),b=v(I0*v(I*I)),D=v(h*y),Z=g+S,F=v(v(Z*Z)-y-u),q=D+u,it=q-b,at=D-u,Bt=v(F*it),yt=v(q*at),pt=v(F*at),Ft=v(it*q);return new z(Bt,yt,Ft,pt)}add(h){O(h);const{a:g,d:S}=t,{ex:I,ey:y,ez:u,et:b}=this,{ex:D,ey:Z,ez:F,et:q}=h;if(g===BigInt(-1)){const L=v((y-I)*(Z+D)),j=v((y+I)*(Z-D)),rt=v(j-L);if(rt===to)return this.double();const Q=v(u*I0*q),ot=v(b*I0*F),qt=ot+Q,It=j+L,xt=ot-Q,Qt=v(qt*rt),Ct=v(It*xt),Dt=v(qt*xt),Se=v(rt*It);return new z(Qt,Ct,Se,Dt)}const it=v(I*D),at=v(y*Z),Bt=v(b*S*q),yt=v(u*F),pt=v((I+y)*(D+Z)-it-at),Ft=yt-Bt,lt=yt+Bt,ct=v(at-g*it),Tt=v(pt*Ft),kt=v(lt*ct),k=v(pt*ct),T=v(Ft*lt);return new z(Tt,kt,T,k)}subtract(h){return this.add(h.negate())}wNAF(h){return nt.wNAFCached(this,C,h,z.normalizeZ)}multiply(h){const{p:g,f:S}=this.wNAF(P(h,n));return z.normalizeZ([g,S])[0]}multiplyUnsafe(h){let g=R(h);return g===to?tt:this.equals(tt)||g===vi?this:this.equals(H)?this.wNAF(g).p:nt.unsafeLadder(this,g)}isSmallOrder(){return this.multiplyUnsafe(p).is0()}isTorsionFree(){return nt.unsafeLadder(this,n).is0()}toAffine(h){const{ex:g,ey:S,ez:I}=this,y=this.is0();h==null&&(h=y?WH:e.inv(I));const u=v(g*h),b=v(S*h),D=v(I*h);if(y)return{x:to,y:vi};if(D!==vi)throw new Error("invZ was invalid");return{x:u,y:b}}clearCofactor(){const{h}=t;return h===vi?this:this.multiplyUnsafe(h)}static fromHex(h,g=!1){const{d:S,a:I}=t,y=e.BYTES,u=(h=pn("pointHex",h,y)).slice(),b=h[y-1];u[y-1]=-129&b;const D=Xu(u);D===to||P(D,g?m:e.ORDER);const Z=v(D*D),F=v(Z-vi),q=v(S*Z-I);let{isValid:it,value:at}=_(F,q);if(!it)throw new Error("Point.fromHex: invalid y coordinate");const Bt=(at&vi)===vi,yt=(128&b)!=0;if(!g&&at===to&&yt)throw new Error("Point.fromHex: x=0 and x_0=1");return yt!==Bt&&(at=v(-at)),z.fromAffine({x:at,y:D})}static fromPrivateKey(h){return d(h).point}toRawBytes(){const{x:h,y:g}=this.toAffine(),S=hh(g,e.BYTES);return S[S.length-1]|=h&vi?128:0,S}toHex(){return $a(this.toRawBytes())}}z.BASE=new z(t.Gx,t.Gy,vi,v(t.Gx*t.Gy)),z.ZERO=new z(to,vi,vi,to);const{BASE:H,ZERO:tt}=z,nt=OS(z,8*l);function G(f){return $r(f,n)}function M(f){return G(Xu(f))}function d(f){const h=l;f=pn("private key",f,h);const g=pn("hashed private key",i(f),2*h),S=E(g.slice(0,h)),I=g.slice(h,2*h),y=M(S),u=H.multiply(y),b=u.toRawBytes();return{head:S,prefix:I,scalar:y,point:u,pointBytes:b}}function o(f=new Uint8Array,...h){const g=Ha(...h);return M(i(w(g,pn("context",f),!!s)))}const a=GH;return H._setWindowSize(8),{CURVE:t,getPublicKey:function(f){return d(f).pointBytes},sign:function(f,h,g={}){f=pn("message",f),s&&(f=s(f));const{prefix:S,scalar:I,pointBytes:y}=d(h),u=o(g.context,S,f),b=H.multiply(u).toRawBytes(),D=G(u+o(g.context,b,y,f)*I);return R(D),pn("result",Ha(b,hh(D,e.BYTES)),2*l)},verify:function(f,h,g,S=a){const{context:I,zip215:y}=S,u=e.BYTES;f=pn("signature",f,2*u),h=pn("message",h),s&&(h=s(h));const b=Xu(f.slice(u,2*u));let D,Z,F;try{D=z.fromHex(g,y),Z=z.fromHex(f.slice(0,u),y),F=H.multiplyUnsafe(b)}catch{return!1}if(!y&&D.isSmallOrder())return!1;const q=o(I,Z.toRawBytes(),D.toRawBytes(),h);return Z.add(D.multiplyUnsafe(q)).subtract(F).clearCofactor().equals(z.ZERO)},ExtendedPoint:z,utils:{getExtendedPublicKey:d,randomPrivateKey:()=>c(e.BYTES),precompute:(f=8,h=z.BASE)=>(h._setWindowSize(f),h.multiply(BigInt(3)),h)}}}(tV),rV=(cs.ORDER+BigInt(3))/BigInt(8);cs.pow(Rv,rV),cs.sqrt(cs.neg(cs.ONE)),cs.ORDER,BigInt(5),BigInt(8),BigInt(486662),function(r,t){if(!r.isOdd)throw new Error("Field doesn't have isOdd");const e=r.sqrt(t);r.isOdd(e)&&r.neg(e)}(cs,cs.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Cv={exports:{}},nV=Wy(Object.freeze({__proto__:null,default:{}}));(function(r,t){function e(M,d){if(!M)throw new Error(d||"Assertion failed")}function n(M,d){M.super_=d;var o=function(){};o.prototype=d.prototype,M.prototype=new o,M.prototype.constructor=M}function s(M,d,o){if(s.isBN(M))return M;this.negative=0,this.words=null,this.length=0,this.red=null,M!==null&&(d!=="le"&&d!=="be"||(o=d,d=10),this._init(M||0,d||10,o||"be"))}var i;typeof Cv=="object"?Cv.exports=s:t.BN=s,s.BN=s,s.wordSize=26;try{i=typeof window<"u"&&window.Buffer!==void 0?window.Buffer:nV.Buffer}catch{}function c(M,d){var o=M.charCodeAt(d);return o>=48&&o<=57?o-48:o>=65&&o<=70?o-55:o>=97&&o<=102?o-87:void e(!1,"Invalid character in "+M)}function l(M,d,o){var a=c(M,o);return o-1>=d&&(a|=c(M,o-1)<<4),a}function p(M,d,o,a){for(var f=0,h=0,g=Math.min(M.length,o),S=d;S=49?I-49+10:I>=17?I-17+10:I,e(I>=0&&h0?M:d},s.min=function(M,d){return M.cmp(d)<0?M:d},s.prototype._init=function(M,d,o){if(typeof M=="number")return this._initNumber(M,d,o);if(typeof M=="object")return this._initArray(M,d,o);d==="hex"&&(d=16),e(d===(0|d)&&d>=2&&d<=36);var a=0;(M=M.toString().replace(/\s+/g,""))[0]==="-"&&(a++,this.negative=1),a=0;a-=3)h=M[a]|M[a-1]<<8|M[a-2]<<16,this.words[f]|=h<>>26-g&67108863,(g+=24)>=26&&(g-=26,f++);else if(o==="le")for(a=0,f=0;a>>26-g&67108863,(g+=24)>=26&&(g-=26,f++);return this._strip()},s.prototype._parseHex=function(M,d,o){this.length=Math.ceil((M.length-d)/6),this.words=new Array(this.length);for(var a=0;a=d;a-=2)f=l(M,d,a)<=18?(h-=18,g+=1,this.words[g]|=f>>>26):h+=8;else for(a=(M.length-d)%2==0?d+1:d;a=18?(h-=18,g+=1,this.words[g]|=f>>>26):h+=8;this._strip()},s.prototype._parseBase=function(M,d,o){this.words=[0],this.length=1;for(var a=0,f=1;f<=67108863;f*=d)a++;a--,f=f/d|0;for(var h=M.length-o,g=h%a,S=Math.min(h,h-g)+o,I=0,y=o;y1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=v}catch{s.prototype.inspect=v}else s.prototype.inspect=v;function v(){return(this.red?""}var _=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],E=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],w=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function x(M,d,o){o.negative=d.negative^M.negative;var a=M.length+d.length|0;o.length=a,a=a-1|0;var f=0|M.words[0],h=0|d.words[0],g=f*h,S=67108863&g,I=g/67108864|0;o.words[0]=S;for(var y=1;y>>26,b=67108863&I,D=Math.min(y,d.length-1),Z=Math.max(0,y-M.length+1);Z<=D;Z++){var F=y-Z|0;u+=(g=(f=0|M.words[F])*(h=0|d.words[Z])+b)/67108864|0,b=67108863&g}o.words[y]=0|b,I=0|u}return I!==0?o.words[y]=0|I:o.length--,o._strip()}s.prototype.toString=function(M,d){var o;if(d=0|d||1,(M=M||10)===16||M==="hex"){o="";for(var a=0,f=0,h=0;h>>24-a&16777215,(a+=2)>=26&&(a-=26,h--),o=f!==0||h!==this.length-1?_[6-S.length]+S+o:S+o}for(f!==0&&(o=f.toString(16)+o);o.length%d!=0;)o="0"+o;return this.negative!==0&&(o="-"+o),o}if(M===(0|M)&&M>=2&&M<=36){var I=E[M],y=w[M];o="";var u=this.clone();for(u.negative=0;!u.isZero();){var b=u.modrn(y).toString(M);o=(u=u.idivn(y)).isZero()?b+o:_[I-b.length]+b+o}for(this.isZero()&&(o="0"+o);o.length%d!=0;)o="0"+o;return this.negative!==0&&(o="-"+o),o}e(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var M=this.words[0];return this.length===2?M+=67108864*this.words[1]:this.length===3&&this.words[2]===1?M+=4503599627370496+67108864*this.words[1]:this.length>2&&e(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-M:M},s.prototype.toJSON=function(){return this.toString(16,2)},i&&(s.prototype.toBuffer=function(M,d){return this.toArrayLike(i,M,d)}),s.prototype.toArray=function(M,d){return this.toArrayLike(Array,M,d)},s.prototype.toArrayLike=function(M,d,o){this._strip();var a=this.byteLength(),f=o||Math.max(1,a);e(a<=f,"byte array longer than desired length"),e(f>0,"Requested array length <= 0");var h=function(g,S){return g.allocUnsafe?g.allocUnsafe(S):new g(S)}(M,f);return this["_toArrayLike"+(d==="le"?"LE":"BE")](h,a),h},s.prototype._toArrayLikeLE=function(M,d){for(var o=0,a=0,f=0,h=0;f>8&255),o>16&255),h===6?(o>24&255),a=0,h=0):(a=g>>>24,h+=2)}if(o=0&&(M[o--]=g>>8&255),o>=0&&(M[o--]=g>>16&255),h===6?(o>=0&&(M[o--]=g>>24&255),a=0,h=0):(a=g>>>24,h+=2)}if(o>=0)for(M[o--]=a;o>=0;)M[o--]=0},Math.clz32?s.prototype._countBits=function(M){return 32-Math.clz32(M)}:s.prototype._countBits=function(M){var d=M,o=0;return d>=4096&&(o+=13,d>>>=13),d>=64&&(o+=7,d>>>=7),d>=8&&(o+=4,d>>>=4),d>=2&&(o+=2,d>>>=2),o+d},s.prototype._zeroBits=function(M){if(M===0)return 26;var d=M,o=0;return!(8191&d)&&(o+=13,d>>>=13),!(127&d)&&(o+=7,d>>>=7),!(15&d)&&(o+=4,d>>>=4),!(3&d)&&(o+=2,d>>>=2),!(1&d)&&o++,o},s.prototype.bitLength=function(){var M=this.words[this.length-1],d=this._countBits(M);return 26*(this.length-1)+d},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var M=0,d=0;dM.length?this.clone().ior(M):M.clone().ior(this)},s.prototype.uor=function(M){return this.length>M.length?this.clone().iuor(M):M.clone().iuor(this)},s.prototype.iuand=function(M){var d;d=this.length>M.length?M:this;for(var o=0;oM.length?this.clone().iand(M):M.clone().iand(this)},s.prototype.uand=function(M){return this.length>M.length?this.clone().iuand(M):M.clone().iuand(this)},s.prototype.iuxor=function(M){var d,o;this.length>M.length?(d=this,o=M):(d=M,o=this);for(var a=0;aM.length?this.clone().ixor(M):M.clone().ixor(this)},s.prototype.uxor=function(M){return this.length>M.length?this.clone().iuxor(M):M.clone().iuxor(this)},s.prototype.inotn=function(M){e(typeof M=="number"&&M>=0);var d=0|Math.ceil(M/26),o=M%26;this._expand(d),o>0&&d--;for(var a=0;a0&&(this.words[a]=~this.words[a]&67108863>>26-o),this._strip()},s.prototype.notn=function(M){return this.clone().inotn(M)},s.prototype.setn=function(M,d){e(typeof M=="number"&&M>=0);var o=M/26|0,a=M%26;return this._expand(o+1),this.words[o]=d?this.words[o]|1<M.length?(o=this,a=M):(o=M,a=this);for(var f=0,h=0;h>>26;for(;f!==0&&h>>26;if(this.length=o.length,f!==0)this.words[this.length]=f,this.length++;else if(o!==this)for(;hM.length?this.clone().iadd(M):M.clone().iadd(this)},s.prototype.isub=function(M){if(M.negative!==0){M.negative=0;var d=this.iadd(M);return M.negative=1,d._normSign()}if(this.negative!==0)return this.negative=0,this.iadd(M),this.negative=1,this._normSign();var o,a,f=this.cmp(M);if(f===0)return this.negative=0,this.length=1,this.words[0]=0,this;f>0?(o=this,a=M):(o=M,a=this);for(var h=0,g=0;g>26,this.words[g]=67108863&d;for(;h!==0&&g>26,this.words[g]=67108863&d;if(h===0&&g>>13,Z=0|g[1],F=8191&Z,q=Z>>>13,it=0|g[2],at=8191&it,Bt=it>>>13,yt=0|g[3],pt=8191&yt,Ft=yt>>>13,lt=0|g[4],ct=8191<,Tt=lt>>>13,kt=0|g[5],k=8191&kt,T=kt>>>13,L=0|g[6],j=8191&L,rt=L>>>13,Q=0|g[7],ot=8191&Q,qt=Q>>>13,It=0|g[8],xt=8191&It,Qt=It>>>13,Ct=0|g[9],Dt=8191&Ct,Se=Ct>>>13,te=0|S[0],Ut=8191&te,Te=te>>>13,J=0|S[1],X=8191&J,st=J>>>13,N=0|S[2],$=8191&N,gt=N>>>13,ft=0|S[3],mt=8191&ft,vt=ft>>>13,At=0|S[4],_t=8191&At,Gt=At>>>13,Rt=0|S[5],wt=8191&Rt,se=Rt>>>13,Lt=0|S[6],Et=8191&Lt,de=Lt>>>13,Pt=0|S[7],Mt=8191&Pt,K=Pt>>>13,Y=0|S[8],V=8191&Y,U=Y>>>13,W=0|S[9],et=8191&W,dt=W>>>13;o.negative=M.negative^d.negative,o.length=19;var ut=(y+(a=Math.imul(b,Ut))|0)+((8191&(f=(f=Math.imul(b,Te))+Math.imul(D,Ut)|0))<<13)|0;y=((h=Math.imul(D,Te))+(f>>>13)|0)+(ut>>>26)|0,ut&=67108863,a=Math.imul(F,Ut),f=(f=Math.imul(F,Te))+Math.imul(q,Ut)|0,h=Math.imul(q,Te);var ht=(y+(a=a+Math.imul(b,X)|0)|0)+((8191&(f=(f=f+Math.imul(b,st)|0)+Math.imul(D,X)|0))<<13)|0;y=((h=h+Math.imul(D,st)|0)+(f>>>13)|0)+(ht>>>26)|0,ht&=67108863,a=Math.imul(at,Ut),f=(f=Math.imul(at,Te))+Math.imul(Bt,Ut)|0,h=Math.imul(Bt,Te),a=a+Math.imul(F,X)|0,f=(f=f+Math.imul(F,st)|0)+Math.imul(q,X)|0,h=h+Math.imul(q,st)|0;var zt=(y+(a=a+Math.imul(b,$)|0)|0)+((8191&(f=(f=f+Math.imul(b,gt)|0)+Math.imul(D,$)|0))<<13)|0;y=((h=h+Math.imul(D,gt)|0)+(f>>>13)|0)+(zt>>>26)|0,zt&=67108863,a=Math.imul(pt,Ut),f=(f=Math.imul(pt,Te))+Math.imul(Ft,Ut)|0,h=Math.imul(Ft,Te),a=a+Math.imul(at,X)|0,f=(f=f+Math.imul(at,st)|0)+Math.imul(Bt,X)|0,h=h+Math.imul(Bt,st)|0,a=a+Math.imul(F,$)|0,f=(f=f+Math.imul(F,gt)|0)+Math.imul(q,$)|0,h=h+Math.imul(q,gt)|0;var Wt=(y+(a=a+Math.imul(b,mt)|0)|0)+((8191&(f=(f=f+Math.imul(b,vt)|0)+Math.imul(D,mt)|0))<<13)|0;y=((h=h+Math.imul(D,vt)|0)+(f>>>13)|0)+(Wt>>>26)|0,Wt&=67108863,a=Math.imul(ct,Ut),f=(f=Math.imul(ct,Te))+Math.imul(Tt,Ut)|0,h=Math.imul(Tt,Te),a=a+Math.imul(pt,X)|0,f=(f=f+Math.imul(pt,st)|0)+Math.imul(Ft,X)|0,h=h+Math.imul(Ft,st)|0,a=a+Math.imul(at,$)|0,f=(f=f+Math.imul(at,gt)|0)+Math.imul(Bt,$)|0,h=h+Math.imul(Bt,gt)|0,a=a+Math.imul(F,mt)|0,f=(f=f+Math.imul(F,vt)|0)+Math.imul(q,mt)|0,h=h+Math.imul(q,vt)|0;var ye=(y+(a=a+Math.imul(b,_t)|0)|0)+((8191&(f=(f=f+Math.imul(b,Gt)|0)+Math.imul(D,_t)|0))<<13)|0;y=((h=h+Math.imul(D,Gt)|0)+(f>>>13)|0)+(ye>>>26)|0,ye&=67108863,a=Math.imul(k,Ut),f=(f=Math.imul(k,Te))+Math.imul(T,Ut)|0,h=Math.imul(T,Te),a=a+Math.imul(ct,X)|0,f=(f=f+Math.imul(ct,st)|0)+Math.imul(Tt,X)|0,h=h+Math.imul(Tt,st)|0,a=a+Math.imul(pt,$)|0,f=(f=f+Math.imul(pt,gt)|0)+Math.imul(Ft,$)|0,h=h+Math.imul(Ft,gt)|0,a=a+Math.imul(at,mt)|0,f=(f=f+Math.imul(at,vt)|0)+Math.imul(Bt,mt)|0,h=h+Math.imul(Bt,vt)|0,a=a+Math.imul(F,_t)|0,f=(f=f+Math.imul(F,Gt)|0)+Math.imul(q,_t)|0,h=h+Math.imul(q,Gt)|0;var Yt=(y+(a=a+Math.imul(b,wt)|0)|0)+((8191&(f=(f=f+Math.imul(b,se)|0)+Math.imul(D,wt)|0))<<13)|0;y=((h=h+Math.imul(D,se)|0)+(f>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,a=Math.imul(j,Ut),f=(f=Math.imul(j,Te))+Math.imul(rt,Ut)|0,h=Math.imul(rt,Te),a=a+Math.imul(k,X)|0,f=(f=f+Math.imul(k,st)|0)+Math.imul(T,X)|0,h=h+Math.imul(T,st)|0,a=a+Math.imul(ct,$)|0,f=(f=f+Math.imul(ct,gt)|0)+Math.imul(Tt,$)|0,h=h+Math.imul(Tt,gt)|0,a=a+Math.imul(pt,mt)|0,f=(f=f+Math.imul(pt,vt)|0)+Math.imul(Ft,mt)|0,h=h+Math.imul(Ft,vt)|0,a=a+Math.imul(at,_t)|0,f=(f=f+Math.imul(at,Gt)|0)+Math.imul(Bt,_t)|0,h=h+Math.imul(Bt,Gt)|0,a=a+Math.imul(F,wt)|0,f=(f=f+Math.imul(F,se)|0)+Math.imul(q,wt)|0,h=h+Math.imul(q,se)|0;var pe=(y+(a=a+Math.imul(b,Et)|0)|0)+((8191&(f=(f=f+Math.imul(b,de)|0)+Math.imul(D,Et)|0))<<13)|0;y=((h=h+Math.imul(D,de)|0)+(f>>>13)|0)+(pe>>>26)|0,pe&=67108863,a=Math.imul(ot,Ut),f=(f=Math.imul(ot,Te))+Math.imul(qt,Ut)|0,h=Math.imul(qt,Te),a=a+Math.imul(j,X)|0,f=(f=f+Math.imul(j,st)|0)+Math.imul(rt,X)|0,h=h+Math.imul(rt,st)|0,a=a+Math.imul(k,$)|0,f=(f=f+Math.imul(k,gt)|0)+Math.imul(T,$)|0,h=h+Math.imul(T,gt)|0,a=a+Math.imul(ct,mt)|0,f=(f=f+Math.imul(ct,vt)|0)+Math.imul(Tt,mt)|0,h=h+Math.imul(Tt,vt)|0,a=a+Math.imul(pt,_t)|0,f=(f=f+Math.imul(pt,Gt)|0)+Math.imul(Ft,_t)|0,h=h+Math.imul(Ft,Gt)|0,a=a+Math.imul(at,wt)|0,f=(f=f+Math.imul(at,se)|0)+Math.imul(Bt,wt)|0,h=h+Math.imul(Bt,se)|0,a=a+Math.imul(F,Et)|0,f=(f=f+Math.imul(F,de)|0)+Math.imul(q,Et)|0,h=h+Math.imul(q,de)|0;var ve=(y+(a=a+Math.imul(b,Mt)|0)|0)+((8191&(f=(f=f+Math.imul(b,K)|0)+Math.imul(D,Mt)|0))<<13)|0;y=((h=h+Math.imul(D,K)|0)+(f>>>13)|0)+(ve>>>26)|0,ve&=67108863,a=Math.imul(xt,Ut),f=(f=Math.imul(xt,Te))+Math.imul(Qt,Ut)|0,h=Math.imul(Qt,Te),a=a+Math.imul(ot,X)|0,f=(f=f+Math.imul(ot,st)|0)+Math.imul(qt,X)|0,h=h+Math.imul(qt,st)|0,a=a+Math.imul(j,$)|0,f=(f=f+Math.imul(j,gt)|0)+Math.imul(rt,$)|0,h=h+Math.imul(rt,gt)|0,a=a+Math.imul(k,mt)|0,f=(f=f+Math.imul(k,vt)|0)+Math.imul(T,mt)|0,h=h+Math.imul(T,vt)|0,a=a+Math.imul(ct,_t)|0,f=(f=f+Math.imul(ct,Gt)|0)+Math.imul(Tt,_t)|0,h=h+Math.imul(Tt,Gt)|0,a=a+Math.imul(pt,wt)|0,f=(f=f+Math.imul(pt,se)|0)+Math.imul(Ft,wt)|0,h=h+Math.imul(Ft,se)|0,a=a+Math.imul(at,Et)|0,f=(f=f+Math.imul(at,de)|0)+Math.imul(Bt,Et)|0,h=h+Math.imul(Bt,de)|0,a=a+Math.imul(F,Mt)|0,f=(f=f+Math.imul(F,K)|0)+Math.imul(q,Mt)|0,h=h+Math.imul(q,K)|0;var ge=(y+(a=a+Math.imul(b,V)|0)|0)+((8191&(f=(f=f+Math.imul(b,U)|0)+Math.imul(D,V)|0))<<13)|0;y=((h=h+Math.imul(D,U)|0)+(f>>>13)|0)+(ge>>>26)|0,ge&=67108863,a=Math.imul(Dt,Ut),f=(f=Math.imul(Dt,Te))+Math.imul(Se,Ut)|0,h=Math.imul(Se,Te),a=a+Math.imul(xt,X)|0,f=(f=f+Math.imul(xt,st)|0)+Math.imul(Qt,X)|0,h=h+Math.imul(Qt,st)|0,a=a+Math.imul(ot,$)|0,f=(f=f+Math.imul(ot,gt)|0)+Math.imul(qt,$)|0,h=h+Math.imul(qt,gt)|0,a=a+Math.imul(j,mt)|0,f=(f=f+Math.imul(j,vt)|0)+Math.imul(rt,mt)|0,h=h+Math.imul(rt,vt)|0,a=a+Math.imul(k,_t)|0,f=(f=f+Math.imul(k,Gt)|0)+Math.imul(T,_t)|0,h=h+Math.imul(T,Gt)|0,a=a+Math.imul(ct,wt)|0,f=(f=f+Math.imul(ct,se)|0)+Math.imul(Tt,wt)|0,h=h+Math.imul(Tt,se)|0,a=a+Math.imul(pt,Et)|0,f=(f=f+Math.imul(pt,de)|0)+Math.imul(Ft,Et)|0,h=h+Math.imul(Ft,de)|0,a=a+Math.imul(at,Mt)|0,f=(f=f+Math.imul(at,K)|0)+Math.imul(Bt,Mt)|0,h=h+Math.imul(Bt,K)|0,a=a+Math.imul(F,V)|0,f=(f=f+Math.imul(F,U)|0)+Math.imul(q,V)|0,h=h+Math.imul(q,U)|0;var ie=(y+(a=a+Math.imul(b,et)|0)|0)+((8191&(f=(f=f+Math.imul(b,dt)|0)+Math.imul(D,et)|0))<<13)|0;y=((h=h+Math.imul(D,dt)|0)+(f>>>13)|0)+(ie>>>26)|0,ie&=67108863,a=Math.imul(Dt,X),f=(f=Math.imul(Dt,st))+Math.imul(Se,X)|0,h=Math.imul(Se,st),a=a+Math.imul(xt,$)|0,f=(f=f+Math.imul(xt,gt)|0)+Math.imul(Qt,$)|0,h=h+Math.imul(Qt,gt)|0,a=a+Math.imul(ot,mt)|0,f=(f=f+Math.imul(ot,vt)|0)+Math.imul(qt,mt)|0,h=h+Math.imul(qt,vt)|0,a=a+Math.imul(j,_t)|0,f=(f=f+Math.imul(j,Gt)|0)+Math.imul(rt,_t)|0,h=h+Math.imul(rt,Gt)|0,a=a+Math.imul(k,wt)|0,f=(f=f+Math.imul(k,se)|0)+Math.imul(T,wt)|0,h=h+Math.imul(T,se)|0,a=a+Math.imul(ct,Et)|0,f=(f=f+Math.imul(ct,de)|0)+Math.imul(Tt,Et)|0,h=h+Math.imul(Tt,de)|0,a=a+Math.imul(pt,Mt)|0,f=(f=f+Math.imul(pt,K)|0)+Math.imul(Ft,Mt)|0,h=h+Math.imul(Ft,K)|0,a=a+Math.imul(at,V)|0,f=(f=f+Math.imul(at,U)|0)+Math.imul(Bt,V)|0,h=h+Math.imul(Bt,U)|0;var ue=(y+(a=a+Math.imul(F,et)|0)|0)+((8191&(f=(f=f+Math.imul(F,dt)|0)+Math.imul(q,et)|0))<<13)|0;y=((h=h+Math.imul(q,dt)|0)+(f>>>13)|0)+(ue>>>26)|0,ue&=67108863,a=Math.imul(Dt,$),f=(f=Math.imul(Dt,gt))+Math.imul(Se,$)|0,h=Math.imul(Se,gt),a=a+Math.imul(xt,mt)|0,f=(f=f+Math.imul(xt,vt)|0)+Math.imul(Qt,mt)|0,h=h+Math.imul(Qt,vt)|0,a=a+Math.imul(ot,_t)|0,f=(f=f+Math.imul(ot,Gt)|0)+Math.imul(qt,_t)|0,h=h+Math.imul(qt,Gt)|0,a=a+Math.imul(j,wt)|0,f=(f=f+Math.imul(j,se)|0)+Math.imul(rt,wt)|0,h=h+Math.imul(rt,se)|0,a=a+Math.imul(k,Et)|0,f=(f=f+Math.imul(k,de)|0)+Math.imul(T,Et)|0,h=h+Math.imul(T,de)|0,a=a+Math.imul(ct,Mt)|0,f=(f=f+Math.imul(ct,K)|0)+Math.imul(Tt,Mt)|0,h=h+Math.imul(Tt,K)|0,a=a+Math.imul(pt,V)|0,f=(f=f+Math.imul(pt,U)|0)+Math.imul(Ft,V)|0,h=h+Math.imul(Ft,U)|0;var fe=(y+(a=a+Math.imul(at,et)|0)|0)+((8191&(f=(f=f+Math.imul(at,dt)|0)+Math.imul(Bt,et)|0))<<13)|0;y=((h=h+Math.imul(Bt,dt)|0)+(f>>>13)|0)+(fe>>>26)|0,fe&=67108863,a=Math.imul(Dt,mt),f=(f=Math.imul(Dt,vt))+Math.imul(Se,mt)|0,h=Math.imul(Se,vt),a=a+Math.imul(xt,_t)|0,f=(f=f+Math.imul(xt,Gt)|0)+Math.imul(Qt,_t)|0,h=h+Math.imul(Qt,Gt)|0,a=a+Math.imul(ot,wt)|0,f=(f=f+Math.imul(ot,se)|0)+Math.imul(qt,wt)|0,h=h+Math.imul(qt,se)|0,a=a+Math.imul(j,Et)|0,f=(f=f+Math.imul(j,de)|0)+Math.imul(rt,Et)|0,h=h+Math.imul(rt,de)|0,a=a+Math.imul(k,Mt)|0,f=(f=f+Math.imul(k,K)|0)+Math.imul(T,Mt)|0,h=h+Math.imul(T,K)|0,a=a+Math.imul(ct,V)|0,f=(f=f+Math.imul(ct,U)|0)+Math.imul(Tt,V)|0,h=h+Math.imul(Tt,U)|0;var ce=(y+(a=a+Math.imul(pt,et)|0)|0)+((8191&(f=(f=f+Math.imul(pt,dt)|0)+Math.imul(Ft,et)|0))<<13)|0;y=((h=h+Math.imul(Ft,dt)|0)+(f>>>13)|0)+(ce>>>26)|0,ce&=67108863,a=Math.imul(Dt,_t),f=(f=Math.imul(Dt,Gt))+Math.imul(Se,_t)|0,h=Math.imul(Se,Gt),a=a+Math.imul(xt,wt)|0,f=(f=f+Math.imul(xt,se)|0)+Math.imul(Qt,wt)|0,h=h+Math.imul(Qt,se)|0,a=a+Math.imul(ot,Et)|0,f=(f=f+Math.imul(ot,de)|0)+Math.imul(qt,Et)|0,h=h+Math.imul(qt,de)|0,a=a+Math.imul(j,Mt)|0,f=(f=f+Math.imul(j,K)|0)+Math.imul(rt,Mt)|0,h=h+Math.imul(rt,K)|0,a=a+Math.imul(k,V)|0,f=(f=f+Math.imul(k,U)|0)+Math.imul(T,V)|0,h=h+Math.imul(T,U)|0;var Kt=(y+(a=a+Math.imul(ct,et)|0)|0)+((8191&(f=(f=f+Math.imul(ct,dt)|0)+Math.imul(Tt,et)|0))<<13)|0;y=((h=h+Math.imul(Tt,dt)|0)+(f>>>13)|0)+(Kt>>>26)|0,Kt&=67108863,a=Math.imul(Dt,wt),f=(f=Math.imul(Dt,se))+Math.imul(Se,wt)|0,h=Math.imul(Se,se),a=a+Math.imul(xt,Et)|0,f=(f=f+Math.imul(xt,de)|0)+Math.imul(Qt,Et)|0,h=h+Math.imul(Qt,de)|0,a=a+Math.imul(ot,Mt)|0,f=(f=f+Math.imul(ot,K)|0)+Math.imul(qt,Mt)|0,h=h+Math.imul(qt,K)|0,a=a+Math.imul(j,V)|0,f=(f=f+Math.imul(j,U)|0)+Math.imul(rt,V)|0,h=h+Math.imul(rt,U)|0;var oe=(y+(a=a+Math.imul(k,et)|0)|0)+((8191&(f=(f=f+Math.imul(k,dt)|0)+Math.imul(T,et)|0))<<13)|0;y=((h=h+Math.imul(T,dt)|0)+(f>>>13)|0)+(oe>>>26)|0,oe&=67108863,a=Math.imul(Dt,Et),f=(f=Math.imul(Dt,de))+Math.imul(Se,Et)|0,h=Math.imul(Se,de),a=a+Math.imul(xt,Mt)|0,f=(f=f+Math.imul(xt,K)|0)+Math.imul(Qt,Mt)|0,h=h+Math.imul(Qt,K)|0,a=a+Math.imul(ot,V)|0,f=(f=f+Math.imul(ot,U)|0)+Math.imul(qt,V)|0,h=h+Math.imul(qt,U)|0;var Jt=(y+(a=a+Math.imul(j,et)|0)|0)+((8191&(f=(f=f+Math.imul(j,dt)|0)+Math.imul(rt,et)|0))<<13)|0;y=((h=h+Math.imul(rt,dt)|0)+(f>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,a=Math.imul(Dt,Mt),f=(f=Math.imul(Dt,K))+Math.imul(Se,Mt)|0,h=Math.imul(Se,K),a=a+Math.imul(xt,V)|0,f=(f=f+Math.imul(xt,U)|0)+Math.imul(Qt,V)|0,h=h+Math.imul(Qt,U)|0;var le=(y+(a=a+Math.imul(ot,et)|0)|0)+((8191&(f=(f=f+Math.imul(ot,dt)|0)+Math.imul(qt,et)|0))<<13)|0;y=((h=h+Math.imul(qt,dt)|0)+(f>>>13)|0)+(le>>>26)|0,le&=67108863,a=Math.imul(Dt,V),f=(f=Math.imul(Dt,U))+Math.imul(Se,V)|0,h=Math.imul(Se,U);var ae=(y+(a=a+Math.imul(xt,et)|0)|0)+((8191&(f=(f=f+Math.imul(xt,dt)|0)+Math.imul(Qt,et)|0))<<13)|0;y=((h=h+Math.imul(Qt,dt)|0)+(f>>>13)|0)+(ae>>>26)|0,ae&=67108863;var ne=(y+(a=Math.imul(Dt,et))|0)+((8191&(f=(f=Math.imul(Dt,dt))+Math.imul(Se,et)|0))<<13)|0;return y=((h=Math.imul(Se,dt))+(f>>>13)|0)+(ne>>>26)|0,ne&=67108863,I[0]=ut,I[1]=ht,I[2]=zt,I[3]=Wt,I[4]=ye,I[5]=Yt,I[6]=pe,I[7]=ve,I[8]=ge,I[9]=ie,I[10]=ue,I[11]=fe,I[12]=ce,I[13]=Kt,I[14]=oe,I[15]=Jt,I[16]=le,I[17]=ae,I[18]=ne,y!==0&&(I[19]=y,o.length++),o};function B(M,d,o){o.negative=d.negative^M.negative,o.length=M.length+d.length;for(var a=0,f=0,h=0;h>>26)|0)>>>26,g&=67108863}o.words[h]=S,a=g,g=f}return a!==0?o.words[h]=a:o.length--,o._strip()}function P(M,d,o){return B(M,d,o)}Math.imul||(A=x),s.prototype.mulTo=function(M,d){var o=this.length+M.length;return this.length===10&&M.length===10?A(this,M,d):o<63?x(this,M,d):o<1024?B(this,M,d):P(this,M,d)},s.prototype.mul=function(M){var d=new s(null);return d.words=new Array(this.length+M.length),this.mulTo(M,d)},s.prototype.mulf=function(M){var d=new s(null);return d.words=new Array(this.length+M.length),P(this,M,d)},s.prototype.imul=function(M){return this.clone().mulTo(M,this)},s.prototype.imuln=function(M){var d=M<0;d&&(M=-M),e(typeof M=="number"),e(M<67108864);for(var o=0,a=0;a>=26,o+=f/67108864|0,o+=h>>>26,this.words[a]=67108863&h}return o!==0&&(this.words[a]=o,this.length++),d?this.ineg():this},s.prototype.muln=function(M){return this.clone().imuln(M)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(M){var d=function(h){for(var g=new Array(h.bitLength()),S=0;S>>y&1}return g}(M);if(d.length===0)return new s(1);for(var o=this,a=0;a=0);var d,o=M%26,a=(M-o)/26,f=67108863>>>26-o<<26-o;if(o!==0){var h=0;for(d=0;d>>26-o}h&&(this.words[d]=h,this.length++)}if(a!==0){for(d=this.length-1;d>=0;d--)this.words[d+a]=this.words[d];for(d=0;d=0),a=d?(d-d%26)/26:0;var f=M%26,h=Math.min((M-f)/26,this.length),g=67108863^67108863>>>f<h)for(this.length-=h,I=0;I=0&&(y!==0||I>=a);I--){var u=0|this.words[I];this.words[I]=y<<26-f|u>>>f,y=u&g}return S&&y!==0&&(S.words[S.length++]=y),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(M,d,o){return e(this.negative===0),this.iushrn(M,d,o)},s.prototype.shln=function(M){return this.clone().ishln(M)},s.prototype.ushln=function(M){return this.clone().iushln(M)},s.prototype.shrn=function(M){return this.clone().ishrn(M)},s.prototype.ushrn=function(M){return this.clone().iushrn(M)},s.prototype.testn=function(M){e(typeof M=="number"&&M>=0);var d=M%26,o=(M-d)/26,a=1<=0);var d=M%26,o=(M-d)/26;if(e(this.negative===0,"imaskn works only with positive numbers"),this.length<=o)return this;if(d!==0&&o++,this.length=Math.min(o,this.length),d!==0){var a=67108863^67108863>>>d<=67108864;d++)this.words[d]-=67108864,d===this.length-1?this.words[d+1]=1:this.words[d+1]++;return this.length=Math.max(this.length,d+1),this},s.prototype.isubn=function(M){if(e(typeof M=="number"),e(M<67108864),M<0)return this.iaddn(-M);if(this.negative!==0)return this.negative=0,this.iaddn(M),this.negative=1,this;if(this.words[0]-=M,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var d=0;d>26)-(S/67108864|0),this.words[a+o]=67108863&f}for(;a>26,this.words[a+o]=67108863&f;if(g===0)return this._strip();for(e(g===-1),g=0,a=0;a>26,this.words[a]=67108863&f;return this.negative=1,this._strip()},s.prototype._wordDiv=function(M,d){var o=(this.length,M.length),a=this.clone(),f=M,h=0|f.words[f.length-1];(o=26-this._countBits(h))!=0&&(f=f.ushln(o),a.iushln(o),h=0|f.words[f.length-1]);var g,S=a.length-f.length;if(d!=="mod"){(g=new s(null)).length=S+1,g.words=new Array(g.length);for(var I=0;I=0;u--){var b=67108864*(0|a.words[f.length+u])+(0|a.words[f.length+u-1]);for(b=Math.min(b/h|0,67108863),a._ishlnsubmul(f,b,u);a.negative!==0;)b--,a.negative=0,a._ishlnsubmul(f,1,u),a.isZero()||(a.negative^=1);g&&(g.words[u]=b)}return g&&g._strip(),a._strip(),d!=="div"&&o!==0&&a.iushrn(o),{div:g||null,mod:a}},s.prototype.divmod=function(M,d,o){return e(!M.isZero()),this.isZero()?{div:new s(0),mod:new s(0)}:this.negative!==0&&M.negative===0?(h=this.neg().divmod(M,d),d!=="mod"&&(a=h.div.neg()),d!=="div"&&(f=h.mod.neg(),o&&f.negative!==0&&f.iadd(M)),{div:a,mod:f}):this.negative===0&&M.negative!==0?(h=this.divmod(M.neg(),d),d!=="mod"&&(a=h.div.neg()),{div:a,mod:h.mod}):this.negative&M.negative?(h=this.neg().divmod(M.neg(),d),d!=="div"&&(f=h.mod.neg(),o&&f.negative!==0&&f.isub(M)),{div:h.div,mod:f}):M.length>this.length||this.cmp(M)<0?{div:new s(0),mod:this}:M.length===1?d==="div"?{div:this.divn(M.words[0]),mod:null}:d==="mod"?{div:null,mod:new s(this.modrn(M.words[0]))}:{div:this.divn(M.words[0]),mod:new s(this.modrn(M.words[0]))}:this._wordDiv(M,d);var a,f,h},s.prototype.div=function(M){return this.divmod(M,"div",!1).div},s.prototype.mod=function(M){return this.divmod(M,"mod",!1).mod},s.prototype.umod=function(M){return this.divmod(M,"mod",!0).mod},s.prototype.divRound=function(M){var d=this.divmod(M);if(d.mod.isZero())return d.div;var o=d.div.negative!==0?d.mod.isub(M):d.mod,a=M.ushrn(1),f=M.andln(1),h=o.cmp(a);return h<0||f===1&&h===0?d.div:d.div.negative!==0?d.div.isubn(1):d.div.iaddn(1)},s.prototype.modrn=function(M){var d=M<0;d&&(M=-M),e(M<=67108863);for(var o=(1<<26)%M,a=0,f=this.length-1;f>=0;f--)a=(o*a+(0|this.words[f]))%M;return d?-a:a},s.prototype.modn=function(M){return this.modrn(M)},s.prototype.idivn=function(M){var d=M<0;d&&(M=-M),e(M<=67108863);for(var o=0,a=this.length-1;a>=0;a--){var f=(0|this.words[a])+67108864*o;this.words[a]=f/M|0,o=f%M}return this._strip(),d?this.ineg():this},s.prototype.divn=function(M){return this.clone().idivn(M)},s.prototype.egcd=function(M){e(M.negative===0),e(!M.isZero());var d=this,o=M.clone();d=d.negative!==0?d.umod(M):d.clone();for(var a=new s(1),f=new s(0),h=new s(0),g=new s(1),S=0;d.isEven()&&o.isEven();)d.iushrn(1),o.iushrn(1),++S;for(var I=o.clone(),y=d.clone();!d.isZero();){for(var u=0,b=1;!(d.words[0]&b)&&u<26;++u,b<<=1);if(u>0)for(d.iushrn(u);u-- >0;)(a.isOdd()||f.isOdd())&&(a.iadd(I),f.isub(y)),a.iushrn(1),f.iushrn(1);for(var D=0,Z=1;!(o.words[0]&Z)&&D<26;++D,Z<<=1);if(D>0)for(o.iushrn(D);D-- >0;)(h.isOdd()||g.isOdd())&&(h.iadd(I),g.isub(y)),h.iushrn(1),g.iushrn(1);d.cmp(o)>=0?(d.isub(o),a.isub(h),f.isub(g)):(o.isub(d),h.isub(a),g.isub(f))}return{a:h,b:g,gcd:o.iushln(S)}},s.prototype._invmp=function(M){e(M.negative===0),e(!M.isZero());var d=this,o=M.clone();d=d.negative!==0?d.umod(M):d.clone();for(var a,f=new s(1),h=new s(0),g=o.clone();d.cmpn(1)>0&&o.cmpn(1)>0;){for(var S=0,I=1;!(d.words[0]&I)&&S<26;++S,I<<=1);if(S>0)for(d.iushrn(S);S-- >0;)f.isOdd()&&f.iadd(g),f.iushrn(1);for(var y=0,u=1;!(o.words[0]&u)&&y<26;++y,u<<=1);if(y>0)for(o.iushrn(y);y-- >0;)h.isOdd()&&h.iadd(g),h.iushrn(1);d.cmp(o)>=0?(d.isub(o),f.isub(h)):(o.isub(d),h.isub(f))}return(a=d.cmpn(1)===0?f:h).cmpn(0)<0&&a.iadd(M),a},s.prototype.gcd=function(M){if(this.isZero())return M.abs();if(M.isZero())return this.abs();var d=this.clone(),o=M.clone();d.negative=0,o.negative=0;for(var a=0;d.isEven()&&o.isEven();a++)d.iushrn(1),o.iushrn(1);for(;;){for(;d.isEven();)d.iushrn(1);for(;o.isEven();)o.iushrn(1);var f=d.cmp(o);if(f<0){var h=d;d=o,o=h}else if(f===0||o.cmpn(1)===0)break;d.isub(o)}return o.iushln(a)},s.prototype.invm=function(M){return this.egcd(M).a.umod(M)},s.prototype.isEven=function(){return(1&this.words[0])==0},s.prototype.isOdd=function(){return(1&this.words[0])==1},s.prototype.andln=function(M){return this.words[0]&M},s.prototype.bincn=function(M){e(typeof M=="number");var d=M%26,o=(M-d)/26,a=1<>>26,g&=67108863,this.words[h]=g}return f!==0&&(this.words[h]=f,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(M){var d,o=M<0;if(this.negative!==0&&!o)return-1;if(this.negative===0&&o)return 1;if(this._strip(),this.length>1)d=1;else{o&&(M=-M),e(M<=67108863,"Number is too big");var a=0|this.words[0];d=a===M?0:aM.length)return 1;if(this.length=0;o--){var a=0|this.words[o],f=0|M.words[o];if(a!==f){af&&(d=1);break}}return d},s.prototype.gtn=function(M){return this.cmpn(M)===1},s.prototype.gt=function(M){return this.cmp(M)===1},s.prototype.gten=function(M){return this.cmpn(M)>=0},s.prototype.gte=function(M){return this.cmp(M)>=0},s.prototype.ltn=function(M){return this.cmpn(M)===-1},s.prototype.lt=function(M){return this.cmp(M)===-1},s.prototype.lten=function(M){return this.cmpn(M)<=0},s.prototype.lte=function(M){return this.cmp(M)<=0},s.prototype.eqn=function(M){return this.cmpn(M)===0},s.prototype.eq=function(M){return this.cmp(M)===0},s.red=function(M){return new nt(M)},s.prototype.toRed=function(M){return e(!this.red,"Already a number in reduction context"),e(this.negative===0,"red works only with positives"),M.convertTo(this)._forceRed(M)},s.prototype.fromRed=function(){return e(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(M){return this.red=M,this},s.prototype.forceRed=function(M){return e(!this.red,"Already a number in reduction context"),this._forceRed(M)},s.prototype.redAdd=function(M){return e(this.red,"redAdd works only with red numbers"),this.red.add(this,M)},s.prototype.redIAdd=function(M){return e(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,M)},s.prototype.redSub=function(M){return e(this.red,"redSub works only with red numbers"),this.red.sub(this,M)},s.prototype.redISub=function(M){return e(this.red,"redISub works only with red numbers"),this.red.isub(this,M)},s.prototype.redShl=function(M){return e(this.red,"redShl works only with red numbers"),this.red.shl(this,M)},s.prototype.redMul=function(M){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,M),this.red.mul(this,M)},s.prototype.redIMul=function(M){return e(this.red,"redMul works only with red numbers"),this.red._verify2(this,M),this.red.imul(this,M)},s.prototype.redSqr=function(){return e(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return e(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return e(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return e(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return e(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(M){return e(this.red&&!M.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,M)};var R={k256:null,p224:null,p192:null,p25519:null};function C(M,d){this.name=M,this.p=new s(d,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function O(){C.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function z(){C.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function H(){C.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function tt(){C.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function nt(M){if(typeof M=="string"){var d=s._prime(M);this.m=d.p,this.prime=d}else e(M.gtn(1),"modulus must be greater than 1"),this.m=M,this.prime=null}function G(M){nt.call(this,M),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(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)}C.prototype._tmp=function(){var M=new s(null);return M.words=new Array(Math.ceil(this.n/13)),M},C.prototype.ireduce=function(M){var d,o=M;do this.split(o,this.tmp),d=(o=(o=this.imulK(o)).iadd(this.tmp)).bitLength();while(d>this.n);var a=d0?o.isub(this.p):o.strip!==void 0?o.strip():o._strip(),o},C.prototype.split=function(M,d){M.iushrn(this.n,0,d)},C.prototype.imulK=function(M){return M.imul(this.k)},n(O,C),O.prototype.split=function(M,d){for(var o=4194303,a=Math.min(M.length,9),f=0;f>>22,h=g}h>>>=22,M.words[f-10]=h,h===0&&M.length>10?M.length-=10:M.length-=9},O.prototype.imulK=function(M){M.words[M.length]=0,M.words[M.length+1]=0,M.length+=2;for(var d=0,o=0;o>>=26,M.words[o]=f,d=a}return d!==0&&(M.words[M.length++]=d),M},s._prime=function(M){if(R[M])return R[M];var d;if(M==="k256")d=new O;else if(M==="p224")d=new z;else if(M==="p192")d=new H;else{if(M!=="p25519")throw new Error("Unknown prime "+M);d=new tt}return R[M]=d,d},nt.prototype._verify1=function(M){e(M.negative===0,"red works only with positives"),e(M.red,"red works only with red numbers")},nt.prototype._verify2=function(M,d){e((M.negative|d.negative)==0,"red works only with positives"),e(M.red&&M.red===d.red,"red works only with red numbers")},nt.prototype.imod=function(M){return this.prime?this.prime.ireduce(M)._forceRed(this):(m(M,M.umod(this.m)._forceRed(this)),M)},nt.prototype.neg=function(M){return M.isZero()?M.clone():this.m.sub(M)._forceRed(this)},nt.prototype.add=function(M,d){this._verify2(M,d);var o=M.add(d);return o.cmp(this.m)>=0&&o.isub(this.m),o._forceRed(this)},nt.prototype.iadd=function(M,d){this._verify2(M,d);var o=M.iadd(d);return o.cmp(this.m)>=0&&o.isub(this.m),o},nt.prototype.sub=function(M,d){this._verify2(M,d);var o=M.sub(d);return o.cmpn(0)<0&&o.iadd(this.m),o._forceRed(this)},nt.prototype.isub=function(M,d){this._verify2(M,d);var o=M.isub(d);return o.cmpn(0)<0&&o.iadd(this.m),o},nt.prototype.shl=function(M,d){return this._verify1(M),this.imod(M.ushln(d))},nt.prototype.imul=function(M,d){return this._verify2(M,d),this.imod(M.imul(d))},nt.prototype.mul=function(M,d){return this._verify2(M,d),this.imod(M.mul(d))},nt.prototype.isqr=function(M){return this.imul(M,M.clone())},nt.prototype.sqr=function(M){return this.mul(M,M)},nt.prototype.sqrt=function(M){if(M.isZero())return M.clone();var d=this.m.andln(3);if(e(d%2==1),d===3){var o=this.m.add(new s(1)).iushrn(2);return this.pow(M,o)}for(var a=this.m.subn(1),f=0;!a.isZero()&&a.andln(1)===0;)f++,a.iushrn(1);e(!a.isZero());var h=new s(1).toRed(this),g=h.redNeg(),S=this.m.subn(1).iushrn(1),I=this.m.bitLength();for(I=new s(2*I*I).toRed(this);this.pow(I,S).cmp(g)!==0;)I.redIAdd(g);for(var y=this.pow(I,a),u=this.pow(M,a.addn(1).iushrn(1)),b=this.pow(M,a),D=f;b.cmp(h)!==0;){for(var Z=b,F=0;Z.cmp(h)!==0;F++)Z=Z.redSqr();e(F=0;a--){for(var I=d.words[a],y=S-1;y>=0;y--){var u=I>>y&1;f!==o[0]&&(f=this.sqr(f)),u!==0||h!==0?(h<<=1,h|=u,(++g==4||a===0&&y===0)&&(f=this.mul(f,o[h]),g=0,h=0)):g=0}S=26}return f},nt.prototype.convertTo=function(M){var d=M.umod(this.m);return d===M?d.clone():d},nt.prototype.convertFrom=function(M){var d=M.clone();return d.red=null,d},s.mont=function(M){return new G(M)},n(G,nt),G.prototype.convertTo=function(M){return this.imod(M.ushln(this.shift))},G.prototype.convertFrom=function(M){var d=this.imod(M.mul(this.rinv));return d.red=null,d},G.prototype.imul=function(M,d){if(M.isZero()||d.isZero())return M.words[0]=0,M.length=1,M;var o=M.imul(d),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=o.isub(a).iushrn(this.shift),h=f;return f.cmp(this.m)>=0?h=f.isub(this.m):f.cmpn(0)<0&&(h=f.iadd(this.m)),h._forceRed(this)},G.prototype.mul=function(M,d){if(M.isZero()||d.isZero())return new s(0)._forceRed(this);var o=M.mul(d),a=o.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),f=o.isub(a).iushrn(this.shift),h=f;return f.cmp(this.m)>=0?h=f.isub(this.m):f.cmpn(0)<0&&(h=f.iadd(this.m)),h._forceRed(this)},G.prototype.invm=function(M){return this.imod(M._invmp(this.m).mul(this.r2))._forceRed(this)}})(0,ho);var US=Cv.exports,Z8=ES(US),Tv={exports:{}};(function(r,t){var e=Vr,n=e.Buffer;function s(c,l){for(var p in c)l[p]=c[p]}function i(c,l,p){return n(c,l,p)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?r.exports=e:(s(e,t),t.Buffer=i),i.prototype=Object.create(n.prototype),s(n,i),i.from=function(c,l,p){if(typeof c=="number")throw new TypeError("Argument must not be a number");return n(c,l,p)},i.alloc=function(c,l,p){if(typeof c!="number")throw new TypeError("Argument must be a number");var m=n(c);return l!==void 0?typeof p=="string"?m.fill(l,p):m.fill(l):m.fill(0),m},i.allocUnsafe=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return n(c)},i.allocUnsafeSlow=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return e.SlowBuffer(c)}})(Tv,Tv.exports);var B0=Tv.exports.Buffer,NS=function(r){if(r.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),e=0;e>>0,B=new Uint8Array(A);_[E];){var P=t[_.charCodeAt(E)];if(P===255)return;for(var R=0,C=A-1;(P!==0||R>>0,B[C]=P%256>>>0,P=P/256>>>0;if(P!==0)throw new Error("Non-zero carry");x=R,E++}for(var O=A-x;O!==A&&B[O]===0;)O++;var z=B0.allocUnsafe(w+(A-O));z.fill(0,0,w);for(var H=w;O!==A;)z[H++]=B[O++];return z}return{encode:function(_){if((Array.isArray(_)||_ instanceof Uint8Array)&&(_=B0.from(_)),!B0.isBuffer(_))throw new TypeError("Expected Buffer");if(_.length===0)return"";for(var E=0,w=0,x=0,A=_.length;x!==A&&_[x]===0;)x++,E++;for(var B=(A-x)*m+1>>>0,P=new Uint8Array(B);x!==A;){for(var R=_[x],C=0,O=B-1;(R!==0||C>>0,P[O]=R%c>>>0,R=R/c>>>0;if(R!==0)throw new Error("Non-zero carry");w=C,x++}for(var z=B-w;z!==B&&P[z]===0;)z++;for(var H=l.repeat(E);zr&t^r&e^t&e,oV=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]),qs=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Fs=new Uint32Array(64);class sV extends PS{constructor(){super(64,32,8,!1),this.A=0|qs[0],this.B=0|qs[1],this.C=0|qs[2],this.D=0|qs[3],this.E=0|qs[4],this.F=0|qs[5],this.G=0|qs[6],this.H=0|qs[7]}get(){const{A:t,B:e,C:n,D:s,E:i,F:c,G:l,H:p}=this;return[t,e,n,s,i,c,l,p]}set(t,e,n,s,i,c,l,p){this.A=0|t,this.B=0|e,this.C=0|n,this.D=0|s,this.E=0|i,this.F=0|c,this.G=0|l,this.H=0|p}process(t,e){for(let E=0;E<16;E++,e+=4)Fs[E]=t.getUint32(e,!1);for(let E=16;E<64;E++){const w=Fs[E-15],x=Fs[E-2],A=_o(w,7)^_o(w,18)^w>>>3,B=_o(x,17)^_o(x,19)^x>>>10;Fs[E]=B+Fs[E-7]+A+Fs[E-16]|0}let{A:n,B:s,C:i,D:c,E:l,F:p,G:m,H:v}=this;for(let E=0;E<64;E++){const w=v+(_o(l,6)^_o(l,11)^_o(l,25))+((_=l)&p^~_&m)+oV[E]+Fs[E]|0,x=(_o(n,2)^_o(n,13)^_o(n,22))+iV(n,s,i)|0;v=m,m=p,p=l,l=c+w|0,c=i,i=s,s=n,n=w+x|0}var _;n=n+this.A|0,s=s+this.B|0,i=i+this.C|0,c=c+this.D|0,l=l+this.E|0,p=p+this.F|0,m=m+this.G|0,v=v+this.H|0,this.set(n,s,i,c,l,p,m,v)}roundClean(){Fs.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Lv=IS(()=>new sV);var Tn={};function Ms(r,t,e){return t<=r&&r<=e}function Ol(r){if(r===void 0)return{};if(r===Object(r))return r;throw TypeError("Could not convert argument to dictionary")}function Ov(r){this.tokens=[].slice.call(r)}Ov.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(r){if(Array.isArray(r))for(var t=r;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(r)},push:function(r){if(Array.isArray(r))for(var t=r;t.length;)this.tokens.push(t.shift());else this.tokens.push(r)}};var Cu=-1;function _m(r,t){if(r)throw TypeError("Decoder error");return t||65533}var Ul="utf-8";function Nl(r,t){if(!(this instanceof Nl))return new Nl(r,t);if((r=r!==void 0?String(r).toLowerCase():Ul)!==Ul)throw new Error("Encoding not supported. Only utf-8 is supported");t=Ol(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function Dl(r,t){if(!(this instanceof Dl))return new Dl(r,t);if((r=r!==void 0?String(r).toLowerCase():Ul)!==Ul)throw new Error("Encoding not supported. Only utf-8 is supported");t=Ol(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}function aV(r){var t=r.fatal,e=0,n=0,s=0,i=128,c=191;this.handler=function(l,p){if(p===-1&&s!==0)return s=0,_m(t);if(p===-1)return Cu;if(s===0){if(Ms(p,0,127))return p;if(Ms(p,194,223))s=1,e=p-192;else if(Ms(p,224,239))p===224&&(i=160),p===237&&(c=159),s=2,e=p-224;else{if(!Ms(p,240,244))return _m(t);p===240&&(i=144),p===244&&(c=143),s=3,e=p-240}return e<<=6*s,null}if(!Ms(p,i,c))return e=s=n=0,i=128,c=191,l.prepend(p),_m(t);if(i=128,c=191,e+=p-128<<6*(s-(n+=1)),n!==s)return null;var m=e;return e=s=n=0,m}}function uV(r){r.fatal,this.handler=function(t,e){if(e===-1)return Cu;if(Ms(e,0,127))return e;var n,s;Ms(e,128,2047)?(n=1,s=192):Ms(e,2048,65535)?(n=2,s=224):Ms(e,65536,1114111)&&(n=3,s=240);for(var i=[(e>>6*n)+s];n>0;){var c=e>>6*(n-1);i.push(128|63&c),n-=1}return i}}Nl.prototype={decode:function(r,t){var e;e=typeof r=="object"&&r instanceof ArrayBuffer?new Uint8Array(r):typeof r=="object"&&"buffer"in r&&r.buffer instanceof ArrayBuffer?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):new Uint8Array(0),t=Ol(t),this._streaming||(this._decoder=new aV({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!t.stream;for(var n,s=new Ov(e),i=[];!s.endOfStream()&&(n=this._decoder.handler(s,s.read()))!==Cu;)n!==null&&(Array.isArray(n)?i.push.apply(i,n):i.push(n));if(!this._streaming){do{if((n=this._decoder.handler(s,s.read()))===Cu)break;n!==null&&(Array.isArray(n)?i.push.apply(i,n):i.push(n))}while(!s.endOfStream());this._decoder=null}return i.length&&(["utf-8"].indexOf(this.encoding)===-1||this._ignoreBOM||this._BOMseen||(i[0]===65279?(this._BOMseen=!0,i.shift()):this._BOMseen=!0)),function(c){for(var l="",p=0;p>10),56320+(1023&m)))}return l}(i)}},Dl.prototype={encode:function(r,t){r=r?String(r):"",t=Ol(t),this._streaming||(this._encoder=new uV(this._options)),this._streaming=!!t.stream;for(var e,n=[],s=new Ov(function(i){for(var c=String(i),l=c.length,p=0,m=[];p57343)m.push(v);else if(56320<=v&&v<=57343)m.push(65533);else if(55296<=v&&v<=56319)if(p===l-1)m.push(65533);else{var _=i.charCodeAt(p+1);if(56320<=_&&_<=57343){var E=1023&v,w=1023&_;m.push(65536+(E<<10)+w),p+=1}else m.push(65533)}p+=1}return m}(r));!s.endOfStream()&&(e=this._encoder.handler(s,s.read()))!==Cu;)Array.isArray(e)?n.push.apply(n,e):n.push(e);if(!this._streaming){for(;(e=this._encoder.handler(s,s.read()))!==Cu;)Array.isArray(e)?n.push.apply(n,e):n.push(e);this._encoder=null}return new Uint8Array(n)}};var fV=Wy(Object.freeze({__proto__:null,TextEncoder:Dl,TextDecoder:Nl})),cV=ho&&ho.__createBinding||(Object.create?function(r,t,e,n){n===void 0&&(n=e),Object.defineProperty(r,n,{enumerable:!0,get:function(){return t[e]}})}:function(r,t,e,n){n===void 0&&(n=e),r[n]=t[e]}),hV=ho&&ho.__setModuleDefault||(Object.create?function(r,t){Object.defineProperty(r,"default",{enumerable:!0,value:t})}:function(r,t){r.default=t}),Mo=ho&&ho.__decorate||function(r,t,e,n){var s,i=arguments.length,c=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,e):n;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")c=Reflect.decorate(r,t,e,n);else for(var l=r.length-1;l>=0;l--)(s=r[l])&&(c=(i<3?s(c):i>3?s(t,e,c):s(t,e))||c);return i>3&&c&&Object.defineProperty(t,e,c),c},lV=ho&&ho.__importStar||function(r){if(r&&r.__esModule)return r;var t={};if(r!=null)for(var e in r)e!=="default"&&Object.hasOwnProperty.call(r,e)&&cV(t,r,e);return hV(t,r),t},DS=ho&&ho.__importDefault||function(r){return r&&r.__esModule?r:{default:r}};Object.defineProperty(Tn,"__esModule",{value:!0});var zS=Tn.deserializeUnchecked=$S=Tn.deserialize=KS=Tn.serialize=Tn.BinaryReader=Tn.BinaryWriter=Tn.BorshError=Tn.baseDecode=Tn.baseEncode=void 0;const Zs=DS(US),G8=DS(NS),dV=lV(fV),pV=new(typeof TextDecoder!="function"?dV.TextDecoder:TextDecoder)("utf-8",{fatal:!0});Tn.baseEncode=function(r){return typeof r=="string"&&(r=Zt.Buffer.from(r,"utf8")),G8.default.encode(Zt.Buffer.from(r))},Tn.baseDecode=function(r){return Zt.Buffer.from(G8.default.decode(r))};const Mm=1024;class Qn extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}Tn.BorshError=Qn;class qS{constructor(){this.buf=Zt.Buffer.alloc(Mm),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Zt.Buffer.concat([this.buf,Zt.Buffer.alloc(Mm)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(Zt.Buffer.from(new Zs.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(Zt.Buffer.from(new Zs.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(Zt.Buffer.from(new Zs.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(Zt.Buffer.from(new Zs.default(t).toArray("le",64)))}writeBuffer(t){this.buf=Zt.Buffer.concat([Zt.Buffer.from(this.buf.subarray(0,this.length)),t,Zt.Buffer.alloc(Mm)]),this.length+=t.length}writeString(t){this.maybeResize();const e=Zt.Buffer.from(t,"utf8");this.writeU32(e.length),this.writeBuffer(e)}writeFixedArray(t){this.writeBuffer(Zt.Buffer.from(t))}writeArray(t,e){this.maybeResize(),this.writeU32(t.length);for(const n of t)this.maybeResize(),e(n)}toArray(){return this.buf.subarray(0,this.length)}}function Eo(r,t,e){const n=e.value;e.value=function(...s){try{return n.apply(this,s)}catch(i){if(i instanceof RangeError){const c=i.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(c)>=0)throw new Qn("Reached the end of buffer when deserializing")}throw i}}}Tn.BinaryWriter=qS;class yi{constructor(t){this.buf=t,this.offset=0}readU8(){const t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){const t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){const t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){const t=this.readBuffer(8);return new Zs.default(t,"le")}readU128(){const t=this.readBuffer(16);return new Zs.default(t,"le")}readU256(){const t=this.readBuffer(32);return new Zs.default(t,"le")}readU512(){const t=this.readBuffer(64);return new Zs.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new Qn(`Expected buffer length ${t} isn't within bounds`);const e=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,e}readString(){const t=this.readU32(),e=this.readBuffer(t);try{return pV.decode(e)}catch(n){throw new Qn(`Error decoding UTF-8 string: ${n}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){const e=this.readU32(),n=Array();for(let s=0;s{Sa(r,t,i,n[0],s)});else if(n.kind!==void 0)switch(n.kind){case"option":e==null?s.writeU8(0):(s.writeU8(1),Sa(r,t,e,n.type,s));break;case"map":s.writeU32(e.size),e.forEach((i,c)=>{Sa(r,t,c,n.key,s),Sa(r,t,i,n.value,s)});break;default:throw new Qn(`FieldType ${n} unrecognized`)}else jS(r,e,s)}catch(i){throw i instanceof Qn&&i.addToFieldPath(t),i}}function jS(r,t,e){if(typeof t.borshSerialize=="function")return void t.borshSerialize(e);const n=r.get(t.constructor);if(!n)throw new Qn(`Class ${t.constructor.name} is missing in schema`);if(n.kind==="struct")n.fields.map(([s,i])=>{Sa(r,s,t[s],i,e)});else{if(n.kind!=="enum")throw new Qn(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`);{const s=t[n.field];for(let i=0;ika(r,t,e[0],n))}if(e.kind==="option")return n.readU8()?ka(r,t,e.type,n):void 0;if(e.kind==="map"){let s=new Map;const i=n.readU32();for(let c=0;c=n.values.length)throw new Qn(`Enum index: ${s} is out of range`);const[i,c]=n.values[s];return new t({[i]:ka(r,i,c,e)})}throw new Qn(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`)}var $S=Tn.deserialize=function(r,t,e,n=yi){const s=new n(e),i=Jy(r,t,s);if(s.offsetthis.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const e=Object.create(this.constructor.prototype);return Object.assign(e,this),e.property=t,e}fromArray(t){}}function tb(r,t){return t.property?r+"["+t.property+"]":r}Vt.Layout=Lr,Vt.nameWithProperty=tb,Vt.bindConstructorLayout=function(r,t){if(typeof r!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(r,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof Lr))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");r.layout_=t,t.boundConstructor_=r,t.makeDestinationObject=()=>new r,Object.defineProperty(r.prototype,"encode",{value(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(r,"decode",{value:(e,n)=>t.decode(e,n),writable:!0})};class ii extends Lr{isCount(){throw new Error("ExternalLayout is abstract")}}Vt.ExternalLayout=ii;class HS extends ii{constructor(t=1,e){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,e),this.elementSpan=t}isCount(){return!0}decode(t,e=0){Nf(t);const n=t.length-e;return Math.floor(n/this.elementSpan)}encode(t,e,n){return 0}}Vt.GreedyCount=HS;class eb extends ii{constructor(t,e=0,n){if(!(t instanceof Lr))throw new TypeError("layout must be a Layout");if(!Number.isInteger(e))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=e}isCount(){return this.layout instanceof Ki||this.layout instanceof ao}decode(t,e=0){return this.layout.decode(t,e+this.offset)}encode(t,e,n=0){return this.layout.encode(t,e,n+this.offset)}}Vt.OffsetLayout=eb;class Ki extends Lr{constructor(t,e){if(super(t,e),6c+s.encode(l,e,n+c),0);return this.count instanceof ii&&this.count.encode(t.length,e,n),i}}Vt.Sequence=tk;class ek extends Lr{constructor(t,e,n){if(!Array.isArray(t)||!t.reduce((i,c)=>i&&c instanceof Lr,!0))throw new TypeError("fields must be array of Layout instances");typeof e=="boolean"&&n===void 0&&(n=e,e=void 0);for(const i of t)if(0>i.span&&i.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let s=-1;try{s=t.reduce((i,c)=>i+c.getSpan(),0)}catch{}super(s,e),this.fields=t,this.decodePrefixes=!!n}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce((s,i)=>{const c=i.getSpan(t,e);return e+=c,s+c},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,e=0){Nf(t);const n=this.makeDestinationObject();for(const s of this.fields)if(s.property!==void 0&&(n[s.property]=s.decode(t,e)),e+=s.getSpan(t,e),this.decodePrefixes&&t.length===e)break;return n}encode(t,e,n=0){const s=n;let i=0,c=0;for(const l of this.fields){let p=l.span;if(c=0p&&(p=l.getSpan(e,n)))}i=n,n+=p}return i+c-s}fromArray(t){const e=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?e=-1:0<=e&&(e+=n.span)}}}Vt.Structure=ek;class rb{constructor(t){this.property=t}decode(t,e){throw new Error("UnionDiscriminator is abstract")}encode(t,e,n){throw new Error("UnionDiscriminator is abstract")}}Vt.UnionDiscriminator=rb;class zl extends rb{constructor(t,e){if(!(t instanceof ii&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(e||t.property||"variant"),this.layout=t}decode(t,e){return this.layout.decode(t,e)}encode(t,e,n){return this.layout.encode(t,e,n)}}Vt.UnionLayoutDiscriminator=zl;class nb extends Lr{constructor(t,e,n){let s;if(t instanceof Ki||t instanceof ao)s=new zl(new eb(t));else if(t instanceof ii&&t.isCount())s=new zl(t);else{if(!(t instanceof rb))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");s=t}if(e===void 0&&(e=null),!(e===null||e instanceof Lr))throw new TypeError("defaultLayout must be null or a Layout");if(e!==null){if(0>e.span)throw new Error("defaultLayout must have constant span");e.property===void 0&&(e=e.replicate("content"))}let i=-1;e&&(i=e.span,0<=i&&(t instanceof Ki||t instanceof ao)&&(i+=s.layout.span)),super(i,n),this.discriminator=s,this.usesPrefixDiscriminator=t instanceof Ki||t instanceof ao,this.defaultLayout=e,this.registry={};let c=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(l){return c(l)},this.configGetSourceVariant=function(l){c=l.bind(this)}}getSpan(t,e=0){if(0<=this.span)return this.span;const n=this.getVariant(t,e);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,e)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const e=this.registry[t[this.discriminator.property]];if(e&&(!e.layout||e.property&&Object.prototype.hasOwnProperty.call(t,e.property)))return e}else for(const e in this.registry){const n=this.registry[e];if(n.property&&Object.prototype.hasOwnProperty.call(t,n.property))return n}throw new Error("unable to infer src variant")}decode(t,e=0){let n;const s=this.discriminator,i=s.decode(t,e),c=this.registry[i];if(c===void 0){const l=this.defaultLayout;let p=0;this.usesPrefixDiscriminator&&(p=s.layout.span),n=this.makeDestinationObject(),n[s.property]=i,n[l.property]=l.decode(t,e+p)}else n=c.decode(t,e);return n}encode(t,e,n=0){const s=this.getSourceVariant(t);if(s===void 0){const i=this.discriminator,c=this.defaultLayout;let l=0;return this.usesPrefixDiscriminator&&(l=i.layout.span),i.encode(t[i.property],e,n),l+c.encode(t[c.property],e,n+l)}return s.encode(t,e,n)}addVariant(t,e,n){const s=new rk(this,t,e,n);return this.registry[t]=s,s}getVariant(t,e=0){let n;return n=t instanceof Uint8Array?this.discriminator.decode(t,e):t,this.registry[n]}}Vt.Union=nb;class rk extends Lr{constructor(t,e,n,s){if(!(t instanceof nb))throw new TypeError("union must be a Union");if(!Number.isInteger(e)||0>e)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&s===void 0&&(s=n,n=null),n){if(!(n instanceof Lr))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof s!="string")throw new TypeError("variant must have a String property")}let i=t.span;0>t.span&&(i=n?n.span:0,0<=i&&t.usesPrefixDiscriminator&&(i+=t.discriminator.layout.span)),super(i,s),this.union=t,this.variant=e,this.layout=n||null}getSpan(t,e=0){if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let s=0;return this.layout&&(s=this.layout.getSpan(t,e+n)),n+s}decode(t,e=0){const n=this.makeDestinationObject();if(this!==this.union.getVariant(t,e))throw new Error("variant mismatch");let s=0;return this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,e+s):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,e,n=0){let s=0;if(this.union.usesPrefixDiscriminator&&(s=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,e,n);let i=s;if(this.layout&&(this.layout.encode(t[this.property],e,n+s),i+=this.layout.getSpan(e,n+s),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}function Pu(r){return 0>r&&(r+=4294967296),r}Vt.VariantLayout=rk;class ib extends Lr{constructor(t,e,n){if(!(t instanceof Ki||t instanceof ao))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof e=="string"&&n===void 0&&(n=e,e=!1),4=e)throw new TypeError("bits must be positive integer");const s=8*t.span,i=t.fields.reduce((c,l)=>c+l.bits,0);if(e+i>s)throw new Error("bits too long for span remainder ("+(s-i)+" of "+s+" remain)");this.container=t,this.bits=e,this.valueMask=(1<>>this.start}encode(t){if(typeof t!="number"||!Number.isInteger(t)||t!==Pu(t&this.valueMask))throw new TypeError(tb("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const e=this.container._packedGetValue(),n=Pu(t<n&&(n=this.length.decode(t,e)),n}decode(t,e=0){let n=this.span;return 0>n&&(n=this.length.decode(t,e)),Mr(t).slice(e,e+n)}encode(t,e,n){let s=this.length;if(this.length instanceof ii&&(s=t.length),!(t instanceof Uint8Array&&s===t.length))throw new TypeError(tb("Blob.encode",this)+" requires (length "+s+") Uint8Array as src");if(n+s>e.length)throw new RangeError("encoding overruns Uint8Array");const i=Mr(t);return Mr(e).write(i.toString("hex"),n,s,"hex"),this.length instanceof ii&&this.length.encode(s,e,n),s}}Vt.Blob=ik;class ok extends Lr{constructor(t){super(-1,t)}getSpan(t,e=0){Nf(t);let n=e;for(;ne.length)throw new RangeError("encoding overruns Buffer");const c=Mr(e);return s.copy(c,n),c[n+i]=0,i+1}}Vt.CString=ok;class sk extends Lr{constructor(t,e){if(typeof t=="string"&&e===void 0&&(e=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,e),this.maxSpan=t}getSpan(t,e=0){return Nf(t),t.length-e}decode(t,e=0){const n=this.getSpan(t,e);if(0<=this.maxSpan&&this.maxSpane.length)throw new RangeError("encoding overruns Buffer");return s.copy(Mr(e),n),i}}Vt.UTF8=sk;class ak extends Lr{constructor(t,e){super(0,e),this.value=t}decode(t,e){return this.value}encode(t,e,n){return 0}}Vt.Constant=ak,Vt.greedy=(r,t)=>new HS(r,t);var Va=Vt.offset=(r,t,e)=>new eb(r,t,e),cn=Vt.u8=r=>new Ki(1,r),Ti=Vt.u16=r=>new Ki(2,r);Vt.u24=r=>new Ki(3,r);var Ke=Vt.u32=r=>new Ki(4,r);Vt.u40=r=>new Ki(5,r),Vt.u48=r=>new Ki(6,r);var Bn=Vt.nu64=r=>new VS(r);Vt.u16be=r=>new ao(2,r),Vt.u24be=r=>new ao(3,r),Vt.u32be=r=>new ao(4,r),Vt.u40be=r=>new ao(5,r),Vt.u48be=r=>new ao(6,r),Vt.nu64be=r=>new ZS(r),Vt.s8=r=>new _a(1,r),Vt.s16=r=>new _a(2,r),Vt.s24=r=>new _a(3,r),Vt.s32=r=>new _a(4,r),Vt.s40=r=>new _a(5,r),Vt.s48=r=>new _a(6,r);var Ei=Vt.ns64=r=>new WS(r);Vt.s16be=r=>new Bu(2,r),Vt.s24be=r=>new Bu(3,r),Vt.s32be=r=>new Bu(4,r),Vt.s40be=r=>new Bu(5,r),Vt.s48be=r=>new Bu(6,r),Vt.ns64be=r=>new GS(r),Vt.f32=r=>new YS(r),Vt.f32be=r=>new XS(r),Vt.f64=r=>new JS(r),Vt.f64be=r=>new QS(r);var je=Vt.struct=(r,t,e)=>new ek(r,t,e);Vt.bits=(r,t,e)=>new ib(r,t,e);var qa=Vt.seq=(r,t,e)=>new tk(r,t,e);Vt.union=(r,t,e)=>new nb(r,t,e),Vt.unionLayoutDiscriminator=(r,t)=>new zl(r,t);var yf=Vt.blob=(r,t)=>new ik(r,t);Vt.cstr=r=>new ok(r),Vt.utf8=(r,t)=>new sk(r,t),Vt.constant=(r,t)=>new ak(r,t);var $h={};Object.defineProperty($h,"__esModule",{value:!0});var mV=$h.toBigIntLE=function(r){{const t=Zt.Buffer.from(r);t.reverse();const e=t.toString("hex");return e.length===0?BigInt(0):BigInt(`0x${e}`)}};$h.toBigIntBE=function(r){{const t=r.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}};var Em,vV=$h.toBufferLE=function(r,t){{const e=r.toString(16),n=Zt.Buffer.from(e.padStart(2*t,"0").slice(0,2*t),"hex");return n.reverse(),n}};$h.toBufferBE=function(r,t){{const e=r.toString(16);return Zt.Buffer.from(e.padStart(2*t,"0").slice(0,2*t),"hex")}};class gV extends TypeError{constructor(t,e){let n;const{message:s,...i}=t,{path:c}=t;super(c.length===0?s:"At path: "+c.join(".")+" -- "+s),Object.assign(this,i),this.name=this.constructor.name,this.failures=()=>{var l;return(l=n)!=null?l:n=[t,...e()]}}}function ea(r){return typeof r=="object"&&r!=null}function lo(r){return typeof r=="string"?JSON.stringify(r):""+r}function yV(r,t,e,n){if(r===!0)return;r===!1?r={}:typeof r=="string"&&(r={message:r});const{path:s,branch:i}=t,{type:c}=e,{refinement:l,message:p="Expected a value of type `"+c+"`"+(l?" with refinement `"+l+"`":"")+", but received: `"+lo(n)+"`"}=r;return{value:n,type:c,refinement:l,key:s[s.length-1],path:s,branch:i,...r,message:p}}function*Y8(r,t,e,n){var s;ea(s=r)&&typeof s[Symbol.iterator]=="function"||(r=[r]);for(const i of r){const c=yV(i,t,e,n);c&&(yield c)}}function*sb(r,t,e={}){const{path:n=[],branch:s=[r],coerce:i=!1,mask:c=!1}=e,l={path:n,branch:s};if(i&&(r=t.coercer(r,l),c&&t.type!=="type"&&ea(t.schema)&&ea(r)&&!Array.isArray(r)))for(const m in r)t.schema[m]===void 0&&delete r[m];let p=!0;for(const m of t.validator(r,l))p=!1,yield[m,void 0];for(let[m,v,_]of t.entries(r,l)){const E=sb(v,_,{path:m===void 0?n:[...n,m],branch:m===void 0?s:[...s,v],coerce:i,mask:c});for(const w of E)w[0]?(p=!1,yield[w[0],void 0]):i&&(v=w[1],m===void 0?r=v:r instanceof Map?r.set(m,v):r instanceof Set?r.add(v):ea(r)&&(r[m]=v))}if(p)for(const m of t.refiner(r,l))p=!1,yield[m,void 0];p&&(yield[void 0,r])}class ts{constructor(t){const{type:e,schema:n,validator:s,refiner:i,coercer:c=p=>p,entries:l=function*(){}}=t;this.type=e,this.schema=n,this.entries=l,this.coercer=c,this.validator=s?(p,m)=>Y8(s(p,m),m,this,p):()=>[],this.refiner=i?(p,m)=>Y8(i(p,m),m,this,p):()=>[]}assert(t){return function(e,n){const s=Oc(e,n);if(s[0])throw s[0]}(t,this)}create(t){return Nd(t,this)}is(t){return uk(t,this)}mask(t){return function(e,n){const s=Oc(e,n,{coerce:!0,mask:!0});if(s[0])throw s[0];return s[1]}(t,this)}validate(t,e={}){return Oc(t,this,e)}}function Nd(r,t){const e=Oc(r,t,{coerce:!0});if(e[0])throw e[0];return e[1]}function uk(r,t){return!Oc(r,t)[0]}function Oc(r,t,e={}){const n=sb(r,t,e),s=function(i){const{done:c,value:l}=i.next();return c?void 0:l}(n);return s[0]?[new gV(s[0],function*(){for(const i of n)i[0]&&(yield i[0])}),void 0]:[void 0,s[1]]}function lu(r,t){return new ts({type:r,schema:null,validator:t})}function Oe(r){return new ts({type:"array",schema:r,*entries(t){if(r&&Array.isArray(t))for(const[e,n]of t.entries())yield[e,n,r]},coercer:t=>Array.isArray(t)?t.slice():t,validator:t=>Array.isArray(t)||"Expected an array value, but received: "+lo(t)})}function Yo(){return lu("boolean",r=>typeof r=="boolean")}function ab(r){return lu("instance",t=>t instanceof r||"Expected a `"+r.name+"` instance, but received: "+lo(t))}function Gr(r){const t=lo(r),e=typeof r;return new ts({type:"literal",schema:e==="string"||e==="number"||e==="boolean"?r:null,validator:n=>n===r||"Expected the literal `"+t+"`, but received: "+lo(n)})}function Le(r){return new ts({...r,validator:(t,e)=>t===null||r.validator(t,e),refiner:(t,e)=>t===null||r.refiner(t,e)})}function $t(){return lu("number",r=>typeof r=="number"&&!isNaN(r)||"Expected a number, but received: "+lo(r))}function He(r){return new ts({...r,validator:(t,e)=>t===void 0||r.validator(t,e),refiner:(t,e)=>t===void 0||r.refiner(t,e)})}function fk(r,t){return new ts({type:"record",schema:null,*entries(e){if(ea(e))for(const n in e){const s=e[n];yield[n,n,r],yield[n,s,t]}},validator:e=>ea(e)||"Expected an object, but received: "+lo(e)})}function Me(){return lu("string",r=>typeof r=="string"||"Expected a string, but received: "+lo(r))}function ub(r){const t=lu("never",()=>!1);return new ts({type:"tuple",schema:null,*entries(e){if(Array.isArray(e)){const n=Math.max(r.length,e.length);for(let s=0;sArray.isArray(e)||"Expected an array, but received: "+lo(e)})}function be(r){const t=Object.keys(r);return new ts({type:"type",schema:r,*entries(e){if(ea(e))for(const n of t)yield[n,e[n],r[n]]},validator:e=>ea(e)||"Expected an object, but received: "+lo(e)})}function di(r){const t=r.map(e=>e.type).join(" | ");return new ts({type:"union",schema:null,validator(e,n){const s=[];for(const i of r){const[...c]=sb(e,i,n),[l]=c;if(!l[0])return[];for(const[p]of c)p&&s.push(p)}return["Expected the value to satisfy a union of `"+t+"`, but received: "+lo(e),...s]}})}function Hh(){return lu("unknown",()=>!0)}function Vh(r,t,e){return new ts({...r,coercer:(n,s)=>uk(n,t)?r.coercer(e(n,s),s):r.coercer(n,s)})}var bV=new Uint8Array(16);function X8(){if(!Em&&!(Em=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto)))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Em(bV)}var wV=/^(?:[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 ql(r){return typeof r=="string"&&wV.test(r)}for(var J8,Am,kn=[],Sm=0;Sm<256;++Sm)kn.push((Sm+256).toString(16).substr(1));function ol(r){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(kn[r[t+0]]+kn[r[t+1]]+kn[r[t+2]]+kn[r[t+3]]+"-"+kn[r[t+4]]+kn[r[t+5]]+"-"+kn[r[t+6]]+kn[r[t+7]]+"-"+kn[r[t+8]]+kn[r[t+9]]+"-"+kn[r[t+10]]+kn[r[t+11]]+kn[r[t+12]]+kn[r[t+13]]+kn[r[t+14]]+kn[r[t+15]]).toLowerCase();if(!ql(e))throw TypeError("Stringified UUID is invalid");return e}var km=0,Im=0;function ck(r){if(!ql(r))throw TypeError("Invalid UUID");var t,e=new Uint8Array(16);return e[0]=(t=parseInt(r.slice(0,8),16))>>>24,e[1]=t>>>16&255,e[2]=t>>>8&255,e[3]=255&t,e[4]=(t=parseInt(r.slice(9,13),16))>>>8,e[5]=255&t,e[6]=(t=parseInt(r.slice(14,18),16))>>>8,e[7]=255&t,e[8]=(t=parseInt(r.slice(19,23),16))>>>8,e[9]=255&t,e[10]=(t=parseInt(r.slice(24,36),16))/1099511627776&255,e[11]=t/4294967296&255,e[12]=t>>>24&255,e[13]=t>>>16&255,e[14]=t>>>8&255,e[15]=255&t,e}function hk(r,t,e){function n(s,i,c,l){if(typeof s=="string"&&(s=function(v){v=unescape(encodeURIComponent(v));for(var _=[],E=0;E>>9<<4)+1}function Ws(r,t){var e=(65535&r)+(65535&t);return(r>>16)+(t>>16)+(e>>16)<<16|65535&e}function Dd(r,t,e,n,s,i){return Ws((c=Ws(Ws(t,r),Ws(n,i)))<<(l=s)|c>>>32-l,e);var c,l}function Zn(r,t,e,n,s,i,c){return Dd(t&e|~t&n,r,t,s,i,c)}function Wn(r,t,e,n,s,i,c){return Dd(t&n|e&~n,r,t,s,i,c)}function Gn(r,t,e,n,s,i,c){return Dd(t^e^n,r,t,s,i,c)}function Yn(r,t,e,n,s,i,c){return Dd(e^(t|~n),r,t,s,i,c)}var xV=hk("v3",48,function(r){if(typeof r=="string"){var t=unescape(encodeURIComponent(r));r=new Uint8Array(t.length);for(var e=0;e>5]>>>l%32&255,m=parseInt(c.charAt(p>>>4&15)+c.charAt(15&p),16);s.push(m)}return s}(function(n,s){n[s>>5]|=128<>5]|=(255&n[c/8])<>>32-t}var EV=hk("v5",80,function(r){var t=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof r=="string"){var n=unescape(encodeURIComponent(r));r=[];for(var s=0;s>>0;C=R,R=P,P=Bm(B,30)>>>0,B=A,A=H}e[0]=e[0]+A>>>0,e[1]=e[1]+B>>>0,e[2]=e[2]+P>>>0,e[3]=e[3]+R>>>0,e[4]=e[4]+C>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,255&e[0],e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,255&e[1],e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,255&e[2],e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,255&e[3],e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,255&e[4]]}),AV=EV,SV=Object.freeze({__proto__:null,v1:function(r,t,e){var n=t&&e||0,s=t||new Array(16),i=(r=r||{}).node||J8,c=r.clockseq!==void 0?r.clockseq:Am;if(i==null||c==null){var l=r.random||(r.rng||X8)();i==null&&(i=J8=[1|l[0],l[1],l[2],l[3],l[4],l[5]]),c==null&&(c=Am=16383&(l[6]<<8|l[7]))}var p=r.msecs!==void 0?r.msecs:Date.now(),m=r.nsecs!==void 0?r.nsecs:Im+1,v=p-km+(m-Im)/1e4;if(v<0&&r.clockseq===void 0&&(c=c+1&16383),(v<0||p>km)&&r.nsecs===void 0&&(m=0),m>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");km=p,Im=m,Am=c;var _=(1e4*(268435455&(p+=122192928e5))+m)%4294967296;s[n++]=_>>>24&255,s[n++]=_>>>16&255,s[n++]=_>>>8&255,s[n++]=255&_;var E=p/4294967296*1e4&268435455;s[n++]=E>>>8&255,s[n++]=255&E,s[n++]=E>>>24&15|16,s[n++]=E>>>16&255,s[n++]=c>>>8|128,s[n++]=255&c;for(var w=0;w<6;++w)s[n+w]=i[w];return t||ol(s)},v3:_V,v4:function(r,t,e){var n=(r=r||{}).random||(r.rng||X8)();if(n[6]=15&n[6]|64,n[8]=63&n[8]|128,t){e=e||0;for(var s=0;s<16;++s)t[e+s]=n[s];return t}return ol(n)},v5:AV,NIL:"00000000-0000-0000-0000-000000000000",version:function(r){if(!ql(r))throw TypeError("Invalid UUID");return parseInt(r.substr(14,1),16)},validate:ql,stringify:ol,parse:ck}),tx=Wy(SV);tx.v4,tx.v4;var P0,lk={exports:{}};(P0=lk).exports=function(r){return r&&r.__esModule?r:{default:r}},P0.exports.__esModule=!0,P0.exports.default=P0.exports;var ex,rx,Pm,nx,ix=lk.exports,ox={exports:{}},sx={exports:{}};function lh(){return ex||(ex=1,function(r){function t(e){return r.exports=t=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(n){return typeof n}:function(n){return n&&typeof Symbol=="function"&&n.constructor===Symbol&&n!==Symbol.prototype?"symbol":typeof n},r.exports.__esModule=!0,r.exports.default=r.exports,t(e)}r.exports=t,r.exports.__esModule=!0,r.exports.default=r.exports}(sx)),sx.exports}var ax,ux,fx={exports:{}},cx={exports:{}};function hx(){return ux||(ux=1,function(r){r.exports=function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")},r.exports.__esModule=!0,r.exports.default=r.exports}(cx)),cx.exports}var lx,dx,px,mx={exports:{}},vx={exports:{}},gx={exports:{}};function kV(){return dx||(dx=1,function(r){var t=lh().default,e=(lx||(lx=1,function(n){var s=lh().default;n.exports=function(i,c){if(s(i)!=="object"||i===null)return i;var l=i[Symbol.toPrimitive];if(l!==void 0){var p=l.call(i,c||"default");if(s(p)!=="object")return p;throw new TypeError("@@toPrimitive must return a primitive value.")}return(c==="string"?String:Number)(i)},n.exports.__esModule=!0,n.exports.default=n.exports}(gx)),gx.exports);r.exports=function(n){var s=e(n,"string");return t(s)==="symbol"?s:String(s)},r.exports.__esModule=!0,r.exports.default=r.exports}(vx)),vx.exports}function yx(){return px||(px=1,function(r){var t=kV();function e(n,s){for(var i=0;i=0;--kt){var k=this.tryEntries[kt],T=k.completion;if(k.tryLoc==="root")return Tt("end");if(k.tryLoc<=this.prev){var L=C.call(k,"catchLoc"),j=C.call(k,"finallyLoc");if(L&&j){if(this.prev=0;--Tt){var kt=this.tryEntries[Tt];if(kt.tryLoc<=this.prev&&C.call(kt,"finallyLoc")&&this.prev=0;--ct){var Tt=this.tryEntries[ct];if(Tt.finallyLoc===lt)return this.complete(Tt.completion,Tt.afterLoc),yt(Tt),g}},catch:function(lt){for(var ct=this.tryEntries.length-1;ct>=0;--ct){var Tt=this.tryEntries[ct];if(Tt.tryLoc===lt){var kt=Tt.completion;if(kt.type==="throw"){var k=kt.arg;yt(Tt)}return k}}throw new Error("illegal catch attempt")},delegateYield:function(lt,ct,Tt){return this.delegate={iterator:Ft(lt),resultName:ct,nextLoc:Tt},this.method==="next"&&(this.arg=B),g}},P}w.exports=A,w.exports.__esModule=!0,w.exports.default=w.exports}(ox)),ox.exports)();Pm=E;try{regeneratorRuntime=E}catch{typeof globalThis=="object"?globalThis.regeneratorRuntime=E:Function("r","regeneratorRuntime = r")(E)}return Pm}()),n=t((ax||(ax=1,function(E){function w(x,A,B,P,R,C,O){try{var z=x[C](O),H=z.value}catch(tt){return void B(tt)}z.done?A(H):Promise.resolve(H).then(P,R)}E.exports=function(x){return function(){var A=this,B=arguments;return new Promise(function(P,R){var C=x.apply(A,B);function O(H){w(C,P,R,O,z,"next",H)}function z(H){w(C,P,R,O,z,"throw",H)}O(void 0)})}},E.exports.__esModule=!0,E.exports.default=E.exports}(fx)),fx.exports)),s=t(lh()),i=t(hx()),c=t(yx()),l=t(Mx()),p=t(Ix()),m=t(Rx());function v(E){var w=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var x,A=(0,m.default)(E);if(w){var B=(0,m.default)(this).constructor;x=Reflect.construct(A,arguments,B)}else x=A.apply(this,arguments);return(0,p.default)(this,x)}}var _=function(E){(0,l.default)(R,E);var w,x,A,B,P=v(R);function R(C){var O,z=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"ws://localhost:8080",H=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},tt=arguments.length>3?arguments[3]:void 0;(0,i.default)(this,R);var nt=H.autoconnect,G=nt===void 0||nt,M=H.reconnect,d=M===void 0||M,o=H.reconnect_interval,a=o===void 0?1e3:o,f=H.max_reconnects,h=f===void 0?5:f,g=function(S,I){var y={};for(var u in S)Object.prototype.hasOwnProperty.call(S,u)&&I.indexOf(u)<0&&(y[u]=S[u]);if(S!=null&&typeof Object.getOwnPropertySymbols=="function"){var b=0;for(u=Object.getOwnPropertySymbols(S);bz.current_reconnects||z.max_reconnects===0)&&(z.reconnect_timer_id=setTimeout(function(){return z._connect(C,O)},z.reconnect_interval)))})}}]),R}(Lx().EventEmitter);r.default=_})({}),function(r){var t=ix;Object.defineProperty(r,"__esModule",{value:!0}),r.default=function(m,v){return new p(m,v)};var e=t(hx()),n=t(yx()),s=t(Mx()),i=t(Ix()),c=t(Rx());function l(m){var v=function(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch{return!1}}();return function(){var _,E=(0,c.default)(m);if(v){var w=(0,c.default)(this).constructor;_=Reflect.construct(E,arguments,w)}else _=E.apply(this,arguments);return(0,i.default)(this,_)}}var p=function(m){(0,s.default)(_,m);var v=l(_);function _(E,w,x){var A;return(0,e.default)(this,_),(A=v.call(this)).socket=new window.WebSocket(E,x),A.socket.onopen=function(){return A.emit("open")},A.socket.onmessage=function(B){return A.emit("message",B.data)},A.socket.onerror=function(B){return A.emit("error",B)},A.socket.onclose=function(B){A.emit("close",B.code,B.reason)},A}return(0,n.default)(_,[{key:"send",value:function(E,w,x){var A=x||w;try{this.socket.send(E),A()}catch(B){A(B)}}},{key:"close",value:function(E,w){this.socket.close(E,w)}},{key:"addEventListener",value:function(E,w,x){this.socket.addEventListener(E,w,x)}}]),_}(Lx().EventEmitter)}({});const{bytesToNumberBE:IV,hexToBytes:BV}=KH,Fa={Err:class extends Error{constructor(r=""){super(r)}},_parseInt(r){const{Err:t}=Fa;if(r.length<2||r[0]!==2)throw new t("Invalid signature integer tag");const e=r[1],n=r.subarray(2,e+2);if(!e||n.length!==e)throw new t("Invalid signature integer: wrong length");if(128&n[0])throw new t("Invalid signature integer: negative");if(n[0]===0&&!(128&n[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:IV(n),l:r.subarray(e+2)}},toSig(r){const{Err:t}=Fa,e=typeof r=="string"?BV(r):r;if(!(e instanceof Uint8Array))throw new Error("ui8a expected");let n=e.length;if(n<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==n-2)throw new t("Invalid signature: incorrect length");const{d:s,l:i}=Fa._parseInt(e.subarray(2)),{d:c,l}=Fa._parseInt(i);if(l.length)throw new t("Invalid signature: left bytes after parsing");return{r:s,s:c}},hexFromSig(r){const t=m=>8&Number.parseInt(m[0],16)?"00"+m:m,e=m=>{const v=m.toString(16);return 1&v.length?`0${v}`:v},n=t(e(r.s)),s=t(e(r.r)),i=n.length/2,c=s.length/2,l=e(i),p=e(c);return`30${e(c+i+4)}02${p}${s}02${l}${n}`}},os=BigInt(0),Ci=BigInt(1);BigInt(2);const Ox=BigInt(3);function PV(r){const t=function(G){const M=Bv(G);return gf(M,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...M})}(r),{Fp:e,n}=t,s=e.BYTES+1,i=2*e.BYTES+1;function c(G){return $r(G,n)}function l(G){return Iv(G,n)}const{ProjectivePoint:p,normPrivateKeyToScalar:m,weierstrassEquation:v,isWithinCurveOrder:_}=function(G){const M=function(Z){const F=Bv(Z);gf(F,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:q,Fp:it,a:at}=F;if(q){if(!it.eql(at,it.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof q!="object"||typeof q.beta!="bigint"||typeof q.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...F})}(G),{Fp:d}=M,o=M.toBytes||((Z,F,q)=>{const it=F.toAffine();return Ha(Uint8Array.from([4]),d.toBytes(it.x),d.toBytes(it.y))}),a=M.fromBytes||(Z=>{const F=Z.subarray(1);return{x:d.fromBytes(F.subarray(0,d.BYTES)),y:d.fromBytes(F.subarray(d.BYTES,2*d.BYTES))}});function f(Z){const{a:F,b:q}=M,it=d.sqr(Z),at=d.mul(it,Z);return d.add(d.add(at,d.mul(Z,F)),q)}if(!d.eql(d.sqr(M.Gy),f(M.Gx)))throw new Error("bad generator point: equation left != right");function h(Z){return typeof Z=="bigint"&&osd.eql(Bt,d.ZERO);return at(q)&&at(it)?u.ZERO:new u(q,it,d.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(F){const q=d.invertBatch(F.map(it=>it.pz));return F.map((it,at)=>it.toAffine(q[at])).map(u.fromAffine)}static fromHex(F){const q=u.fromAffine(a(pn("pointHex",F)));return q.assertValidity(),q}static fromPrivateKey(F){return u.BASE.multiply(S(F))}_setWindowSize(F){this._WINDOW_SIZE=F,I.delete(this)}assertValidity(){if(this.is0()){if(M.allowInfinityPoint&&!d.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:F,y:q}=this.toAffine();if(!d.isValid(F)||!d.isValid(q))throw new Error("bad point: x or y not FE");const it=d.sqr(q),at=f(F);if(!d.eql(it,at))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:F}=this.toAffine();if(d.isOdd)return!d.isOdd(F);throw new Error("Field doesn't support isOdd")}equals(F){y(F);const{px:q,py:it,pz:at}=this,{px:Bt,py:yt,pz:pt}=F,Ft=d.eql(d.mul(q,pt),d.mul(Bt,at)),lt=d.eql(d.mul(it,pt),d.mul(yt,at));return Ft&<}negate(){return new u(this.px,d.neg(this.py),this.pz)}double(){const{a:F,b:q}=M,it=d.mul(q,Ox),{px:at,py:Bt,pz:yt}=this;let pt=d.ZERO,Ft=d.ZERO,lt=d.ZERO,ct=d.mul(at,at),Tt=d.mul(Bt,Bt),kt=d.mul(yt,yt),k=d.mul(at,Bt);return k=d.add(k,k),lt=d.mul(at,yt),lt=d.add(lt,lt),pt=d.mul(F,lt),Ft=d.mul(it,kt),Ft=d.add(pt,Ft),pt=d.sub(Tt,Ft),Ft=d.add(Tt,Ft),Ft=d.mul(pt,Ft),pt=d.mul(k,pt),lt=d.mul(it,lt),kt=d.mul(F,kt),k=d.sub(ct,kt),k=d.mul(F,k),k=d.add(k,lt),lt=d.add(ct,ct),ct=d.add(lt,ct),ct=d.add(ct,kt),ct=d.mul(ct,k),Ft=d.add(Ft,ct),kt=d.mul(Bt,yt),kt=d.add(kt,kt),ct=d.mul(kt,k),pt=d.sub(pt,ct),lt=d.mul(kt,Tt),lt=d.add(lt,lt),lt=d.add(lt,lt),new u(pt,Ft,lt)}add(F){y(F);const{px:q,py:it,pz:at}=this,{px:Bt,py:yt,pz:pt}=F;let Ft=d.ZERO,lt=d.ZERO,ct=d.ZERO;const Tt=M.a,kt=d.mul(M.b,Ox);let k=d.mul(q,Bt),T=d.mul(it,yt),L=d.mul(at,pt),j=d.add(q,it),rt=d.add(Bt,yt);j=d.mul(j,rt),rt=d.add(k,T),j=d.sub(j,rt),rt=d.add(q,at);let Q=d.add(Bt,pt);return rt=d.mul(rt,Q),Q=d.add(k,L),rt=d.sub(rt,Q),Q=d.add(it,at),Ft=d.add(yt,pt),Q=d.mul(Q,Ft),Ft=d.add(T,L),Q=d.sub(Q,Ft),ct=d.mul(Tt,rt),Ft=d.mul(kt,L),ct=d.add(Ft,ct),Ft=d.sub(T,ct),ct=d.add(T,ct),lt=d.mul(Ft,ct),T=d.add(k,k),T=d.add(T,k),L=d.mul(Tt,L),rt=d.mul(kt,rt),T=d.add(T,L),L=d.sub(k,L),L=d.mul(Tt,L),rt=d.add(rt,L),k=d.mul(T,rt),lt=d.add(lt,k),k=d.mul(Q,rt),Ft=d.mul(j,Ft),Ft=d.sub(Ft,k),k=d.mul(j,T),ct=d.mul(Q,ct),ct=d.add(ct,k),new u(Ft,lt,ct)}subtract(F){return this.add(F.negate())}is0(){return this.equals(u.ZERO)}wNAF(F){return D.wNAFCached(this,I,F,q=>{const it=d.invertBatch(q.map(at=>at.pz));return q.map((at,Bt)=>at.toAffine(it[Bt])).map(u.fromAffine)})}multiplyUnsafe(F){const q=u.ZERO;if(F===os)return q;if(g(F),F===Ci)return this;const{endo:it}=M;if(!it)return D.unsafeLadder(this,F);let{k1neg:at,k1:Bt,k2neg:yt,k2:pt}=it.splitScalar(F),Ft=q,lt=q,ct=this;for(;Bt>os||pt>os;)Bt&Ci&&(Ft=Ft.add(ct)),pt&Ci&&(lt=lt.add(ct)),ct=ct.double(),Bt>>=Ci,pt>>=Ci;return at&&(Ft=Ft.negate()),yt&&(lt=lt.negate()),lt=new u(d.mul(lt.px,it.beta),lt.py,lt.pz),Ft.add(lt)}multiply(F){g(F);let q,it,at=F;const{endo:Bt}=M;if(Bt){const{k1neg:yt,k1:pt,k2neg:Ft,k2:lt}=Bt.splitScalar(at);let{p:ct,f:Tt}=this.wNAF(pt),{p:kt,f:k}=this.wNAF(lt);ct=D.constTimeNegate(yt,ct),kt=D.constTimeNegate(Ft,kt),kt=new u(d.mul(kt.px,Bt.beta),kt.py,kt.pz),q=ct.add(kt),it=Tt.add(k)}else{const{p:yt,f:pt}=this.wNAF(at);q=yt,it=pt}return u.normalizeZ([q,it])[0]}multiplyAndAddUnsafe(F,q,it){const at=u.BASE,Bt=(pt,Ft)=>Ft!==os&&Ft!==Ci&&pt.equals(at)?pt.multiply(Ft):pt.multiplyUnsafe(Ft),yt=Bt(this,q).add(Bt(F,it));return yt.is0()?void 0:yt}toAffine(F){const{px:q,py:it,pz:at}=this,Bt=this.is0();F==null&&(F=Bt?d.ONE:d.inv(at));const yt=d.mul(q,F),pt=d.mul(it,F),Ft=d.mul(at,F);if(Bt)return{x:d.ZERO,y:d.ZERO};if(!d.eql(Ft,d.ONE))throw new Error("invZ was invalid");return{x:yt,y:pt}}isTorsionFree(){const{h:F,isTorsionFree:q}=M;if(F===Ci)return!0;if(q)return q(u,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:F,clearCofactor:q}=M;return F===Ci?this:q?q(u,this):this.multiplyUnsafe(M.h)}toRawBytes(F=!0){return this.assertValidity(),o(u,this,F)}toHex(F=!0){return $a(this.toRawBytes(F))}}u.BASE=new u(M.Gx,M.Gy,d.ONE),u.ZERO=new u(d.ZERO,d.ONE,d.ZERO);const b=M.nBitLength,D=OS(u,M.endo?Math.ceil(b/2):b);return{CURVE:M,ProjectivePoint:u,normPrivateKeyToScalar:S,weierstrassEquation:f,isWithinCurveOrder:h}}({...t,toBytes(G,M,d){const o=M.toAffine(),a=e.toBytes(o.x),f=Ha;return d?f(Uint8Array.from([M.hasEvenY()?2:3]),a):f(Uint8Array.from([4]),a,e.toBytes(o.y))},fromBytes(G){const M=G.length,d=G[0],o=G.subarray(1);if(M!==s||d!==2&&d!==3){if(M===i&&d===4)return{x:e.fromBytes(o.subarray(0,e.BYTES)),y:e.fromBytes(o.subarray(e.BYTES,2*e.BYTES))};throw new Error(`Point of length ${M} was invalid. Expected ${s} compressed bytes or ${i} uncompressed bytes`)}{const f=Aa(o);if(!(os<(a=f)&&a$a(Ju(G,t.nByteLength));function w(G){return G>n>>Ci}const x=(G,M,d)=>Aa(G.slice(M,d));class A{constructor(M,d,o){this.r=M,this.s=d,this.recovery=o,this.assertValidity()}static fromCompact(M){const d=t.nByteLength;return M=pn("compactSignature",M,2*d),new A(x(M,0,d),x(M,d,2*d))}static fromDER(M){const{r:d,s:o}=Fa.toSig(pn("DER",M));return new A(d,o)}assertValidity(){if(!_(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!_(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(M){return new A(this.r,this.s,M)}recoverPublicKey(M){const{r:d,s:o,recovery:a}=this,f=C(pn("msgHash",M));if(a==null||![0,1,2,3].includes(a))throw new Error("recovery id invalid");const h=a===2||a===3?d+t.n:d;if(h>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");const g=1&a?"03":"02",S=p.fromHex(g+E(h)),I=l(h),y=c(-f*I),u=c(o*I),b=p.BASE.multiplyAndAddUnsafe(S,y,u);if(!b)throw new Error("point at infinify");return b.assertValidity(),b}hasHighS(){return w(this.s)}normalizeS(){return this.hasHighS()?new A(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return vf(this.toDERHex())}toDERHex(){return Fa.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return vf(this.toCompactHex())}toCompactHex(){return E(this.r)+E(this.s)}}const B={isValidPrivateKey(G){try{return m(G),!0}catch{return!1}},normPrivateKeyToScalar:m,randomPrivateKey:()=>{const G=K8(t.n);return function(M,d,o=!1){const a=M.length,f=LS(d),h=K8(d);if(a<16||a1024)throw new Error(`expected ${h}-1024 bytes of input, got ${a}`);const g=$r(o?Aa(M):Xu(M),d-Hr)+Hr;return o?hh(g,f):Ju(g,f)}(t.randomBytes(G),t.n)},precompute:(G=8,M=p.BASE)=>(M._setWindowSize(G),M.multiply(BigInt(3)),M)};function P(G){const M=G instanceof Uint8Array,d=typeof G=="string",o=(M||d)&&G.length;return M?o===s||o===i:d?o===2*s||o===2*i:G instanceof p}const R=t.bits2int||function(G){const M=Aa(G),d=8*G.length-t.nBitLength;return d>0?M>>BigInt(d):M},C=t.bits2int_modN||function(G){return c(R(G))},O=Xy(t.nBitLength);function z(G){if(typeof G!="bigint")throw new Error("bigint expected");if(!(os<=G&&GD in d))throw new Error("sign() legacy options not supported");const{hash:o,randomBytes:a}=t;let{lowS:f,prehash:h,extraEntropy:g}=d;f==null&&(f=!0),G=pn("msgHash",G),h&&(G=pn("prehashed msgHash",o(G)));const S=C(G),I=m(M),y=[z(I),z(S)];if(g!=null){const D=g===!0?a(e.BYTES):g;y.push(pn("extraEntropy",D))}const u=Ha(...y),b=S;return{seed:u,k2sig:function(D){const Z=R(D);if(!_(Z))return;const F=l(Z),q=p.BASE.multiply(Z).toAffine(),it=c(q.x);if(it===os)return;const at=c(F*c(b+it*I));if(at===os)return;let Bt=(q.x===it?0:2)|Number(q.y&Ci),yt=at;return f&&w(at)&&(yt=function(pt){return w(pt)?c(-pt):pt}(at),Bt^=1),new A(it,yt,Bt)}}}const tt={lowS:t.lowS,prehash:!1},nt={lowS:t.lowS,prehash:!1};return p.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(G,M=!0){return p.fromPrivateKey(G).toRawBytes(M)},getSharedSecret:function(G,M,d=!0){if(P(G))throw new Error("first arg must be private key");if(!P(M))throw new Error("second arg must be public key");return p.fromHex(M).multiply(m(G)).toRawBytes(d)},sign:function(G,M,d=tt){const{seed:o,k2sig:a}=H(G,M,d),f=t;return RS(f.hash.outputLen,f.nByteLength,f.hmac)(o,a)},verify:function(G,M,d,o=nt){var q;const a=G;if(M=pn("msgHash",M),d=pn("publicKey",d),"strict"in o)throw new Error("options.strict was renamed to lowS");const{lowS:f,prehash:h}=o;let g,S;try{if(typeof a=="string"||a instanceof Uint8Array)try{g=A.fromDER(a)}catch(it){if(!(it instanceof Fa.Err))throw it;g=A.fromCompact(a)}else{if(typeof a!="object"||typeof a.r!="bigint"||typeof a.s!="bigint")throw new Error("PARSE");{const{r:it,s:at}=a;g=new A(it,at)}}S=p.fromHex(d)}catch(it){if(it.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(f&&g.hasHighS())return!1;h&&(M=t.hash(M));const{r:I,s:y}=g,u=C(M),b=l(y),D=c(u*b),Z=c(I*b),F=(q=p.BASE.multiplyAndAddUnsafe(S,D,Z))==null?void 0:q.toAffine();return!!F&&c(F.x)===I},ProjectivePoint:p,Signature:A,utils:B}}BigInt(4);class dk extends kS{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,function(c){if(typeof c!="function"||typeof c.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");U8(c.outputLen),U8(c.blockLen)}(t);const n=Gy(e);if(this.iHash=t.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 s=this.blockLen,i=new Uint8Array(s);i.set(n.length>s?t.create().update(n).digest():n);for(let c=0;cnew dk(r,t).update(e).digest();function RV(r){return{hash:r,hmac:(t,...e)=>pk(r,t,function(...n){const s=new Uint8Array(n.reduce((c,l)=>c+l.length,0));let i=0;return n.forEach(c=>{if(!SS(c))throw new Error("Uint8Array expected");s.set(c,i),i+=c.length}),s}(...e)),randomBytes:BS}}pk.create=(r,t)=>new dk(r,t);const Ux=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Nx=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),CV=BigInt(1),Nv=BigInt(2),Dx=(r,t)=>(r+t/Nv)/t,Dv=TS(Ux,void 0,void 0,{sqrt:function(r){const t=Ux,e=BigInt(3),n=BigInt(6),s=BigInt(11),i=BigInt(22),c=BigInt(23),l=BigInt(44),p=BigInt(88),m=r*r*r%t,v=m*m*r%t,_=rn(v,e,t)*v%t,E=rn(_,e,t)*v%t,w=rn(E,Nv,t)*m%t,x=rn(w,s,t)*w%t,A=rn(x,i,t)*x%t,B=rn(A,l,t)*A%t,P=rn(B,p,t)*B%t,R=rn(P,l,t)*A%t,C=rn(R,e,t)*v%t,O=rn(C,c,t)*x%t,z=rn(O,n,t)*m%t,H=rn(z,Nv,t);if(!Dv.eql(Dv.sqr(H),r))throw new Error("Cannot find square root");return H}}),zv=function(r,t){const e=n=>PV({...r,...RV(n)});return Object.freeze({...e(t),create:e})}({a:BigInt(0),b:BigInt(7),Fp:Dv,n:Nx,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{const t=Nx,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-CV*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=e,c=BigInt("0x100000000000000000000000000000000"),l=Dx(i*r,t),p=Dx(-n*r,t);let m=$r(r-l*e-p*s,t),v=$r(-l*n-p*i,t);const _=m>c,E=v>c;if(_&&(m=t-m),E&&(v=t-v),m>c||v>c)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:_,k1:m,k2neg:E,k2:v}}}},Lv);function zx(r){try{return eV.ExtendedPoint.fromHex(r),!0}catch{return!1}}BigInt(0),zv.ProjectivePoint;const TV=r=>Vr.Buffer.isBuffer(r)?r:r instanceof Uint8Array?Vr.Buffer.from(r.buffer,r.byteOffset,r.byteLength):Vr.Buffer.from(r);class LV{constructor(t){Object.assign(this,t)}encode(){return Vr.Buffer.from(KS(sl,this))}static decode(t){return $S(sl,this,t)}static decodeUnchecked(t){return zS(sl,this,t)}}const sl=new Map;var qx;let mk;const Rm=32;let Fx=1;mk=Symbol.toStringTag;class lr extends LV{constructor(t){if(super({}),this._bn=void 0,function(e){return e._bn!==void 0}(t))this._bn=t._bn;else{if(typeof t=="string"){const e=W8.decode(t);if(e.length!=Rm)throw new Error("Invalid public key input");this._bn=new Z8(e)}else this._bn=new Z8(t);if(this._bn.byteLength()>Rm)throw new Error("Invalid public key input")}}static unique(){const t=new lr(Fx);return Fx+=1,new lr(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return W8.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(Vr.Buffer);if(t.length===Rm)return t;const e=Vr.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[mk](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,n){const s=Vr.Buffer.concat([t.toBuffer(),Vr.Buffer.from(e),n.toBuffer()]),i=Lv(s);return new lr(i)}static createProgramAddressSync(t,e){let n=Vr.Buffer.alloc(0);t.forEach(function(i){if(i.length>32)throw new TypeError("Max seed length exceeded");n=Vr.Buffer.concat([n,TV(i)])}),n=Vr.Buffer.concat([n,e.toBuffer(),Vr.Buffer.from("ProgramDerivedAddress")]);const s=Lv(n);if(zx(s))throw new Error("Invalid seeds, address must fall off the curve");return new lr(s)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let n,s=255;for(;s!=0;){try{const i=t.concat(Vr.Buffer.from([s]));n=this.createProgramAddressSync(i,e)}catch(i){if(i instanceof TypeError)throw i;s--;continue}return[n,s]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){return zx(new lr(t).toBytes())}}qx=lr,lr.default=new qx("11111111111111111111111111111111"),sl.set(lr,{kind:"struct",fields:[["_bn","u256"]]}),new lr("BPFLoader1111111111111111111111111111111111");const kr=(r="publicKey")=>yf(32,r),Tu=(r="string")=>{const t=je([Ke("length"),Ke("lengthPadding"),yf(Va(Ke(),-8),"chars")],r),e=t.decode.bind(t),n=t.encode.bind(t),s=t;return s.decode=(i,c)=>e(i,c).chars.toString(),s.encode=(i,c,l)=>{const p={chars:Vr.Buffer.from(i,"utf8")};return n(p,c,l)},s.alloc=i=>Ke().span+Ke().span+Vr.Buffer.from(i,"utf8").length,s};Vr.Buffer.alloc(64).fill(0);new lr("SysvarC1ock11111111111111111111111111111111"),new lr("SysvarEpochSchedu1e111111111111111111111111"),new lr("Sysvar1nstructions1111111111111111111111111");new lr("SysvarRecentB1ockHashes11111111111111111111");new lr("SysvarRent111111111111111111111111111111111");new lr("SysvarRewards111111111111111111111111111111"),new lr("SysvarS1otHashes111111111111111111111111111"),new lr("SysvarS1otHistory11111111111111111111111111"),new lr("SysvarStakeHistory1111111111111111111111111");const OV=Bn("lamportsPerSignature");je([Ke("version"),Ke("state"),kr("authorizedPubkey"),kr("nonce"),je([OV],"feeCalculator")]).span;const Qu=r=>{const t=yf(8,r),{encode:e,decode:n}=(i=>({decode:i.decode.bind(i),encode:i.encode.bind(i)}))(t),s=t;return s.decode=(i,c)=>{const l=n(i,c);return mV(Vr.Buffer.from(l))},s.encode=(i,c,l)=>{const p=vV(i,8);return e(p,c,l)},s};Object.freeze({Create:{index:0,layout:je([Ke("instruction"),Ei("lamports"),Ei("space"),kr("programId")])},Assign:{index:1,layout:je([Ke("instruction"),kr("programId")])},Transfer:{index:2,layout:je([Ke("instruction"),Qu("lamports")])},CreateWithSeed:{index:3,layout:je([Ke("instruction"),kr("base"),Tu("seed"),Ei("lamports"),Ei("space"),kr("programId")])},AdvanceNonceAccount:{index:4,layout:je([Ke("instruction")])},WithdrawNonceAccount:{index:5,layout:je([Ke("instruction"),Ei("lamports")])},InitializeNonceAccount:{index:6,layout:je([Ke("instruction"),kr("authorized")])},AuthorizeNonceAccount:{index:7,layout:je([Ke("instruction"),kr("authorized")])},Allocate:{index:8,layout:je([Ke("instruction"),Ei("space")])},AllocateWithSeed:{index:9,layout:je([Ke("instruction"),kr("base"),Tu("seed"),Ei("space"),kr("programId")])},AssignWithSeed:{index:10,layout:je([Ke("instruction"),kr("base"),Tu("seed"),kr("programId")])},TransferWithSeed:{index:11,layout:je([Ke("instruction"),Qu("lamports"),Tu("seed"),kr("programId")])},UpgradeNonceAccount:{index:12,layout:je([Ke("instruction")])}});new lr("11111111111111111111111111111111"),new lr("BPFLoader2111111111111111111111111111111111"),je([Ke("typeIndex"),Qu("deactivationSlot"),Bn("lastExtendedSlot"),cn("lastExtendedStartIndex"),cn(),qa(kr(),Va(cn(),-1),"authority")]);const gn=Vh(ab(lr),Me(),r=>new lr(r)),vk=ub([Me(),Gr("base64")]),fb=Vh(ab(Vr.Buffer),vk,r=>Vr.Buffer.from(r[0],"base64"));function gk(r){return di([be({jsonrpc:Gr("2.0"),id:Me(),result:r}),be({jsonrpc:Gr("2.0"),id:Me(),error:be({code:Hh(),message:Me(),data:He(lu("any",()=>!0))})})])}const UV=gk(Hh());function Nr(r){return Vh(gk(r),UV,t=>"error"in t?t:{...t,result:Nd(t.result,r)})}function Fi(r){return Nr(be({context:be({slot:$t()}),value:r}))}function zd(r){return be({context:be({slot:$t()}),value:r})}const NV=be({foundation:$t(),foundationTerm:$t(),initial:$t(),taper:$t(),terminal:$t()});Nr(Oe(Le(be({epoch:$t(),effectiveSlot:$t(),amount:$t(),postBalance:$t(),commission:He(Le($t()))}))));const DV=Oe(be({slot:$t(),prioritizationFee:$t()})),zV=be({total:$t(),validator:$t(),foundation:$t(),epoch:$t()}),qV=be({epoch:$t(),slotIndex:$t(),slotsInEpoch:$t(),absoluteSlot:$t(),blockHeight:He($t()),transactionCount:He($t())}),FV=be({slotsPerEpoch:$t(),leaderScheduleSlotOffset:$t(),warmup:Yo(),firstNormalEpoch:$t(),firstNormalSlot:$t()}),jV=fk(Me(),Oe($t())),iu=Le(di([be({}),Me()])),KV=be({err:iu}),$V=Gr("receivedSignature");be({"solana-core":Me(),"feature-set":He($t())}),Fi(be({err:Le(di([be({}),Me()])),logs:Le(Oe(Me())),accounts:He(Le(Oe(Le(be({executable:Yo(),owner:Me(),lamports:$t(),data:Oe(Me()),rentEpoch:He($t())}))))),unitsConsumed:He($t()),returnData:He(Le(be({programId:Me(),data:ub([Me(),Gr("base64")])})))})),Fi(be({byIdentity:fk(Me(),Oe($t())),range:be({firstSlot:$t(),lastSlot:$t()})})),Nr(NV),Nr(zV),Nr(DV),Nr(qV),Nr(FV),Nr(jV),Nr($t()),Fi(be({total:$t(),circulating:$t(),nonCirculating:$t(),nonCirculatingAccounts:Oe(gn)}));const HV=be({amount:Me(),uiAmount:Le($t()),decimals:$t(),uiAmountString:He(Me())});Fi(Oe(be({address:gn,amount:Me(),uiAmount:Le($t()),decimals:$t(),uiAmountString:He(Me())}))),Fi(Oe(be({pubkey:gn,account:be({executable:Yo(),owner:gn,lamports:$t(),data:fb,rentEpoch:$t()})})));const qv=be({program:Me(),parsed:Hh(),space:$t()});Fi(Oe(be({pubkey:gn,account:be({executable:Yo(),owner:gn,lamports:$t(),data:qv,rentEpoch:$t()})}))),Fi(Oe(be({lamports:$t(),address:gn})));const cb=be({executable:Yo(),owner:gn,lamports:$t(),data:fb,rentEpoch:$t()});be({pubkey:gn,account:cb});const VV=Vh(di([ab(Vr.Buffer),qv]),di([vk,qv]),r=>Array.isArray(r)?Nd(r,fb):r),ZV=be({executable:Yo(),owner:gn,lamports:$t(),data:VV,rentEpoch:$t()});be({pubkey:gn,account:ZV}),be({state:di([Gr("active"),Gr("inactive"),Gr("activating"),Gr("deactivating")]),active:$t(),inactive:$t()}),Nr(Oe(be({signature:Me(),slot:$t(),err:iu,memo:Le(Me()),blockTime:He(Le($t()))}))),Nr(Oe(be({signature:Me(),slot:$t(),err:iu,memo:Le(Me()),blockTime:He(Le($t()))}))),be({subscription:$t(),result:zd(cb)});const WV=be({pubkey:gn,account:cb});be({subscription:$t(),result:zd(WV)});const GV=be({parent:$t(),slot:$t(),root:$t()});be({subscription:$t(),result:GV});const YV=di([be({type:di([Gr("firstShredReceived"),Gr("completed"),Gr("optimisticConfirmation"),Gr("root")]),slot:$t(),timestamp:$t()}),be({type:Gr("createdBank"),parent:$t(),slot:$t(),timestamp:$t()}),be({type:Gr("frozen"),slot:$t(),timestamp:$t(),stats:be({numTransactionEntries:$t(),numSuccessfulTransactions:$t(),numFailedTransactions:$t(),maxTransactionsPerEntry:$t()})}),be({type:Gr("dead"),slot:$t(),timestamp:$t(),err:Me()})]);be({subscription:$t(),result:YV}),be({subscription:$t(),result:zd(di([KV,$V]))}),be({subscription:$t(),result:$t()}),be({pubkey:Me(),gossip:Le(Me()),tpu:Le(Me()),rpc:Le(Me()),version:Le(Me())});const jx=be({votePubkey:Me(),nodePubkey:Me(),activatedStake:$t(),epochVoteAccount:Yo(),epochCredits:Oe(ub([$t(),$t(),$t()])),commission:$t(),lastVote:$t(),rootSlot:Le($t())});Nr(be({current:Oe(jx),delinquent:Oe(jx)}));const XV=di([Gr("processed"),Gr("confirmed"),Gr("finalized")]),JV=be({slot:$t(),confirmations:Le($t()),err:iu,confirmationStatus:He(XV)});Fi(Oe(Le(JV))),Nr($t());const yk=be({accountKey:gn,writableIndexes:Oe($t()),readonlyIndexes:Oe($t())}),Cm=be({signatures:Oe(Me()),message:be({accountKeys:Oe(Me()),header:be({numRequiredSignatures:$t(),numReadonlySignedAccounts:$t(),numReadonlyUnsignedAccounts:$t()}),instructions:Oe(be({accounts:Oe($t()),data:Me(),programIdIndex:$t()})),recentBlockhash:Me(),addressTableLookups:He(Oe(yk))})}),bk=be({pubkey:gn,signer:Yo(),writable:Yo(),source:He(di([Gr("transaction"),Gr("lookupTable")]))}),Kx=be({accountKeys:Oe(bk),signatures:Oe(Me())}),$x=be({parsed:Hh(),program:Me(),programId:gn}),Hx=be({accounts:Oe(gn),data:Me(),programId:gn}),wk=Vh(di([Hx,$x]),di([be({parsed:Hh(),program:Me(),programId:Me()}),be({accounts:Oe(Me()),data:Me(),programId:Me()})]),r=>Nd(r,"accounts"in r?Hx:$x)),Vx=be({signatures:Oe(Me()),message:be({accountKeys:Oe(bk),instructions:Oe(wk),recentBlockhash:Me(),addressTableLookups:He(Le(Oe(yk)))})}),Fl=be({accountIndex:$t(),mint:Me(),owner:He(Me()),uiTokenAmount:HV}),xk=be({writable:Oe(gn),readonly:Oe(gn)}),R0=be({err:iu,fee:$t(),innerInstructions:He(Le(Oe(be({index:$t(),instructions:Oe(be({accounts:Oe($t()),data:Me(),programIdIndex:$t()}))})))),preBalances:Oe($t()),postBalances:Oe($t()),logMessages:He(Le(Oe(Me()))),preTokenBalances:He(Le(Oe(Fl))),postTokenBalances:He(Le(Oe(Fl))),loadedAddresses:He(xk),computeUnitsConsumed:He($t())}),Tm=be({err:iu,fee:$t(),innerInstructions:He(Le(Oe(be({index:$t(),instructions:Oe(wk)})))),preBalances:Oe($t()),postBalances:Oe($t()),logMessages:He(Le(Oe(Me()))),preTokenBalances:He(Le(Oe(Fl))),postTokenBalances:He(Le(Oe(Fl))),loadedAddresses:He(xk),computeUnitsConsumed:He($t())}),wu=di([Gr(0),Gr("legacy")]),ya=be({pubkey:Me(),lamports:$t(),postBalance:Le($t()),rewardType:Le(Me()),commission:He(Le($t()))});Nr(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:$t(),transactions:Oe(be({transaction:Cm,meta:Le(R0),version:He(wu)})),rewards:He(Oe(ya)),blockTime:Le($t()),blockHeight:Le($t())}))),Nr(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:$t(),rewards:He(Oe(ya)),blockTime:Le($t()),blockHeight:Le($t())}))),Nr(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:$t(),transactions:Oe(be({transaction:Kx,meta:Le(R0),version:He(wu)})),rewards:He(Oe(ya)),blockTime:Le($t()),blockHeight:Le($t())}))),Nr(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:$t(),transactions:Oe(be({transaction:Vx,meta:Le(Tm),version:He(wu)})),rewards:He(Oe(ya)),blockTime:Le($t()),blockHeight:Le($t())}))),Nr(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:$t(),transactions:Oe(be({transaction:Kx,meta:Le(Tm),version:He(wu)})),rewards:He(Oe(ya)),blockTime:Le($t()),blockHeight:Le($t())}))),Nr(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:$t(),rewards:He(Oe(ya)),blockTime:Le($t()),blockHeight:Le($t())}))),Nr(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:$t(),transactions:Oe(be({transaction:Cm,meta:Le(R0)})),rewards:He(Oe(ya)),blockTime:Le($t())}))),Nr(Le(be({blockhash:Me(),previousBlockhash:Me(),parentSlot:$t(),signatures:Oe(Me()),blockTime:Le($t())}))),Nr(Le(be({slot:$t(),meta:R0,blockTime:He(Le($t())),transaction:Cm,version:He(wu)}))),Nr(Le(be({slot:$t(),transaction:Vx,meta:Le(Tm),blockTime:He(Le($t())),version:He(wu)}))),Fi(be({blockhash:Me(),feeCalculator:be({lamportsPerSignature:$t()})})),Fi(be({blockhash:Me(),lastValidBlockHeight:$t()})),Fi(Yo()),Nr(Oe(be({slot:$t(),numTransactions:$t(),numSlots:$t(),samplePeriodSecs:$t()}))),Fi(Le(be({feeCalculator:be({lamportsPerSignature:$t()})}))),Nr(Me()),Nr(Me());const QV=be({err:iu,logs:Oe(Me()),signature:Me()});var Zx;be({result:zd(QV),subscription:$t()}),Object.freeze({CreateLookupTable:{index:0,layout:je([Ke("instruction"),Qu("recentSlot"),cn("bumpSeed")])},FreezeLookupTable:{index:1,layout:je([Ke("instruction")])},ExtendLookupTable:{index:2,layout:je([Ke("instruction"),Qu(),qa(kr(),Va(Ke(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:je([Ke("instruction")])},CloseLookupTable:{index:4,layout:je([Ke("instruction")])}}),new lr("AddressLookupTab1e1111111111111111111111111"),Object.freeze({RequestUnits:{index:0,layout:je([cn("instruction"),Ke("units"),Ke("additionalFee")])},RequestHeapFrame:{index:1,layout:je([cn("instruction"),Ke("bytes")])},SetComputeUnitLimit:{index:2,layout:je([cn("instruction"),Ke("units")])},SetComputeUnitPrice:{index:3,layout:je([cn("instruction"),Qu("microLamports")])}}),new lr("ComputeBudget111111111111111111111111111111"),je([cn("numSignatures"),cn("padding"),Ti("signatureOffset"),Ti("signatureInstructionIndex"),Ti("publicKeyOffset"),Ti("publicKeyInstructionIndex"),Ti("messageDataOffset"),Ti("messageDataSize"),Ti("messageInstructionIndex")]),new lr("Ed25519SigVerify111111111111111111111111111"),zv.utils.isValidPrivateKey,zv.getPublicKey,je([cn("numSignatures"),Ti("signatureOffset"),cn("signatureInstructionIndex"),Ti("ethAddressOffset"),cn("ethAddressInstructionIndex"),Ti("messageDataOffset"),Ti("messageDataSize"),cn("messageInstructionIndex"),yf(20,"ethAddress"),yf(64,"signature"),cn("recoveryId")]),new lr("KeccakSecp256k11111111111111111111111111111"),new lr("StakeConfig11111111111111111111111111111111");class Wx{constructor(t,e,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=e,this.custodian=n}}Zx=Wx,Wx.default=new Zx(0,0,lr.default),Object.freeze({Initialize:{index:0,layout:je([Ke("instruction"),((r="authorized")=>je([kr("staker"),kr("withdrawer")],r))(),((r="lockup")=>je([Ei("unixTimestamp"),Ei("epoch"),kr("custodian")],r))()])},Authorize:{index:1,layout:je([Ke("instruction"),kr("newAuthorized"),Ke("stakeAuthorizationType")])},Delegate:{index:2,layout:je([Ke("instruction")])},Split:{index:3,layout:je([Ke("instruction"),Ei("lamports")])},Withdraw:{index:4,layout:je([Ke("instruction"),Ei("lamports")])},Deactivate:{index:5,layout:je([Ke("instruction")])},Merge:{index:7,layout:je([Ke("instruction")])},AuthorizeWithSeed:{index:8,layout:je([Ke("instruction"),kr("newAuthorized"),Ke("stakeAuthorizationType"),Tu("authoritySeed"),kr("authorityOwner")])}}),new lr("Stake11111111111111111111111111111111111111"),Object.freeze({InitializeAccount:{index:0,layout:je([Ke("instruction"),((r="voteInit")=>je([kr("nodePubkey"),kr("authorizedVoter"),kr("authorizedWithdrawer"),cn("commission")],r))()])},Authorize:{index:1,layout:je([Ke("instruction"),kr("newAuthorized"),Ke("voteAuthorizationType")])},Withdraw:{index:3,layout:je([Ke("instruction"),Ei("lamports")])},AuthorizeWithSeed:{index:10,layout:je([Ke("instruction"),((r="voteAuthorizeWithSeedArgs")=>je([Ke("voteAuthorizationType"),kr("currentAuthorityDerivedKeyOwnerPubkey"),Tu("currentAuthorityDerivedKeySeed"),kr("newAuthorized")],r))()])}}),new lr("Vote111111111111111111111111111111111111111"),new lr("Va1idator1nfo111111111111111111111111111111"),be({name:Me(),website:He(Me()),details:He(Me()),keybaseUsername:He(Me())}),new lr("Vote111111111111111111111111111111111111111"),je([kr("nodePubkey"),kr("authorizedWithdrawer"),cn("commission"),Bn(),qa(je([Bn("slot"),Ke("confirmationCount")]),Va(Ke(),-8),"votes"),cn("rootSlotValid"),Bn("rootSlot"),Bn(),qa(je([Bn("epoch"),kr("authorizedVoter")]),Va(Ke(),-8),"authorizedVoters"),je([qa(je([kr("authorizedPubkey"),Bn("epochOfLastAuthorizedSwitch"),Bn("targetEpoch")]),32,"buf"),Bn("idx"),cn("isEmpty")],"priorVoters"),Bn(),qa(je([Bn("epoch"),Bn("credits"),Bn("prevCredits")]),Va(Ke(),-8),"epochCredits"),je([Bn("slot"),Bn("timestamp")],"lastTimestamp")]);var C0,tZ=(C0=function(r,t){return C0=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,n){e.__proto__=n}||function(e,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])},C0(r,t)},function(r,t){if(typeof t!="function"&&t!==null)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function e(){this.constructor=r}C0(r,t),r.prototype=t===null?Object.create(t):(e.prototype=t.prototype,new e)});(function(r){function t(e,n){var s="Invalid schema: ".concat(JSON.stringify(e)," expected ").concat(n);return r.call(this,s)||this}return tZ(t,r),t})(Error);const Gx=new lr("HP3D4D1ZCmohQGFVms2SS4LCANgJyksBf5s1F77FuFjZ");lr.findProgramAddressSync([Gx.toBuffer()],Gx);var Yx;(function(r){r[r.None=0]="None",r[r.Solana=1]="Solana",r[r.Ethereum=2]="Ethereum",r[r.UnverifiedSolana=3]="UnverifiedSolana"})(Yx||(Yx={}));var cr;(function(r){r.IPFS="IPFS",r.ARWV="ARWV",r.SOL="SOL",r.ETH="ETH",r.BTC="BTC",r.LTC="LTC",r.DOGE="DOGE",r.Email="email",r.Url="url",r.Discord="discord",r.Github="github",r.Reddit="reddit",r.Twitter="twitter",r.Telegram="telegram",r.Pic="pic",r.SHDW="SHDW",r.POINT="POINT",r.BSC="BSC",r.Injective="INJ",r.Backpack="backpack",r.A="A",r.AAAA="AAAA",r.CNAME="CNAME",r.TXT="TXT",r.Background="background"})(cr||(cr={}));cr.SOL,cr.ETH,cr.BSC,cr.Injective,cr.A,cr.AAAA,cr.Background;var Xx;(function(r){r[r.V1=1]="V1",r[r.V2=2]="V2"})(Xx||(Xx={}));var eZ="ABAOAAAAAACwiAAAAYkHdvjtnH+IFkUYxx/v3vPe7uw8UkjsD43ChKICDQsT3iIJy4gSiZAjkn5JUFlaiFmjccT9ESkpGBGVIlQgWSkY/QDBoMgrQv0jRJDAfkCXhUmgRX23d4ebnndmd3Z3ZnfVeeDDzM7MPs8zv57Zd2+5hd1Ed4ClYAisBuuUsqLpMHgJjIBNFu1fBW8l1O8AO8Ee8Cn4HIyCg+CI0u4Y+AmMgVPgDOhuEHWBPjAZXAy2gjfA9kb73hlx+i7SK8AHYDf4BOwHB8AoOAyOguPgB/ArOKlcnwHdPe32/Uin9LTvvwTph0gv62nbubKnXT+nZ1z/DcjfFF8vQno7uEaxH923BGVXN9v5Zcgvj/VFPIT8Y/H1k0jXxPn1SEfARjBdab8V+TfB22CXUh5xd3OcZTH3g6di1LZJbLNs55q96M9n4J9Gm6hsfzQvcT8fbfy//TyUf8vG4Lses/5jcd2PSE/IcQan4/o/UXYadE0kaoJBMG1ivNbidNbETr1XoWyuplwyHFN0fFai/8/EY7BIKY/68EpCvwP+mc/m/2vNGnBhp1eZ51bCmgsEAoFAIBAIBAKBQKAO3Irfrg3lfc4qi/cXd+Kee5TfvAd6ieY0ie5D2cNx+eNInwZLmu33gWuRn4/8C3H9CNJNYEt8/TrS35HuSPktvRP1z0LPOvAceB4IsB5saIa6UBfqQl2oc123AjwBVjWrP7MCgcC5y/ue/56yqXv87+qcIU2Z+ny8tuHHpyxsvrDNITDXgqkDRJcPdJY/wMo24/oQmDqZaPHkdplAuhv8ApqDRDeCVj/OAvD9BUSX9qF8Qpt7lTxnZ7+5TmVtrGMM7XchP3sS0SNgGzg4yU5HIBAIBM5NfsO5QDgfjuM54STOw7/Az/F3QtfhfF4Qn9F/gxMouxm/WU7F9afBQuUM7+rtPF+jb0b6ese/I7sI+emadhEzUT5bqbsW+esNbSMWoG6hWo/8gOLPUqUu+v5rKEHX8oS6iEXQexd7XlmBe1aCNWAp6kSsYyjHc82Liv2Xkd/C/HkN1w/Geren+KryToa2PtlQg2c9zijGZnGJ9kaibzZh84jmmfx4TeYpK9H3usMKqxnDCWxsdLY/3ygy9h+l/LYbYHtuXw2/rfsSPo0a/Jrn6PvPrzL2+7CmfV88lkc9j+F7cRzYU4N48DF8uA3n/T7Fly9q4Jdvoth0uLf9LORC11hvO/0D6RnQfRa99+2Hr1NS/M26VvfEe2jaWTAOvG8zzgKf8zCrYL++qUEfbumeQAjTVnQp+QmW99gQpDoJ4+9uHZe5/l3OW/M8x6WUZaduUvUc5p13NTXlz3VpGbCVrGNe5zOnjvGlrDWY1IdWShuuQ9fWh6h+VSV1Wit1lvNhHFz1zeUYtCg5ntvOSStDW5cITRnF5RJ+rcasJHExztwu910tl6LzLYsvuvvzilB0mvSaxt/V+SY0EMurfkjbrTjfInf+FJGkNdzSlOukZaDo3snqs7RZpqj2Gx7sS52D5O79k+93W2W/T3NhQxe3VeF16pwn4eI8qev7Sl1s0PnPy5PalSV57Pp6XuDxrypR9wBR8nOCzm/eXuYp5d4s/lV1XvL+lG2b+2AaQ1nPr23Hrc7z0WT5qvZL0v7QtdX5zdu6HMei+gV1ri8et4XSVpCfdeB7fRWNRy79UP0RCT4Jyre/88bbKsQUawUrV69dxjd+nlXxbCKos79pz1BpOqucz0gEdZ5hMk+aa7Wdy/7xZ5Yqhc+nyHivrkyQ/reM7tziuFojfM7zxtq0505XYutvHrtVnzNl2ONrTGdPkLv9ZjNHOoShnCh5nLLYKOKfK4qK7bjx/gqyj9lFJc2Wz/HIqyMSYaGnqM8+xp6vB1/6feg22UmLFUno1rurvelz7yT1UVfORW3L7+d6fMcAXdzxIVK3TNNioZpSyj2242izpky6y5S0fpr6q5ZXJT7O1qrmQRVB+rkQ1Dk3vvYttyGoc+51/mUVkYLtXvTx7MCvbUnzW2czyR8pql4XUlbcN9l1pSfPfOl0JV2bylyKoM4959sHQfr9Vpbk2V8u4ry0ndcvH5I1xggP9qVem/PHZL+qeGLrc945tLnHtG/LEtdjr4urxMpM92X1RZDd+pLtsorUydeCaiuvbtdSpQ9l2M4SU01nvI1e35L3uS5Jlw8pe1ykCKo2JtrGK9O9ujOlimcD6Y9LEWQ+7019d2VDLVPrTCLrsvjsQ1TfJVJM12pZmm5b4Xptx6HM9SpFkP2c6drJa5/iSr+pD7r+CNLvATVfpST1RYog/fwKTdsyxLVNQfnWrkyziGltJK2hLLptzjHXIsh+/HytmyQfpPA5VNtzXWWLzbiVsc9sbWSJ7UWE69KNh6v9kya2c6TzMa0fwpD37TtvQ6wuiw9CA9cny33Mj2pLte9Kp6996HO/83HPQ5r+ov5mvU9Qte/fIrGJP7axPO/9eXX6kjLPKZNd17iyZdOHLP31JSbfXY6hC59c+ZZ136TZ9SFlj6cvmVkSrkSQn3NG5KBqEVSeH6Ji/vvnhFWjSlfFNDwzyMgqLvvKxXffbeASBWo+Zj4p2x6TfwE=",rZ="AAACAAAAAACAOAAAAbYBSf7t2S1IBEEYBuDVDZ7FYrQMNsFiu3hgEYOI0SCXRIUrB8JhEZtgs5gEg1GMFk02m82oGI02m+9xezCOczv/uwv3fvAwc/PzfXOzcdqzWdaBDdiGPdiHdjE+DS3RNDuCfsn8idQ/g3OH3BdwKf0e96/gumTfYcncLdzBPTzAo+RZ+f0Cr/AG7/AJX4738x1wtz9FO5PX/50n6UXMNdfg/0lERERERERERERERETpdedHBvDRql4nq0cXtW9af98qdRby0Vvp8K4W0V+C5Xw0t4J2bfjeBp3cnEu1brnnCTYNa7eKdz91XP7WO9Lb4GqRb7cY6xbtAdqeVOsY/QGcevw/tb6OT85YhvfKYEx9CMuxKsKnrs+eJtVInVvHJ0eVYVvTZk2siFVLOCjb61PTZX3MdVWEyP7fjzpmMxdzTyq2Ebue6x61nXRGnzndWpf1an7dXmGYE4Y1ptqqKsK1nu26Ju0ty+maV2Rpvk+qnDZjKUIobUiesdAQE/jmCTmHmsskpFZsVYbtmXRcaoSGUPomunW2derQhDPFjtT1Q/eb8vnm990fq35oHVt11bU9m89c7DNI8Qs=",hb=0,_k=-3;function dh(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function nZ(r,t){this.source=r,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=t,this.destLen=0,this.ltree=new dh,this.dtree=new dh}var Mk=new dh,Ek=new dh,Fv=new Uint8Array(30),jv=new Uint16Array(30),Ak=new Uint8Array(30),Sk=new Uint16Array(30),iZ=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Jx=new dh,Ao=new Uint8Array(320);function Qx(r,t,e,n){var s,i;for(s=0;s>>=1,t}function Ro(r,t,e){if(!t)return e;for(;r.bitcount<24;)r.tag|=r.source[r.sourceIndex++]<>>16-t;return r.tag>>>=t,r.bitcount-=t,n+e}function Kv(r,t){for(;r.bitcount<24;)r.tag|=r.source[r.sourceIndex++]<>>=1,++s,e+=t.table[s],n-=t.table[s];while(n>=0);return r.tag=i,r.bitcount-=s,t.trans[e+n]}function sZ(r,t,e){var n,s,i,c,l,p;for(n=Ro(r,5,257),s=Ro(r,5,1),i=Ro(r,4,4),c=0;c<19;++c)Ao[c]=0;for(c=0;c8;)r.sourceIndex--,r.bitcount-=8;if((t=256*(t=r.source[r.sourceIndex+1])+r.source[r.sourceIndex])!==(65535&~(256*r.source[r.sourceIndex+3]+r.source[r.sourceIndex+2])))return _k;for(r.sourceIndex+=4,e=t;e;--e)r.dest[r.destLen++]=r.source[r.sourceIndex++];return r.bitcount=0,hb}(function(r,t){var e;for(e=0;e<7;++e)r.table[e]=0;for(r.table[7]=24,r.table[8]=152,r.table[9]=112,e=0;e<24;++e)r.trans[e]=256+e;for(e=0;e<144;++e)r.trans[24+e]=e;for(e=0;e<8;++e)r.trans[168+e]=280+e;for(e=0;e<112;++e)r.trans[176+e]=144+e;for(e=0;e<5;++e)t.table[e]=0;for(t.table[5]=32,e=0;e<32;++e)t.trans[e]=e})(Mk,Ek),Qx(Fv,jv,4,3),Qx(Ak,Sk,2,1),Fv[28]=0,jv[28]=258;var uZ=function(r,t){var e,n,s=new nZ(r,t);do{switch(e=oZ(s),Ro(s,2,0)){case 0:n=aZ(s);break;case 1:n=e7(s,Mk,Ek);break;case 2:sZ(s,s.ltree,s.dtree),n=e7(s,s.ltree,s.dtree);break;default:n=_k}if(n!==hb)throw new Error("Data error")}while(!e);return s.destLen{let n=r[t];r[t]=r[e],r[e]=n};var cZ={swap32LE:r=>{fZ&&(t=>{const e=t.length;for(let n=0;n1114111?this.errorValue:r<55296||r>56319&&r<=65535?(t=(this.data[r>>5]<<2)+(31&r),this.data[t]):r<=65535?(t=(this.data[2048+(r-55296>>5)]<<2)+(31&r),this.data[t]):r>11)],t=this.data[t+(r>>5&63)],t=(t<<2)+(31&r),this.data[t]):this.data[this.data.length-4]}},kk={exports:{}};kk.exports=function(){var r="3.7.5",t=r,e=typeof atob=="function",n=typeof btoa=="function",s=typeof Zt.Buffer=="function",i=typeof TextDecoder=="function"?new TextDecoder:void 0,c=typeof TextEncoder=="function"?new TextEncoder:void 0,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",p=Array.prototype.slice.call(l),m=function(q){var it={};return q.forEach(function(at,Bt){return it[at]=Bt}),it}(p),v=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,_=String.fromCharCode.bind(String),E=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(q){return new Uint8Array(Array.prototype.slice.call(q,0))},w=function(q){return q.replace(/=/g,"").replace(/[+\/]/g,function(it){return it=="+"?"-":"_"})},x=function(q){return q.replace(/[^A-Za-z0-9\+\/]/g,"")},A=function(q){for(var it,at,Bt,yt,pt="",Ft=q.length%3,lt=0;lt255||(Bt=q.charCodeAt(lt++))>255||(yt=q.charCodeAt(lt++))>255)throw new TypeError("invalid character found");pt+=p[(it=at<<16|Bt<<8|yt)>>18&63]+p[it>>12&63]+p[it>>6&63]+p[63&it]}return Ft?pt.slice(0,Ft-3)+"===".substring(Ft):pt},B=n?function(q){return btoa(q)}:s?function(q){return Zt.Buffer.from(q,"binary").toString("base64")}:A,P=s?function(q){return Zt.Buffer.from(q).toString("base64")}:function(q){for(var it=4096,at=[],Bt=0,yt=q.length;Bt>>6)+_(128|63&it):_(224|it>>>12&15)+_(128|it>>>6&63)+_(128|63&it);var it=65536+1024*(q.charCodeAt(0)-55296)+(q.charCodeAt(1)-56320);return _(240|it>>>18&7)+_(128|it>>>12&63)+_(128|it>>>6&63)+_(128|63&it)},O=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,z=function(q){return q.replace(O,C)},H=s?function(q){return Zt.Buffer.from(q,"utf8").toString("base64")}:c?function(q){return P(c.encode(q))}:function(q){return B(z(q))},tt=function(q,it){return it===void 0&&(it=!1),it?w(H(q)):H(q)},nt=function(q){return tt(q,!0)},G=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,M=function(q){switch(q.length){case 4:var it=((7&q.charCodeAt(0))<<18|(63&q.charCodeAt(1))<<12|(63&q.charCodeAt(2))<<6|63&q.charCodeAt(3))-65536;return _(55296+(it>>>10))+_(56320+(1023&it));case 3:return _((15&q.charCodeAt(0))<<12|(63&q.charCodeAt(1))<<6|63&q.charCodeAt(2));default:return _((31&q.charCodeAt(0))<<6|63&q.charCodeAt(1))}},d=function(q){return q.replace(G,M)},o=function(q){if(q=q.replace(/\s+/g,""),!v.test(q))throw new TypeError("malformed base64.");q+="==".slice(2-(3&q.length));for(var it,at,Bt,yt="",pt=0;pt>16&255):Bt===64?_(it>>16&255,it>>8&255):_(it>>16&255,it>>8&255,255&it);return yt},a=e?function(q){return atob(x(q))}:s?function(q){return Zt.Buffer.from(q,"base64").toString("binary")}:o,f=s?function(q){return E(Zt.Buffer.from(q,"base64"))}:function(q){return E(a(q).split("").map(function(it){return it.charCodeAt(0)}))},h=function(q){return f(S(q))},g=s?function(q){return Zt.Buffer.from(q,"base64").toString("utf8")}:i?function(q){return i.decode(f(q))}:function(q){return d(a(q))},S=function(q){return x(q.replace(/[-_]/g,function(it){return it=="-"?"+":"/"}))},I=function(q){return g(S(q))},y=function(q){if(typeof q!="string")return!1;var it=q.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(it)||!/[^\s0-9a-zA-Z\-_]/.test(it)},u=function(q){return{value:q,enumerable:!1,writable:!0,configurable:!0}},b=function(){var q=function(it,at){return Object.defineProperty(String.prototype,it,u(at))};q("fromBase64",function(){return I(this)}),q("toBase64",function(it){return tt(this,it)}),q("toBase64URI",function(){return tt(this,!0)}),q("toBase64URL",function(){return tt(this,!0)}),q("toUint8Array",function(){return h(this)})},D=function(){var q=function(it,at){return Object.defineProperty(Uint8Array.prototype,it,u(at))};q("toBase64",function(it){return R(this,it)}),q("toBase64URI",function(){return R(this,!0)}),q("toBase64URL",function(){return R(this,!0)})},Z=function(){b(),D()},F={version:r,VERSION:t,atob:a,atobPolyfill:o,btoa:B,btoaPolyfill:A,fromBase64:I,toBase64:tt,encode:tt,encodeURI:nt,encodeURL:nt,utob:z,btou:d,decode:I,isValid:y,fromUint8Array:R,toUint8Array:h,extendString:b,extendUint8Array:D,extendBuiltins:Z,Base64:{}};return Object.keys(F).forEach(function(q){return F.Base64[q]=F[q]}),F}();const Ar={Other:0,CR:1,LF:2,Control:4,Extend:8,ZWJ:16,Regional_Indicator:32,Prepend:64,SpacingMark:128,L:256,V:512,T:1024,LV:2048,LVT:4096,Extended_Pictographic:8192},dZ=eZ,pZ=rZ,Ik=lZ,Bk=kk.exports.Base64,mZ=new Ik(Bk.toUint8Array(dZ)),vZ=new Ik(Bk.toUint8Array(pZ));function un(r,t){return(r&t)!=0}const T0=0,Om=1,Um=2;function gZ(r,t){const e=r.length;let n=0,s=T0;for(let i=t;i+165535?2:1,e.push(s)}for(let s=0;s{const t=PK+r,e=BK(Ae.Buffer.from(t,"utf8")).slice(2);return Ae.Buffer.from(e,"hex")},o7=(r,t,e)=>{const n=[r];t?n.push(t.toBuffer()):n.push(Ae.Buffer.alloc(32)),e?n.push(e.toBuffer()):n.push(Ae.Buffer.alloc(32));const[s]=Xt.findProgramAddressSync(n,TA);return s},Pk=r=>{switch(bZ(r).length){case 1:return 750;case 2:return 700;case 3:return 640;case 4:return 160;default:return 20}};var Es={},Lu={};function s7(r,t,e,n,s){var i=(1<=n;)l-=n,e[p]=c>>l&i,p+=1}),s)l>0&&(e[p]=c<=t)throw new Error("Excessive padding: ".concat(l," (max ").concat(t-1," allowed)"));if(c%(1<8||t<1)throw new RangeError("Invalid bits per element; 1 to 8 expected");return s7(r,t,e,8,!1),e},Lu.toBits=function(r,t,e){if(t>8||t<1)throw new RangeError("Invalid bits per element; 1 to 8 expected");return s7(r,8,e,t,!0),e};var eo={};Object.defineProperty(eo,"__esModule",{value:!0}),eo.CHECKSUM_LENGTH=void 0,eo.createChecksum=function(r,t){var e;switch(t){case"bech32":e=1;break;case"bech32m":e=a7;break;default:throw Error("Invalid encoding value: ".concat(t,"; expected bech32 or bech32m"))}for(var n=c7(r)^e,s=0;s>i&31}},eo.decode=l7,eo.decodeWithPrefix=function(r,t){var e=t.length+2*r.length+1,n=(0,Rk.createBitArray)(e);return h7(r,n.subarray(0,2*r.length+1)),l7(t,n.subarray(2*r.length+1)),n},eo.detectCase=function(r){for(var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"message",e=!1,n=!1,s=0;sf7)throw new TypeError("Invalid char in ".concat(t,": ").concat(i,"; ")+"should be in ASCII range ".concat(u7,"-").concat(f7));n=n||i>=65&&i<=90,e=e||i>=97&&i<=122}if(e&&n)throw new TypeError("Mixed-case ".concat(t));return n?"upper":e?"lower":null},eo.encode=function(r){return r.reduce(function(t,e){return t+$v[e]},"")},eo.expandPrefix=h7,eo.verifyChecksum=function(r){switch(c7(r)){case 1:return"bech32";case a7:return"bech32m";default:return}};var Rk=Lu,$v="qpzry9x8gf2tvdw0s3jn54khce6mua7l",a7=734539939,u7=33,f7=126,Hv=6;eo.CHECKSUM_LENGTH=Hv;var wZ=function(){for(var r=new Map,t=0;t<$v.length;t+=1)r.set($v[t],t);return r}(),xZ=[996825010,642813549,513874426,1027748829,705979059];function c7(r){return r.reduce(function(t,e){var n=t>>25,s=(33554431&t)<<5^e;return xZ.reduce(function(i,c,l){return n>>l&1?i^c:i},s)},1)}function h7(r,t){for(var e=0;e>5,t[e+r.length+1]=31&n}t[r.length]=0}function l7(r,t){for(var e=t||(0,Rk.createBitArray)(r.length),n=0;n2&&arguments[2]!==void 0?arguments[2]:"bech32";return pb(r,lb(t),e)};Es.encode5BitArray=pb,Es.from5BitArray=db,Es.to5BitArray=lb;var ph=Lu,zi=eo;function d7(r,t){for(var e=0;e2&&arguments[2]!==void 0?arguments[2]:"bech32",s=2*r.length+1+t.length+zi.CHECKSUM_LENGTH;if(s-r.length>jl)throw new Error("Message to be produced is too long (max ".concat(jl," supported)"));var i=(e=(0,zi.detectCase)(r,"prefix"))!==null&&e!==void 0?e:"lower",c=(0,ph.createBitArray)(s);(0,zi.expandPrefix)(r.toLowerCase(),c.subarray(0,2*r.length+1)),c.subarray(2*r.length+1,c.length-zi.CHECKSUM_LENGTH).set(t),(0,zi.createChecksum)(c,n);var l=(0,zi.encode)(c.subarray(2*r.length+1));return i==="upper"&&(l=l.toUpperCase()),"".concat(r,"1").concat(l)}function mb(r){if(r.length>jl)throw new TypeError("Message too long; max ".concat(jl," expected"));(0,zi.detectCase)(r);var t=r.toLowerCase(),e=t.lastIndexOf("1");if(e<0)throw new Error('No separator char ("1") found');if(e>r.length-zi.CHECKSUM_LENGTH-1)throw new Error("Data part of the message too short (at least ".concat(zi.CHECKSUM_LENGTH," chars expected)"));var n=t.substring(0,e),s=(0,zi.decodeWithPrefix)(n,t.substring(e+1)),i=(0,zi.verifyChecksum)(s);if(i===void 0)throw new Error("Invalid checksum");return{prefix:n,encoding:i,data:s.subarray(2*n.length+1,s.length-zi.CHECKSUM_LENGTH)}}var _Z=function(){function r(s,i,c){if(function(l,p){if(!(l instanceof p))throw new TypeError("Cannot call a class as a function")}(this,r),s!=="bc"&&s!=="tb")throw new Error('Invalid human-readable prefix, "bc" or "tb" expected');if(i<0||i>16)throw new RangeError("Invalid scriptVersion, value in range [0, 16] expected");if(c.length<2||c.length>40)throw new RangeError("Invalid script length: expected 2 to 40 bytes");if(i===0&&c.length!==20&&c.length!==32)throw new Error("Invalid v0 script length: expected 20 or 32 bytes");this.prefix=s,this.scriptVersion=i,this.data=c}var t,e,n;return t=r,e=[{key:"type",value:function(){if(this.scriptVersion===0)switch(this.data.length){case 20:return"p2wpkh";case 32:return"p2wsh";default:return}}},{key:"encode",value:function(){var s=Math.ceil(8*this.data.length/5),i=(0,ph.createBitArray)(s+1);i[0]=this.scriptVersion,lb(this.data,i.subarray(1));var c=this.scriptVersion===0?"bech32":"bech32m";return pb(this.prefix,i,c)}}],n=[{key:"decode",value:function(s){var i=mb(s),c=i.prefix,l=i.data,p=i.encoding;if(c!=="bc"&&c!=="tb")throw new Error('Invalid human-readable prefix, "bc" or "tb" expected');var m=l[0];if(m===0&&p!=="bech32")throw Error("Unexpected encoding ".concat(p," used for version 0 script"));if(m>0&&p!=="bech32m")throw Error("Unexpected encoding ".concat(p," used for version ").concat(m," script"));return new this(c,m,db(l.subarray(1)))}}],e&&d7(t.prototype,e),n&&d7(t,n),Object.defineProperty(t,"prototype",{writable:!1}),r}();Es.BitcoinAddress=_Z;var Ck={exports:{}};(function(r){(function(t){const e="(0?\\d+|0x[a-f0-9]+)",n={fourOctet:new RegExp(`^${e}\\.${e}\\.${e}\\.${e}$`,"i"),threeOctet:new RegExp(`^${e}\\.${e}\\.${e}$`,"i"),twoOctet:new RegExp(`^${e}\\.${e}$`,"i"),longValue:new RegExp(`^${e}$`,"i")},s=new RegExp("^0[0-7]+$","i"),i=new RegExp("^0x[a-f0-9]+$","i"),c="%[0-9a-z]{1,}",l="(?:[0-9a-f]+::?)+",p={zoneIndex:new RegExp(c,"i"),native:new RegExp(`^(::)?(${l})?([0-9a-f]+)?(::)?(${c})?$`,"i"),deprecatedTransitional:new RegExp(`^(?:::)(${e}\\.${e}\\.${e}\\.${e}(${c})?)$`,"i"),transitional:new RegExp(`^((?:${l})|(?:::)(?:${l})?)${e}\\.${e}\\.${e}\\.${e}(${c})?$`,"i")};function m(x,A){if(x.indexOf("::")!==x.lastIndexOf("::"))return null;let B,P,R=0,C=-1,O=(x.match(p.zoneIndex)||[])[0];for(O&&(O=O.substring(1),x=x.replace(/%.+$/,""));(C=x.indexOf(":",C+1))>=0;)R++;if(x.substr(0,2)==="::"&&R--,x.substr(-2,2)==="::"&&R--,R>A)return null;for(P=A-R,B=":";P--;)B+="0:";return(x=x.replace("::",B))[0]===":"&&(x=x.slice(1)),x[x.length-1]===":"&&(x=x.slice(0,-1)),A=function(){const z=x.split(":"),H=[];for(let tt=0;tt0;){if(R=B-P,R<0&&(R=0),x[C]>>R!=A[C]>>R)return!1;P-=B,C+=1}return!0}function _(x){if(i.test(x))return parseInt(x,16);if(x[0]==="0"&&!isNaN(parseInt(x[1],10))){if(s.test(x))return parseInt(x,8);throw new Error(`ipaddr: cannot parse ${x} as octal`)}return parseInt(x,10)}function E(x,A){for(;x.length=0;R-=1){if(C=this.octets[R],!(C in P)||(O=P[C],B&&O!==0))return null;O!==8&&(B=!0),A+=O}return 32-A},x.prototype.range=function(){return w.subnetMatch(this,this.SpecialRanges)},x.prototype.toByteArray=function(){return this.octets.slice(0)},x.prototype.toIPv4MappedAddress=function(){return w.IPv6.parse(`::ffff:${this.toString()}`)},x.prototype.toNormalizedString=function(){return this.toString()},x.prototype.toString=function(){return this.octets.join(".")},x}(),w.IPv4.broadcastAddressFromCIDR=function(x){try{const A=this.parseCIDR(x),B=A[0].toByteArray(),P=this.subnetMaskFromPrefixLength(A[1]).toByteArray(),R=[];let C=0;for(;C<4;)R.push(parseInt(B[C],10)|255^parseInt(P[C],10)),C++;return new this(R)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},w.IPv4.isIPv4=function(x){return this.parser(x)!==null},w.IPv4.isValid=function(x){try{return new this(this.parser(x)),!0}catch{return!1}},w.IPv4.isValidFourPartDecimal=function(x){return!(!w.IPv4.isValid(x)||!x.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},w.IPv4.networkAddressFromCIDR=function(x){let A,B,P,R,C;try{for(A=this.parseCIDR(x),P=A[0].toByteArray(),C=this.subnetMaskFromPrefixLength(A[1]).toByteArray(),R=[],B=0;B<4;)R.push(parseInt(P[B],10)&parseInt(C[B],10)),B++;return new this(R)}catch{throw new Error("ipaddr: the address does not have IPv4 CIDR format")}},w.IPv4.parse=function(x){const A=this.parser(x);if(A===null)throw new Error("ipaddr: string is not formatted like an IPv4 Address");return new this(A)},w.IPv4.parseCIDR=function(x){let A;if(A=x.match(/^(.+)\/(\d+)$/)){const B=parseInt(A[2]);if(B>=0&&B<=32){const P=[this.parse(A[1]),B];return Object.defineProperty(P,"toString",{value:function(){return this.join("/")}}),P}}throw new Error("ipaddr: string is not formatted like an IPv4 CIDR range")},w.IPv4.parser=function(x){let A,B,P;if(A=x.match(n.fourOctet))return function(){const R=A.slice(1,6),C=[];for(let O=0;O4294967295||P<0)throw new Error("ipaddr: address outside defined range");return function(){const R=[];let C;for(C=0;C<=24;C+=8)R.push(P>>C&255);return R}().reverse()}return(A=x.match(n.twoOctet))?function(){const R=A.slice(1,4),C=[];if(P=_(R[1]),P>16777215||P<0)throw new Error("ipaddr: address outside defined range");return C.push(_(R[0])),C.push(P>>16&255),C.push(P>>8&255),C.push(255&P),C}():(A=x.match(n.threeOctet))?function(){const R=A.slice(1,5),C=[];if(P=_(R[2]),P>65535||P<0)throw new Error("ipaddr: address outside defined range");return C.push(_(R[0])),C.push(_(R[1])),C.push(P>>8&255),C.push(255&P),C}():null},w.IPv4.subnetMaskFromPrefixLength=function(x){if((x=parseInt(x))<0||x>32)throw new Error("ipaddr: invalid IPv4 prefix length");const A=[0,0,0,0];let B=0;const P=Math.floor(x/8);for(;B=0;O-=1){if(R=this.parts[O],!(R in P)||(C=P[R],B&&C!==0))return null;C!==16&&(B=!0),A+=C}return 128-A},x.prototype.range=function(){return w.subnetMatch(this,this.SpecialRanges)},x.prototype.toByteArray=function(){let A;const B=[],P=this.parts;for(let R=0;R>8),B.push(255&A);return B},x.prototype.toFixedLengthString=function(){const A=(function(){const P=[];for(let R=0;R>8,255&B,P>>8,255&P])},x.prototype.toNormalizedString=function(){const A=(function(){const P=[];for(let R=0;RC&&(R=P.index,C=P[0].length);return C<0?B:`${B.substring(0,R)}::${B.substring(R+C)}`},x.prototype.toString=function(){return this.toRFC5952String()},x}(),w.IPv6.broadcastAddressFromCIDR=function(x){try{const A=this.parseCIDR(x),B=A[0].toByteArray(),P=this.subnetMaskFromPrefixLength(A[1]).toByteArray(),R=[];let C=0;for(;C<16;)R.push(parseInt(B[C],10)|255^parseInt(P[C],10)),C++;return new this(R)}catch(A){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${A})`)}},w.IPv6.isIPv6=function(x){return this.parser(x)!==null},w.IPv6.isValid=function(x){if(typeof x=="string"&&x.indexOf(":")===-1)return!1;try{const A=this.parser(x);return new this(A.parts,A.zoneId),!0}catch{return!1}},w.IPv6.networkAddressFromCIDR=function(x){let A,B,P,R,C;try{for(A=this.parseCIDR(x),P=A[0].toByteArray(),C=this.subnetMaskFromPrefixLength(A[1]).toByteArray(),R=[],B=0;B<16;)R.push(parseInt(P[B],10)&parseInt(C[B],10)),B++;return new this(R)}catch(O){throw new Error(`ipaddr: the address does not have IPv6 CIDR format (${O})`)}},w.IPv6.parse=function(x){const A=this.parser(x);if(A.parts===null)throw new Error("ipaddr: string is not formatted like an IPv6 Address");return new this(A.parts,A.zoneId)},w.IPv6.parseCIDR=function(x){let A,B,P;if((B=x.match(/^(.+)\/(\d+)$/))&&(A=parseInt(B[2]),A>=0&&A<=128))return P=[this.parse(B[1]),A],Object.defineProperty(P,"toString",{value:function(){return this.join("/")}}),P;throw new Error("ipaddr: string is not formatted like an IPv6 CIDR range")},w.IPv6.parser=function(x){let A,B,P,R,C,O;if(P=x.match(p.deprecatedTransitional))return this.parser(`::ffff:${P[1]}`);if(p.native.test(x))return m(x,8);if((P=x.match(p.transitional))&&(O=P[6]||"",A=m(P[1].slice(0,-1)+O,6),A.parts)){for(C=[parseInt(P[2]),parseInt(P[3]),parseInt(P[4]),parseInt(P[5])],B=0;B128)throw new Error("ipaddr: invalid IPv6 prefix length");const A=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];let B=0;const P=Math.floor(x/8);for(;B>24&255,J[X+1]=st>>16&255,J[X+2]=st>>8&255,J[X+3]=255&st,J[X+4]=N>>24&255,J[X+5]=N>>16&255,J[X+6]=N>>8&255,J[X+7]=255&N}function x(J,X,st,N,$){var gt,ft=0;for(gt=0;gt<$;gt++)ft|=J[X+gt]^st[N+gt];return(1&ft-1>>>8)-1}function A(J,X,st,N){return x(J,X,st,N,16)}function B(J,X,st,N){return x(J,X,st,N,32)}function P(J,X,st,N){(function($,gt,ft,mt){for(var vt,At=255&mt[0]|(255&mt[1])<<8|(255&mt[2])<<16|(255&mt[3])<<24,_t=255&ft[0]|(255&ft[1])<<8|(255&ft[2])<<16|(255&ft[3])<<24,Gt=255&ft[4]|(255&ft[5])<<8|(255&ft[6])<<16|(255&ft[7])<<24,Rt=255&ft[8]|(255&ft[9])<<8|(255&ft[10])<<16|(255&ft[11])<<24,wt=255&ft[12]|(255&ft[13])<<8|(255&ft[14])<<16|(255&ft[15])<<24,se=255&mt[4]|(255&mt[5])<<8|(255&mt[6])<<16|(255&mt[7])<<24,Lt=255>[0]|(255>[1])<<8|(255>[2])<<16|(255>[3])<<24,Et=255>[4]|(255>[5])<<8|(255>[6])<<16|(255>[7])<<24,de=255>[8]|(255>[9])<<8|(255>[10])<<16|(255>[11])<<24,Pt=255>[12]|(255>[13])<<8|(255>[14])<<16|(255>[15])<<24,Mt=255&mt[8]|(255&mt[9])<<8|(255&mt[10])<<16|(255&mt[11])<<24,K=255&ft[16]|(255&ft[17])<<8|(255&ft[18])<<16|(255&ft[19])<<24,Y=255&ft[20]|(255&ft[21])<<8|(255&ft[22])<<16|(255&ft[23])<<24,V=255&ft[24]|(255&ft[25])<<8|(255&ft[26])<<16|(255&ft[27])<<24,U=255&ft[28]|(255&ft[29])<<8|(255&ft[30])<<16|(255&ft[31])<<24,W=255&mt[12]|(255&mt[13])<<8|(255&mt[14])<<16|(255&mt[15])<<24,et=At,dt=_t,ut=Gt,ht=Rt,zt=wt,Wt=se,ye=Lt,Yt=Et,pe=de,ve=Pt,ge=Mt,ie=K,ue=Y,fe=V,ce=U,Kt=W,oe=0;oe<20;oe+=2)et^=(vt=(ue^=(vt=(pe^=(vt=(zt^=(vt=et+ue|0)<<7|vt>>>25)+et|0)<<9|vt>>>23)+zt|0)<<13|vt>>>19)+pe|0)<<18|vt>>>14,Wt^=(vt=(dt^=(vt=(fe^=(vt=(ve^=(vt=Wt+dt|0)<<7|vt>>>25)+Wt|0)<<9|vt>>>23)+ve|0)<<13|vt>>>19)+fe|0)<<18|vt>>>14,ge^=(vt=(ye^=(vt=(ut^=(vt=(ce^=(vt=ge+ye|0)<<7|vt>>>25)+ge|0)<<9|vt>>>23)+ce|0)<<13|vt>>>19)+ut|0)<<18|vt>>>14,Kt^=(vt=(ie^=(vt=(Yt^=(vt=(ht^=(vt=Kt+ie|0)<<7|vt>>>25)+Kt|0)<<9|vt>>>23)+ht|0)<<13|vt>>>19)+Yt|0)<<18|vt>>>14,et^=(vt=(ht^=(vt=(ut^=(vt=(dt^=(vt=et+ht|0)<<7|vt>>>25)+et|0)<<9|vt>>>23)+dt|0)<<13|vt>>>19)+ut|0)<<18|vt>>>14,Wt^=(vt=(zt^=(vt=(Yt^=(vt=(ye^=(vt=Wt+zt|0)<<7|vt>>>25)+Wt|0)<<9|vt>>>23)+ye|0)<<13|vt>>>19)+Yt|0)<<18|vt>>>14,ge^=(vt=(ve^=(vt=(pe^=(vt=(ie^=(vt=ge+ve|0)<<7|vt>>>25)+ge|0)<<9|vt>>>23)+ie|0)<<13|vt>>>19)+pe|0)<<18|vt>>>14,Kt^=(vt=(ce^=(vt=(fe^=(vt=(ue^=(vt=Kt+ce|0)<<7|vt>>>25)+Kt|0)<<9|vt>>>23)+ue|0)<<13|vt>>>19)+fe|0)<<18|vt>>>14;et=et+At|0,dt=dt+_t|0,ut=ut+Gt|0,ht=ht+Rt|0,zt=zt+wt|0,Wt=Wt+se|0,ye=ye+Lt|0,Yt=Yt+Et|0,pe=pe+de|0,ve=ve+Pt|0,ge=ge+Mt|0,ie=ie+K|0,ue=ue+Y|0,fe=fe+V|0,ce=ce+U|0,Kt=Kt+W|0,$[0]=et>>>0&255,$[1]=et>>>8&255,$[2]=et>>>16&255,$[3]=et>>>24&255,$[4]=dt>>>0&255,$[5]=dt>>>8&255,$[6]=dt>>>16&255,$[7]=dt>>>24&255,$[8]=ut>>>0&255,$[9]=ut>>>8&255,$[10]=ut>>>16&255,$[11]=ut>>>24&255,$[12]=ht>>>0&255,$[13]=ht>>>8&255,$[14]=ht>>>16&255,$[15]=ht>>>24&255,$[16]=zt>>>0&255,$[17]=zt>>>8&255,$[18]=zt>>>16&255,$[19]=zt>>>24&255,$[20]=Wt>>>0&255,$[21]=Wt>>>8&255,$[22]=Wt>>>16&255,$[23]=Wt>>>24&255,$[24]=ye>>>0&255,$[25]=ye>>>8&255,$[26]=ye>>>16&255,$[27]=ye>>>24&255,$[28]=Yt>>>0&255,$[29]=Yt>>>8&255,$[30]=Yt>>>16&255,$[31]=Yt>>>24&255,$[32]=pe>>>0&255,$[33]=pe>>>8&255,$[34]=pe>>>16&255,$[35]=pe>>>24&255,$[36]=ve>>>0&255,$[37]=ve>>>8&255,$[38]=ve>>>16&255,$[39]=ve>>>24&255,$[40]=ge>>>0&255,$[41]=ge>>>8&255,$[42]=ge>>>16&255,$[43]=ge>>>24&255,$[44]=ie>>>0&255,$[45]=ie>>>8&255,$[46]=ie>>>16&255,$[47]=ie>>>24&255,$[48]=ue>>>0&255,$[49]=ue>>>8&255,$[50]=ue>>>16&255,$[51]=ue>>>24&255,$[52]=fe>>>0&255,$[53]=fe>>>8&255,$[54]=fe>>>16&255,$[55]=fe>>>24&255,$[56]=ce>>>0&255,$[57]=ce>>>8&255,$[58]=ce>>>16&255,$[59]=ce>>>24&255,$[60]=Kt>>>0&255,$[61]=Kt>>>8&255,$[62]=Kt>>>16&255,$[63]=Kt>>>24&255})(J,X,st,N)}function R(J,X,st,N){(function($,gt,ft,mt){for(var vt,At=255&mt[0]|(255&mt[1])<<8|(255&mt[2])<<16|(255&mt[3])<<24,_t=255&ft[0]|(255&ft[1])<<8|(255&ft[2])<<16|(255&ft[3])<<24,Gt=255&ft[4]|(255&ft[5])<<8|(255&ft[6])<<16|(255&ft[7])<<24,Rt=255&ft[8]|(255&ft[9])<<8|(255&ft[10])<<16|(255&ft[11])<<24,wt=255&ft[12]|(255&ft[13])<<8|(255&ft[14])<<16|(255&ft[15])<<24,se=255&mt[4]|(255&mt[5])<<8|(255&mt[6])<<16|(255&mt[7])<<24,Lt=255>[0]|(255>[1])<<8|(255>[2])<<16|(255>[3])<<24,Et=255>[4]|(255>[5])<<8|(255>[6])<<16|(255>[7])<<24,de=255>[8]|(255>[9])<<8|(255>[10])<<16|(255>[11])<<24,Pt=255>[12]|(255>[13])<<8|(255>[14])<<16|(255>[15])<<24,Mt=255&mt[8]|(255&mt[9])<<8|(255&mt[10])<<16|(255&mt[11])<<24,K=255&ft[16]|(255&ft[17])<<8|(255&ft[18])<<16|(255&ft[19])<<24,Y=255&ft[20]|(255&ft[21])<<8|(255&ft[22])<<16|(255&ft[23])<<24,V=255&ft[24]|(255&ft[25])<<8|(255&ft[26])<<16|(255&ft[27])<<24,U=255&ft[28]|(255&ft[29])<<8|(255&ft[30])<<16|(255&ft[31])<<24,W=255&mt[12]|(255&mt[13])<<8|(255&mt[14])<<16|(255&mt[15])<<24,et=0;et<20;et+=2)At^=(vt=(Y^=(vt=(de^=(vt=(wt^=(vt=At+Y|0)<<7|vt>>>25)+At|0)<<9|vt>>>23)+wt|0)<<13|vt>>>19)+de|0)<<18|vt>>>14,se^=(vt=(_t^=(vt=(V^=(vt=(Pt^=(vt=se+_t|0)<<7|vt>>>25)+se|0)<<9|vt>>>23)+Pt|0)<<13|vt>>>19)+V|0)<<18|vt>>>14,Mt^=(vt=(Lt^=(vt=(Gt^=(vt=(U^=(vt=Mt+Lt|0)<<7|vt>>>25)+Mt|0)<<9|vt>>>23)+U|0)<<13|vt>>>19)+Gt|0)<<18|vt>>>14,W^=(vt=(K^=(vt=(Et^=(vt=(Rt^=(vt=W+K|0)<<7|vt>>>25)+W|0)<<9|vt>>>23)+Rt|0)<<13|vt>>>19)+Et|0)<<18|vt>>>14,At^=(vt=(Rt^=(vt=(Gt^=(vt=(_t^=(vt=At+Rt|0)<<7|vt>>>25)+At|0)<<9|vt>>>23)+_t|0)<<13|vt>>>19)+Gt|0)<<18|vt>>>14,se^=(vt=(wt^=(vt=(Et^=(vt=(Lt^=(vt=se+wt|0)<<7|vt>>>25)+se|0)<<9|vt>>>23)+Lt|0)<<13|vt>>>19)+Et|0)<<18|vt>>>14,Mt^=(vt=(Pt^=(vt=(de^=(vt=(K^=(vt=Mt+Pt|0)<<7|vt>>>25)+Mt|0)<<9|vt>>>23)+K|0)<<13|vt>>>19)+de|0)<<18|vt>>>14,W^=(vt=(U^=(vt=(V^=(vt=(Y^=(vt=W+U|0)<<7|vt>>>25)+W|0)<<9|vt>>>23)+Y|0)<<13|vt>>>19)+V|0)<<18|vt>>>14;$[0]=At>>>0&255,$[1]=At>>>8&255,$[2]=At>>>16&255,$[3]=At>>>24&255,$[4]=se>>>0&255,$[5]=se>>>8&255,$[6]=se>>>16&255,$[7]=se>>>24&255,$[8]=Mt>>>0&255,$[9]=Mt>>>8&255,$[10]=Mt>>>16&255,$[11]=Mt>>>24&255,$[12]=W>>>0&255,$[13]=W>>>8&255,$[14]=W>>>16&255,$[15]=W>>>24&255,$[16]=Lt>>>0&255,$[17]=Lt>>>8&255,$[18]=Lt>>>16&255,$[19]=Lt>>>24&255,$[20]=Et>>>0&255,$[21]=Et>>>8&255,$[22]=Et>>>16&255,$[23]=Et>>>24&255,$[24]=de>>>0&255,$[25]=de>>>8&255,$[26]=de>>>16&255,$[27]=de>>>24&255,$[28]=Pt>>>0&255,$[29]=Pt>>>8&255,$[30]=Pt>>>16&255,$[31]=Pt>>>24&255})(J,X,st,N)}var C=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function O(J,X,st,N,$,gt,ft){var mt,vt,At=new Uint8Array(16),_t=new Uint8Array(64);for(vt=0;vt<16;vt++)At[vt]=0;for(vt=0;vt<8;vt++)At[vt]=gt[vt];for(;$>=64;){for(P(_t,At,ft,C),vt=0;vt<64;vt++)J[X+vt]=st[N+vt]^_t[vt];for(mt=1,vt=8;vt<16;vt++)mt=mt+(255&At[vt])|0,At[vt]=255&mt,mt>>>=8;$-=64,X+=64,N+=64}if($>0)for(P(_t,At,ft,C),vt=0;vt<$;vt++)J[X+vt]=st[N+vt]^_t[vt];return 0}function z(J,X,st,N,$){var gt,ft,mt=new Uint8Array(16),vt=new Uint8Array(64);for(ft=0;ft<16;ft++)mt[ft]=0;for(ft=0;ft<8;ft++)mt[ft]=N[ft];for(;st>=64;){for(P(vt,mt,$,C),ft=0;ft<64;ft++)J[X+ft]=vt[ft];for(gt=1,ft=8;ft<16;ft++)gt=gt+(255&mt[ft])|0,mt[ft]=255>,gt>>>=8;st-=64,X+=64}if(st>0)for(P(vt,mt,$,C),ft=0;ft>>13|st<<3),N=255&J[4]|(255&J[5])<<8,this.r[2]=7939&(st>>>10|N<<6),$=255&J[6]|(255&J[7])<<8,this.r[3]=8191&(N>>>7|$<<9),gt=255&J[8]|(255&J[9])<<8,this.r[4]=255&($>>>4|gt<<12),this.r[5]=gt>>>1&8190,ft=255&J[10]|(255&J[11])<<8,this.r[6]=8191&(gt>>>14|ft<<2),mt=255&J[12]|(255&J[13])<<8,this.r[7]=8065&(ft>>>11|mt<<5),vt=255&J[14]|(255&J[15])<<8,this.r[8]=8191&(mt>>>8|vt<<8),this.r[9]=vt>>>5&127,this.pad[0]=255&J[16]|(255&J[17])<<8,this.pad[1]=255&J[18]|(255&J[19])<<8,this.pad[2]=255&J[20]|(255&J[21])<<8,this.pad[3]=255&J[22]|(255&J[23])<<8,this.pad[4]=255&J[24]|(255&J[25])<<8,this.pad[5]=255&J[26]|(255&J[27])<<8,this.pad[6]=255&J[28]|(255&J[29])<<8,this.pad[7]=255&J[30]|(255&J[31])<<8};function G(J,X,st,N,$,gt){var ft=new nt(gt);return ft.update(st,N,$),ft.finish(J,X),0}function M(J,X,st,N,$,gt){var ft=new Uint8Array(16);return G(ft,0,st,N,$,gt),A(J,X,ft,0)}function d(J,X,st,N,$){var gt;if(st<32)return-1;for(tt(J,0,X,0,st,N,$),G(J,16,J,32,st-32,J),gt=0;gt<16;gt++)J[gt]=0;return 0}function o(J,X,st,N,$){var gt,ft=new Uint8Array(32);if(st<32||(H(ft,0,32,N,$),M(X,16,X,32,st-32,ft)!==0))return-1;for(tt(J,0,X,0,st,N,$),gt=0;gt<32;gt++)J[gt]=0;return 0}function a(J,X){var st;for(st=0;st<16;st++)J[st]=0|X[st]}function f(J){var X,st,N=1;for(X=0;X<16;X++)st=J[X]+N+65535,N=Math.floor(st/65536),J[X]=st-65536*N;J[0]+=N-1+37*(N-1)}function h(J,X,st){for(var N,$=~(st-1),gt=0;gt<16;gt++)N=$&(J[gt]^X[gt]),J[gt]^=N,X[gt]^=N}function g(J,X){var st,N,$,gt=t(),ft=t();for(st=0;st<16;st++)ft[st]=X[st];for(f(ft),f(ft),f(ft),N=0;N<2;N++){for(gt[0]=ft[0]-65517,st=1;st<15;st++)gt[st]=ft[st]-65535-(gt[st-1]>>16&1),gt[st-1]&=65535;gt[15]=ft[15]-32767-(gt[14]>>16&1),$=gt[15]>>16&1,gt[14]&=65535,h(ft,gt,1-$)}for(st=0;st<16;st++)J[2*st]=255&ft[st],J[2*st+1]=ft[st]>>8}function S(J,X){var st=new Uint8Array(32),N=new Uint8Array(32);return g(st,J),g(N,X),B(st,0,N,0)}function I(J){var X=new Uint8Array(32);return g(X,J),1&X[0]}function y(J,X){var st;for(st=0;st<16;st++)J[st]=X[2*st]+(X[2*st+1]<<8);J[15]&=32767}function u(J,X,st){for(var N=0;N<16;N++)J[N]=X[N]+st[N]}function b(J,X,st){for(var N=0;N<16;N++)J[N]=X[N]-st[N]}function D(J,X,st){var N,$,gt=0,ft=0,mt=0,vt=0,At=0,_t=0,Gt=0,Rt=0,wt=0,se=0,Lt=0,Et=0,de=0,Pt=0,Mt=0,K=0,Y=0,V=0,U=0,W=0,et=0,dt=0,ut=0,ht=0,zt=0,Wt=0,ye=0,Yt=0,pe=0,ve=0,ge=0,ie=st[0],ue=st[1],fe=st[2],ce=st[3],Kt=st[4],oe=st[5],Jt=st[6],le=st[7],ae=st[8],ne=st[9],Ot=st[10],Nt=st[11],he=st[12],ee=st[13],re=st[14],me=st[15];gt+=(N=X[0])*ie,ft+=N*ue,mt+=N*fe,vt+=N*ce,At+=N*Kt,_t+=N*oe,Gt+=N*Jt,Rt+=N*le,wt+=N*ae,se+=N*ne,Lt+=N*Ot,Et+=N*Nt,de+=N*he,Pt+=N*ee,Mt+=N*re,K+=N*me,ft+=(N=X[1])*ie,mt+=N*ue,vt+=N*fe,At+=N*ce,_t+=N*Kt,Gt+=N*oe,Rt+=N*Jt,wt+=N*le,se+=N*ae,Lt+=N*ne,Et+=N*Ot,de+=N*Nt,Pt+=N*he,Mt+=N*ee,K+=N*re,Y+=N*me,mt+=(N=X[2])*ie,vt+=N*ue,At+=N*fe,_t+=N*ce,Gt+=N*Kt,Rt+=N*oe,wt+=N*Jt,se+=N*le,Lt+=N*ae,Et+=N*ne,de+=N*Ot,Pt+=N*Nt,Mt+=N*he,K+=N*ee,Y+=N*re,V+=N*me,vt+=(N=X[3])*ie,At+=N*ue,_t+=N*fe,Gt+=N*ce,Rt+=N*Kt,wt+=N*oe,se+=N*Jt,Lt+=N*le,Et+=N*ae,de+=N*ne,Pt+=N*Ot,Mt+=N*Nt,K+=N*he,Y+=N*ee,V+=N*re,U+=N*me,At+=(N=X[4])*ie,_t+=N*ue,Gt+=N*fe,Rt+=N*ce,wt+=N*Kt,se+=N*oe,Lt+=N*Jt,Et+=N*le,de+=N*ae,Pt+=N*ne,Mt+=N*Ot,K+=N*Nt,Y+=N*he,V+=N*ee,U+=N*re,W+=N*me,_t+=(N=X[5])*ie,Gt+=N*ue,Rt+=N*fe,wt+=N*ce,se+=N*Kt,Lt+=N*oe,Et+=N*Jt,de+=N*le,Pt+=N*ae,Mt+=N*ne,K+=N*Ot,Y+=N*Nt,V+=N*he,U+=N*ee,W+=N*re,et+=N*me,Gt+=(N=X[6])*ie,Rt+=N*ue,wt+=N*fe,se+=N*ce,Lt+=N*Kt,Et+=N*oe,de+=N*Jt,Pt+=N*le,Mt+=N*ae,K+=N*ne,Y+=N*Ot,V+=N*Nt,U+=N*he,W+=N*ee,et+=N*re,dt+=N*me,Rt+=(N=X[7])*ie,wt+=N*ue,se+=N*fe,Lt+=N*ce,Et+=N*Kt,de+=N*oe,Pt+=N*Jt,Mt+=N*le,K+=N*ae,Y+=N*ne,V+=N*Ot,U+=N*Nt,W+=N*he,et+=N*ee,dt+=N*re,ut+=N*me,wt+=(N=X[8])*ie,se+=N*ue,Lt+=N*fe,Et+=N*ce,de+=N*Kt,Pt+=N*oe,Mt+=N*Jt,K+=N*le,Y+=N*ae,V+=N*ne,U+=N*Ot,W+=N*Nt,et+=N*he,dt+=N*ee,ut+=N*re,ht+=N*me,se+=(N=X[9])*ie,Lt+=N*ue,Et+=N*fe,de+=N*ce,Pt+=N*Kt,Mt+=N*oe,K+=N*Jt,Y+=N*le,V+=N*ae,U+=N*ne,W+=N*Ot,et+=N*Nt,dt+=N*he,ut+=N*ee,ht+=N*re,zt+=N*me,Lt+=(N=X[10])*ie,Et+=N*ue,de+=N*fe,Pt+=N*ce,Mt+=N*Kt,K+=N*oe,Y+=N*Jt,V+=N*le,U+=N*ae,W+=N*ne,et+=N*Ot,dt+=N*Nt,ut+=N*he,ht+=N*ee,zt+=N*re,Wt+=N*me,Et+=(N=X[11])*ie,de+=N*ue,Pt+=N*fe,Mt+=N*ce,K+=N*Kt,Y+=N*oe,V+=N*Jt,U+=N*le,W+=N*ae,et+=N*ne,dt+=N*Ot,ut+=N*Nt,ht+=N*he,zt+=N*ee,Wt+=N*re,ye+=N*me,de+=(N=X[12])*ie,Pt+=N*ue,Mt+=N*fe,K+=N*ce,Y+=N*Kt,V+=N*oe,U+=N*Jt,W+=N*le,et+=N*ae,dt+=N*ne,ut+=N*Ot,ht+=N*Nt,zt+=N*he,Wt+=N*ee,ye+=N*re,Yt+=N*me,Pt+=(N=X[13])*ie,Mt+=N*ue,K+=N*fe,Y+=N*ce,V+=N*Kt,U+=N*oe,W+=N*Jt,et+=N*le,dt+=N*ae,ut+=N*ne,ht+=N*Ot,zt+=N*Nt,Wt+=N*he,ye+=N*ee,Yt+=N*re,pe+=N*me,Mt+=(N=X[14])*ie,K+=N*ue,Y+=N*fe,V+=N*ce,U+=N*Kt,W+=N*oe,et+=N*Jt,dt+=N*le,ut+=N*ae,ht+=N*ne,zt+=N*Ot,Wt+=N*Nt,ye+=N*he,Yt+=N*ee,pe+=N*re,ve+=N*me,K+=(N=X[15])*ie,ft+=38*(V+=N*fe),mt+=38*(U+=N*ce),vt+=38*(W+=N*Kt),At+=38*(et+=N*oe),_t+=38*(dt+=N*Jt),Gt+=38*(ut+=N*le),Rt+=38*(ht+=N*ae),wt+=38*(zt+=N*ne),se+=38*(Wt+=N*Ot),Lt+=38*(ye+=N*Nt),Et+=38*(Yt+=N*he),de+=38*(pe+=N*ee),Pt+=38*(ve+=N*re),Mt+=38*(ge+=N*me),gt=(N=(gt+=38*(Y+=N*ue))+($=1)+65535)-65536*($=Math.floor(N/65536)),ft=(N=ft+$+65535)-65536*($=Math.floor(N/65536)),mt=(N=mt+$+65535)-65536*($=Math.floor(N/65536)),vt=(N=vt+$+65535)-65536*($=Math.floor(N/65536)),At=(N=At+$+65535)-65536*($=Math.floor(N/65536)),_t=(N=_t+$+65535)-65536*($=Math.floor(N/65536)),Gt=(N=Gt+$+65535)-65536*($=Math.floor(N/65536)),Rt=(N=Rt+$+65535)-65536*($=Math.floor(N/65536)),wt=(N=wt+$+65535)-65536*($=Math.floor(N/65536)),se=(N=se+$+65535)-65536*($=Math.floor(N/65536)),Lt=(N=Lt+$+65535)-65536*($=Math.floor(N/65536)),Et=(N=Et+$+65535)-65536*($=Math.floor(N/65536)),de=(N=de+$+65535)-65536*($=Math.floor(N/65536)),Pt=(N=Pt+$+65535)-65536*($=Math.floor(N/65536)),Mt=(N=Mt+$+65535)-65536*($=Math.floor(N/65536)),K=(N=K+$+65535)-65536*($=Math.floor(N/65536)),gt=(N=(gt+=$-1+37*($-1))+($=1)+65535)-65536*($=Math.floor(N/65536)),ft=(N=ft+$+65535)-65536*($=Math.floor(N/65536)),mt=(N=mt+$+65535)-65536*($=Math.floor(N/65536)),vt=(N=vt+$+65535)-65536*($=Math.floor(N/65536)),At=(N=At+$+65535)-65536*($=Math.floor(N/65536)),_t=(N=_t+$+65535)-65536*($=Math.floor(N/65536)),Gt=(N=Gt+$+65535)-65536*($=Math.floor(N/65536)),Rt=(N=Rt+$+65535)-65536*($=Math.floor(N/65536)),wt=(N=wt+$+65535)-65536*($=Math.floor(N/65536)),se=(N=se+$+65535)-65536*($=Math.floor(N/65536)),Lt=(N=Lt+$+65535)-65536*($=Math.floor(N/65536)),Et=(N=Et+$+65535)-65536*($=Math.floor(N/65536)),de=(N=de+$+65535)-65536*($=Math.floor(N/65536)),Pt=(N=Pt+$+65535)-65536*($=Math.floor(N/65536)),Mt=(N=Mt+$+65535)-65536*($=Math.floor(N/65536)),K=(N=K+$+65535)-65536*($=Math.floor(N/65536)),gt+=$-1+37*($-1),J[0]=gt,J[1]=ft,J[2]=mt,J[3]=vt,J[4]=At,J[5]=_t,J[6]=Gt,J[7]=Rt,J[8]=wt,J[9]=se,J[10]=Lt,J[11]=Et,J[12]=de,J[13]=Pt,J[14]=Mt,J[15]=K}function Z(J,X){D(J,X,X)}function F(J,X){var st,N=t();for(st=0;st<16;st++)N[st]=X[st];for(st=253;st>=0;st--)Z(N,N),st!==2&&st!==4&&D(N,N,X);for(st=0;st<16;st++)J[st]=N[st]}function q(J,X){var st,N=t();for(st=0;st<16;st++)N[st]=X[st];for(st=250;st>=0;st--)Z(N,N),st!==1&&D(N,N,X);for(st=0;st<16;st++)J[st]=N[st]}function it(J,X,st){var N,$,gt=new Uint8Array(32),ft=new Float64Array(80),mt=t(),vt=t(),At=t(),_t=t(),Gt=t(),Rt=t();for($=0;$<31;$++)gt[$]=X[$];for(gt[31]=127&X[31]|64,gt[0]&=248,y(ft,st),$=0;$<16;$++)vt[$]=ft[$],_t[$]=mt[$]=At[$]=0;for(mt[0]=_t[0]=1,$=254;$>=0;--$)h(mt,vt,N=gt[$>>>3]>>>(7&$)&1),h(At,_t,N),u(Gt,mt,At),b(mt,mt,At),u(At,vt,_t),b(vt,vt,_t),Z(_t,Gt),Z(Rt,mt),D(mt,At,mt),D(At,vt,Gt),u(Gt,mt,At),b(mt,mt,At),Z(vt,mt),b(At,_t,Rt),D(mt,At,l),u(mt,mt,_t),D(At,At,mt),D(mt,_t,Rt),D(_t,vt,ft),Z(vt,Gt),h(mt,vt,N),h(At,_t,N);for($=0;$<16;$++)ft[$+16]=mt[$],ft[$+32]=At[$],ft[$+48]=vt[$],ft[$+64]=_t[$];var wt=ft.subarray(32),se=ft.subarray(16);return F(wt,wt),D(se,se,wt),g(J,se),0}function at(J,X){return it(J,X,s)}function Bt(J,X){return e(X,32),at(J,X)}function yt(J,X,st){var N=new Uint8Array(32);return it(N,st,X),R(J,n,N,C)}nt.prototype.blocks=function(J,X,st){for(var N,$,gt,ft,mt,vt,At,_t,Gt,Rt,wt,se,Lt,Et,de,Pt,Mt,K,Y,V=this.fin?0:2048,U=this.h[0],W=this.h[1],et=this.h[2],dt=this.h[3],ut=this.h[4],ht=this.h[5],zt=this.h[6],Wt=this.h[7],ye=this.h[8],Yt=this.h[9],pe=this.r[0],ve=this.r[1],ge=this.r[2],ie=this.r[3],ue=this.r[4],fe=this.r[5],ce=this.r[6],Kt=this.r[7],oe=this.r[8],Jt=this.r[9];st>=16;)Rt=Gt=0,Rt+=(U+=8191&(N=255&J[X+0]|(255&J[X+1])<<8))*pe,Rt+=(W+=8191&(N>>>13|($=255&J[X+2]|(255&J[X+3])<<8)<<3))*(5*Jt),Rt+=(et+=8191&($>>>10|(gt=255&J[X+4]|(255&J[X+5])<<8)<<6))*(5*oe),Rt+=(dt+=8191&(gt>>>7|(ft=255&J[X+6]|(255&J[X+7])<<8)<<9))*(5*Kt),Gt=(Rt+=(ut+=8191&(ft>>>4|(mt=255&J[X+8]|(255&J[X+9])<<8)<<12))*(5*ce))>>>13,Rt&=8191,Rt+=(ht+=mt>>>1&8191)*(5*fe),Rt+=(zt+=8191&(mt>>>14|(vt=255&J[X+10]|(255&J[X+11])<<8)<<2))*(5*ue),Rt+=(Wt+=8191&(vt>>>11|(At=255&J[X+12]|(255&J[X+13])<<8)<<5))*(5*ie),Rt+=(ye+=8191&(At>>>8|(_t=255&J[X+14]|(255&J[X+15])<<8)<<8))*(5*ge),wt=Gt+=(Rt+=(Yt+=_t>>>5|V)*(5*ve))>>>13,wt+=U*ve,wt+=W*pe,wt+=et*(5*Jt),wt+=dt*(5*oe),Gt=(wt+=ut*(5*Kt))>>>13,wt&=8191,wt+=ht*(5*ce),wt+=zt*(5*fe),wt+=Wt*(5*ue),wt+=ye*(5*ie),Gt+=(wt+=Yt*(5*ge))>>>13,wt&=8191,se=Gt,se+=U*ge,se+=W*ve,se+=et*pe,se+=dt*(5*Jt),Gt=(se+=ut*(5*oe))>>>13,se&=8191,se+=ht*(5*Kt),se+=zt*(5*ce),se+=Wt*(5*fe),se+=ye*(5*ue),Lt=Gt+=(se+=Yt*(5*ie))>>>13,Lt+=U*ie,Lt+=W*ge,Lt+=et*ve,Lt+=dt*pe,Gt=(Lt+=ut*(5*Jt))>>>13,Lt&=8191,Lt+=ht*(5*oe),Lt+=zt*(5*Kt),Lt+=Wt*(5*ce),Lt+=ye*(5*fe),Et=Gt+=(Lt+=Yt*(5*ue))>>>13,Et+=U*ue,Et+=W*ie,Et+=et*ge,Et+=dt*ve,Gt=(Et+=ut*pe)>>>13,Et&=8191,Et+=ht*(5*Jt),Et+=zt*(5*oe),Et+=Wt*(5*Kt),Et+=ye*(5*ce),de=Gt+=(Et+=Yt*(5*fe))>>>13,de+=U*fe,de+=W*ue,de+=et*ie,de+=dt*ge,Gt=(de+=ut*ve)>>>13,de&=8191,de+=ht*pe,de+=zt*(5*Jt),de+=Wt*(5*oe),de+=ye*(5*Kt),Pt=Gt+=(de+=Yt*(5*ce))>>>13,Pt+=U*ce,Pt+=W*fe,Pt+=et*ue,Pt+=dt*ie,Gt=(Pt+=ut*ge)>>>13,Pt&=8191,Pt+=ht*ve,Pt+=zt*pe,Pt+=Wt*(5*Jt),Pt+=ye*(5*oe),Mt=Gt+=(Pt+=Yt*(5*Kt))>>>13,Mt+=U*Kt,Mt+=W*ce,Mt+=et*fe,Mt+=dt*ue,Gt=(Mt+=ut*ie)>>>13,Mt&=8191,Mt+=ht*ge,Mt+=zt*ve,Mt+=Wt*pe,Mt+=ye*(5*Jt),K=Gt+=(Mt+=Yt*(5*oe))>>>13,K+=U*oe,K+=W*Kt,K+=et*ce,K+=dt*fe,Gt=(K+=ut*ue)>>>13,K&=8191,K+=ht*ie,K+=zt*ge,K+=Wt*ve,K+=ye*pe,Y=Gt+=(K+=Yt*(5*Jt))>>>13,Y+=U*Jt,Y+=W*oe,Y+=et*Kt,Y+=dt*ce,Gt=(Y+=ut*fe)>>>13,Y&=8191,Y+=ht*ue,Y+=zt*ie,Y+=Wt*ge,Y+=ye*ve,U=Rt=8191&(Gt=(Gt=((Gt+=(Y+=Yt*pe)>>>13)<<2)+Gt|0)+(Rt&=8191)|0),W=wt+=Gt>>>=13,et=se&=8191,dt=Lt&=8191,ut=Et&=8191,ht=de&=8191,zt=Pt&=8191,Wt=Mt&=8191,ye=K&=8191,Yt=Y&=8191,X+=16,st-=16;this.h[0]=U,this.h[1]=W,this.h[2]=et,this.h[3]=dt,this.h[4]=ut,this.h[5]=ht,this.h[6]=zt,this.h[7]=Wt,this.h[8]=ye,this.h[9]=Yt},nt.prototype.finish=function(J,X){var st,N,$,gt,ft=new Uint16Array(10);if(this.leftover){for(gt=this.leftover,this.buffer[gt++]=1;gt<16;gt++)this.buffer[gt]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(st=this.h[1]>>>13,this.h[1]&=8191,gt=2;gt<10;gt++)this.h[gt]+=st,st=this.h[gt]>>>13,this.h[gt]&=8191;for(this.h[0]+=5*st,st=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=st,st=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=st,ft[0]=this.h[0]+5,st=ft[0]>>>13,ft[0]&=8191,gt=1;gt<10;gt++)ft[gt]=this.h[gt]+st,st=ft[gt]>>>13,ft[gt]&=8191;for(ft[9]-=8192,N=(1^st)-1,gt=0;gt<10;gt++)ft[gt]&=N;for(N=~N,gt=0;gt<10;gt++)this.h[gt]=this.h[gt]&N|ft[gt];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),$=this.h[0]+this.pad[0],this.h[0]=65535&$,gt=1;gt<8;gt++)$=(this.h[gt]+this.pad[gt]|0)+($>>>16)|0,this.h[gt]=65535&$;J[X+0]=this.h[0]>>>0&255,J[X+1]=this.h[0]>>>8&255,J[X+2]=this.h[1]>>>0&255,J[X+3]=this.h[1]>>>8&255,J[X+4]=this.h[2]>>>0&255,J[X+5]=this.h[2]>>>8&255,J[X+6]=this.h[3]>>>0&255,J[X+7]=this.h[3]>>>8&255,J[X+8]=this.h[4]>>>0&255,J[X+9]=this.h[4]>>>8&255,J[X+10]=this.h[5]>>>0&255,J[X+11]=this.h[5]>>>8&255,J[X+12]=this.h[6]>>>0&255,J[X+13]=this.h[6]>>>8&255,J[X+14]=this.h[7]>>>0&255,J[X+15]=this.h[7]>>>8&255},nt.prototype.update=function(J,X,st){var N,$;if(this.leftover){for(($=16-this.leftover)>st&&($=st),N=0;N<$;N++)this.buffer[this.leftover+N]=J[X+N];if(st-=$,X+=$,this.leftover+=$,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(st>=16&&($=st-st%16,this.blocks(J,X,$),X+=$,st-=$),st){for(N=0;N=128;){for(V=0;V<16;V++)U=8*V+he,Wt[V]=st[U+0]<<24|st[U+1]<<16|st[U+2]<<8|st[U+3],ye[V]=st[U+4]<<24|st[U+5]<<16|st[U+6]<<8|st[U+7];for(V=0;V<80;V++)if($=Yt,gt=pe,ft=ve,mt=ge,vt=ie,At=ue,_t=fe,Rt=Kt,wt=oe,se=Jt,Lt=le,Et=ae,de=ne,Pt=Ot,dt=65535&(et=Nt),ut=et>>>16,ht=65535&(W=ce),zt=W>>>16,dt+=65535&(et=(ae>>>14|ie<<18)^(ae>>>18|ie<<14)^(ie>>>9|ae<<23)),ut+=et>>>16,ht+=65535&(W=(ie>>>14|ae<<18)^(ie>>>18|ae<<14)^(ae>>>9|ie<<23)),zt+=W>>>16,dt+=65535&(et=ae&ne^~ae&Ot),ut+=et>>>16,ht+=65535&(W=ie&ue^~ie&fe),zt+=W>>>16,W=lt[2*V],dt+=65535&(et=lt[2*V+1]),ut+=et>>>16,ht+=65535&W,zt+=W>>>16,W=Wt[V%16],ut+=(et=ye[V%16])>>>16,ht+=65535&W,zt+=W>>>16,ht+=(ut+=(dt+=65535&et)>>>16)>>>16,dt=65535&(et=Y=65535&dt|ut<<16),ut=et>>>16,ht=65535&(W=K=65535&ht|(zt+=ht>>>16)<<16),zt=W>>>16,dt+=65535&(et=(Kt>>>28|Yt<<4)^(Yt>>>2|Kt<<30)^(Yt>>>7|Kt<<25)),ut+=et>>>16,ht+=65535&(W=(Yt>>>28|Kt<<4)^(Kt>>>2|Yt<<30)^(Kt>>>7|Yt<<25)),zt+=W>>>16,ut+=(et=Kt&oe^Kt&Jt^oe&Jt)>>>16,ht+=65535&(W=Yt&pe^Yt&ve^pe&ve),zt+=W>>>16,Gt=65535&(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)|(zt+=ht>>>16)<<16,Mt=65535&dt|ut<<16,dt=65535&(et=Lt),ut=et>>>16,ht=65535&(W=mt),zt=W>>>16,ut+=(et=Y)>>>16,ht+=65535&(W=K),zt+=W>>>16,pe=$,ve=gt,ge=ft,ie=mt=65535&(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)|(zt+=ht>>>16)<<16,ue=vt,fe=At,ce=_t,Yt=Gt,oe=Rt,Jt=wt,le=se,ae=Lt=65535&dt|ut<<16,ne=Et,Ot=de,Nt=Pt,Kt=Mt,V%16==15)for(U=0;U<16;U++)W=Wt[U],dt=65535&(et=ye[U]),ut=et>>>16,ht=65535&W,zt=W>>>16,W=Wt[(U+9)%16],dt+=65535&(et=ye[(U+9)%16]),ut+=et>>>16,ht+=65535&W,zt+=W>>>16,K=Wt[(U+1)%16],dt+=65535&(et=((Y=ye[(U+1)%16])>>>1|K<<31)^(Y>>>8|K<<24)^(Y>>>7|K<<25)),ut+=et>>>16,ht+=65535&(W=(K>>>1|Y<<31)^(K>>>8|Y<<24)^K>>>7),zt+=W>>>16,K=Wt[(U+14)%16],ut+=(et=((Y=ye[(U+14)%16])>>>19|K<<13)^(K>>>29|Y<<3)^(Y>>>6|K<<26))>>>16,ht+=65535&(W=(K>>>19|Y<<13)^(Y>>>29|K<<3)^K>>>6),zt+=W>>>16,zt+=(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)>>>16,Wt[U]=65535&ht|zt<<16,ye[U]=65535&dt|ut<<16;dt=65535&(et=Kt),ut=et>>>16,ht=65535&(W=Yt),zt=W>>>16,W=J[0],ut+=(et=X[0])>>>16,ht+=65535&W,zt+=W>>>16,zt+=(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)>>>16,J[0]=Yt=65535&ht|zt<<16,X[0]=Kt=65535&dt|ut<<16,dt=65535&(et=oe),ut=et>>>16,ht=65535&(W=pe),zt=W>>>16,W=J[1],ut+=(et=X[1])>>>16,ht+=65535&W,zt+=W>>>16,zt+=(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)>>>16,J[1]=pe=65535&ht|zt<<16,X[1]=oe=65535&dt|ut<<16,dt=65535&(et=Jt),ut=et>>>16,ht=65535&(W=ve),zt=W>>>16,W=J[2],ut+=(et=X[2])>>>16,ht+=65535&W,zt+=W>>>16,zt+=(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)>>>16,J[2]=ve=65535&ht|zt<<16,X[2]=Jt=65535&dt|ut<<16,dt=65535&(et=le),ut=et>>>16,ht=65535&(W=ge),zt=W>>>16,W=J[3],ut+=(et=X[3])>>>16,ht+=65535&W,zt+=W>>>16,zt+=(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)>>>16,J[3]=ge=65535&ht|zt<<16,X[3]=le=65535&dt|ut<<16,dt=65535&(et=ae),ut=et>>>16,ht=65535&(W=ie),zt=W>>>16,W=J[4],ut+=(et=X[4])>>>16,ht+=65535&W,zt+=W>>>16,zt+=(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)>>>16,J[4]=ie=65535&ht|zt<<16,X[4]=ae=65535&dt|ut<<16,dt=65535&(et=ne),ut=et>>>16,ht=65535&(W=ue),zt=W>>>16,W=J[5],ut+=(et=X[5])>>>16,ht+=65535&W,zt+=W>>>16,zt+=(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)>>>16,J[5]=ue=65535&ht|zt<<16,X[5]=ne=65535&dt|ut<<16,dt=65535&(et=Ot),ut=et>>>16,ht=65535&(W=fe),zt=W>>>16,W=J[6],ut+=(et=X[6])>>>16,ht+=65535&W,zt+=W>>>16,zt+=(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)>>>16,J[6]=fe=65535&ht|zt<<16,X[6]=Ot=65535&dt|ut<<16,dt=65535&(et=Nt),ut=et>>>16,ht=65535&(W=ce),zt=W>>>16,W=J[7],ut+=(et=X[7])>>>16,ht+=65535&W,zt+=W>>>16,zt+=(ht+=(ut+=(dt+=65535&et)>>>16)>>>16)>>>16,J[7]=ce=65535&ht|zt<<16,X[7]=Nt=65535&dt|ut<<16,he+=128,N-=128}return N}function Tt(J,X,st){var N,$=new Int32Array(8),gt=new Int32Array(8),ft=new Uint8Array(256),mt=st;for($[0]=1779033703,$[1]=3144134277,$[2]=1013904242,$[3]=2773480762,$[4]=1359893119,$[5]=2600822924,$[6]=528734635,$[7]=1541459225,gt[0]=4089235720,gt[1]=2227873595,gt[2]=4271175723,gt[3]=1595750129,gt[4]=2917565137,gt[5]=725511199,gt[6]=4215389547,gt[7]=327033209,ct($,gt,X,st),st%=128,N=0;N=0;--$)k(J,X,N=st[$/8|0]>>(7&$)&1),kt(X,J),kt(J,J),k(J,X,N)}function j(J,X){var st=[t(),t(),t(),t()];a(st[0],v),a(st[1],_),a(st[2],c),D(st[3],v,_),L(J,st,X)}function rt(J,X,st){var N,$=new Uint8Array(64),gt=[t(),t(),t(),t()];for(st||e(X,32),Tt($,X,32),$[0]&=248,$[31]&=127,$[31]|=64,j(gt,$),T(J,gt),N=0;N<32;N++)X[N+32]=J[N];return 0}var Q=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function ot(J,X){var st,N,$,gt;for(N=63;N>=32;--N){for(st=0,$=N-32,gt=N-12;$>4)*Q[$],st=X[$]>>8,X[$]&=255;for($=0;$<32;$++)X[$]-=st*Q[$];for(N=0;N<32;N++)X[N+1]+=X[N]>>8,J[N]=255&X[N]}function qt(J){var X,st=new Float64Array(64);for(X=0;X<64;X++)st[X]=J[X];for(X=0;X<64;X++)J[X]=0;ot(J,st)}function It(J,X,st,N){var $,gt,ft=new Uint8Array(64),mt=new Uint8Array(64),vt=new Uint8Array(64),At=new Float64Array(64),_t=[t(),t(),t(),t()];Tt(ft,N,32),ft[0]&=248,ft[31]&=127,ft[31]|=64;var Gt=st+64;for($=0;$>7&&b(At[0],i,At[0]),D(At[3],At[0],At[1]),0)}(vt,N))return-1;for($=0;$=0},r.sign.keyPair=function(){var J=new Uint8Array(Dt),X=new Uint8Array(Se);return rt(J,X),{publicKey:J,secretKey:X}},r.sign.keyPair.fromSecretKey=function(J){if(Ut(J),J.length!==Se)throw new Error("bad secret key size");for(var X=new Uint8Array(Dt),st=0;st{if(t.includes(".")||t.trim().toLowerCase()!==t)throw new Bl(Il.InvalidDomain);const[l]=Xt.findProgramAddressSync([v0.toBuffer()],v0),p=i7(t),m=o7(p,void 0,T4),v=i7(m.toBase58()),_=o7(v,l),[E]=Xt.findProgramAddressSync([m.toBuffer()],v0),w=LA.findIndex(tt=>c==null?void 0:c.equals(tt));let x;const A=[];if(w!==-1&&c){x=m4(i,c,!0);const tt=await r.getAccountInfo(x);if(!(tt!=null&&tt.data)){const nt=kj(n,x,c,i);A.push(nt)}}const B=new T8.PythHttpClient(r,T8.getPythProgramKeyForCluster("mainnet-beta")),P=await B.getData(),R=CK.get(i.toBase58());if(!R)throw new Bl(Il.SymbolNotFound,`No symbol found for mint ${i.toBase58()}`);const C=P.productPrice.get("Crypto."+R+"/USD"),O=P.productFromSymbol.get("Crypto."+R+"/USD"),z=m4(i,LK),H=new oh({name:t,space:e,referrerIdxOpt:w!=-1?w:null}).getInstruction(v0,TA,T4,m,_,an.programId,l,n,s,TK,C.productAccountKey,new Xt(O.price_account),z,kl,na,E,x);return A.push(H),[[],A]};new Xt("85iDfUvr3HJyLM2zcq5BXSiDvUWfw6cSE1FfNBo8Ap29");var m7;(function(r){r.DegenPoet1="DegenPoet#1",r.Rgb0x001="rgb0x00#1"})(m7||(m7={}));new Xt("ART5dr4bDic2sQVZoFheEmUxwQq5VGSx9he7JxHcXNQD");new Xt("CSWvuDHXExVGEMR9kP8xYAHuNjXogeRck9Cnr312CC9g");const AZ=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2}),L0=(r,t)=>{const e=AZ.format(r);return t?e.replace("$",""):e},mh=[{decimals:6,tokenSymbol:"USDC",mintAddress:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",tokenName:"USD Coin",pythFeed:"Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD",icon:"https://raw.githubusercontent.com/trustwallet/assets/f3ffd0b9ae2165336279ce2f8db1981a55ce30f8/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png"},{decimals:9,tokenSymbol:"SOL",mintAddress:"So11111111111111111111111111111111111111112",pythFeed:"H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG",tokenName:"Wrapped SOL",icon:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/So11111111111111111111111111111111111111112/logo.png"},{decimals:6,tokenSymbol:"FIDA",mintAddress:"EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",tokenName:"Bonfida Token",pythFeed:"ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF",icon:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp/logo.svg"},{decimals:6,tokenSymbol:"USDT",mintAddress:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",tokenName:"USDT",pythFeed:"3vxLXJqLqF3JG5TCbYycbKWRBbCJQLxQmBGCkyqEEefL",icon:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/D3KdBta3p53RV5FoahnJM5tP45h6Fd3AyFYgXTJvGCaK/logo.svg"},{decimals:9,tokenSymbol:"mSOL",mintAddress:"mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",tokenName:"mSOL",pythFeed:"E4v1BBgoso9s64TQvmyownAVJbhbEPGyzA3qn4n46qj9",icon:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So/logo.png"},{decimals:5,tokenSymbol:"BONK",mintAddress:"DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",tokenName:"BONK",pythFeed:"8ihFLu5FimgTQ1Unh4dVyEHUGodJ5gJQCrQf4KUVB9bN",icon:"https://solana.fm/api/image-proxy?imageUrl=https://arweave.net/hQiPZOsRZXGXBJd_82PhVdlM_hACsT_q6wqwf5cSY7I"},{decimals:8,tokenSymbol:"BAT",mintAddress:"EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz",tokenName:"BAT",pythFeed:"AbMTYZ82Xfv9PtTQ5e1fJXemXjzqEEFHP3oDLRTae6yz",icon:"https://raw.githubusercontent.com/solana-labs/token-list/main/assets/mainnet/EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz/logo.png"}],SZ=r=>{var t;return(t=mh.find(e=>e.tokenSymbol===r))==null?void 0:t.icon},O0="EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",Tk=1232,kZ=(r,t,e="48tzUutUCPDohF4YqFpX9dHHS43V1bn9R45LHEFVhbtq")=>{const n=[];let s=[];for(const i of r)IZ([...s,i],t,e)>Tk?(n.push(s),s=[i]):s.push(i);return s.length>0&&n.push(s),n},IZ=(r,t,e="48tzUutUCPDohF4YqFpX9dHHS43V1bn9R45LHEFVhbtq")=>{try{const n=new Zl().add(...r);return n.recentBlockhash=e,n.feePayer=t,n.serialize({requireAllSignatures:!1,verifySignatures:!1}).length}catch{return Tk+1}},BZ=async(r,t,e,n)=>{let s=n;const i=[],c=await r.getBalance(e),l=await r.getAccountInfo(t);if(!l||!l.data){const m=gT(e,t,e,wg);i.push(m)}else{const m=await r.getTokenAccountBalance(t,"processed");if(c+parseInt(m.value.amount)[mT(r,t,t)];function RZ(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var CZ="ABAOAAAAAACwiAAAAYkHdvjtnH+IFkUYxx/v3vPe7uw8UkjsD43ChKICDQsT3iIJy4gSiZAjkn5JUFlaiFmjccT9ESkpGBGVIlQgWSkY/QDBoMgrQv0jRJDAfkCXhUmgRX23d4ebnndmd3Z3ZnfVeeDDzM7MPs8zv57Zd2+5hd1Ed4ClYAisBuuUsqLpMHgJjIBNFu1fBW8l1O8AO8Ee8Cn4HIyCg+CI0u4Y+AmMgVPgDOhuEHWBPjAZXAy2gjfA9kb73hlx+i7SK8AHYDf4BOwHB8AoOAyOguPgB/ArOKlcnwHdPe32/Uin9LTvvwTph0gv62nbubKnXT+nZ1z/DcjfFF8vQno7uEaxH923BGVXN9v5Zcgvj/VFPIT8Y/H1k0jXxPn1SEfARjBdab8V+TfB22CXUh5xd3OcZTH3g6di1LZJbLNs55q96M9n4J9Gm6hsfzQvcT8fbfy//TyUf8vG4Lses/5jcd2PSE/IcQan4/o/UXYadE0kaoJBMG1ivNbidNbETr1XoWyuplwyHFN0fFai/8/EY7BIKY/68EpCvwP+mc/m/2vNGnBhp1eZ51bCmgsEAoFAIBAIBAKBQKAO3Irfrg3lfc4qi/cXd+Kee5TfvAd6ieY0ie5D2cNx+eNInwZLmu33gWuRn4/8C3H9CNJNYEt8/TrS35HuSPktvRP1z0LPOvAceB4IsB5saIa6UBfqQl2oc123AjwBVjWrP7MCgcC5y/ue/56yqXv87+qcIU2Z+ny8tuHHpyxsvrDNITDXgqkDRJcPdJY/wMo24/oQmDqZaPHkdplAuhv8ApqDRDeCVj/OAvD9BUSX9qF8Qpt7lTxnZ7+5TmVtrGMM7XchP3sS0SNgGzg4yU5HIBAIBM5NfsO5QDgfjuM54STOw7/Az/F3QtfhfF4Qn9F/gxMouxm/WU7F9afBQuUM7+rtPF+jb0b6ese/I7sI+emadhEzUT5bqbsW+esNbSMWoG6hWo/8gOLPUqUu+v5rKEHX8oS6iEXQexd7XlmBe1aCNWAp6kSsYyjHc82Liv2Xkd/C/HkN1w/Geren+KryToa2PtlQg2c9zijGZnGJ9kaibzZh84jmmfx4TeYpK9H3usMKqxnDCWxsdLY/3ygy9h+l/LYbYHtuXw2/rfsSPo0a/Jrn6PvPrzL2+7CmfV88lkc9j+F7cRzYU4N48DF8uA3n/T7Fly9q4Jdvoth0uLf9LORC11hvO/0D6RnQfRa99+2Hr1NS/M26VvfEe2jaWTAOvG8zzgKf8zCrYL++qUEfbumeQAjTVnQp+QmW99gQpDoJ4+9uHZe5/l3OW/M8x6WUZaduUvUc5p13NTXlz3VpGbCVrGNe5zOnjvGlrDWY1IdWShuuQ9fWh6h+VSV1Wit1lvNhHFz1zeUYtCg5ntvOSStDW5cITRnF5RJ+rcasJHExztwu910tl6LzLYsvuvvzilB0mvSaxt/V+SY0EMurfkjbrTjfInf+FJGkNdzSlOukZaDo3snqs7RZpqj2Gx7sS52D5O79k+93W2W/T3NhQxe3VeF16pwn4eI8qev7Sl1s0PnPy5PalSV57Pp6XuDxrypR9wBR8nOCzm/eXuYp5d4s/lV1XvL+lG2b+2AaQ1nPr23Hrc7z0WT5qvZL0v7QtdX5zdu6HMei+gV1ri8et4XSVpCfdeB7fRWNRy79UP0RCT4Jyre/88bbKsQUawUrV69dxjd+nlXxbCKos79pz1BpOqucz0gEdZ5hMk+aa7Wdy/7xZ5Yqhc+nyHivrkyQ/reM7tziuFojfM7zxtq0505XYutvHrtVnzNl2ONrTGdPkLv9ZjNHOoShnCh5nLLYKOKfK4qK7bjx/gqyj9lFJc2Wz/HIqyMSYaGnqM8+xp6vB1/6feg22UmLFUno1rurvelz7yT1UVfORW3L7+d6fMcAXdzxIVK3TNNioZpSyj2242izpky6y5S0fpr6q5ZXJT7O1qrmQRVB+rkQ1Dk3vvYttyGoc+51/mUVkYLtXvTx7MCvbUnzW2czyR8pql4XUlbcN9l1pSfPfOl0JV2bylyKoM4959sHQfr9Vpbk2V8u4ry0ndcvH5I1xggP9qVem/PHZL+qeGLrc945tLnHtG/LEtdjr4urxMpM92X1RZDd+pLtsorUydeCaiuvbtdSpQ9l2M4SU01nvI1e35L3uS5Jlw8pe1ykCKo2JtrGK9O9ujOlimcD6Y9LEWQ+7019d2VDLVPrTCLrsvjsQ1TfJVJM12pZmm5b4Xptx6HM9SpFkP2c6drJa5/iSr+pD7r+CNLvATVfpST1RYog/fwKTdsyxLVNQfnWrkyziGltJK2hLLptzjHXIsh+/HytmyQfpPA5VNtzXWWLzbiVsc9sbWSJ7UWE69KNh6v9kya2c6TzMa0fwpD37TtvQ6wuiw9CA9cny33Mj2pLte9Kp6996HO/83HPQ5r+ov5mvU9Qte/fIrGJP7axPO/9eXX6kjLPKZNd17iyZdOHLP31JSbfXY6hC59c+ZZ136TZ9SFlj6cvmVkSrkSQn3NG5KBqEVSeH6Ji/vvnhFWjSlfFNDwzyMgqLvvKxXffbeASBWo+Zj4p2x6TfwE=",TZ="AAACAAAAAACAOAAAAbYBSf7t2S1IBEEYBuDVDZ7FYrQMNsFiu3hgEYOI0SCXRIUrB8JhEZtgs5gEg1GMFk02m82oGI02m+9xezCOczv/uwv3fvAwc/PzfXOzcdqzWdaBDdiGPdiHdjE+DS3RNDuCfsn8idQ/g3OH3BdwKf0e96/gumTfYcncLdzBPTzAo+RZ+f0Cr/AG7/AJX4738x1wtz9FO5PX/50n6UXMNdfg/0lERERERERERERERETpdedHBvDRql4nq0cXtW9af98qdRby0Vvp8K4W0V+C5Xw0t4J2bfjeBp3cnEu1brnnCTYNa7eKdz91XP7WO9Lb4GqRb7cY6xbtAdqeVOsY/QGcevw/tb6OT85YhvfKYEx9CMuxKsKnrs+eJtVInVvHJ0eVYVvTZk2siFVLOCjb61PTZX3MdVWEyP7fjzpmMxdzTyq2Ebue6x61nXRGnzndWpf1an7dXmGYE4Y1ptqqKsK1nu26Ju0ty+maV2Rpvk+qnDZjKUIobUiesdAQE/jmCTmHmsskpFZsVYbtmXRcaoSGUPomunW2derQhDPFjtT1Q/eb8vnm990fq35oHVt11bU9m89c7DNI8Qs=",vb=0,Lk=-3;function vh(){this.table=new Uint16Array(16),this.trans=new Uint16Array(288)}function LZ(r,t){this.source=r,this.sourceIndex=0,this.tag=0,this.bitcount=0,this.dest=t,this.destLen=0,this.ltree=new vh,this.dtree=new vh}var Ok=new vh,Uk=new vh,Vv=new Uint8Array(30),Zv=new Uint16Array(30),Nk=new Uint8Array(30),Dk=new Uint16Array(30),OZ=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),v7=new vh,So=new Uint8Array(320);function g7(r,t,e,n){var s,i;for(s=0;s>>=1,t}function Co(r,t,e){if(!t)return e;for(;r.bitcount<24;)r.tag|=r.source[r.sourceIndex++]<>>16-t;return r.tag>>>=t,r.bitcount-=t,n+e}function Wv(r,t){for(;r.bitcount<24;)r.tag|=r.source[r.sourceIndex++]<>>=1,++s,e+=t.table[s],n-=t.table[s];while(n>=0);return r.tag=i,r.bitcount-=s,t.trans[e+n]}function NZ(r,t,e){var n,s,i,c,l,p;for(n=Co(r,5,257),s=Co(r,5,1),i=Co(r,4,4),c=0;c<19;++c)So[c]=0;for(c=0;c8;)r.sourceIndex--,r.bitcount-=8;if((t=256*(t=r.source[r.sourceIndex+1])+r.source[r.sourceIndex])!==(65535&~(256*r.source[r.sourceIndex+3]+r.source[r.sourceIndex+2])))return Lk;for(r.sourceIndex+=4,e=t;e;--e)r.dest[r.destLen++]=r.source[r.sourceIndex++];return r.bitcount=0,vb}(function(r,t){var e;for(e=0;e<7;++e)r.table[e]=0;for(r.table[7]=24,r.table[8]=152,r.table[9]=112,e=0;e<24;++e)r.trans[e]=256+e;for(e=0;e<144;++e)r.trans[24+e]=e;for(e=0;e<8;++e)r.trans[168+e]=280+e;for(e=0;e<112;++e)r.trans[176+e]=144+e;for(e=0;e<5;++e)t.table[e]=0;for(t.table[5]=32,e=0;e<32;++e)t.trans[e]=e})(Ok,Uk),g7(Vv,Zv,4,3),g7(Nk,Dk,2,1),Vv[28]=0,Zv[28]=258;var zZ=function(r,t){var e,n,s=new LZ(r,t);do{switch(e=UZ(s),Co(s,2,0)){case 0:n=DZ(s);break;case 1:n=b7(s,Ok,Uk);break;case 2:NZ(s,s.ltree,s.dtree),n=b7(s,s.ltree,s.dtree);break;default:n=Lk}if(n!==vb)throw new Error("Data error")}while(!e);return s.destLen{let n=r[t];r[t]=r[e],r[e]=n};var FZ={swap32LE:r=>{qZ&&(t=>{const e=t.length;for(let n=0;n1114111?this.errorValue:r<55296||r>56319&&r<=65535?(t=(this.data[r>>5]<<2)+(31&r),this.data[t]):r<=65535?(t=(this.data[2048+(r-55296>>5)]<<2)+(31&r),this.data[t]):r>11)],t=this.data[t+(r>>5&63)],t=(t<<2)+(31&r),this.data[t]):this.data[this.data.length-4]}},zk={exports:{}};zk.exports=(M7=_7="3.7.5",E7=typeof atob=="function",A7=typeof btoa=="function",ba=typeof Zt.Buffer=="function",Dm=typeof TextDecoder=="function"?new TextDecoder:void 0,zm=typeof TextEncoder=="function"?new TextEncoder:void 0,S7="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",xu=Array.prototype.slice.call(S7),r2={},xu.forEach(function(r,t){return r2[r]=t}),bc=r2,k7=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,bn=String.fromCharCode.bind(String),qm=typeof Uint8Array.from=="function"?Uint8Array.from.bind(Uint8Array):function(r){return new Uint8Array(Array.prototype.slice.call(r,0))},Fm=function(r){return r.replace(/=/g,"").replace(/[+\/]/g,function(t){return t=="+"?"-":"_"})},jm=function(r){return r.replace(/[^A-Za-z0-9\+\/]/g,"")},Km=function(r){for(var t,e,n,s,i="",c=r.length%3,l=0;l255||(n=r.charCodeAt(l++))>255||(s=r.charCodeAt(l++))>255)throw new TypeError("invalid character found");i+=xu[(t=e<<16|n<<8|s)>>18&63]+xu[t>>12&63]+xu[t>>6&63]+xu[63&t]}return c?i.slice(0,c-3)+"===".substring(c):i},U0=ba?function(r){return Zt.Buffer.from(r).toString("base64")}:function(r){for(var t=4096,e=[],n=0,s=r.length;n>>6)+bn(128|63&t):bn(224|t>>>12&15)+bn(128|t>>>6&63)+bn(128|63&t);var t=65536+1024*(r.charCodeAt(0)-55296)+(r.charCodeAt(1)-56320);return bn(240|t>>>18&7)+bn(128|t>>>12&63)+bn(128|t>>>6&63)+bn(128|63&t)},B7=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,Hm=ba?function(r){return Zt.Buffer.from(r,"utf8").toString("base64")}:zm?function(r){return U0(zm.encode(r))}:function(r){return $m(P7(r))},Vm=function(r){return _u(r,!0)},R7=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,C7=function(r){switch(r.length){case 4:var t=((7&r.charCodeAt(0))<<18|(63&r.charCodeAt(1))<<12|(63&r.charCodeAt(2))<<6|63&r.charCodeAt(3))-65536;return bn(55296+(t>>>10))+bn(56320+(1023&t));case 3:return bn((15&r.charCodeAt(0))<<12|(63&r.charCodeAt(1))<<6|63&r.charCodeAt(2));default:return bn((31&r.charCodeAt(0))<<6|63&r.charCodeAt(1))}},Zm=function(r){if(r=r.replace(/\s+/g,""),!k7.test(r))throw new TypeError("malformed base64.");r+="==".slice(2-(3&r.length));for(var t,e,n,s="",i=0;i>16&255):n===64?bn(t>>16&255,t>>8&255):bn(t>>16&255,t>>8&255,255&t);return s},Gm=ba?function(r){return qm(Zt.Buffer.from(r,"base64"))}:function(r){return qm(Wm(r).split("").map(function(t){return t.charCodeAt(0)}))},Ym=function(r){return Gm(Xm(r))},L7=ba?function(r){return Zt.Buffer.from(r,"base64").toString("utf8")}:Dm?function(r){return Dm.decode(Gm(r))}:function(r){return T7(Wm(r))},Xm=function(r){return jm(r.replace(/[-_]/g,function(t){return t=="-"?"+":"/"}))},Qm=function(r){return{value:r,enumerable:!1,writable:!0,configurable:!0}},t2=function(){var r=function(t,e){return Object.defineProperty(String.prototype,t,Qm(e))};r("fromBase64",function(){return Jm(this)}),r("toBase64",function(t){return _u(this,t)}),r("toBase64URI",function(){return _u(this,!0)}),r("toBase64URL",function(){return _u(this,!0)}),r("toUint8Array",function(){return Ym(this)})},e2=function(){var r=function(t,e){return Object.defineProperty(Uint8Array.prototype,t,Qm(e))};r("toBase64",function(t){return N0(this,t)}),r("toBase64URI",function(){return N0(this,!0)}),r("toBase64URL",function(){return N0(this,!0)})},O7=function(){t2(),e2()},wc={version:_7,VERSION:M7,atob:Wm=E7?function(r){return atob(jm(r))}:ba?function(r){return Zt.Buffer.from(r,"base64").toString("binary")}:Zm,atobPolyfill:Zm,btoa:$m=A7?function(r){return btoa(r)}:ba?function(r){return Zt.Buffer.from(r,"binary").toString("base64")}:Km,btoaPolyfill:Km,fromBase64:Jm=function(r){return L7(Xm(r))},toBase64:_u=function(r,t){return t===void 0&&(t=!1),t?Fm(Hm(r)):Hm(r)},encode:_u,encodeURI:Vm,encodeURL:Vm,utob:P7=function(r){return r.replace(B7,I7)},btou:T7=function(r){return r.replace(R7,C7)},decode:Jm,isValid:function(r){if(typeof r!="string")return!1;var t=r.replace(/\s+/g,"").replace(/={0,2}$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},fromUint8Array:N0=function(r,t){return t===void 0&&(t=!1),t?Fm(U0(r)):U0(r)},toUint8Array:Ym,extendString:t2,extendUint8Array:e2,extendBuiltins:O7,Base64:{}},Object.keys(wc).forEach(function(r){return wc.Base64[r]=wc[r]}),wc);const Sr={Other:0,CR:1,LF:2,Control:4,Extend:8,ZWJ:16,Regional_Indicator:32,Prepend:64,SpacingMark:128,L:256,V:512,T:1024,LV:2048,LVT:4096,Extended_Pictographic:8192},$Z=CZ,HZ=TZ,qk=KZ,Fk=zk.exports.Base64,VZ=new qk(Fk.toUint8Array($Z)),ZZ=new qk(Fk.toUint8Array(HZ));function fn(r,t){return(r&t)!=0}const D0=0,n2=1,i2=2;function WZ(r,t){const e=r.length;let n=0,s=D0;for(let i=t;i+165535?2:1,e.push(s)}for(let s=0;sXZ.has(r),jk=/a-z/,Kk=/абвгдеёжзийклмнопрстуфхцчшщъыьэюя/,$k=/\u4e00-\u9fa5/,Hk=/ぁ-んァ-ン/,fa=/0-9/,ca=/\_\-/,Vk=/\u1100-\u115E\u1161-\u11FF\u302E\u302F\u3131-\u3163\u3165-\u318E\u3200-\u321E\u3260-\u327E\uA960-\uA97C\uAC00-\uD158\uD160-\uD172\uD17B-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uFFA1-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC/,Zk=/\u0600-\u0604\u0606-\u060B\u060D-\u061A\u061D-\u061E\u0620-\u063F\u0641-\u064A\u0656-\u066F/,QZ=new RegExp("^["+(jk.source+Kk.source+$k.source+Hk.source+Vk.source+Zk.source+fa.source+ca.source)+"]+$"),Rs=(r,t)=>r?!!t.test(r):!0,yb=r=>Rs(r,QZ),tW=r=>{const t=new RegExp("^["+jk.source+fa.source+ca.source+"]+$");return Rs(r,t)},eW=r=>{const t=new RegExp("^["+$k.source+fa.source+ca.source+"]+$");return Rs(r,t)},rW=r=>{const t=new RegExp("^["+Hk.source+fa.source+ca.source+"]+$");return Rs(r,t)},nW=r=>{const t=new RegExp("^["+Kk.source+fa.source+ca.source+"]+$");return Rs(r,t)},iW=r=>{const t=new RegExp("^["+fa.source+"]+$");return Rs(r,t)},oW=r=>{const t=new RegExp("^["+ca.source+"]+$");return Rs(r,t)},sW=r=>{const t=new RegExp("^["+Vk.source+fa.source+ca.source+"]+$");return Rs(r,t)},aW=r=>{const t=new RegExp("^["+Zk.source+fa.source+ca.source+"]+$");return Rs(r,t)},uW=["🥷","🦣","🦬"],U7=r=>GZ.has(r),Wk=r=>{if(!r)return!1;if(U7(r))return!0;const t=gb(r);for(let e of t){if(uW.includes(e)||e.length===0||JZ(e)||YZ.has(e))return!1;if(!yb(e)&&!U7(e))return!1}return!0};var Bo;(function(r){r[r.English=0]="English",r[r.Cyrillic=1]="Cyrillic",r[r.Chinese=2]="Chinese",r[r.Japanese=3]="Japanese",r[r.Emoji=4]="Emoji",r[r.Unauthorized=5]="Unauthorized",r[r.Korean=6]="Korean",r[r.Arabic=7]="Arabic"})(Bo||(Bo={}));const Gk=r=>gb(r).length>1?Bo.Unauthorized:tW(r)?Bo.English:eW(r)?Bo.Chinese:nW(r)?Bo.Cyrillic:rW(r)?Bo.Japanese:sW(r)?Bo.Korean:aW(r)?Bo.Arabic:Bo.Unauthorized,fW=(r,t)=>{const e=gb(r);for(let n of e){const s=yb(n),i=Wk(n);if((s||!i)&&!oW(n)&&!iW(n)&&t!==Gk(n))return!1}return!0},cW=["","."],hW=({value:r,prev:t,onError:e})=>{if(cW.includes(r))return"";r.endsWith(".sol")&&(r=r.split(".sol")[0]);const n=r.toLowerCase().trim(),s=n.split(".");if(s.length>2)return e==null||e(),t;for(const c of s){const l=yb(c),p=Wk(c);if(!l&&!p||!fW(c,Gk(r[0]||"")))return e==null||e(),t}return n},Yk=(r,t,e=5)=>r?r.length<=t?r:r.slice(0,t-e)+"..."+r.slice(-e):"",Xk=({domain:r,available:t=!1,price:e,children:n})=>St.jsxs("div",{className:"flex flex-row items-center gap-4 px-4 py-3 shadow-domain dark:shadow-none rounded-xl bg-background-secondary min-h-[72px]",children:[St.jsxs("div",{className:"flex flex-col mr-auto",children:[St.jsx("span",{className:"text-base text-content-secondary font-primary",children:Yk(`${r}.sol`,25,3)}),t&&St.jsxs("span",{className:"flex items-center gap-1 text-sm font-medium",children:[St.jsx("img",{className:"w-4 h-4",src:SZ("USDC"),alt:"$"}),e]})]}),n]}),N7=({domain:r,available:t=!1,price:e})=>{const{cart:n,addToCart:s,removeFromCart:i}=xe.useContext(Ah);e=e??Pk(r);const c=!!n[r],[l,p]=xe.useState(c),m=v=>{p(!1),i(v)};return xe.useEffect(()=>{let v;return c&&!l&&(v=setTimeout(()=>{p(!0)},1500)),()=>clearTimeout(v)},[c,l]),St.jsxs(Xk,{domain:r,available:t,price:e,children:[!t&&St.jsx("div",{className:"px-3 rounded-lg bg-accent bg-opacity-10",children:St.jsx("span",{className:"text-xs font-semibold leading-6 tracking-widest text-accent",children:"Registered"})}),t&&St.jsx("div",{className:sn("flex items-center flex-row justify-between min-w-[93px]",t?"gap-2":"gap-1"),children:St.jsx("button",{type:"button",className:sn("flex items-center gap-2 px-3 py-1 text-sm text-base-button-content rounded-lg font-primary bg-theme-primary",c&&l&&"bg-transparent text-theme-primary dark:text-theme-secondary"),tabIndex:0,onClick:()=>c?m(r):s({domain:r,storage:1e3,price:Number(e)}),children:c?St.jsx(St.Fragment,{children:l?St.jsxs(St.Fragment,{children:["Remove",St.jsx(VM,{width:24,height:24})]}):St.jsxs(St.Fragment,{children:["Added",St.jsx(lz,{width:24,height:24})]})}):St.jsxs(St.Fragment,{children:["Add to cart",St.jsx(hz,{width:20,height:20})]})})})]})},D7=()=>St.jsxs("div",{className:"flex flex-row items-center justify-between gap-4 px-4 py-3 shadow-domain dark:shadow-none rounded-xl bg-background-secondary h-[72px] animate-pulse",children:[St.jsx("div",{className:"w-[80px] h-4 rounded-full bg-background-skeleton"}),St.jsx("div",{className:"h-4 rounded-full w-[120px] bg-background-skeleton"})]}),Gv=({className:r,children:t,size:e="full",disabled:n,...s})=>St.jsx("button",{type:"button",disabled:n,...s,tabIndex:0,className:sn("flex items-center gap-2 px-3 justify-center text-white font-primary bg-theme-primary",e==="full"&&"py-2.5 rounded-xl tracking-wide",e==="small"&&"text-sm py-1 rounded-lg",n&&"bg-theme-secondary",r),children:t}),z7=()=>St.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"currentColor",viewBox:"0 0 69 20",className:"h-full",children:[St.jsx("path",{d:"m8.843.27-.124.001.005 4.563h.124L8.843.27ZM16.8 14.917l-3.71-2.271.062-.125 3.71 2.27-.063.126ZM.788 14.917l-.061-.125 3.709-2.271.062.125-3.71 2.27Z"}),St.jsx("path",{d:"M8.784 10.104c-.021 0-.042 0-.042-.02L4.415 7.478a.159.159 0 0 1-.041-.083c0-.042.02-.063.041-.084l4.327-2.604c.021-.02.062-.02.103 0l4.328 2.625c.02.021.04.063.04.084 0 .041-.02.062-.04.083l-4.328 2.604h-.061Zm-4.142-2.73 4.121 2.5 4.121-2.478-4.121-2.5-4.121 2.479Z"}),St.jsx("path",{d:"M8.784 15.292c-.021 0-.042 0-.042-.021l-4.327-2.584a.159.159 0 0 1-.041-.083V7.396c0-.042.02-.063.041-.083.02-.021.062-.021.103 0l4.327 2.604c.021.02.042.062.042.083v5.188c0 .041-.021.062-.042.083-.04.02-.061.02-.061.02Zm-4.225-2.75 4.122 2.479v-4.959l-4.122-2.5v4.98Z"}),St.jsx("path",{d:"M8.784 15.292c-.021 0-.042 0-.042-.021a.159.159 0 0 1-.04-.084V10c0-.042.02-.063.04-.083l4.328-2.604c.02-.021.062-.021.103 0 .02.02.04.062.04.083v5.229c0 .042-.02.063-.04.083l-4.328 2.584h-.061Zm.082-5.23v4.959l4.121-2.459v-5l-4.12 2.5Z"}),St.jsx("path",{d:"M8.784 20 .5 15V5l8.284-5 8.283 5v10l-8.283 5Zm-7.83-5.27 7.809 4.728 7.81-4.729V5.271L8.783.563.954 5.27v9.458Z"}),St.jsx("path",{d:"M8.763 10.292.623 5.354C.522 5.292.48 5.146.542 5.021c.062-.125.206-.146.31-.084L8.762 9.73l7.954-4.792c.103-.062.247-.02.31.084.06.125.02.27-.083.333l-8.181 4.938Z"}),St.jsx("path",{d:"M8.784 19.958c-.124 0-.227-.104-.227-.25V10c0-.125.103-.25.227-.25.123 0 .226.104.226.25v9.708c0 .146-.103.25-.226.25ZM30.4 12.125c0 1.5-1.154 2.438-3.01 2.438h-3.585V5.979h3.38c1.834 0 2.988.854 2.988 2.25a1.97 1.97 0 0 1-1.32 1.875c.949.271 1.546 1.063 1.546 2.021Zm-3.215-2.562c.886 0 1.422-.438 1.422-1.167 0-.688-.536-1.125-1.422-1.125H25.35v2.292h1.834Zm.165 3.708c.886 0 1.442-.458 1.442-1.208 0-.73-.577-1.209-1.525-1.209h-1.916v2.417h1.999ZM31.327 11.167c0-2.209 1.277-3.542 3.38-3.542 2.1 0 3.378 1.333 3.378 3.542 0 2.208-1.277 3.541-3.379 3.541-2.102 0-3.38-1.333-3.38-3.541Zm3.38 2.333c1.194 0 1.915-.896 1.915-2.333 0-1.459-.72-2.334-1.916-2.334-1.195 0-1.937.896-1.937 2.334 0 1.458.742 2.333 1.937 2.333ZM42.825 8.875c-.804 0-1.463.5-1.937 1.604v4.084h-1.463V7.77h1.401l.041 1c.557-.77 1.36-1.167 2.205-1.167 1.525 0 2.473 1.042 2.473 2.625v4.313h-1.443v-4.209c.021-.895-.494-1.458-1.277-1.458ZM49.09 14.563h-1.443V8.957H46.43V7.771h1.216v-.73c0-1.374.783-2.229 2.06-2.229h1.628V6h-1.133c-.804 0-1.113.25-1.113 1v.75h4.08v6.792h-1.442V8.958h-2.638v5.604ZM59.763 8.604V5.5h1.443v9.063h-1.381l-.041-.855c-.454.625-1.237 1-2.123 1-1.772 0-3.008-1.5-3.008-3.541 0-2.042 1.236-3.542 3.008-3.542.886 0 1.628.375 2.102.98ZM57.991 13.5c.824 0 1.463-.52 1.772-1.333v-2c-.288-.813-.948-1.334-1.772-1.334-1.133 0-1.916.98-1.916 2.334.02 1.354.783 2.333 1.916 2.333ZM67.078 13.646c-.453.708-1.236 1.062-2.184 1.062-1.298 0-2.164-.791-2.164-2 0-1.395 1.092-2.208 2.926-2.208h1.402v-.417c0-.854-.577-1.395-1.525-1.395-.907 0-1.505.479-1.566 1.25h-1.422c.103-1.438 1.277-2.334 3.05-2.334 1.792 0 2.905.938 2.905 2.542v4.396h-1.38l-.042-.896Zm-1.854-.104c.803 0 1.421-.438 1.834-1.188v-.791l-1.443.02c-.906 0-1.442.355-1.442 1.063 0 .52.35.896 1.05.896Z"})]}),lW=({domain:r,onEdit:t})=>{const{cart:e,removeFromCart:n}=xe.useContext(Ah),s=e[r];return St.jsx(Xk,{domain:s.domain,available:!0,price:s.price,children:St.jsxs("div",{className:"flex flex-col items-end gap-2 text-sm",children:[St.jsxs("div",{className:"flex flex-row gap-2",children:[St.jsxs("span",{children:["Storage: ",s.storage/1e3,"kB"]}),St.jsxs("button",{type:"button",className:"flex items-center text-theme-primary dark:text-theme-secondary gap-0.5",tabIndex:0,onClick:t,children:["Edit",St.jsx(cz,{width:16,height:16})]})]}),St.jsxs("button",{type:"button",className:"flex items-center gap-2 text-theme-primary dark:text-theme-secondary",tabIndex:0,onClick:()=>n(r),children:["Remove",St.jsx(VM,{width:20,height:20})]})]})})},q7=({children:r,isVisible:t,toggleVisibility:e})=>{const n=xe.useRef(null),s=c=>{c.preventDefault(),c.target===n.current&&e(!t)},i=xe.useCallback(c=>{c.code==="Escape"&&e(!1)},[e]);return xe.useEffect(()=>{t&&document.addEventListener("keydown",i),t||document.removeEventListener("keydown",i)},[t,i]),t?St.jsx("div",{className:sn("animate-modal-fade-in absolute top-0 bottom-0 left-0 right-0","bg-modal-overlay-bg bg-opacity-60 z-[1]","flex items-center justify-center"),ref:n,onClick:s,children:r}):null},dW=new Ne("ETp9eKXVv1dWwHSpsXRUuXHmw24PwRkttCGVgpZEY9zF"),pW=new Ne("H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG"),mW=new Ne("Gnt27xtC473ZT2Mw5u8wZ68Z3gULkSTb5DuxJy7eJotD"),vW=new Ne("3vxLXJqLqF3JG5TCbYycbKWRBbCJQLxQmBGCkyqEEefL"),gW=new Ne("E4v1BBgoso9s64TQvmyownAVJbhbEPGyzA3qn4n46qj9"),yW=new Ne("8ihFLu5FimgTQ1Unh4dVyEHUGodJ5gJQCrQf4KUVB9bN"),bW=new Ne("AbMTYZ82Xfv9PtTQ5e1fJXemXjzqEEFHP3oDLRTae6yz"),F7=new Map([["EchesyfXePKdLtoiZSL8pBe8Myagyy8ZRqsACNCFGnvp",dW],["So11111111111111111111111111111111111111112",pW],["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",mW],["Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",vW],["mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So",gW],["DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",yW],["EPeUFDgHRxs9xxEPVaL6kfGQvCon7jmAWKVUHuux1Tpz",bW]]),wW=async(r,t)=>{var s;const e=(s=await r.getAccountInfo(t))==null?void 0:s.data;if(!e)throw new Error("Unable to retrieve oracle data");const n=ND.parsePriceData(e);return n.price||n.previousPrice},xW=()=>{const{connection:r}=vg();return yg(async()=>{var n;if(!r)return;const e=new Map;for(const s of F7.keys())e.set(s,{price:await wW(r,F7.get(s)),decimals:((n=mh.find(i=>i.mintAddress===s))==null?void 0:n.decimals)||4});return e},[!!r])},_W=async(r,t)=>{var e;try{const n=await r.getTokenAccountBalance(t);return((e=n==null?void 0:n.value)==null?void 0:e.uiAmount)||0}catch{return 0}},MW=()=>{const{publicKey:r,connection:t}=ad(),[e,n]=xe.useState({}),s=xe.useCallback(async()=>{if(r){const i={};for(const c of mh){const l=new Ne(c.mintAddress),p=n9(l,r),m=await _W(t,p);if(l.equals(wg)){const v=await t.getBalance(r)/dI;i[c.tokenSymbol]=v+m}else i[c.tokenSymbol]=m}n(i)}},[r,t]);return xe.useEffect(()=>{s()},[r,t,s]),{balances:e}},EW=()=>St.jsxs("div",{className:"flex flex-col items-center justify-center gap-10 grow",children:[St.jsx("div",{className:"w-[76px] h-[76px] rounded-full border-4 border-theme-secondary border-t-theme-primary animate-spin"}),St.jsx("span",{className:"max-w-[225px] font-primary text-center font-medium tracking-wider",children:"Your transaction is being processed..."})]}),AW=()=>St.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 px-3 grow-[0.5] text-center",children:[St.jsx(pz,{width:90,height:90,className:"text-theme-primary text-opacity-60"}),St.jsx("p",{className:"text-lg font-bold font-primary",children:"Congrats on registering your domains!"}),St.jsxs("p",{className:"text-sm font-primary",children:["Head over to",St.jsx("a",{href:"https://www.sns.id/",rel:"noopener",target:"_blank",className:"mx-1 text-theme-primary",children:"sns.id"}),"to learn how to take full advantage of your domains"]})]}),SW=()=>St.jsxs("div",{className:"flex flex-col items-center justify-center gap-6 px-3 grow-[0.5] text-center",children:[St.jsx(WM,{width:90,height:90,className:"rotate-180 text-theme-primary text-opacity-60"}),St.jsx("p",{className:"text-lg font-bold font-primary",children:"Something went wrong"}),St.jsx("p",{className:"text-sm font-primary",children:"Please retry the process"})]}),kW=[{label:"1kb",value:1e3},{label:"2kb",value:2e3},{label:"3kb",value:3e3},{label:"4kb",value:4e3},{label:"5kb",value:5e3},{label:"6kb",value:6e3},{label:"7kb",value:7e3},{label:"8kb",value:8e3},{label:"9kb",value:9e3},{label:"10kb",value:1e4}],IW=({backHandler:r})=>{const t=xW(),{publicKey:e,connection:n,signAllTransactions:s}=ad(),{balances:i}=MW(),[c,l]=xe.useState(1),{cart:p,emptyCart:m,addToCart:v,referrerKey:_}=xe.useContext(Ah),{setError:E}=xe.useContext(sd),[w,x]=xe.useState(mh[0]),[A,B]=xe.useState(!1),[P,R]=xe.useState(""),[C,O]=xe.useState("registering"),z=w.mintAddress===O0,H=z?.95:1,tt=Object.values(p).reduce((h,g)=>h+Pk(g.domain)*H,0);xe.useEffect(()=>{},[e,n]);const nt=h=>{var S,I;const g=(I=(S=t.result)==null?void 0:S.get(h))==null?void 0:I.price;return tt/(g||1)},G=h=>{const g=nt(h);return h===O0?g*.95:g};xe.useEffect(()=>{Object.keys(p).length||r()},[p,r]);const M={1:"w-[33%]",2:"w-[66%]",3:"w-full"},d=()=>{c===2?l(1):r()},o=async()=>{switch(c){case 2:await f();break;case 3:C==="error"&&await f(),C==="success"&&(m(),r(!0));break;default:l(c+1);break}},a=G(w.mintAddress),f=async()=>{if(!(!n||!e||!s)){if(i[w.tokenSymbol]_.equals(F)):void 0);h.push(...Z)}if(wg.equals(S)){const D=await BZ(n,I,g,Math.ceil(a*1.01*Math.pow(10,9))),Z=PZ(I,g);h=[...D,...h,...Z]}const y=kZ(h,g),{blockhash:u}=await n.getLatestBlockhash();let b=y.map(D=>new Zl().add(...D));b.forEach(D=>{D.feePayer=g,D.recentBlockhash=u}),b=await s(b);for(const D of b){const Z=await n.sendRawTransaction(D.serialize());await n.confirmTransaction(Z),console.log(Z)}O("success"),l(3)}catch(h){if(console.error(h),h instanceof pI){E(h.message),O("registering");return}l(3),O("error")}}};return St.jsxs("div",{className:"flex flex-col flex-grow pb-14",children:[St.jsxs("div",{className:"sticky -top-1 bg-background-primary h-[48px] flex justify-center items-center px-3",children:[St.jsx("button",{type:"button",tabIndex:0,onClick:d,disabled:C==="processing",className:"absolute top-0 p-3 border-0 left-3 text-theme-primary dark:text-theme-secondary",children:St.jsx(mz,{width:24,height:24})}),St.jsx("div",{className:"w-[175px] h-[5px] rounded-md bg-background-interactive dark:bg-background-secondary bg-gradient-to-r",children:St.jsx("div",{className:sn("bg-theme-primary dark:bg-theme-secondary h-full rounded-md transition-[width] duration-500",M[c])})})]}),St.jsxs("div",{className:"flex flex-col flex-grow pt-6 body",children:[C==="success"&&St.jsx(AW,{}),C==="error"&&St.jsx(SW,{}),C==="processing"&&St.jsx(EW,{}),C==="registering"&&St.jsxs(St.Fragment,{children:[c===1&&St.jsxs(St.Fragment,{children:[St.jsx("p",{className:"px-3 mb-2 ml-4 text-sm text-text-secondary font-primary",children:"You are registering"}),St.jsx("div",{className:"flex flex-col gap-2 px-3 pb-4",children:Object.values(p).map(h=>St.jsx(lW,{domain:h.domain,onEdit:()=>R(h.domain)},h.domain))}),St.jsx(q7,{isVisible:!!P,toggleVisibility:()=>R(""),children:!!P&&St.jsxs("div",{className:"w-[320px] p bg-background-primary flex flex-col gap-3 p-4 rounded-xl",children:[St.jsxs("p",{className:"flex items-start justify-between text-lg font-medium font-primary",children:["Storage size",St.jsx("button",{type:"button",tabIndex:0,className:"p-1 -mt-3 -mr-3",onClick:()=>R(""),children:St.jsx(GM,{width:24,height:24})})]}),St.jsxs("div",{className:"text-xs",children:[St.jsx("p",{className:"mb-2",children:"The storage size will determine the maximum amount of data you can store on your domain."}),St.jsxs("p",{className:"",children:[St.jsx(vz,{width:16,height:16,className:"inline mr-1 mb-[2px] text-accent"}),"Each additional kb of memory costs around 0.007 SOL (0.001 USDC)"]})]}),St.jsx("div",{className:"grid grid-cols-5 gap-2",children:kW.map(h=>{const g=p[P],S=h.value===(g==null?void 0:g.storage);return St.jsx("button",{type:"button",tabIndex:0,className:sn("border-2 border-solid rounded-lg px-2 py-2 border-theme-primary border-opacity-10 text-sm",S&&"border-opacity-100"),onClick:()=>{v({...g,storage:h.value}),R("")},children:h.label},h.value)})})]})})]}),c===2&&St.jsxs("div",{className:"flex flex-col flex-grow px-3 pb-5",children:[St.jsxs("div",{className:"mb-auto",children:[St.jsx("p",{className:"mb-3 ml-4 font-medium font-primary",children:"Pay with"}),St.jsx("div",{children:St.jsxs("button",{type:"button",tabIndex:0,className:"flex items-center w-full gap-4 p-4 border cursor-pointer rounded-xl border-interactive-border bg-background-interactive",onClick:()=>B(!A),children:[St.jsx("img",{className:"w-4 h-4 rounded-[50%]",src:w.icon,alt:w.tokenSymbol}),St.jsx("span",{className:"tracking-wide text-text-primary",children:w.tokenSymbol}),St.jsxs("div",{className:"relative w-[25px] h-[25px] flex justify-center items-center ml-auto",children:[St.jsx("div",{className:sn("transition-transform duration-200 absolute w-[8px] h-[2px] bg-theme-primary dark:bg-theme-secondary rounded-sm -rotate-[45deg] ml-[5px]",A&&"rotate-[45deg]")}),St.jsx("div",{className:sn("transition-transform duration-200 absolute w-[8px] h-[2px] bg-theme-primary dark:bg-theme-secondary rounded-sm rotate-[45deg] -ml-[4px]",A&&"-rotate-[45deg]")})]})]})})]}),St.jsxs("div",{children:[St.jsx("p",{className:"mb-3 font-medium font-primary",children:"Order summary"}),St.jsxs("div",{className:"flex items-start justify-between mb-2 text-sm font-medium leading-6 border-b border-interactive-border",children:[St.jsx("div",{children:"Total"}),St.jsxs("div",{className:"flex flex-col items-end",children:[St.jsxs("span",{children:[L0(a,!0)," ",w.tokenSymbol]}),St.jsx("span",{className:"text-xs leading-6 text-text-primary text-opacity-60 dark:text-text-secondary",children:L0(tt)})]})]}),St.jsxs("div",{className:"flex items-start justify-between text-sm font-medium leading-6 border-b border-interactive-border",children:[St.jsx("div",{children:"Discount"}),St.jsx("div",{children:z?"5%":"0%"})]})]}),St.jsx(q7,{isVisible:A,toggleVisibility:B,children:St.jsx("div",{className:"w-[320px] bg-background-primary flex flex-col gap-3 py-3 rounded-xl",children:mh.map(h=>{const g=G(h.mintAddress),S=i[h.tokenSymbol]{x(h),B(!1)},children:[St.jsx("img",{src:h.icon,alt:h.tokenSymbol,className:"w-6 h-6 rounded-[50%]"}),St.jsxs("div",{className:"flex flex-col items-start",children:[St.jsx("span",{children:h.tokenSymbol}),St.jsxs("span",{className:"flex text-xs text-text-secondary gap-0.5 items-center",children:[St.jsx(ZM,{width:14,height:14}),i[h.tokenSymbol]]})]}),St.jsxs("div",{className:"flex flex-col ml-auto text-sm",children:[St.jsxs("span",{className:sn("tabular-nums",h.mintAddress===O0&&"line-through"),children:[L0(nt(h.mintAddress),!0)," ",h.tokenSymbol]}),St.jsx("span",{className:"tabular-nums text-success",children:h.mintAddress===O0&&St.jsxs(St.Fragment,{children:[L0(G(h.mintAddress),!0)," ","FIDA"]})})]})]},h.tokenSymbol)})})})]})]})]}),C==="processing"?null:St.jsxs("div",{className:"absolute flex flex-col gap-2 left-3 right-3 bottom-4",children:[St.jsxs(Gv,{className:sn("text-base-button-content",C==="error"&&"bottom-[70px]"),onClick:o,children:[c===1&&"Continue to payment",c===2&&C==="registering"&&"Confirm and register",C==="success"&&"Done",C==="error"&&"Retry"]}),C==="error"&&St.jsx(Gv,{className:sn("bg-transparent text-theme-primary"),onClick:()=>r(),children:"Close"})]})]})},BW=()=>{const{visible:r,setVisible:t,connected:e,publicKey:n,disconnect:s}=ad(),[i,c]=xe.useState(!1),l=()=>{e?c(!i):t(!r)},p=()=>{s(),c(!1)};return St.jsxs("div",{className:"relative flex ml-auto",children:[St.jsxs("button",{type:"button",className:"relative flex items-center gap-2 px-3 h-[32px] py-1 text-xs tracking-wide rounded-lg bg-theme-secondary font-primary text-theme-primary",tabIndex:0,"aria-label":"Connect wallet","aria-haspopup":"true",onClick:l,children:[St.jsx(ZM,{width:16,height:16}),e?Yk(n==null?void 0:n.toString(),8,4):"Connect wallet",e&&St.jsx(gz,{className:sn("transition-transform",i&&"rotate-180")})]}),St.jsx("button",{type:"button",tabIndex:0,"aria-label":"Disconnect wallet",className:sn(!i&&"invisible opacity-0 -translate-y-1","absolute h-[48px] top-[100%] left-0 right-0 w-full z-10","duration-300 transition-[transform,opacity]","bg-background-secondary rounded-xl text-base flex items-center justify-center text-text-primary","shadow-domain dark:shadow-none dark:border dark:border-interactive-border","active:opacity-70 active:transition-none"),onClick:p,children:"Disconnect"})]})},PW=({status:r})=>{const{setStatus:t}=xe.useContext(sd);return xe.useMemo(()=>{setTimeout(()=>{t(null)},4e3)},[t]),St.jsxs("div",{className:sn("bg-background-primary dark:border dark:border-interactive-border","shadow-xl dark:shadow-none","absolute top-2.5 left-3 right-3 rounded-lg py-3 px-4 flex gap-2 z-10 overflow-hidden"),children:[St.jsx("div",{className:sn("absolute top-0 left-0 right-0 h-0.5 animate-width-to-zero",r.status==="error"&&"bg-error",r.status==="success"&&"bg-success")}),St.jsxs("button",{className:"absolute flex items-center justify-center w-5 h-5 top-1 right-1",type:"button",tabIndex:0,onClick:()=>t(null),children:[St.jsx("div",{className:"absolute w-4 h-[1px] bg-text-primary rotate-45"}),St.jsx("div",{className:"absolute w-4 h-[1px] bg-text-primary -rotate-45"})]}),r.status==="error"&&St.jsx(WM,{width:20,height:20,className:"rotate-180 text-error mt-0.5 shrink-0"}),St.jsx("span",{className:"font-medium font-primary",children:r.message})]})},RW=({className:r,style:t,partnerLogo:e}={})=>{var a,f;const{connected:n,setVisible:s,visible:i,connection:c}=ad(),[l,p]=xe.useState("home"),[m,v]=xe.useState(!1),[_,E]=xe.useState(!1),[w,x]=xe.useState(""),[A,B]=xe.useState(""),{isCartEmpty:P}=xe.useContext(Ah),{status:R}=xe.useContext(sd),C=uz({connection:c,domain:A}),O=fz({connection:c,domain:A}),[z,H]=xe.useState(null),tt=h=>{E(!1),z&&clearTimeout(z),x(hW({value:h,prev:w,onError:()=>{E(!0);const g=setTimeout(()=>{E(!1)},3e3);H(g)}}))},nt=h=>{h.preventDefault(),p("search"),B(w)},G=(h=!1)=>{h?(B(""),x(""),v(!1),p("home")):p("search")},M=l==="home",d=l==="search",o=l==="cart";return St.jsxs("div",{className:sn("flex flex-col w-[93svw] h-[560px] max-h-[75svh] max-w-[400px] bg-background-primary rounded-lg absolute bottom-16 right-0 text-text-primary overflow-auto","shadow-xl dark:border dark:border-interactive-border",r),style:t,"aria-label":"SNS widget allows you to quickly search and buy .sol domains",children:[R&&St.jsx(PW,{status:R}),St.jsxs("div",{className:"flex items-center px-3 pt-3",children:[!M&&St.jsx("div",{className:"flex items-center justify-center gap-2 text-sm font-medium text-center text-text-primary",children:St.jsx("span",{className:"h-[26px]",children:St.jsx(z7,{})})}),St.jsx(BW,{})]}),St.jsxs("div",{className:"flex flex-col flex-grow overflow-auto",children:[(M||d)&&St.jsxs(St.Fragment,{children:[St.jsxs("div",{className:sn("translate-y-[80px] transition-all duration-700 px-3",d&&"-translate-y-[22px]"),children:[St.jsx("h1",{className:sn("block max-h-[32px] text-2xl font-medium text-center font-primary transition-[opacity] ease-out duration-200",d&&"opacity-0 invisible",m&&"max-h-0"),onTransitionEnd:()=>{d&&v(!0)},children:"Secure a custom domain"}),St.jsxs("form",{className:"flex gap-2 mt-10",onSubmit:nt,children:[St.jsx(wz,{value:w,placeholder:"Search your domain",autoCapitalize:"off",spellCheck:"false",enterKeyHint:"search",className:"shadow-input-field dark:shadow-none",type:"search",required:!0,errorMessage:_?"Character not allowed":void 0,onChange:h=>tt(h.target.value)}),St.jsx("button",{className:` + rounded-[10px] bg-theme-primary h-[56px] w-[56px] p-2 + flex items-center justify-center text-base-button-content + `,tabIndex:0,children:St.jsx(dz,{width:24,height:24})})]})]}),d&&St.jsxs(St.Fragment,{children:[St.jsxs("div",{className:"px-3 mb-3 overflow-auto animate-fade-in",children:[C.loading?St.jsx(D7,{}):St.jsx(St.Fragment,{children:(a=C.result)==null?void 0:a.map(h=>St.jsx(N7,{domain:h.domain,available:h.available},h.domain))}),St.jsxs("div",{className:"mt-4",children:[O.status!=="error"&&St.jsx("p",{className:"mb-2 ml-4 text-sm text-text-secondary font-primary",children:"You might also like"}),St.jsxs("div",{className:"flex flex-col gap-2 pb-14",children:[O.status==="error"&&St.jsxs("div",{children:[St.jsx("p",{className:"mb-6 text-sm tracking-widest text-center",children:"Looks like we have an issue helping you with domain suggestions."}),St.jsxs("button",{type:"button",className:"m-auto flex items-center gap-2 px-3 h-[32px] w-max py-1 text-xs tracking-wide rounded-lg bg-theme-secondary font-primary text-theme-primary",tabIndex:0,"aria-label":`Try load suggestions for ${A} again`,onClick:()=>O.execute(),children:["Try again '",A,"'"]}),St.jsx("p",{className:"my-6 text-sm tracking-widest text-center",children:"...and if the problem persists"}),St.jsx("div",{className:"flex justify-center",children:St.jsxs("a",{className:"flex items-center gap-2 justify-center text-theme-primary text-[11px] tracking-wider dark:text-theme-secondary",href:"https://discord.bonfida.org",target:"_blank",rel:"noopener",children:[St.jsx(bz,{width:24}),"Tell us on discord",St.jsx(yz,{width:18})]})})]}),O.loading?St.jsx(St.Fragment,{children:new Array(5).fill(0).map((h,g)=>St.jsx(D7,{},g))}):St.jsx(St.Fragment,{children:(f=O.result)==null?void 0:f.map(h=>St.jsx(N7,{domain:h.domain,available:h.available},h.domain))})]})]})]}),!P&&St.jsx(Gv,{className:"absolute left-3 right-3 bottom-3 text-base-button-content",onClick:()=>{n?p("cart"):s(!i)},children:n?"Go to cart":"Connect your wallet"})]})]}),o&&St.jsx(IW,{backHandler:G})]}),M&&St.jsx("div",{className:"p-3",children:St.jsxs("div",{className:"flex items-center justify-center gap-2 text-sm font-medium text-center text-text-primary",children:["Powered by",St.jsx("span",{className:"h-[20px] flex",children:St.jsx(z7,{})}),e&&St.jsxs(St.Fragment,{children:[St.jsx("span",{children:"x"}),St.jsx("span",{className:"flex",children:e})]})]})})]})},mG=({endpoint:r,connection:t,passthroughWallet:e,containerClassNames:n,containerStyles:s,referrerKey:i,partnerLogo:c})=>St.jsx(YC,{endpoint:r,connection:t,passthroughWallet:e,children:St.jsx(KC,{referrerKey:i,children:St.jsx($C,{children:St.jsx(RW,{className:n,style:s,partnerLogo:c})})})});export{mG as default}; diff --git a/preview-build/index.html b/preview-build/index.html index dae7501..b12c690 100644 --- a/preview-build/index.html +++ b/preview-build/index.html @@ -4,7 +4,7 @@ SNS Registration Widget - +