@depay/widgets 12.17.0 → 12.18.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,7 +7,7 @@ O=function(){return e};var e={},t=Object.prototype,n=t.hasOwnProperty,r="functio
7
7
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
8
8
  e.exports=n=function(){return r},e.exports.__esModule=!0,e.exports.default=e.exports;var r={},i=Object.prototype,o=i.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},s=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function l(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,n){return e[t]=n}}function h(e,t,n,r){var i=t&&t.prototype instanceof p?t:p,o=Object.create(i.prototype),a=new E(r||[]);return o._invoke=function(e,t,n){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return k()}for(n.method=i,n.arg=o;;){var a=n.delegate;if(a){var s=I(a,n);if(s){if(s===f)continue;return s}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if("suspendedStart"===r)throw r="completed",n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);r="executing";var u=d(e,t,n);if("normal"===u.type){if(r=n.done?"completed":"suspendedYield",u.arg===f)continue;return{value:u.arg,done:n.done}}"throw"===u.type&&(r="completed",n.method="throw",n.arg=u.arg)}}}(e,n,a),o}function d(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}r.wrap=h;var f={};function p(){}function y(){}function m(){}var g={};l(g,s,(function(){return this}));var v=Object.getPrototypeOf,w=v&&v(v(x([])));w&&w!==i&&o.call(w,s)&&(g=w);var b=m.prototype=p.prototype=Object.create(g);function M(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function A(e,n){function r(i,a,s,u){var c=d(e[i],e,a);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==t(h)&&o.call(h,"__await")?n.resolve(h.__await).then((function(e){r("next",e,s,u)}),(function(e){r("throw",e,s,u)})):n.resolve(h).then((function(e){l.value=e,s(l)}),(function(e){return r("throw",e,s,u)}))}u(c.arg)}var i;this._invoke=function(e,t){function o(){return new n((function(n,i){r(e,t,n,i)}))}return i=i?i.then(o,o):o()}}function I(e,t){var n=e.iterator[t.method];if(void 0===n){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,I(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var r=d(n,e.iterator,t.arg);if("throw"===r.type)return t.method="throw",t.arg=r.arg,t.delegate=null,f;var i=r.arg;return i?i.done?(t[e.resultName]=i.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):i:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function N(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function E(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(N,this),this.reset(!0)}function x(e){if(e){var t=e[s];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,r=function t(){for(;++n<e.length;)if(o.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return r.next=r}}return{next:k}}function k(){return{value:void 0,done:!0}}return y.prototype=m,l(b,"constructor",m),l(m,"constructor",y),y.displayName=l(m,c,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===y||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,m):(e.__proto__=m,l(e,c,"GeneratorFunction")),e.prototype=Object.create(b),e},r.awrap=function(e){return{__await:e}},M(A.prototype),l(A.prototype,u,(function(){return this})),r.AsyncIterator=A,r.async=function(e,t,n,i,o){void 0===o&&(o=Promise);var a=new A(h(e,t,n,i),o);return r.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},M(b),l(b,c,"Generator"),l(b,s,(function(){return this})),l(b,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var t=[];for(var n in e)t.push(n);return t.reverse(),function n(){for(;t.length;){var r=t.pop();if(r in e)return n.value=r,n.done=!1,n}return n.done=!0,n}},r.values=x,E.prototype={constructor:E,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&o.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(n,r){return a.type="throw",a.arg=e,t.next=n,r&&(t.method="next",t.arg=void 0),!!r}for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],a=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var s=o.call(i,"catchLoc"),u=o.call(i,"finallyLoc");if(s&&u){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,f):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),T(n),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;T(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,n){return this.delegate={iterator:x(e),resultName:t,nextLoc:n},"next"===this.method&&(this.arg=void 0),f}},r}e.exports=n,e.exports.__esModule=!0,e.exports.default=e.exports}(fa)),fa.exports}var ga,va={exports:{}};var wa,ba={exports:{}};function Ma(){return wa||(wa=1,function(e){e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports}(ba)),ba.exports}var Aa,Ia={exports:{}};function Na(){return Aa||(Aa=1,function(e){function t(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}e.exports=function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports}(Ia)),Ia.exports}var Ta,Ea,xa={exports:{}},ka={exports:{}};function La(){return Ta||(Ta=1,function(e){function t(n,r){return e.exports=t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,t(n,r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(ka)),ka.exports}function Sa(){return Ea||(Ea=1,function(e){var t=La();e.exports=function(e,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(n&&n.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),n&&t(e,n)},e.exports.__esModule=!0,e.exports.default=e.exports}(xa)),xa.exports}var ja,Da,Ca={exports:{}},Oa={exports:{}};function za(){return ja||(ja=1,function(e){e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.__esModule=!0,e.exports.default=e.exports}(Oa)),Oa.exports}function Pa(){return Da||(Da=1,function(e){var t=ya().default,n=za();e.exports=function(e,r){if(r&&("object"===t(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return n(e)},e.exports.__esModule=!0,e.exports.default=e.exports}(Ca)),Ca.exports}var _a,Ba={exports:{}};function Ra(){return _a||(_a=1,function(e){function t(n){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.__esModule=!0,e.exports.default=e.exports,t(n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}(Ba)),Ba.exports}var Ua,Qa={exports:{}};function Wa(){return Ua||(Ua=1,function(e){var t=Object.prototype.hasOwnProperty,n="~";function r(){}function i(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,r,o,a){if("function"!=typeof r)throw new TypeError("The listener must be a function");var s=new i(r,o||e,a),u=n?n+t:t;return e._events[u]?e._events[u].fn?e._events[u]=[e._events[u],s]:e._events[u].push(s):(e._events[u]=s,e._eventsCount++),e}function a(e,t){0==--e._eventsCount?e._events=new r:delete e._events[t]}function s(){this._events=new r,this._eventsCount=0}Object.create&&(r.prototype=Object.create(null),(new r).__proto__||(n=!1)),s.prototype.eventNames=function(){var e,r,i=[];if(0===this._eventsCount)return i;for(r in e=this._events)t.call(e,r)&&i.push(n?r.slice(1):r);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},s.prototype.listeners=function(e){var t=n?n+e:e,r=this._events[t];if(!r)return[];if(r.fn)return[r.fn];for(var i=0,o=r.length,a=new Array(o);i<o;i++)a[i]=r[i].fn;return a},s.prototype.listenerCount=function(e){var t=n?n+e:e,r=this._events[t];return r?r.fn?1:r.length:0},s.prototype.emit=function(e,t,r,i,o,a){var s=n?n+e:e;if(!this._events[s])return!1;var u,c,l=this._events[s],h=arguments.length;if(l.fn){switch(l.once&&this.removeListener(e,l.fn,void 0,!0),h){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,t),!0;case 3:return l.fn.call(l.context,t,r),!0;case 4:return l.fn.call(l.context,t,r,i),!0;case 5:return l.fn.call(l.context,t,r,i,o),!0;case 6:return l.fn.call(l.context,t,r,i,o,a),!0}for(c=1,u=new Array(h-1);c<h;c++)u[c-1]=arguments[c];l.fn.apply(l.context,u)}else{var d,f=l.length;for(c=0;c<f;c++)switch(l[c].once&&this.removeListener(e,l[c].fn,void 0,!0),h){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,t);break;case 3:l[c].fn.call(l[c].context,t,r);break;case 4:l[c].fn.call(l[c].context,t,r,i);break;default:if(!u)for(d=1,u=new Array(h-1);d<h;d++)u[d-1]=arguments[d];l[c].fn.apply(l[c].context,u)}}return!0},s.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},s.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},s.prototype.removeListener=function(e,t,r,i){var o=n?n+e:e;if(!this._events[o])return this;if(!t)return a(this,o),this;var s=this._events[o];if(s.fn)s.fn!==t||i&&!s.once||r&&s.context!==r||a(this,o);else{for(var u=0,c=[],l=s.length;u<l;u++)(s[u].fn!==t||i&&!s[u].once||r&&s[u].context!==r)&&c.push(s[u]);c.length?this._events[o]=1===c.length?c[0]:c:a(this,o)}return this},s.prototype.removeAllListeners=function(e){var t;return e?(t=n?n+e:e,this._events[t]&&a(this,t)):(this._events=new r,this._eventsCount=0),this},s.prototype.off=s.prototype.removeListener,s.prototype.addListener=s.prototype.on,s.prefixed=n,s.EventEmitter=s,e.exports=s}(Qa)),Qa.exports}!function(e){var t=ua.exports;Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=t(function(){if(da)return ha;da=1;var e=ma()();ha=e;try{regeneratorRuntime=e}catch(t){"object"===("undefined"==typeof globalThis?"undefined":z(globalThis))?globalThis.regeneratorRuntime=e:Function("r","regeneratorRuntime = r")(e)}return ha}()),r=t((ga||(ga=1,function(e){function t(e,t,n,r,i,o,a){try{var s=e[o](a),u=s.value}catch(e){return void n(e)}s.done?t(u):Promise.resolve(u).then(r,i)}e.exports=function(e){return function(){var n=this,r=arguments;return new Promise((function(i,o){var a=e.apply(n,r);function s(e){t(a,i,o,s,u,"next",e)}function u(e){t(a,i,o,s,u,"throw",e)}s(void 0)}))}},e.exports.__esModule=!0,e.exports.default=e.exports}(va)),va.exports)),i=t(ya()),o=t(Ma()),a=t(Na()),s=t(Sa()),u=t(Pa()),c=t(Ra()),l=Wa();function h(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=(0,c.default)(e);if(t){var i=(0,c.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,u.default)(this,n)}}var d=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n},f=function(e){(0,s.default)(p,e);var t,u,c,l,f=h(p);function p(e){var t,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"ws://localhost:8080",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;(0,o.default)(this,p);var a=r.autoconnect,s=void 0===a||a,u=r.reconnect,c=void 0===u||u,l=r.reconnect_interval,h=void 0===l?1e3:l,y=r.max_reconnects,m=void 0===y?5:y,g=d(r,["autoconnect","reconnect","reconnect_interval","max_reconnects"]);return(t=f.call(this)).webSocketFactory=e,t.queue={},t.rpc_id=0,t.address=n,t.autoconnect=s,t.ready=!1,t.reconnect=c,t.reconnect_timer_id=void 0,t.reconnect_interval=h,t.max_reconnects=m,t.rest_options=g,t.current_reconnects=0,t.generate_request_id=i||function(){return++t.rpc_id},t.autoconnect&&t._connect(t.address,Object.assign({autoconnect:t.autoconnect,reconnect:t.reconnect,reconnect_interval:t.reconnect_interval,max_reconnects:t.max_reconnects},t.rest_options)),t}return(0,a.default)(p,[{key:"connect",value:function(){this.socket||this._connect(this.address,Object.assign({autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects},this.rest_options))}},{key:"call",value:function(e,t,n,r){var o=this;return r||"object"!==(0,i.default)(n)||(r=n,n=null),new Promise((function(i,a){if(!o.ready)return a(new Error("socket not ready"));var s=o.generate_request_id(e,t),u={jsonrpc:"2.0",method:e,params:t||null,id:s};o.socket.send(JSON.stringify(u),r,(function(e){if(e)return a(e);o.queue[s]={promise:[i,a]},n&&(o.queue[s].timeout=setTimeout((function(){delete o.queue[s],a(new Error("reply timeout"))}),n))}))}))}},{key:"login",value:(l=(0,r.default)(n.default.mark((function e(t){var r;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.call("rpc.login",t);case 2:if(r=e.sent){e.next=5;break}throw new Error("authentication failed");case 5:return e.abrupt("return",r);case 6:case"end":return e.stop()}}),e,this)}))),function(e){return l.apply(this,arguments)})},{key:"listMethods",value:(c=(0,r.default)(n.default.mark((function e(){return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.call("__listMethods");case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"notify",value:function(e,t){var n=this;return new Promise((function(r,i){if(!n.ready)return i(new Error("socket not ready"));var o={jsonrpc:"2.0",method:e,params:t||null};n.socket.send(JSON.stringify(o),(function(e){if(e)return i(e);r()}))}))}},{key:"subscribe",value:(u=(0,r.default)(n.default.mark((function e(t){var r;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"string"==typeof t&&(t=[t]),e.next=3,this.call("rpc.on",t);case 3:if(r=e.sent,"string"!=typeof t||"ok"===r[t]){e.next=6;break}throw new Error("Failed subscribing to an event '"+t+"' with: "+r[t]);case 6:return e.abrupt("return",r);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"unsubscribe",value:(t=(0,r.default)(n.default.mark((function e(t){var r;return n.default.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"string"==typeof t&&(t=[t]),e.next=3,this.call("rpc.off",t);case 3:if(r=e.sent,"string"!=typeof t||"ok"===r[t]){e.next=6;break}throw new Error("Failed unsubscribing from an event with: "+r);case 6:return e.abrupt("return",r);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"close",value:function(e,t){this.socket.close(e||1e3,t)}},{key:"_connect",value:function(e,t){var n=this;clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(e,t),this.socket.addEventListener("open",(function(){n.ready=!0,n.emit("open"),n.current_reconnects=0})),this.socket.addEventListener("message",(function(e){var t=e.data;t instanceof ArrayBuffer&&(t=Ne.from(t).toString());try{t=JSON.parse(t)}catch(e){return}if(t.notification&&n.listeners(t.notification).length){if(!Object.keys(t.params).length)return n.emit(t.notification);var r=[t.notification];if(t.params.constructor===Object)r.push(t.params);else for(var i=0;i<t.params.length;i++)r.push(t.params[i]);return Promise.resolve().then((function(){n.emit.apply(n,r)}))}if(!n.queue[t.id])return t.method&&t.params?Promise.resolve().then((function(){n.emit(t.method,t.params)})):void 0;"error"in t=="result"in t&&n.queue[t.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),n.queue[t.id].timeout&&clearTimeout(n.queue[t.id].timeout),t.error?n.queue[t.id].promise[1](t.error):n.queue[t.id].promise[0](t.result),delete n.queue[t.id]})),this.socket.addEventListener("error",(function(e){return n.emit("error",e)})),this.socket.addEventListener("close",(function(r){var i=r.code,o=r.reason;n.ready&&setTimeout((function(){return n.emit("close",i,o)}),0),n.ready=!1,n.socket=void 0,1e3!==i&&(n.current_reconnects++,n.reconnect&&(n.max_reconnects>n.current_reconnects||0===n.max_reconnects)&&(n.reconnect_timer_id=setTimeout((function(){return n._connect(e,t)}),n.reconnect_interval)))}))}}]),p}(l.EventEmitter);e.default=f}(sa);var Ya=S(sa),Fa={};!function(e){var t=ua.exports;Object.defineProperty(e,"__esModule",{value:!0}),e.default=function(e,t){return new u(e,t)};var n=t(Ma()),r=t(Na()),i=t(Sa()),o=t(Pa()),a=t(Ra());function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}();return function(){var n,r=(0,a.default)(e);if(t){var i=(0,a.default)(this).constructor;n=Reflect.construct(r,arguments,i)}else n=r.apply(this,arguments);return(0,o.default)(this,n)}}var u=function(e){(0,i.default)(o,e);var t=s(o);function o(e,r,i){var a;return(0,n.default)(this,o),(a=t.call(this)).socket=new window.WebSocket(e,i),a.socket.onopen=function(){return a.emit("open")},a.socket.onmessage=function(e){return a.emit("message",e.data)},a.socket.onerror=function(e){return a.emit("error",e)},a.socket.onclose=function(e){a.emit("close",e.code,e.reason)},a}return(0,r.default)(o,[{key:"send",value:function(e,t,n){var r=n||t;try{this.socket.send(e),r()}catch(e){r(e)}}},{key:"close",value:function(e,t){this.socket.close(e,t)}},{key:"addEventListener",value:function(e,t,n){this.socket.addEventListener(e,t,n)}}]),o}(Wa().EventEmitter)}(Fa);for(var Va=S(Fa),Ha=[],Ga=[],qa=[],Za=BigInt(0),Ja=BigInt(1),Xa=BigInt(2),Ka=BigInt(7),$a=BigInt(256),es=BigInt(113),ts=0,ns=Ja,rs=1,is=0;ts<24;ts++){var os=[is,(2*rs+3*is)%5];rs=os[0],is=os[1],Ha.push(2*(5*is+rs)),Ga.push((ts+1)*(ts+2)/2%64);for(var as=Za,ss=0;ss<7;ss++)(ns=(ns<<Ja^(ns>>Ka)*es)%$a)&Xa&&(as^=Ja<<(Ja<<BigInt(ss))-Ja);qa.push(as)}var us=ee(Lt(qa,!0),2),cs=us[0],ls=us[1],hs=function(e,t,n){return n>32?Dt(e,t,n):St(e,t,n)},ds=function(e,t,n){return n>32?Ct(e,t,n):jt(e,t,n)};var fs=function(e){W(n,At);var t=X(n);function n(e,r,i){var o,a=arguments.length>3&&void 0!==arguments[3]&&arguments[3],s=arguments.length>4&&void 0!==arguments[4]?arguments[4]:24;if(B(this,n),(o=t.call(this)).blockLen=e,o.suffix=r,o.outputLen=i,o.enableXOF=a,o.rounds=s,o.pos=0,o.posOut=0,o.finished=!1,o.destroyed=!1,ct(i),0>=o.blockLen||o.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");return o.state=new Uint8Array(200),o.state32=yt(o.state),o}return U(n,[{key:"keccak",value:function(){!function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:24,n=new Uint32Array(10),r=24-t;r<24;r++){for(var i=0;i<10;i++)n[i]=e[i]^e[i+10]^e[i+20]^e[i+30]^e[i+40];for(var o=0;o<10;o+=2)for(var a=(o+8)%10,s=(o+2)%10,u=n[s],c=n[s+1],l=hs(u,c,1)^n[a],h=ds(u,c,1)^n[a+1],d=0;d<50;d+=10)e[o+d]^=l,e[o+d+1]^=h;for(var f=e[2],p=e[3],y=0;y<24;y++){var m=Ga[y],g=hs(f,p,m),v=ds(f,p,m),w=Ha[y];f=e[w],p=e[w+1],e[w]=g,e[w+1]=v}for(var b=0;b<50;b+=10){for(var M=0;M<10;M++)n[M]=e[b+M];for(var A=0;A<10;A++)e[b+A]^=~n[(A+2)%10]&n[(A+4)%10]}e[0]^=cs[r],e[1]^=ls[r]}n.fill(0)}(this.state32,this.rounds),this.posOut=0,this.pos=0}},{key:"update",value:function(e){dt(this);for(var t=this.blockLen,n=this.state,r=(e=bt(e)).length,i=0;i<r;){for(var o=Math.min(t-this.pos,r-i),a=0;a<o;a++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}},{key:"finish",value:function(){if(!this.finished){this.finished=!0;var e=this.state,t=this.suffix,n=this.pos,r=this.blockLen;e[n]^=t,0!=(128&t)&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}}},{key:"writeInto",value:function(e){dt(this,!1),ht(e),this.finish();for(var t=this.state,n=this.blockLen,r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();var o=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return e}},{key:"xofInto",value:function(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}},{key:"xof",value:function(e){return ct(e),this.xofInto(new Uint8Array(e))}},{key:"digestInto",value:function(e){if(ft(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}},{key:"digest",value:function(){return this.digestInto(new Uint8Array(this.outputLen))}},{key:"destroy",value:function(){this.destroyed=!0,this.state.fill(0)}},{key:"_cloneInto",value:function(e){var t=this.blockLen,r=this.suffix,i=this.outputLen,o=this.rounds,a=this.enableXOF;return e||(e=new n(t,r,i,a,o)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=o,e.suffix=r,e.outputLen=i,e.enableXOF=a,e.destroyed=this.destroyed,e}}]),n}(),ps=function(e,t,n){return It((function(){return new fs(t,e,n)}))}(1,136,32);var ys=on,ms=rn,gs={Err:function(e){W(n,G(Error));var t=X(n);function n(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return B(this,n),t.call(this,e)}return U(n)}(),_parseInt:function(e){var t=gs.Err;if(e.length<2||2!==e[0])throw new t("Invalid signature integer tag");var n=e[1],r=e.subarray(2,n+2);if(!n||r.length!==n)throw new t("Invalid signature integer: wrong length");if(128&r[0])throw new t("Invalid signature integer: negative");if(0===r[0]&&!(128&r[1]))throw new t("Invalid signature integer: unnecessary leading zero");return{d:ys(r),l:e.subarray(n+2)}},toSig:function(e){var t=gs.Err,n="string"==typeof e?ms(e):e;if(!Vt(n))throw new Error("ui8a expected");var r=n.length;if(r<2||48!=n[0])throw new t("Invalid signature tag");if(n[1]!==r-2)throw new t("Invalid signature: incorrect length");var i=gs._parseInt(n.subarray(2)),o=i.d,a=i.l,s=gs._parseInt(a),u=s.d;if(s.l.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s:u}},hexFromSig:function(e){var t=function(e){return 8&Number.parseInt(e[0],16)?"00"+e:e},n=function(e){var t=e.toString(16);return 1&t.length?"0".concat(t):t},r=t(n(e.s)),i=t(n(e.r)),o=r.length/2,a=i.length/2,s=n(o),u=n(a);return"30".concat(n(a+o+4),"02").concat(u).concat(i,"02").concat(s).concat(r)}},vs=BigInt(0),ws=BigInt(1);BigInt(2);var bs=BigInt(3);function Ms(e){var t=function(e){var t=Un(e);mn(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});var n=t.endo,r=t.Fp,i=t.a;if(n){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if("object"!==z(n)||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze(C({},t))}(e),n=t.Fp,r=t.toBytes||function(e,t,r){var i=t.toAffine();return ln(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))},i=t.fromBytes||function(e){var t=e.subarray(1);return{x:n.fromBytes(t.subarray(0,n.BYTES)),y:n.fromBytes(t.subarray(n.BYTES,2*n.BYTES))}};function o(e){var r=t.a,i=t.b,o=n.sqr(e),a=n.mul(o,e);return n.add(n.add(a,n.mul(e,r)),i)}if(!n.eql(n.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function a(e){return"bigint"==typeof e&&vs<e&&e<t.n}function s(e){if(!a(e))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function u(e){var n,r=t.allowedPrivateKeyLengths,i=t.nByteLength,o=t.wrapPrivateKey,a=t.n;if(r&&"bigint"!=typeof e){if(Vt(e)&&(e=Gt(e)),"string"!=typeof e||!r.includes(e.length))throw new Error("Invalid key");e=e.padStart(2*i,"0")}try{n="bigint"==typeof e?e:on(cn("private key",e,i))}catch(t){throw new Error("private key must be ".concat(i," bytes, hex or bigint, not ").concat(z(e)))}return o&&(n=Tn(n,a)),s(n),n}var c=new Map;function l(e){if(!(e instanceof h))throw new Error("ProjectivePoint expected")}var h=function(){function e(t,r,i){if(B(this,e),this.px=t,this.py=r,this.pz=i,null==t||!n.isValid(t))throw new Error("x required");if(null==r||!n.isValid(r))throw new Error("y required");if(null==i||!n.isValid(i))throw new Error("z required")}return U(e,[{key:"x",get:function(){return this.toAffine().x}},{key:"y",get:function(){return this.toAffine().y}},{key:"_setWindowSize",value:function(e){this._WINDOW_SIZE=e,c.delete(this)}},{key:"assertValidity",value:function(){if(this.is0()){if(t.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}var e=this.toAffine(),r=e.x,i=e.y;if(!n.isValid(r)||!n.isValid(i))throw new Error("bad point: x or y not FE");var a=n.sqr(i),s=o(r);if(!n.eql(a,s))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}},{key:"hasEvenY",value:function(){var e=this.toAffine().y;if(n.isOdd)return!n.isOdd(e);throw new Error("Field doesn't support isOdd")}},{key:"equals",value:function(e){l(e);var t=this.px,r=this.py,i=this.pz,o=e.px,a=e.py,s=e.pz,u=n.eql(n.mul(t,s),n.mul(o,i)),c=n.eql(n.mul(r,s),n.mul(a,i));return u&&c}},{key:"negate",value:function(){return new e(this.px,n.neg(this.py),this.pz)}},{key:"double",value:function(){var r=t.a,i=t.b,o=n.mul(i,bs),a=this.px,s=this.py,u=this.pz,c=n.ZERO,l=n.ZERO,h=n.ZERO,d=n.mul(a,a),f=n.mul(s,s),p=n.mul(u,u),y=n.mul(a,s);return y=n.add(y,y),h=n.mul(a,u),h=n.add(h,h),c=n.mul(r,h),l=n.mul(o,p),l=n.add(c,l),c=n.sub(f,l),l=n.add(f,l),l=n.mul(c,l),c=n.mul(y,c),h=n.mul(o,h),p=n.mul(r,p),y=n.sub(d,p),y=n.mul(r,y),y=n.add(y,h),h=n.add(d,d),d=n.add(h,d),d=n.add(d,p),d=n.mul(d,y),l=n.add(l,d),p=n.mul(s,u),p=n.add(p,p),d=n.mul(p,y),c=n.sub(c,d),h=n.mul(p,f),h=n.add(h,h),new e(c,l,h=n.add(h,h))}},{key:"add",value:function(r){l(r);var i=this.px,o=this.py,a=this.pz,s=r.px,u=r.py,c=r.pz,h=n.ZERO,d=n.ZERO,f=n.ZERO,p=t.a,y=n.mul(t.b,bs),m=n.mul(i,s),g=n.mul(o,u),v=n.mul(a,c),w=n.add(i,o),b=n.add(s,u);w=n.mul(w,b),b=n.add(m,g),w=n.sub(w,b),b=n.add(i,a);var M=n.add(s,c);return b=n.mul(b,M),M=n.add(m,v),b=n.sub(b,M),M=n.add(o,a),h=n.add(u,c),M=n.mul(M,h),h=n.add(g,v),M=n.sub(M,h),f=n.mul(p,b),h=n.mul(y,v),f=n.add(h,f),h=n.sub(g,f),f=n.add(g,f),d=n.mul(h,f),g=n.add(m,m),g=n.add(g,m),v=n.mul(p,v),b=n.mul(y,b),g=n.add(g,v),v=n.sub(m,v),v=n.mul(p,v),b=n.add(b,v),m=n.mul(g,b),d=n.add(d,m),m=n.mul(M,b),h=n.mul(w,h),h=n.sub(h,m),m=n.mul(w,g),f=n.mul(M,f),new e(h,d,f=n.add(f,m))}},{key:"subtract",value:function(e){return this.add(e.negate())}},{key:"is0",value:function(){return this.equals(e.ZERO)}},{key:"wNAF",value:function(t){return f.wNAFCached(this,c,t,(function(t){var r=n.invertBatch(t.map((function(e){return e.pz})));return t.map((function(e,t){return e.toAffine(r[t])})).map(e.fromAffine)}))}},{key:"multiplyUnsafe",value:function(r){var i=e.ZERO;if(r===vs)return i;if(s(r),r===ws)return this;var o=t.endo;if(!o)return f.unsafeLadder(this,r);for(var a=o.splitScalar(r),u=a.k1neg,c=a.k1,l=a.k2neg,h=a.k2,d=i,p=i,y=this;c>vs||h>vs;)c&ws&&(d=d.add(y)),h&ws&&(p=p.add(y)),y=y.double(),c>>=ws,h>>=ws;return u&&(d=d.negate()),l&&(p=p.negate()),p=new e(n.mul(p.px,o.beta),p.py,p.pz),d.add(p)}},{key:"multiply",value:function(r){s(r);var i,o,a=r,u=t.endo;if(u){var c=u.splitScalar(a),l=c.k1neg,h=c.k1,d=c.k2neg,p=c.k2,y=this.wNAF(h),m=y.p,g=y.f,v=this.wNAF(p),w=v.p,b=v.f;m=f.constTimeNegate(l,m),w=f.constTimeNegate(d,w),w=new e(n.mul(w.px,u.beta),w.py,w.pz),i=m.add(w),o=g.add(b)}else{var M=this.wNAF(a);i=M.p,o=M.f}return e.normalizeZ([i,o])[0]}},{key:"multiplyAndAddUnsafe",value:function(t,n,r){var i=e.BASE,o=function(e,t){return t!==vs&&t!==ws&&e.equals(i)?e.multiply(t):e.multiplyUnsafe(t)},a=o(this,n).add(o(t,r));return a.is0()?void 0:a}},{key:"toAffine",value:function(e){var t=this.px,r=this.py,i=this.pz,o=this.is0();null==e&&(e=o?n.ONE:n.inv(i));var a=n.mul(t,e),s=n.mul(r,e),u=n.mul(i,e);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(u,n.ONE))throw new Error("invZ was invalid");return{x:a,y:s}}},{key:"isTorsionFree",value:function(){var n=t.h,r=t.isTorsionFree;if(n===ws)return!0;if(r)return r(e,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}},{key:"clearCofactor",value:function(){var n=t.h,r=t.clearCofactor;return n===ws?this:r?r(e,this):this.multiplyUnsafe(t.h)}},{key:"toRawBytes",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this.assertValidity(),r(e,this,t)}},{key:"toHex",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return Gt(this.toRawBytes(e))}}],[{key:"fromAffine",value:function(t){var r=t||{},i=r.x,o=r.y;if(!t||!n.isValid(i)||!n.isValid(o))throw new Error("invalid affine point");if(t instanceof e)throw new Error("projective point not allowed");var a=function(e){return n.eql(e,n.ZERO)};return a(i)&&a(o)?e.ZERO:new e(i,o,n.ONE)}},{key:"normalizeZ",value:function(t){var r=n.invertBatch(t.map((function(e){return e.pz})));return t.map((function(e,t){return e.toAffine(r[t])})).map(e.fromAffine)}},{key:"fromHex",value:function(t){var n=e.fromAffine(i(cn("pointHex",t)));return n.assertValidity(),n}},{key:"fromPrivateKey",value:function(t){return e.BASE.multiply(u(t))}}]),e}();h.BASE=new h(t.Gx,t.Gy,n.ONE),h.ZERO=new h(n.ZERO,n.ONE,n.ZERO);var d=t.nBitLength,f=Rn(h,t.endo?Math.ceil(d/2):d);return{CURVE:t,ProjectivePoint:h,normPrivateKeyToScalar:u,weierstrassEquation:o,isWithinCurveOrder:a}}function As(e){var t,n=(mn(t=Un(e),{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze(C({lowS:!0},t))),r=n.Fp,i=n.n,o=r.BYTES+1,a=2*r.BYTES+1;function s(e){return Tn(e,i)}function u(e){return kn(e,i)}var c=Ms(C(C({},n),{},{toBytes:function(e,t,n){var i=t.toAffine(),o=r.toBytes(i.x),a=ln;return n?a(Uint8Array.from([t.hasEvenY()?2:3]),o):a(Uint8Array.from([4]),o,r.toBytes(i.y))},fromBytes:function(e){var t=e.length,n=e[0],i=e.subarray(1);if(t!==o||2!==n&&3!==n){if(t===a&&4===n)return{x:r.fromBytes(i.subarray(0,r.BYTES)),y:r.fromBytes(i.subarray(r.BYTES,2*r.BYTES))};throw new Error("Point of length ".concat(t," was invalid. Expected ").concat(o," compressed bytes or ").concat(a," uncompressed bytes"))}var s=on(i);if(!(vs<(u=s)&&u<r.ORDER))throw new Error("Point is not on curve");var u,c=d(s),l=r.sqrt(c);return 1==(1&n)!==((l&ws)===ws)&&(l=r.neg(l)),{x:s,y:l}}})),l=c.ProjectivePoint,h=c.normPrivateKeyToScalar,d=c.weierstrassEquation,f=c.isWithinCurveOrder,p=function(e){return Gt(sn(e,n.nByteLength))};function y(e){return e>i>>ws}function m(e){return y(e)?s(-e):e}var g=function(e,t,n){return on(e.slice(t,n))},v=function(){function e(t,n,r){B(this,e),this.r=t,this.s=n,this.recovery=r,this.assertValidity()}return U(e,[{key:"assertValidity",value:function(){if(!f(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!f(this.s))throw new Error("s must be 0 < s < CURVE.n")}},{key:"addRecoveryBit",value:function(t){return new e(this.r,this.s,t)}},{key:"recoverPublicKey",value:function(e){var t=this.r,i=this.s,o=this.recovery,a=A(cn("msgHash",e));if(null==o||![0,1,2,3].includes(o))throw new Error("recovery id invalid");var c=2===o||3===o?t+n.n:t;if(c>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");var h=0==(1&o)?"02":"03",d=l.fromHex(h+p(c)),f=u(c),y=s(-a*f),m=s(i*f),g=l.BASE.multiplyAndAddUnsafe(d,y,m);if(!g)throw new Error("point at infinify");return g.assertValidity(),g}},{key:"hasHighS",value:function(){return y(this.s)}},{key:"normalizeS",value:function(){return this.hasHighS()?new e(this.r,s(-this.s),this.recovery):this}},{key:"toDERRawBytes",value:function(){return rn(this.toDERHex())}},{key:"toDERHex",value:function(){return gs.hexFromSig({r:this.r,s:this.s})}},{key:"toCompactRawBytes",value:function(){return rn(this.toCompactHex())}},{key:"toCompactHex",value:function(){return p(this.r)+p(this.s)}}],[{key:"fromCompact",value:function(t){var r=n.nByteLength;return t=cn("compactSignature",t,2*r),new e(g(t,0,r),g(t,r,2*r))}},{key:"fromDER",value:function(t){var n=gs.toSig(cn("DER",t));return new e(n.r,n.s)}}]),e}(),w={isValidPrivateKey:function(e){try{return h(e),!0}catch(e){return!1}},normPrivateKeyToScalar:h,randomPrivateKey:function(){var e=Pn(n.n);return function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.length,i=zn(t),o=Pn(t);if(r<16||r<o||r>1024)throw new Error("expected ".concat(o,"-1024 bytes of input, got ").concat(r));var a=Tn(n?on(e):an(e),t-wn)+wn;return n?un(a,i):sn(a,i)}(n.randomBytes(e),n.n)},precompute:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:8,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:l.BASE;return t._setWindowSize(e),t.multiply(BigInt(3)),t}};function b(e){var t=Vt(e),n="string"==typeof e,r=(t||n)&&e.length;return t?r===o||r===a:n?r===2*o||r===2*a:e instanceof l}var M=n.bits2int||function(e){var t=on(e),r=8*e.length-n.nBitLength;return r>0?t>>BigInt(r):t},A=n.bits2int_modN||function(e){return s(M(e))},I=hn(n.nBitLength);function N(e){if("bigint"!=typeof e)throw new Error("bigint expected");if(!(vs<=e&&e<I))throw new Error("bigint expected < 2^".concat(n.nBitLength));return sn(e,n.nByteLength)}function T(e,t){var i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:E;if(["recovered","canonical"].some((function(e){return e in i})))throw new Error("sign() legacy options not supported");var o=n.hash,a=n.randomBytes,c=i.lowS,d=i.prehash,p=i.extraEntropy;null==c&&(c=!0),e=cn("msgHash",e),d&&(e=cn("prehashed msgHash",o(e)));var g=A(e),w=h(t),b=[N(w),N(g)];if(null!=p){var I=!0===p?a(r.BYTES):p;b.push(cn("extraEntropy",I))}var T=ln.apply(gn,b),x=g;function k(e){var t=M(e);if(f(t)){var n=u(t),r=l.BASE.multiply(t).toAffine(),i=s(r.x);if(i!==vs){var o=s(n*s(x+i*w));if(o!==vs){var a=(r.x===i?0:2)|Number(r.y&ws),h=o;return c&&y(o)&&(h=m(o),a^=1),new v(i,h,a)}}}}return{seed:T,k2sig:k}}var E={lowS:n.lowS,prehash:!1},x={lowS:n.lowS,prehash:!1};return l.BASE._setWindowSize(8),{CURVE:n,getPublicKey:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return l.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(b(e))throw new Error("first arg must be private key");if(!b(t))throw new Error("second arg must be public key");var r=l.fromHex(t);return r.multiply(h(e)).toRawBytes(n)},sign:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:E,i=T(e,t,r),o=i.seed,a=i.k2sig,s=n,u=pn(s.hash.outputLen,s.nByteLength,s.hmac);return u(o,a)},verify:function(e,t,r){var i,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:x,a=e;if(t=cn("msgHash",t),r=cn("publicKey",r),"strict"in o)throw new Error("options.strict was renamed to lowS");var c,h=o.lowS,d=o.prehash,f=void 0;try{if("string"==typeof a||Vt(a))try{f=v.fromDER(a)}catch(e){if(!(e instanceof gs.Err))throw e;f=v.fromCompact(a)}else{if("object"!==z(a)||"bigint"!=typeof a.r||"bigint"!=typeof a.s)throw new Error("PARSE");var p=a.r,y=a.s;f=new v(p,y)}c=l.fromHex(r)}catch(e){if("PARSE"===e.message)throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(h&&f.hasHighS())return!1;d&&(t=n.hash(t));var m=f,g=m.r,w=m.s,b=A(t),M=u(w),I=s(b*M),N=s(g*M),T=null===(i=l.BASE.multiplyAndAddUnsafe(c,I,N))||void 0===i?void 0:i.toAffine();if(!T)return!1;var E=s(T.x);return E===g},ProjectivePoint:l,Signature:v,utils:w}}BigInt(4);var Is=function(e){W(n,At);var t=X(n);function n(e,r){var i;B(this,n),(i=t.call(this)).finished=!1,i.destroyed=!1,function(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");ct(e.outputLen),ct(e.blockLen)}(e);var o=bt(r);if(i.iHash=e.create(),"function"!=typeof i.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");i.blockLen=i.iHash.blockLen,i.outputLen=i.iHash.outputLen;var a=i.blockLen,s=new Uint8Array(a);s.set(o.length>a?e.create().update(o).digest():o);for(var u=0;u<s.length;u++)s[u]^=54;i.iHash.update(s),i.oHash=e.create();for(var c=0;c<s.length;c++)s[c]^=106;return i.oHash.update(s),s.fill(0),i}return U(n,[{key:"update",value:function(e){return dt(this),this.iHash.update(e),this}},{key:"digestInto",value:function(e){dt(this),ht(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}},{key:"digest",value:function(){var e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}},{key:"_cloneInto",value:function(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));var t=this.oHash,n=this.iHash,r=this.finished,i=this.destroyed,o=this.blockLen,a=this.outputLen;return(e=e).finished=r,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}},{key:"destroy",value:function(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}]),n}(),Ns=function(e,t,n){return new Is(e,t).update(n).digest()};Ns.create=function(e,t){return new Is(e,t)};
9
9
  /*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
10
- var Ts=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Es=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),xs=BigInt(1),ks=BigInt(2),Ls=function(e,t){return(e+t/ks)/t};var Ss=On(Ts,void 0,void 0,{sqrt:function(e){var t=Ts,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),a=BigInt(23),s=BigInt(44),u=BigInt(88),c=e*e*e%t,l=c*c*e%t,h=xn(l,n,t)*l%t,d=xn(h,n,t)*l%t,f=xn(d,ks,t)*c%t,p=xn(f,i,t)*f%t,y=xn(p,o,t)*p%t,m=xn(y,s,t)*y%t,g=xn(m,u,t)*m%t,v=xn(g,s,t)*y%t,w=xn(v,n,t)*l%t,b=xn(w,a,t)*p%t,M=xn(b,r,t)*c%t,A=xn(M,ks,t);if(!Ss.eql(Ss.sqr(A),e))throw new Error("Cannot find square root");return A}}),js=function(e,t){var n=function(t){return As(C(C({},e),function(e){return{hash:e,hmac:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return Ns(e,t,Mt.apply(void 0,r))},randomBytes:Nt}}(t)))};return Object.freeze(C(C({},n(t)),{},{create:n}))}({a:BigInt(0),b:BigInt(7),Fp:Ss,n:Es,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:function(e){var t=Es,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-xs*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,a=BigInt("0x100000000000000000000000000000000"),s=Ls(o*e,t),u=Ls(-r*e,t),c=Tn(e-s*n-u*i,t),l=Tn(-s*r-u*o,t),h=c>a,d=l>a;if(h&&(c=t-c),d&&(l=t-l),c>a||l>a)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:h,k1:c,k2neg:d,k2:l}}}},vr);BigInt(0),js.ProjectivePoint;var Ds=["commitment"],Cs=["encoding"],Os=["commitment"],zs=["commitment"],Ps=ir.utils.randomPrivateKey,_s=function(){var e=ir.utils.randomPrivateKey(),t=Bs(e),n=new Uint8Array(64);return n.set(e),n.set(t,32),{publicKey:t,secretKey:n}},Bs=ir.getPublicKey;function Rs(e){try{return ir.ExtendedPoint.fromHex(e),!0}catch(e){return!1}}var Us,Qs=function(e,t){return ir.sign(e,t.slice(0,32))},Ws=ir.verify,Ys=function(e){return Ne.isBuffer(e)?e:e instanceof Uint8Array?Ne.from(e.buffer,e.byteOffset,e.byteLength):Ne.from(e)},Fs=function(){function e(t){B(this,e),Object.assign(this,t)}return U(e,[{key:"encode",value:function(){return Ne.from(Jr(Hs,this))}}],[{key:"decode",value:function(e){return $r(Hs,this,e)}},{key:"decodeUnchecked",value:function(e){return Br(Hs,this,e)}}]),e}(),Vs=function(e){W(n,Fs);var t=X(n);function n(e){var r;if(B(this,n),(r=t.call(this,e)).enum="",1!==Object.keys(e).length)throw new Error("Enum can only take single value");return Object.keys(e).map((function(e){r.enum=e})),r}return U(n)}(),Hs=new Map;var Gs=1,qs=function(e,t){W(a,Fs);var n,r,i,o=X(a);function a(e){var t;if(B(this,a),(t=o.call(this,{}))._bn=void 0,function(e){return void 0!==e._bn}(e))t._bn=e._bn;else{if("string"==typeof e){var n=dr.decode(e);if(32!=n.length)throw new Error("Invalid public key input");t._bn=new cr(n)}else t._bn=new cr(e);if(t._bn.byteLength()>32)throw new Error("Invalid public key input")}return t}return U(a,[{key:"equals",value:function(e){return this._bn.eq(e._bn)}},{key:"toBase58",value:function(){return dr.encode(this.toBytes())}},{key:"toJSON",value:function(){return this.toBase58()}},{key:"toBytes",value:function(){var e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}},{key:"toBuffer",value:function(){var e=this._bn.toArrayLike(Ne);if(32===e.length)return e;var t=Ne.alloc(32);return e.copy(t,32-e.length),t}},{key:t,get:function(){return"PublicKey(".concat(this.toString(),")")}},{key:"toString",value:function(){return this.toBase58()}}],[{key:"unique",value:function(){var e=new a(Gs);return Gs+=1,new a(e.toBuffer())}},{key:"createWithSeed",value:(i=_(O().mark((function e(t,n,r){var i,o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Ne.concat([t.toBuffer(),Ne.from(n),r.toBuffer()]),o=vr(i),e.abrupt("return",new a(o));case 3:case"end":return e.stop()}}),e)}))),function(e,t,n){return i.apply(this,arguments)})},{key:"createProgramAddressSync",value:function(e,t){var n=Ne.alloc(0);e.forEach((function(e){if(e.length>32)throw new TypeError("Max seed length exceeded");n=Ne.concat([n,Ys(e)])})),n=Ne.concat([n,t.toBuffer(),Ne.from("ProgramDerivedAddress")]);var r=vr(n);if(Rs(r))throw new Error("Invalid seeds, address must fall off the curve");return new a(r)}},{key:"createProgramAddress",value:(r=_(O().mark((function e(t,n){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.createProgramAddressSync(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"findProgramAddressSync",value:function(e,t){for(var n,r=255;0!=r;){try{var i=e.concat(Ne.from([r]));n=this.createProgramAddressSync(i,t)}catch(e){if(e instanceof TypeError)throw e;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}},{key:"findProgramAddress",value:(n=_(O().mark((function e(t,n){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.findProgramAddressSync(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"isOnCurve",value:function(e){return Rs(new a(e).toBytes())}}]),a}(0,Symbol.toStringTag);Us=qs,qs.default=new Us("11111111111111111111111111111111"),Hs.set(qs,{kind:"struct",fields:[["_bn","u256"]]});var Zs=function(){function e(t){if(B(this,e),this._publicKey=void 0,this._secretKey=void 0,t){var n=Ys(t);if(64!==t.length)throw new Error("bad secret key size");this._publicKey=n.slice(32,64),this._secretKey=n.slice(0,32)}else this._secretKey=Ys(Ps()),this._publicKey=Ys(Bs(this._secretKey))}return U(e,[{key:"publicKey",get:function(){return new qs(this._publicKey)}},{key:"secretKey",get:function(){return Ne.concat([this._secretKey,this._publicKey],64)}}]),e}(),Js=new qs("BPFLoader1111111111111111111111111111111111"),Xs=function(e){W(n,G(Error));var t=X(n);function n(e){var r;return B(this,n),(r=t.call(this,"Signature ".concat(e," has expired: block height exceeded."))).signature=void 0,r.signature=e,r}return U(n)}();Object.defineProperty(Xs.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});var Ks=function(e){W(n,G(Error));var t=X(n);function n(e,r){var i;return B(this,n),(i=t.call(this,"Transaction was not confirmed in ".concat(r.toFixed(2)," seconds. It is ")+"unknown if it succeeded or failed. Check signature "+"".concat(e," using the Solana Explorer or CLI tools."))).signature=void 0,i.signature=e,i}return U(n)}();Object.defineProperty(Ks.prototype,"name",{value:"TransactionExpiredTimeoutError"});var $s=function(e){W(n,G(Error));var t=X(n);function n(e){var r;return B(this,n),(r=t.call(this,"Signature ".concat(e," has expired: the nonce is no longer valid."))).signature=void 0,r.signature=e,r}return U(n)}();Object.defineProperty($s.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});var eu=function(){function e(t,n){B(this,e),this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=n}return U(e,[{key:"keySegments",value:function(){var e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}},{key:"get",value:function(e){var t,n=se(this.keySegments());try{for(n.s();!(t=n.n()).done;){var r=t.value;if(e<r.length)return r[e];e-=r.length}}catch(e){n.e(e)}finally{n.f()}}},{key:"length",get:function(){return this.keySegments().flat().length}},{key:"compileInstructions",value:function(e){if(this.length>256)throw new Error("Account index overflow encountered during compilation");var t=new Map;this.keySegments().flat().forEach((function(e,n){t.set(e.toBase58(),n)}));var n=function(e){var n=t.get(e.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return e.map((function(e){return{programIdIndex:n(e.programId),accountKeyIndexes:e.keys.map((function(e){return n(e.pubkey)})),data:e.data}}))}}]),e}(),tu=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"publicKey";return Hi(32,e)},nu=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature";return Hi(64,e)},ru=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"string",t=Fi([Qi("length"),Qi("lengthPadding"),Hi(Bi(Qi(),-8),"chars")],e),n=t.decode.bind(t),r=t.encode.bind(t),i=t;return i.decode=function(e,t){return n(e,t).chars.toString()},i.encode=function(e,t,n){var i={chars:Ne.from(e,"utf8")};return r(i,t,n)},i.alloc=function(e){return Qi().span+Qi().span+Ne.from(e,"utf8").length},i};function iu(e,t){var n=function e(n){if(n.span>=0)return n.span;if("function"==typeof n.alloc)return n.alloc(t[n.property]);if("count"in n&&"elementLayout"in n){var r=t[n.property];if(Array.isArray(r))return r.length*e(n.elementLayout)}else if("fields"in n)return iu({layout:n},t[n.property]);return 0},r=0;return e.layout.fields.forEach((function(e){r+=n(e)})),r}function ou(e){for(var t=0,n=0;;){var r=e.shift();if(t|=(127&r)<<7*n,n+=1,0==(128&r))break}return t}function au(e,t){for(var n=t;;){var r=127&n;if(0==(n>>=7)){e.push(r);break}r|=128,e.push(r)}}function su(e,t){if(!e)throw new Error(t||"Assertion failed")}var uu=function(){function e(t,n){B(this,e),this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=n}return U(e,[{key:"getMessageComponents",value:function(){var e=te(this.keyMetaMap.entries());su(e.length<=256,"Max static account keys length exceeded");var t=e.filter((function(e){var t=ee(e,2)[1];return t.isSigner&&t.isWritable})),n=e.filter((function(e){var t=ee(e,2)[1];return t.isSigner&&!t.isWritable})),r=e.filter((function(e){var t=ee(e,2)[1];return!t.isSigner&&t.isWritable})),i=e.filter((function(e){var t=ee(e,2)[1];return!t.isSigner&&!t.isWritable})),o={numRequiredSignatures:t.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};return su(t.length>0,"Expected at least one writable signer key"),su(ee(t[0],1)[0]===this.payer.toBase58(),"Expected first writable signer key to be the fee payer"),[o,[].concat(te(t.map((function(e){var t=ee(e,1)[0];return new qs(t)}))),te(n.map((function(e){var t=ee(e,1)[0];return new qs(t)}))),te(r.map((function(e){var t=ee(e,1)[0];return new qs(t)}))),te(i.map((function(e){var t=ee(e,1)[0];return new qs(t)}))))]}},{key:"extractTableLookup",value:function(e){var t=ee(this.drainKeysFoundInLookupTable(e.state.addresses,(function(e){return!e.isSigner&&!e.isInvoked&&e.isWritable})),2),n=t[0],r=t[1],i=ee(this.drainKeysFoundInLookupTable(e.state.addresses,(function(e){return!e.isSigner&&!e.isInvoked&&!e.isWritable})),2),o=i[0],a=i[1];if(0!==n.length||0!==o.length)return[{accountKey:e.key,writableIndexes:n,readonlyIndexes:o},{writable:r,readonly:a}]}},{key:"drainKeysFoundInLookupTable",value:function(e,t){var n,r=this,i=new Array,o=new Array,a=se(this.keyMetaMap.entries());try{var s=function(){var a=ee(n.value,2),s=a[0],u=a[1];if(t(u)){var c=new qs(s),l=e.findIndex((function(e){return e.equals(c)}));l>=0&&(su(l<256,"Max lookup table index exceeded"),i.push(l),o.push(c),r.keyMetaMap.delete(s))}};for(a.s();!(n=a.n()).done;)s()}catch(e){a.e(e)}finally{a.f()}return[i,o]}}],[{key:"compile",value:function(t,n){var r=new Map,i=function(e){var t=e.toBase58(),n=r.get(t);return void 0===n&&(n={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(t,n)),n},o=i(n);o.isSigner=!0,o.isWritable=!0;var a,s=se(t);try{for(s.s();!(a=s.n()).done;){var u=a.value;i(u.programId).isInvoked=!0;var c,l=se(u.keys);try{for(l.s();!(c=l.n()).done;){var h=c.value,d=i(h.pubkey);d.isSigner||(d.isSigner=h.isSigner),d.isWritable||(d.isWritable=h.isWritable)}}catch(e){l.e(e)}finally{l.f()}}}catch(e){s.e(e)}finally{s.f()}return new e(n,r)}}]),e}(),cu=function(){function e(t){var n=this;B(this,e),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((function(e){return new qs(e)})),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach((function(e){return n.indexToProgramIds.set(e.programIdIndex,n.accountKeys[e.programIdIndex])}))}return U(e,[{key:"version",get:function(){return"legacy"}},{key:"staticAccountKeys",get:function(){return this.accountKeys}},{key:"compiledInstructions",get:function(){return this.instructions.map((function(e){return{programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:dr.decode(e.data)}}))}},{key:"addressTableLookups",get:function(){return[]}},{key:"getAccountKeys",value:function(){return new eu(this.staticAccountKeys)}},{key:"isAccountSigner",value:function(e){return e<this.header.numRequiredSignatures}},{key:"isAccountWritable",value:function(e){var t=this.header.numRequiredSignatures;return e>=this.header.numRequiredSignatures?e-t<this.accountKeys.length-t-this.header.numReadonlyUnsignedAccounts:e<t-this.header.numReadonlySignedAccounts}},{key:"isProgramId",value:function(e){return this.indexToProgramIds.has(e)}},{key:"programIds",value:function(){return te(this.indexToProgramIds.values())}},{key:"nonProgramIds",value:function(){var e=this;return this.accountKeys.filter((function(t,n){return!e.isProgramId(n)}))}},{key:"serialize",value:function(){var e=this.accountKeys.length,t=[];au(t,e);var n=this.instructions.map((function(e){var t=e.accounts,n=e.programIdIndex,r=Array.from(dr.decode(e.data)),i=[];au(i,t.length);var o=[];return au(o,r.length),{programIdIndex:n,keyIndicesCount:Ne.from(i),keyIndices:t,dataLength:Ne.from(o),data:r}})),r=[];au(r,n.length);var i=Ne.alloc(1232);Ne.from(r).copy(i);var o=r.length;n.forEach((function(e){var t=Fi([Ri("programIdIndex"),Hi(e.keyIndicesCount.length,"keyIndicesCount"),Vi(Ri("keyIndex"),e.keyIndices.length,"keyIndices"),Hi(e.dataLength.length,"dataLength"),Vi(Ri("userdatum"),e.data.length,"data")]).encode(e,i,o);o+=t})),i=i.slice(0,o);var a=Fi([Hi(1,"numRequiredSignatures"),Hi(1,"numReadonlySignedAccounts"),Hi(1,"numReadonlyUnsignedAccounts"),Hi(t.length,"keyCount"),Vi(tu("key"),e,"keys"),tu("recentBlockhash")]),s={numRequiredSignatures:Ne.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:Ne.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:Ne.from([this.header.numReadonlyUnsignedAccounts]),keyCount:Ne.from(t),keys:this.accountKeys.map((function(e){return Ys(e.toBytes())})),recentBlockhash:dr.decode(this.recentBlockhash)},u=Ne.alloc(2048),c=a.encode(s,u);return i.copy(u,c),u.slice(0,c+i.length)}}],[{key:"compile",value:function(t){var n=ee(uu.compile(t.instructions,t.payerKey).getMessageComponents(),2),r=n[0],i=n[1],o=new eu(i).compileInstructions(t.instructions).map((function(e){return{programIdIndex:e.programIdIndex,accounts:e.accountKeyIndexes,data:dr.encode(e.data)}}));return new e({header:r,accountKeys:i,recentBlockhash:t.recentBlockhash,instructions:o})}},{key:"from",value:function(t){var n=te(t),r=n.shift();if(r!==(127&r))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");for(var i=n.shift(),o=n.shift(),a=ou(n),s=[],u=0;u<a;u++){var c=n.slice(0,32);n=n.slice(32),s.push(new qs(Ne.from(c)))}for(var l=n.slice(0,32),h=ou(n=n.slice(32)),d=[],f=0;f<h;f++){var p=n.shift(),y=ou(n),m=n.slice(0,y),g=ou(n=n.slice(y)),v=n.slice(0,g),w=dr.encode(Ne.from(v));n=n.slice(g),d.push({programIdIndex:p,accounts:m,data:w})}return new e({header:{numRequiredSignatures:r,numReadonlySignedAccounts:i,numReadonlyUnsignedAccounts:o},recentBlockhash:dr.encode(Ne.from(l)),accountKeys:s,instructions:d})}}]),e}(),lu=function(){function e(t){B(this,e),this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=t.header,this.staticAccountKeys=t.staticAccountKeys,this.recentBlockhash=t.recentBlockhash,this.compiledInstructions=t.compiledInstructions,this.addressTableLookups=t.addressTableLookups}return U(e,[{key:"version",get:function(){return 0}},{key:"numAccountKeysFromLookups",get:function(){var e,t=0,n=se(this.addressTableLookups);try{for(n.s();!(e=n.n()).done;){var r=e.value;t+=r.readonlyIndexes.length+r.writableIndexes.length}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"getAccountKeys",value:function(e){var t;if(e&&"accountKeysFromLookups"in e&&e.accountKeysFromLookups){if(this.numAccountKeysFromLookups!=e.accountKeysFromLookups.writable.length+e.accountKeysFromLookups.readonly.length)throw new Error("Failed to get account keys because of a mismatch in the number of account keys from lookups");t=e.accountKeysFromLookups}else if(e&&"addressLookupTableAccounts"in e&&e.addressLookupTableAccounts)t=this.resolveAddressTableLookups(e.addressLookupTableAccounts);else if(this.addressTableLookups.length>0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new eu(this.staticAccountKeys,t)}},{key:"isAccountSigner",value:function(e){return e<this.header.numRequiredSignatures}},{key:"isAccountWritable",value:function(e){var t=this.header.numRequiredSignatures,n=this.staticAccountKeys.length;return e>=n?e-n<this.addressTableLookups.reduce((function(e,t){return e+t.writableIndexes.length}),0):e>=this.header.numRequiredSignatures?e-t<n-t-this.header.numReadonlyUnsignedAccounts:e<t-this.header.numReadonlySignedAccounts}},{key:"resolveAddressTableLookups",value:function(e){var t,n={writable:[],readonly:[]},r=se(this.addressTableLookups);try{var i=function(){var r=t.value,i=e.find((function(e){return e.key.equals(r.accountKey)}));if(!i)throw new Error("Failed to find address lookup table account for table key ".concat(r.accountKey.toBase58()));var o,a=se(r.writableIndexes);try{for(a.s();!(o=a.n()).done;){var s=o.value;if(!(s<i.state.addresses.length))throw new Error("Failed to find address for index ".concat(s," in address lookup table ").concat(r.accountKey.toBase58()));n.writable.push(i.state.addresses[s])}}catch(e){a.e(e)}finally{a.f()}var u,c=se(r.readonlyIndexes);try{for(c.s();!(u=c.n()).done;){var l=u.value;if(!(l<i.state.addresses.length))throw new Error("Failed to find address for index ".concat(l," in address lookup table ").concat(r.accountKey.toBase58()));n.readonly.push(i.state.addresses[l])}}catch(e){c.e(e)}finally{c.f()}};for(r.s();!(t=r.n()).done;)i()}catch(e){r.e(e)}finally{r.f()}return n}},{key:"serialize",value:function(){var e=Array();au(e,this.staticAccountKeys.length);var t=this.serializeInstructions(),n=Array();au(n,this.compiledInstructions.length);var r=this.serializeAddressTableLookups(),i=Array();au(i,this.addressTableLookups.length);var o=Fi([Ri("prefix"),Fi([Ri("numRequiredSignatures"),Ri("numReadonlySignedAccounts"),Ri("numReadonlyUnsignedAccounts")],"header"),Hi(e.length,"staticAccountKeysLength"),Vi(tu(),this.staticAccountKeys.length,"staticAccountKeys"),tu("recentBlockhash"),Hi(n.length,"instructionsLength"),Hi(t.length,"serializedInstructions"),Hi(i.length,"addressTableLookupsLength"),Hi(r.length,"serializedAddressTableLookups")]),a=new Uint8Array(1232),s=o.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(e),staticAccountKeys:this.staticAccountKeys.map((function(e){return e.toBytes()})),recentBlockhash:dr.decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:t,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:r},a);return a.slice(0,s)}},{key:"serializeInstructions",value:function(){var e,t=0,n=new Uint8Array(1232),r=se(this.compiledInstructions);try{for(r.s();!(e=r.n()).done;){var i=e.value,o=Array();au(o,i.accountKeyIndexes.length);var a=Array();au(a,i.data.length),t+=Fi([Ri("programIdIndex"),Hi(o.length,"encodedAccountKeyIndexesLength"),Vi(Ri(),i.accountKeyIndexes.length,"accountKeyIndexes"),Hi(a.length,"encodedDataLength"),Hi(i.data.length,"data")]).encode({programIdIndex:i.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(o),accountKeyIndexes:i.accountKeyIndexes,encodedDataLength:new Uint8Array(a),data:i.data},n,t)}}catch(e){r.e(e)}finally{r.f()}return n.slice(0,t)}},{key:"serializeAddressTableLookups",value:function(){var e,t=0,n=new Uint8Array(1232),r=se(this.addressTableLookups);try{for(r.s();!(e=r.n()).done;){var i=e.value,o=Array();au(o,i.writableIndexes.length);var a=Array();au(a,i.readonlyIndexes.length),t+=Fi([tu("accountKey"),Hi(o.length,"encodedWritableIndexesLength"),Vi(Ri(),i.writableIndexes.length,"writableIndexes"),Hi(a.length,"encodedReadonlyIndexesLength"),Vi(Ri(),i.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:i.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(o),writableIndexes:i.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(a),readonlyIndexes:i.readonlyIndexes},n,t)}}catch(e){r.e(e)}finally{r.f()}return n.slice(0,t)}}],[{key:"compile",value:function(t){var n,r=uu.compile(t.instructions,t.payerKey),i=new Array,o={writable:new Array,readonly:new Array},a=se(t.addressLookupTableAccounts||[]);try{for(a.s();!(n=a.n()).done;){var s=n.value,u=r.extractTableLookup(s);if(void 0!==u){var c,l,h=ee(u,2),d=h[0],f=h[1],p=f.writable,y=f.readonly;i.push(d),(c=o.writable).push.apply(c,te(p)),(l=o.readonly).push.apply(l,te(y))}}}catch(e){a.e(e)}finally{a.f()}var m=ee(r.getMessageComponents(),2),g=m[0],v=m[1],w=new eu(v,o).compileInstructions(t.instructions);return new e({header:g,staticAccountKeys:v,recentBlockhash:t.recentBlockhash,compiledInstructions:w,addressTableLookups:i})}},{key:"deserialize",value:function(t){var n=te(t),r=n.shift(),i=127&r;su(r!==i,"Expected versioned message but received legacy message");su(0===i,"Expected versioned message with version 0 but found version ".concat(i));for(var o={numRequiredSignatures:n.shift(),numReadonlySignedAccounts:n.shift(),numReadonlyUnsignedAccounts:n.shift()},a=[],s=ou(n),u=0;u<s;u++)a.push(new qs(n.splice(0,32)));for(var c=dr.encode(n.splice(0,32)),l=ou(n),h=[],d=0;d<l;d++){var f=n.shift(),p=ou(n),y=n.splice(0,p),m=ou(n),g=new Uint8Array(n.splice(0,m));h.push({programIdIndex:f,accountKeyIndexes:y,data:g})}for(var v=ou(n),w=[],b=0;b<v;b++){var M=new qs(n.splice(0,32)),A=ou(n),I=n.splice(0,A),N=ou(n),T=n.splice(0,N);w.push({accountKey:M,writableIndexes:I,readonlyIndexes:T})}return new e({header:o,staticAccountKeys:a,recentBlockhash:c,compiledInstructions:h,addressTableLookups:w})}}]),e}(),hu={deserializeMessageVersion:function(e){var t=e[0],n=127&t;return n===t?"legacy":n},deserialize:function(e){var t=hu.deserializeMessageVersion(e);if("legacy"===t)return cu.from(e);if(0===t)return lu.deserialize(e);throw new Error("Transaction message version ".concat(t," deserialization is not supported"))}},du=function(e){return e[e.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",e[e.PROCESSED=1]="PROCESSED",e[e.TIMED_OUT=2]="TIMED_OUT",e[e.NONCE_INVALID=3]="NONCE_INVALID",e}({}),fu=Ne.alloc(64).fill(0),pu=function(){function e(t){B(this,e),this.keys=void 0,this.programId=void 0,this.data=Ne.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}return U(e,[{key:"toJSON",value:function(){return{keys:this.keys.map((function(e){var t=e.pubkey,n=e.isSigner,r=e.isWritable;return{pubkey:t.toJSON(),isSigner:n,isWritable:r}})),programId:this.programId.toJSON(),data:te(this.data)}}}]),e}(),yu=function(){function e(t){if(B(this,e),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")){var n=t.minContextSlot,r=t.nonceInfo;this.minNonceContextSlot=n,this.nonceInfo=r}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){var i=t.blockhash,o=t.lastValidBlockHeight;this.recentBlockhash=i,this.lastValidBlockHeight=o}else{var a=t.recentBlockhash,s=t.nonceInfo;s&&(this.nonceInfo=s),this.recentBlockhash=a}}var t;return U(e,[{key:"signature",get:function(){return this.signatures.length>0?this.signatures[0].signature:null}},{key:"toJSON",value:function(){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((function(e){return e.toJSON()})),signers:this.signatures.map((function(e){return e.publicKey.toJSON()}))}}},{key:"add",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(0===n.length)throw new Error("No instructions");return n.forEach((function(t){"instructions"in t?e.instructions=e.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?e.instructions.push(t):e.instructions.push(new pu(t))})),this}},{key:"compileMessage",value:function(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;var e,t,n;if(this.nonceInfo?(e=this.nonceInfo.nonce,t=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction].concat(te(this.instructions)):this.instructions):(e=this.recentBlockhash,t=this.instructions),!e)throw new Error("Transaction recentBlockhash required");if(t.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(var r=0;r<t.length;r++)if(void 0===t[r].programId)throw new Error("Transaction instruction index ".concat(r," has undefined program id"));var i=[],o=[];t.forEach((function(e){e.keys.forEach((function(e){o.push(C({},e))}));var t=e.programId.toString();i.includes(t)||i.push(t)})),i.forEach((function(e){o.push({pubkey:new qs(e),isSigner:!1,isWritable:!1})}));var a=[];o.forEach((function(e){var t=e.pubkey.toString(),n=a.findIndex((function(e){return e.pubkey.toString()===t}));n>-1?(a[n].isWritable=a[n].isWritable||e.isWritable,a[n].isSigner=a[n].isSigner||e.isSigner):a.push(e)})),a.sort((function(e,t){if(e.isSigner!==t.isSigner)return e.isSigner?-1:1;if(e.isWritable!==t.isWritable)return e.isWritable?-1:1;return e.pubkey.toBase58().localeCompare(t.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));var s=a.findIndex((function(e){return e.pubkey.equals(n)}));if(s>-1){var u=ee(a.splice(s,1),1)[0];u.isSigner=!0,u.isWritable=!0,a.unshift(u)}else a.unshift({pubkey:n,isSigner:!0,isWritable:!0});var c,l=se(this.signatures);try{var h=function(){var e=c.value,t=a.findIndex((function(t){return t.pubkey.equals(e.publicKey)}));if(!(t>-1))throw new Error("unknown signer: ".concat(e.publicKey.toString()));a[t].isSigner||(a[t].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."))};for(l.s();!(c=l.n()).done;)h()}catch(e){l.e(e)}finally{l.f()}var d=0,f=0,p=0,y=[],m=[];a.forEach((function(e){var t=e.pubkey,n=e.isSigner,r=e.isWritable;n?(y.push(t.toString()),d+=1,r||(f+=1)):(m.push(t.toString()),r||(p+=1))}));var g=y.concat(m),v=t.map((function(e){var t=e.data,n=e.programId;return{programIdIndex:g.indexOf(n.toString()),accounts:e.keys.map((function(e){return g.indexOf(e.pubkey.toString())})),data:dr.encode(t)}}));return v.forEach((function(e){su(e.programIdIndex>=0),e.accounts.forEach((function(e){return su(e>=0)}))})),new cu({header:{numRequiredSignatures:d,numReadonlySignedAccounts:f,numReadonlyUnsignedAccounts:p},accountKeys:g,recentBlockhash:e,instructions:v})}},{key:"_compile",value:function(){var e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);if(this.signatures.length===t.length&&this.signatures.every((function(e,n){return t[n].equals(e.publicKey)})))return e;return this.signatures=t.map((function(e){return{signature:null,publicKey:e}})),e}},{key:"serializeMessage",value:function(){return this._compile().serialize()}},{key:"getEstimatedFee",value:(t=_(O().mark((function e(t){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getFeeForMessage(this.compileMessage());case 2:return e.abrupt("return",e.sent.value);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"setSigners",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)throw new Error("No signers");var r=new Set;this.signatures=t.filter((function(e){var t=e.toString();return!r.has(t)&&(r.add(t),!0)})).map((function(e){return{signature:null,publicKey:e}}))}},{key:"sign",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)throw new Error("No signers");for(var r=new Set,i=[],o=0,a=t;o<a.length;o++){var s=a[o],u=s.publicKey.toString();r.has(u)||(r.add(u),i.push(s))}this.signatures=i.map((function(e){return{signature:null,publicKey:e.publicKey}}));var c=this._compile();this._partialSign.apply(this,[c].concat(i))}},{key:"partialSign",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)throw new Error("No signers");for(var r=new Set,i=[],o=0,a=t;o<a.length;o++){var s=a[o],u=s.publicKey.toString();r.has(u)||(r.add(u),i.push(s))}var c=this._compile();this._partialSign.apply(this,[c].concat(i))}},{key:"_partialSign",value:function(e){for(var t=this,n=e.serialize(),r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];i.forEach((function(e){var r=Qs(n,e.secretKey);t._addSignature(e.publicKey,Ys(r))}))}},{key:"addSignature",value:function(e,t){this._compile(),this._addSignature(e,t)}},{key:"_addSignature",value:function(e,t){su(64===t.length);var n=this.signatures.findIndex((function(t){return e.equals(t.publicKey)}));if(n<0)throw new Error("unknown signer: ".concat(e.toString()));this.signatures[n].signature=Ne.from(t)}},{key:"verifySignatures",value:function(e){return this._verifySignatures(this.serializeMessage(),void 0===e||e)}},{key:"_verifySignatures",value:function(e,t){var n,r=se(this.signatures);try{for(r.s();!(n=r.n()).done;){var i=n.value,o=i.signature,a=i.publicKey;if(null===o){if(t)return!1}else if(!Ws(o,e,a.toBytes()))return!1}}catch(e){r.e(e)}finally{r.f()}return!0}},{key:"serialize",value:function(e){var t=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),n=t.requireAllSignatures,r=t.verifySignatures,i=this.serializeMessage();if(r&&!this._verifySignatures(i,n))throw new Error("Signature verification failed");return this._serialize(i)}},{key:"_serialize",value:function(e){var t=this.signatures,n=[];au(n,t.length);var r=n.length+64*t.length+e.length,i=Ne.alloc(r);return su(t.length<256),Ne.from(n).copy(i,0),t.forEach((function(e,t){var r=e.signature;null!==r&&(su(64===r.length,"signature has invalid length"),Ne.from(r).copy(i,n.length+64*t))})),e.copy(i,n.length+64*t.length),su(i.length<=1232,"Transaction too large: ".concat(i.length," > ").concat(1232)),i}},{key:"keys",get:function(){return su(1===this.instructions.length),this.instructions[0].keys.map((function(e){return e.pubkey}))}},{key:"programId",get:function(){return su(1===this.instructions.length),this.instructions[0].programId}},{key:"data",get:function(){return su(1===this.instructions.length),this.instructions[0].data}}],[{key:"from",value:function(t){for(var n=te(t),r=ou(n),i=[],o=0;o<r;o++){var a=n.slice(0,64);n=n.slice(64),i.push(dr.encode(Ne.from(a)))}return e.populate(cu.from(n),i)}},{key:"populate",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=new e;return r.recentBlockhash=t.recentBlockhash,t.header.numRequiredSignatures>0&&(r.feePayer=t.accountKeys[0]),n.forEach((function(e,n){var i={signature:e==dr.encode(fu)?null:dr.decode(e),publicKey:t.accountKeys[n]};r.signatures.push(i)})),t.instructions.forEach((function(e){var n=e.accounts.map((function(e){var n=t.accountKeys[e];return{pubkey:n,isSigner:r.signatures.some((function(e){return e.publicKey.toString()===n.toString()}))||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}}));r.instructions.push(new pu({keys:n,programId:t.accountKeys[e.programIdIndex],data:dr.decode(e.data)}))})),r._message=t,r._json=r.toJSON(),r}}]),e}(),mu=function(){function e(t){B(this,e),this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=t.payerKey,this.instructions=t.instructions,this.recentBlockhash=t.recentBlockhash}return U(e,[{key:"compileToLegacyMessage",value:function(){return cu.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions})}},{key:"compileToV0Message",value:function(e){return lu.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions,addressLookupTableAccounts:e})}}],[{key:"decompile",value:function(t,n){var r=t.header,i=t.compiledInstructions,o=t.recentBlockhash,a=r.numRequiredSignatures,s=r.numReadonlySignedAccounts,u=r.numReadonlyUnsignedAccounts,c=a-s;su(c>0,"Message header is invalid");var l=t.staticAccountKeys.length-a-u;su(l>=0,"Message header is invalid");var h=t.getAccountKeys(n),d=h.get(0);if(void 0===d)throw new Error("Failed to decompile message because no account keys were found");var f,p=[],y=se(i);try{for(y.s();!(f=y.n()).done;){var m,g=f.value,v=[],w=se(g.accountKeyIndexes);try{for(w.s();!(m=w.n()).done;){var b=m.value,M=h.get(b);if(void 0===M)throw new Error("Failed to find key for account key index ".concat(b));var A=void 0;A=b<a?b<c:b<h.staticAccountKeys.length?b-a<l:b-h.staticAccountKeys.length<h.accountKeysFromLookups.writable.length,v.push({pubkey:M,isSigner:b<r.numRequiredSignatures,isWritable:A})}}catch(e){w.e(e)}finally{w.f()}var I=h.get(g.programIdIndex);if(void 0===I)throw new Error("Failed to find program id for program id index ".concat(g.programIdIndex));p.push(new pu({programId:I,data:Ys(g.data),keys:v}))}}catch(e){y.e(e)}finally{y.f()}return new e({payerKey:d,instructions:p,recentBlockhash:o})}}]),e}(),gu=function(){function e(t,n){if(B(this,e),this.signatures=void 0,this.message=void 0,void 0!==n)su(n.length===t.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=n;else{for(var r=[],i=0;i<t.header.numRequiredSignatures;i++)r.push(new Uint8Array(64));this.signatures=r}this.message=t}return U(e,[{key:"version",get:function(){return this.message.version}},{key:"serialize",value:function(){var e=this.message.serialize(),t=Array();au(t,this.signatures.length);var n=Fi([Hi(t.length,"encodedSignaturesLength"),Vi(nu(),this.signatures.length,"signatures"),Hi(e.length,"serializedMessage")]),r=new Uint8Array(2048),i=n.encode({encodedSignaturesLength:new Uint8Array(t),signatures:this.signatures,serializedMessage:e},r);return r.slice(0,i)}},{key:"sign",value:function(e){var t,n=this,r=this.message.serialize(),i=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures),o=se(e);try{var a=function(){var e=t.value,o=i.findIndex((function(t){return t.equals(e.publicKey)}));su(o>=0,"Cannot sign with non signer key ".concat(e.publicKey.toBase58())),n.signatures[o]=Qs(r,e.secretKey)};for(o.s();!(t=o.n()).done;)a()}catch(e){o.e(e)}finally{o.f()}}},{key:"addSignature",value:function(e,t){su(64===t.byteLength,"Signature must be 64 bytes long");var n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((function(t){return t.equals(e)}));su(n>=0,"Can not add signature; `".concat(e.toBase58(),"` is not required to sign this transaction")),this.signatures[n]=t}}],[{key:"deserialize",value:function(t){for(var n=te(t),r=[],i=ou(n),o=0;o<i;o++)r.push(new Uint8Array(n.splice(0,64)));return new e(hu.deserialize(new Uint8Array(n)),r)}}]),e}(),vu=new qs("SysvarC1ock11111111111111111111111111111111"),wu=new qs("SysvarEpochSchedu1e111111111111111111111111"),bu=new qs("Sysvar1nstructions1111111111111111111111111"),Mu=new qs("SysvarRecentB1ockHashes11111111111111111111"),Au=new qs("SysvarRent111111111111111111111111111111111"),Iu=new qs("SysvarRewards111111111111111111111111111111"),Nu=new qs("SysvarS1otHashes111111111111111111111111111"),Tu=new qs("SysvarS1otHistory11111111111111111111111111"),Eu=new qs("SysvarStakeHistory1111111111111111111111111");function xu(e,t,n,r){return ku.apply(this,arguments)}function ku(){return(ku=_(O().mark((function e(t,n,r,i){var o,a,s,u,c;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=i&&{skipPreflight:i.skipPreflight,preflightCommitment:i.preflightCommitment||i.commitment,maxRetries:i.maxRetries,minContextSlot:i.minContextSlot},e.next=3,t.sendTransaction(n,r,o);case 3:if(a=e.sent,null==n.recentBlockhash||null==n.lastValidBlockHeight){e.next=10;break}return e.next=7,t.confirmTransaction({abortSignal:null==i?void 0:i.abortSignal,signature:a,blockhash:n.recentBlockhash,lastValidBlockHeight:n.lastValidBlockHeight},i&&i.commitment);case 7:s=e.sent.value,e.next=22;break;case 10:if(null==n.minNonceContextSlot||null==n.nonceInfo){e.next=18;break}return u=n.nonceInfo.nonceInstruction,c=u.keys[0].pubkey,e.next=15,t.confirmTransaction({abortSignal:null==i?void 0:i.abortSignal,minContextSlot:n.minNonceContextSlot,nonceAccountPubkey:c,nonceValue:n.nonceInfo.nonce,signature:a},i&&i.commitment);case 15:s=e.sent.value,e.next=22;break;case 18:return null!=(null==i?void 0:i.abortSignal)&&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."),e.next=21,t.confirmTransaction(a,i&&i.commitment);case 21:s=e.sent.value;case 22:if(!s.err){e.next=24;break}throw new Error("Transaction ".concat(a," failed (").concat(JSON.stringify(s),")"));case 24:return e.abrupt("return",a);case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Lu(e){return new Promise((function(t){return setTimeout(t,e)}))}function Su(e,t){var n=e.layout.span>=0?e.layout.span:iu(e,t),r=Ne.alloc(n),i=Object.assign({instruction:e.index},t);return e.layout.encode(i,r),r}function ju(e,t){var n;try{n=e.layout.decode(t)}catch(e){throw new Error("invalid instruction; "+e)}if(n.instruction!==e.index)throw new Error("invalid instruction; instruction index mismatch ".concat(n.instruction," != ").concat(e.index));return n}var Du,Cu=Wi("lamportsPerSignature"),Ou=Fi([Qi("version"),Qi("state"),tu("authorizedPubkey"),tu("nonce"),Fi([Cu],"feeCalculator")]),zu=Ou.span,Pu=function(){function e(t){B(this,e),this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}return U(e,null,[{key:"fromAccountData",value:function(t){var n=Ou.decode(Ys(t),0);return new e({authorizedPubkey:new qs(n.authorizedPubkey),nonce:new qs(n.nonce).toString(),feeCalculator:n.feeCalculator})}}]),e}(),_u=(Du=8,function(e){var t=Hi(Du,e),n=function(e){return{decode:e.decode.bind(e),encode:e.encode.bind(e)}}(t),r=n.encode,i=n.decode,o=t;return o.decode=function(e,t){var n=i(e,t);return qi(Ne.from(n))},o.encode=function(e,t,n){var i=Zi(e,Du);return r(i,t,n)},o}),Bu=function(){function e(){B(this,e)}return U(e,null,[{key:"decodeInstructionType",value:function(e){this.checkProgramId(e.programId);for(var t,n=Qi("instruction").decode(e.data),r=0,i=Object.entries(Ru);r<i.length;r++){var o=ee(i[r],2),a=o[0];if(o[1].index==n){t=a;break}}if(!t)throw new Error("Instruction type incorrect; not a SystemInstruction");return t}},{key:"decodeCreateAccount",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=ju(Ru.Create,e.data),n=t.lamports,r=t.space,i=t.programId;return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,lamports:n,space:r,programId:new qs(i)}}},{key:"decodeTransfer",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=ju(Ru.Transfer,e.data).lamports;return{fromPubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,lamports:t}}},{key:"decodeTransferWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=ju(Ru.TransferWithSeed,e.data),n=t.lamports,r=t.seed,i=t.programId;return{fromPubkey:e.keys[0].pubkey,basePubkey:e.keys[1].pubkey,toPubkey:e.keys[2].pubkey,lamports:n,seed:r,programId:new qs(i)}}},{key:"decodeAllocate",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);var t=ju(Ru.Allocate,e.data).space;return{accountPubkey:e.keys[0].pubkey,space:t}}},{key:"decodeAllocateWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);var t=ju(Ru.AllocateWithSeed,e.data),n=t.base,r=t.seed,i=t.space,o=t.programId;return{accountPubkey:e.keys[0].pubkey,basePubkey:new qs(n),seed:r,space:i,programId:new qs(o)}}},{key:"decodeAssign",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);var t=ju(Ru.Assign,e.data).programId;return{accountPubkey:e.keys[0].pubkey,programId:new qs(t)}}},{key:"decodeAssignWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);var t=ju(Ru.AssignWithSeed,e.data),n=t.base,r=t.seed,i=t.programId;return{accountPubkey:e.keys[0].pubkey,basePubkey:new qs(n),seed:r,programId:new qs(i)}}},{key:"decodeCreateWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=ju(Ru.CreateWithSeed,e.data),n=t.base,r=t.seed,i=t.lamports,o=t.space,a=t.programId;return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,basePubkey:new qs(n),seed:r,lamports:i,space:o,programId:new qs(a)}}},{key:"decodeNonceInitialize",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=ju(Ru.InitializeNonceAccount,e.data).authorized;return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:new qs(t)}}},{key:"decodeNonceAdvance",value:function(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),ju(Ru.AdvanceNonceAccount,e.data),{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}},{key:"decodeNonceWithdraw",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);var t=ju(Ru.WithdrawNonceAccount,e.data).lamports;return{noncePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:t}}},{key:"decodeNonceAuthorize",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=ju(Ru.AuthorizeNonceAccount,e.data).authorized;return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[1].pubkey,newAuthorizedPubkey:new qs(t)}}},{key:"checkProgramId",value:function(e){if(!e.equals(Uu.programId))throw new Error("invalid instruction; programId is not SystemProgram")}},{key:"checkKeyLength",value:function(e,t){if(e.length<t)throw new Error("invalid instruction; found ".concat(e.length," keys, expected at least ").concat(t))}}]),e}(),Ru=Object.freeze({Create:{index:0,layout:Fi([Qi("instruction"),Yi("lamports"),Yi("space"),tu("programId")])},Assign:{index:1,layout:Fi([Qi("instruction"),tu("programId")])},Transfer:{index:2,layout:Fi([Qi("instruction"),_u("lamports")])},CreateWithSeed:{index:3,layout:Fi([Qi("instruction"),tu("base"),ru("seed"),Yi("lamports"),Yi("space"),tu("programId")])},AdvanceNonceAccount:{index:4,layout:Fi([Qi("instruction")])},WithdrawNonceAccount:{index:5,layout:Fi([Qi("instruction"),Yi("lamports")])},InitializeNonceAccount:{index:6,layout:Fi([Qi("instruction"),tu("authorized")])},AuthorizeNonceAccount:{index:7,layout:Fi([Qi("instruction"),tu("authorized")])},Allocate:{index:8,layout:Fi([Qi("instruction"),Yi("space")])},AllocateWithSeed:{index:9,layout:Fi([Qi("instruction"),tu("base"),ru("seed"),Yi("space"),tu("programId")])},AssignWithSeed:{index:10,layout:Fi([Qi("instruction"),tu("base"),ru("seed"),tu("programId")])},TransferWithSeed:{index:11,layout:Fi([Qi("instruction"),_u("lamports"),ru("seed"),tu("programId")])},UpgradeNonceAccount:{index:12,layout:Fi([Qi("instruction")])}}),Uu=function(){function e(){B(this,e)}return U(e,null,[{key:"createAccount",value:function(e){var t=Su(Ru.Create,{lamports:e.lamports,space:e.space,programId:Ys(e.programId.toBuffer())});return new pu({keys:[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:t})}},{key:"transfer",value:function(e){var t,n;"basePubkey"in e?(t=Su(Ru.TransferWithSeed,{lamports:BigInt(e.lamports),seed:e.seed,programId:Ys(e.programId.toBuffer())}),n=[{pubkey:e.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]):(t=Su(Ru.Transfer,{lamports:BigInt(e.lamports)}),n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]);return new pu({keys:n,programId:this.programId,data:t})}},{key:"assign",value:function(e){var t,n;"basePubkey"in e?(t=Su(Ru.AssignWithSeed,{base:Ys(e.basePubkey.toBuffer()),seed:e.seed,programId:Ys(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]):(t=Su(Ru.Assign,{programId:Ys(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]);return new pu({keys:n,programId:this.programId,data:t})}},{key:"createAccountWithSeed",value:function(e){var t=Su(Ru.CreateWithSeed,{base:Ys(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:Ys(e.programId.toBuffer())}),n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey!=e.fromPubkey&&n.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new pu({keys:n,programId:this.programId,data:t})}},{key:"createNonceAccount",value:function(t){var n=new yu;"basePubkey"in t&&"seed"in t?n.add(e.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:zu,programId:this.programId})):n.add(e.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:zu,programId:this.programId}));var r={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return n.add(this.nonceInitialize(r)),n}},{key:"nonceInitialize",value:function(e){var t=Su(Ru.InitializeNonceAccount,{authorized:Ys(e.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:Mu,isSigner:!1,isWritable:!1},{pubkey:Au,isSigner:!1,isWritable:!1}],programId:this.programId,data:t};return new pu(n)}},{key:"nonceAdvance",value:function(e){var t=Su(Ru.AdvanceNonceAccount),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:Mu,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t};return new pu(n)}},{key:"nonceWithdraw",value:function(e){var t=Su(Ru.WithdrawNonceAccount,{lamports:e.lamports});return new pu({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:Mu,isSigner:!1,isWritable:!1},{pubkey:Au,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}},{key:"nonceAuthorize",value:function(e){var t=Su(Ru.AuthorizeNonceAccount,{authorized:Ys(e.newAuthorizedPubkey.toBuffer())});return new pu({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}},{key:"allocate",value:function(e){var t,n;"basePubkey"in e?(t=Su(Ru.AllocateWithSeed,{base:Ys(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:Ys(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]):(t=Su(Ru.Allocate,{space:e.space}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]);return new pu({keys:n,programId:this.programId,data:t})}}]),e}();Uu.programId=new qs("11111111111111111111111111111111");var Qu=function(){function e(){B(this,e)}var t;return U(e,null,[{key:"getMinNumSignatures",value:function(t){return 2*(Math.ceil(t/e.chunkSize)+1+1)}},{key:"load",value:(t=_(O().mark((function t(n,r,i,o,a){var s,u,c,l,h,d,f,p,y,m,g,v,w,b,M,A,I,N,T;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.getMinimumBalanceForRentExemption(a.length);case 2:return s=t.sent,t.next=5,n.getAccountInfo(i.publicKey,"confirmed");case 5:if(u=t.sent,c=null,null===u){t.next=16;break}if(!u.executable){t.next=11;break}return console.error("Program load failed, account is already executable"),t.abrupt("return",!1);case 11:u.data.length!==a.length&&(c=c||new yu).add(Uu.allocate({accountPubkey:i.publicKey,space:a.length})),u.owner.equals(o)||(c=c||new yu).add(Uu.assign({accountPubkey:i.publicKey,programId:o})),u.lamports<s&&(c=c||new yu).add(Uu.transfer({fromPubkey:r.publicKey,toPubkey:i.publicKey,lamports:s-u.lamports})),t.next=17;break;case 16:c=(new yu).add(Uu.createAccount({fromPubkey:r.publicKey,newAccountPubkey:i.publicKey,lamports:s>0?s:1,space:a.length,programId:o}));case 17:if(null===c){t.next=20;break}return t.next=20,xu(n,c,[r,i],{commitment:"confirmed"});case 20:l=Fi([Qi("instruction"),Qi("offset"),Qi("bytesLength"),Qi("bytesLengthPadding"),Vi(Ri("byte"),Bi(Qi(),-8),"bytes")]),h=e.chunkSize,d=0,f=a,p=[];case 25:if(!(f.length>0)){t.next=39;break}if(y=f.slice(0,h),m=Ne.alloc(h+16),l.encode({instruction:0,offset:d,bytes:y,bytesLength:0,bytesLengthPadding:0},m),g=(new yu).add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0}],programId:o,data:m}),p.push(xu(n,g,[r,i],{commitment:"confirmed"})),!n._rpcEndpoint.includes("solana.com")){t.next=35;break}return t.next=35,Lu(250);case 35:d+=h,f=f.slice(h),t.next=25;break;case 39:return t.next=41,Promise.all(p);case 41:return v=Fi([Qi("instruction")]),w=Ne.alloc(v.span),v.encode({instruction:1},w),b=(new yu).add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0},{pubkey:Au,isSigner:!1,isWritable:!1}],programId:o,data:w}),M="processed",t.next=48,n.sendTransaction(b,[r,i],{preflightCommitment:M});case 48:return A=t.sent,t.next=51,n.confirmTransaction({signature:A,lastValidBlockHeight:b.lastValidBlockHeight,blockhash:b.recentBlockhash},M);case 51:if(I=t.sent,N=I.context,!(T=I.value).err){t.next=56;break}throw new Error("Transaction ".concat(A," failed (").concat(JSON.stringify(T),")"));case 56:return t.prev=57,t.next=60,n.getSlot({commitment:M});case 60:if(!(t.sent>N.slot)){t.next=63;break}return t.abrupt("break",71);case 63:t.next=67;break;case 65:t.prev=65,t.t0=t.catch(57);case 67:return t.next=69,new Promise((function(e){return setTimeout(e,Math.round(200))}));case 69:t.next=56;break;case 71:return t.abrupt("return",!0);case 72:case"end":return t.stop()}}),t,null,[[57,65]])}))),function(e,n,r,i,o){return t.apply(this,arguments)})}]),e}();Qu.chunkSize=932;var Wu=new qs("BPFLoader2111111111111111111111111111111111"),Yu=function(){function e(){B(this,e)}return U(e,null,[{key:"getMinNumSignatures",value:function(e){return Qu.getMinNumSignatures(e)}},{key:"load",value:function(e,t,n,r,i){return Qu.load(e,t,n,i,r)}}]),e}();function Fu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vu=Object.prototype.toString,Hu=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};function Gu(e,t){var n,r,i,o,a,s,u;if(!0===e)return"true";if(!1===e)return"false";switch(z(e)){case"object":if(null===e)return null;if(e.toJSON&&"function"==typeof e.toJSON)return Gu(e.toJSON(),t);if("[object Array]"===(u=Vu.call(e))){for(i="[",r=e.length-1,n=0;n<r;n++)i+=Gu(e[n],!0)+",";return r>-1&&(i+=Gu(e[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=Hu(e).sort()).length,i="",n=0;n<r;)void 0!==(s=Gu(e[a=o[n]],!1))&&(i&&(i+=","),i+=JSON.stringify(a)+":"+s),n++;return"{"+i+"}"}return JSON.stringify(e);case"function":case"undefined":return t?null:void 0;case"string":return JSON.stringify(e);default:return isFinite(e)?e:null}}var qu=Fu((function(e){var t=Gu(e,!1);if(void 0!==t)return""+t}));function Zu(e){for(var t=0;e>1;)e/=2,t++;return t}var Ju=function(){function e(t,n,r,i,o){B(this,e),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=n,this.warmup=r,this.firstNormalEpoch=i,this.firstNormalSlot=o}return U(e,[{key:"getEpoch",value:function(e){return this.getEpochAndSlotIndex(e)[0]}},{key:"getEpochAndSlotIndex",value:function(e){if(e<this.firstNormalSlot){var t=Zu(function(e){return 0===e?1:(e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,1+(e|=e>>32))}(e+32+1))-Zu(32)-1;return[t,e-(this.getSlotsInEpoch(t)-32)]}var n=e-this.firstNormalSlot,r=Math.floor(n/this.slotsPerEpoch);return[this.firstNormalEpoch+r,n%this.slotsPerEpoch]}},{key:"getFirstSlotInEpoch",value:function(e){return e<=this.firstNormalEpoch?32*(Math.pow(2,e)-1):(e-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}},{key:"getLastSlotInEpoch",value:function(e){return this.getFirstSlotInEpoch(e)+this.getSlotsInEpoch(e)-1}},{key:"getSlotsInEpoch",value:function(e){return e<this.firstNormalEpoch?Math.pow(2,e+Zu(32)):this.slotsPerEpoch}}]),e}(),Xu=function(e){W(n,G(Error));var t=X(n);function n(e,r){var i;return B(this,n),(i=t.call(this,e)).logs=void 0,i.logs=r,i}return U(n)}(),Ku=function(e){W(n,G(Error));var t=X(n);function n(e,r){var i,o=e.code,a=e.message,s=e.data;return B(this,n),(i=t.call(this,null!=r?"".concat(r,": ").concat(a):a)).code=void 0,i.data=void 0,i.code=o,i.data=s,i.name="SolanaJSONRPCError",i}return U(n)}(),$u=globalThis.fetch,ec=function(e){W(n,Ya);var t=X(n);function n(e,r,i){var o;B(this,n);return(o=t.call(this,(function(e){var t=Va(e,C({autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3},r));return o.underlyingSocket="socket"in t?t.socket:t,t}),e,r,i)).underlyingSocket=void 0,o}return U(n,[{key:"call",value:function(){for(var e,t,r=null===(e=this.underlyingSocket)||void 0===e?void 0:e.readyState,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return 1===r?(t=$(Y(n.prototype),"call",this)).call.apply(t,[this].concat(o)):Promise.reject(new Error("Tried to call a JSON-RPC method `"+o[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+r+")"))}},{key:"notify",value:function(){for(var e,t,r=null===(e=this.underlyingSocket)||void 0===e?void 0:e.readyState,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return 1===r?(t=$(Y(n.prototype),"notify",this)).call.apply(t,[this].concat(o)):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+o[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+r+")"))}}]),n}();var tc=function(){function e(t){B(this,e),this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}return U(e,[{key:"isActive",value:function(){var e=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===e}}],[{key:"deserialize",value:function(e){var t=function(e,t){var n;try{n=e.layout.decode(t)}catch(e){throw new Error("invalid instruction; "+e)}if(n.typeIndex!==e.index)throw new Error("invalid account data; account type mismatch ".concat(n.typeIndex," != ").concat(e.index));return n}(nc,e),n=e.length-56;su(n>=0,"lookup table is invalid"),su(n%32==0,"lookup table is invalid");var r=n/32,i=Fi([Vi(tu(),r,"addresses")]).decode(e.slice(56)).addresses;return{deactivationSlot:t.deactivationSlot,lastExtendedSlot:t.lastExtendedSlot,lastExtendedSlotStartIndex:t.lastExtendedStartIndex,authority:0!==t.authority.length?new qs(t.authority[0]):void 0,addresses:i.map((function(e){return new qs(e)}))}}}]),e}(),nc={index:1,layout:Fi([Qi("typeIndex"),_u("deactivationSlot"),Wi("lastExtendedSlot"),Ri("lastExtendedStartIndex"),Ri(),Vi(tu(),Bi(Ri(),-1),"authority")])},rc=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i;var ic=xo(mo(qs),Ao(),(function(e){return new qs(e)})),oc=Io([Ao(),go("base64")]),ac=xo(mo(Ne),oc,(function(e){return Ne.from(e[0],"base64")}));function sc(e){var t,n;if("string"==typeof e)t=e;else if(e){t=e.commitment,n=q(e,Ds)}return{commitment:t,config:n}}function uc(e){return To([No({jsonrpc:go("2.0"),id:Ao(),result:e}),No({jsonrpc:go("2.0"),id:Ao(),error:No({code:Eo(),message:Ao(),data:bo(fo("any",(function(){return!0})))})})])}var cc=uc(Eo());function lc(e){return xo(uc(e),cc,(function(t){return"error"in t?t:C(C({},t),{},{result:co(t.result,e)})}))}function hc(e){return lc(No({context:No({slot:wo()}),value:e}))}function dc(e){return No({context:No({slot:wo()}),value:e})}function fc(e,t){return 0===e?new lu({header:t.header,staticAccountKeys:t.accountKeys.map((function(e){return new qs(e)})),recentBlockhash:t.recentBlockhash,compiledInstructions:t.instructions.map((function(e){return{programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:dr.decode(e.data)}})),addressTableLookups:t.addressTableLookups}):new cu(t)}var pc=No({foundation:wo(),foundationTerm:wo(),initial:wo(),taper:wo(),terminal:wo()}),yc=lc(po(vo(No({epoch:wo(),effectiveSlot:wo(),amount:wo(),postBalance:wo(),commission:bo(vo(wo()))})))),mc=po(No({slot:wo(),prioritizationFee:wo()})),gc=No({total:wo(),validator:wo(),foundation:wo(),epoch:wo()}),vc=No({epoch:wo(),slotIndex:wo(),slotsInEpoch:wo(),absoluteSlot:wo(),blockHeight:bo(wo()),transactionCount:bo(wo())}),wc=No({slotsPerEpoch:wo(),leaderScheduleSlotOffset:wo(),warmup:yo(),firstNormalEpoch:wo(),firstNormalSlot:wo()}),bc=Mo(Ao(),po(wo())),Mc=vo(To([No({}),Ao()])),Ac=No({err:Mc}),Ic=go("receivedSignature"),Nc=No({"solana-core":Ao(),"feature-set":bo(wo())}),Tc=hc(No({err:vo(To([No({}),Ao()])),logs:vo(po(Ao())),accounts:bo(vo(po(vo(No({executable:yo(),owner:Ao(),lamports:wo(),data:po(Ao()),rentEpoch:bo(wo())}))))),unitsConsumed:bo(wo()),returnData:bo(vo(No({programId:Ao(),data:Io([Ao(),go("base64")])})))})),Ec=hc(No({byIdentity:Mo(Ao(),po(wo())),range:No({firstSlot:wo(),lastSlot:wo()})}));var xc=lc(pc),kc=lc(gc),Lc=lc(mc),Sc=lc(vc),jc=lc(wc),Dc=lc(bc),Cc=lc(wo()),Oc=hc(No({total:wo(),circulating:wo(),nonCirculating:wo(),nonCirculatingAccounts:po(ic)})),zc=No({amount:Ao(),uiAmount:vo(wo()),decimals:wo(),uiAmountString:bo(Ao())}),Pc=hc(po(No({address:ic,amount:Ao(),uiAmount:vo(wo()),decimals:wo(),uiAmountString:bo(Ao())}))),_c=hc(po(No({pubkey:ic,account:No({executable:yo(),owner:ic,lamports:wo(),data:ac,rentEpoch:wo()})}))),Bc=No({program:Ao(),parsed:Eo(),space:wo()}),Rc=hc(po(No({pubkey:ic,account:No({executable:yo(),owner:ic,lamports:wo(),data:Bc,rentEpoch:wo()})}))),Uc=hc(po(No({lamports:wo(),address:ic}))),Qc=No({executable:yo(),owner:ic,lamports:wo(),data:ac,rentEpoch:wo()}),Wc=No({pubkey:ic,account:Qc}),Yc=xo(To([mo(Ne),Bc]),To([oc,Bc]),(function(e){return Array.isArray(e)?co(e,ac):e})),Fc=No({executable:yo(),owner:ic,lamports:wo(),data:Yc,rentEpoch:wo()}),Vc=No({pubkey:ic,account:Fc}),Hc=No({state:To([go("active"),go("inactive"),go("activating"),go("deactivating")]),active:wo(),inactive:wo()}),Gc=lc(po(No({signature:Ao(),slot:wo(),err:Mc,memo:vo(Ao()),blockTime:bo(vo(wo()))}))),qc=lc(po(No({signature:Ao(),slot:wo(),err:Mc,memo:vo(Ao()),blockTime:bo(vo(wo()))}))),Zc=No({subscription:wo(),result:dc(Qc)}),Jc=No({pubkey:ic,account:Qc}),Xc=No({subscription:wo(),result:dc(Jc)}),Kc=No({parent:wo(),slot:wo(),root:wo()}),$c=No({subscription:wo(),result:Kc}),el=To([No({type:To([go("firstShredReceived"),go("completed"),go("optimisticConfirmation"),go("root")]),slot:wo(),timestamp:wo()}),No({type:go("createdBank"),parent:wo(),slot:wo(),timestamp:wo()}),No({type:go("frozen"),slot:wo(),timestamp:wo(),stats:No({numTransactionEntries:wo(),numSuccessfulTransactions:wo(),numFailedTransactions:wo(),maxTransactionsPerEntry:wo()})}),No({type:go("dead"),slot:wo(),timestamp:wo(),err:Ao()})]),tl=No({subscription:wo(),result:el}),nl=No({subscription:wo(),result:dc(To([Ac,Ic]))}),rl=No({subscription:wo(),result:wo()}),il=No({pubkey:Ao(),gossip:vo(Ao()),tpu:vo(Ao()),rpc:vo(Ao()),version:vo(Ao())}),ol=No({votePubkey:Ao(),nodePubkey:Ao(),activatedStake:wo(),epochVoteAccount:yo(),epochCredits:po(Io([wo(),wo(),wo()])),commission:wo(),lastVote:wo(),rootSlot:vo(wo())}),al=lc(No({current:po(ol),delinquent:po(ol)})),sl=To([go("processed"),go("confirmed"),go("finalized")]),ul=No({slot:wo(),confirmations:vo(wo()),err:Mc,confirmationStatus:bo(sl)}),cl=hc(po(vo(ul))),ll=lc(wo()),hl=No({accountKey:ic,writableIndexes:po(wo()),readonlyIndexes:po(wo())}),dl=No({signatures:po(Ao()),message:No({accountKeys:po(Ao()),header:No({numRequiredSignatures:wo(),numReadonlySignedAccounts:wo(),numReadonlyUnsignedAccounts:wo()}),instructions:po(No({accounts:po(wo()),data:Ao(),programIdIndex:wo()})),recentBlockhash:Ao(),addressTableLookups:bo(po(hl))})}),fl=No({pubkey:ic,signer:yo(),writable:yo(),source:bo(To([go("transaction"),go("lookupTable")]))}),pl=No({accountKeys:po(fl),signatures:po(Ao())}),yl=No({parsed:Eo(),program:Ao(),programId:ic}),ml=No({accounts:po(ic),data:Ao(),programId:ic}),gl=xo(To([ml,yl]),To([No({parsed:Eo(),program:Ao(),programId:Ao()}),No({accounts:po(Ao()),data:Ao(),programId:Ao()})]),(function(e){return co(e,"accounts"in e?ml:yl)})),vl=No({signatures:po(Ao()),message:No({accountKeys:po(fl),instructions:po(gl),recentBlockhash:Ao(),addressTableLookups:bo(vo(po(hl)))})}),wl=No({accountIndex:wo(),mint:Ao(),owner:bo(Ao()),uiTokenAmount:zc}),bl=No({writable:po(ic),readonly:po(ic)}),Ml=No({err:Mc,fee:wo(),innerInstructions:bo(vo(po(No({index:wo(),instructions:po(No({accounts:po(wo()),data:Ao(),programIdIndex:wo()}))})))),preBalances:po(wo()),postBalances:po(wo()),logMessages:bo(vo(po(Ao()))),preTokenBalances:bo(vo(po(wl))),postTokenBalances:bo(vo(po(wl))),loadedAddresses:bo(bl),computeUnitsConsumed:bo(wo())}),Al=No({err:Mc,fee:wo(),innerInstructions:bo(vo(po(No({index:wo(),instructions:po(gl)})))),preBalances:po(wo()),postBalances:po(wo()),logMessages:bo(vo(po(Ao()))),preTokenBalances:bo(vo(po(wl))),postTokenBalances:bo(vo(po(wl))),loadedAddresses:bo(bl),computeUnitsConsumed:bo(wo())}),Il=To([go(0),go("legacy")]),Nl=No({pubkey:Ao(),lamports:wo(),postBalance:vo(wo()),rewardType:vo(Ao()),commission:bo(vo(wo()))}),Tl=lc(vo(No({blockhash:Ao(),previousBlockhash:Ao(),parentSlot:wo(),transactions:po(No({transaction:dl,meta:vo(Ml),version:bo(Il)})),rewards:bo(po(Nl)),blockTime:vo(wo()),blockHeight:vo(wo())}))),El=lc(vo(No({blockhash:Ao(),previousBlockhash:Ao(),parentSlot:wo(),rewards:bo(po(Nl)),blockTime:vo(wo()),blockHeight:vo(wo())}))),xl=lc(vo(No({blockhash:Ao(),previousBlockhash:Ao(),parentSlot:wo(),transactions:po(No({transaction:pl,meta:vo(Ml),version:bo(Il)})),rewards:bo(po(Nl)),blockTime:vo(wo()),blockHeight:vo(wo())}))),kl=lc(vo(No({blockhash:Ao(),previousBlockhash:Ao(),parentSlot:wo(),transactions:po(No({transaction:vl,meta:vo(Al),version:bo(Il)})),rewards:bo(po(Nl)),blockTime:vo(wo()),blockHeight:vo(wo())}))),Ll=lc(vo(No({blockhash:Ao(),previousBlockhash:Ao(),parentSlot:wo(),transactions:po(No({transaction:pl,meta:vo(Al),version:bo(Il)})),rewards:bo(po(Nl)),blockTime:vo(wo()),blockHeight:vo(wo())}))),Sl=lc(vo(No({blockhash:Ao(),previousBlockhash:Ao(),parentSlot:wo(),rewards:bo(po(Nl)),blockTime:vo(wo()),blockHeight:vo(wo())}))),jl=lc(vo(No({blockhash:Ao(),previousBlockhash:Ao(),parentSlot:wo(),transactions:po(No({transaction:dl,meta:vo(Ml)})),rewards:bo(po(Nl)),blockTime:vo(wo())}))),Dl=lc(vo(No({blockhash:Ao(),previousBlockhash:Ao(),parentSlot:wo(),signatures:po(Ao()),blockTime:vo(wo())}))),Cl=lc(vo(No({slot:wo(),meta:vo(Ml),blockTime:bo(vo(wo())),transaction:dl,version:bo(Il)}))),Ol=lc(vo(No({slot:wo(),transaction:vl,meta:vo(Al),blockTime:bo(vo(wo())),version:bo(Il)}))),zl=hc(No({blockhash:Ao(),feeCalculator:No({lamportsPerSignature:wo()})})),Pl=hc(No({blockhash:Ao(),lastValidBlockHeight:wo()})),_l=hc(yo()),Bl=lc(po(No({slot:wo(),numTransactions:wo(),numSlots:wo(),samplePeriodSecs:wo()}))),Rl=hc(vo(No({feeCalculator:No({lamportsPerSignature:wo()})}))),Ul=lc(Ao()),Ql=lc(Ao()),Wl=No({err:Mc,logs:po(Ao()),signature:Ao()}),Yl=No({result:dc(Wl),subscription:wo()}),Fl={"solana-client":"js/".concat("0.0.0-development")},Vl=function(){function e(t,n){var r,i,o,a,s,u,c,l=this;B(this,e),this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(r={},function(){var e=_(O().mark((function e(t){var n,i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=sc(t),o=i.commitment,a=i.config,s=l._buildArgs([],o,void 0,a),u=qu(s),r[u]=null!==(n=r[u])&&void 0!==n?n:_(O().mark((function e(){var t,n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,l._rpcRequest("getBlockHeight",s);case 3:if(t=e.sent,!("error"in(n=co(t,lc(wo()))))){e.next=7;break}throw new Ku(n.error,"failed to get block height information");case 7:return e.abrupt("return",n.result);case 8:return e.prev=8,delete r[u],e.finish(8);case 11:case"end":return e.stop()}}),e,null,[[0,,8,11]])})))(),e.next=6,r[u];case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),n&&"string"==typeof n?this._commitment=n:n&&(this._commitment=n.commitment,this._confirmTransactionInitialTimeout=n.confirmTransactionInitialTimeout,i=n.wsEndpoint,o=n.httpHeaders,a=n.fetch,s=n.fetchMiddleware,u=n.disableRetryOnRateLimit,c=n.httpAgent),this._rpcEndpoint=function(e){if(!1===/^https?:/.test(e))throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return e}(t),this._rpcWsEndpoint=i||function(e){var t=e.match(rc);if(null==t)throw TypeError("Failed to validate endpoint URL `".concat(e,"`"));var n=ee(t,4);n[0];var r=n[1],i=n[2],o=n[3],a=e.startsWith("https:")?"wss:":"ws:",s=null==i?null:parseInt(i.slice(1),10),u=null==s?"":":".concat(s+1);return"".concat(a,"//").concat(r).concat(u).concat(o)}(t),this._rpcClient=function(e,t,n,r,i,o){var a,s=n||$u;return null!=o&&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."),r&&(a=function(){var e=_(O().mark((function e(t,n){var i;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e,i){try{r(t,n,(function(t,n){return e([t,n])}))}catch(e){i(e)}}));case 2:return i=e.sent,e.next=5,s.apply(void 0,te(i));case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()),new aa(function(){var n=_(O().mark((function n(r,o){var u,c,l,h,d;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:u={method:"POST",body:r,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},t||{},Fl)},n.prev=1,c=5,h=500;case 4:if(!a){n.next=10;break}return n.next=7,a(e,u);case 7:l=n.sent,n.next=13;break;case 10:return n.next=12,s(e,u);case 12:l=n.sent;case 13:if(429===l.status){n.next=15;break}return n.abrupt("break",26);case 15:if(!0!==i){n.next=17;break}return n.abrupt("break",26);case 17:if(0!=(c-=1)){n.next=20;break}return n.abrupt("break",26);case 20:return console.log("Server responded with ".concat(l.status," ").concat(l.statusText,". Retrying after ").concat(h,"ms delay...")),n.next=23,Lu(h);case 23:h*=2;case 24:n.next=4;break;case 26:return n.next=28,l.text();case 28:d=n.sent,l.ok?o(null,d):o(new Error("".concat(l.status," ").concat(l.statusText,": ").concat(d))),n.next=35;break;case 32:n.prev=32,n.t0=n.catch(1),n.t0 instanceof Error&&o(n.t0);case 35:case"end":return n.stop()}}),n,null,[[1,32]])})));return function(e,t){return n.apply(this,arguments)}}(),{})}(t,o,a,s,u,c),this._rpcRequest=function(e){return function(t,n){return new Promise((function(r,i){e.request(t,n,(function(e,t){e?i(e):r(t)}))}))}}(this._rpcClient),this._rpcBatchRequest=function(e){return function(t){return new Promise((function(n,r){0===t.length&&n([]);var i=t.map((function(t){return e.request(t.methodName,t.args)}));e.request(i,(function(e,t){e?r(e):n(t)}))}))}}(this._rpcClient),this._rpcWebSocket=new ec(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))}var t,n,r,i,o,a,s,u,c,l,h,d,f,p,y,m,g,v,w,b,M,A,I,N,T,E,x,k,L,S,j,D,P,R,Q,W,Y,F,V,H,G,Z,J,X,K,$,ne,re,ie,oe,ae,se,ue,ce,le,he,de,fe,pe,ye,me,ge,ve,we,be,Me,Ae,Ie,Te,Ee,xe,ke,Le,Se,je,De,Ce,Oe,ze,Pe,_e,Be,Re,Ue,Qe,We,Ye,Fe,Ve;return U(e,[{key:"commitment",get:function(){return this._commitment}},{key:"rpcEndpoint",get:function(){return this._rpcEndpoint}},{key:"getBalanceAndContext",value:(Ve=_(O().mark((function e(t,n){var r,i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=this._buildArgs([t.toBase58()],i,void 0,o),e.next=4,this._rpcRequest("getBalance",a);case 4:if(s=e.sent,!("error"in(u=co(s,hc(wo()))))){e.next=8;break}throw new Ku(u.error,"failed to get balance for ".concat(t.toBase58()));case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ve.apply(this,arguments)})},{key:"getBalance",value:(Fe=_(O().mark((function e(t,n){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getBalanceAndContext(t,n).then((function(e){return e.value})).catch((function(e){throw new Error("failed to get balance of account "+t.toBase58()+": "+e)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return Fe.apply(this,arguments)})},{key:"getBlockTime",value:(Ye=_(O().mark((function e(t){var n,r;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getBlockTime",[t]);case 2:if(n=e.sent,!("error"in(r=co(n,lc(vo(wo())))))){e.next=6;break}throw new Ku(r.error,"failed to get block time for slot ".concat(t));case 6:return e.abrupt("return",r.result);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return Ye.apply(this,arguments)})},{key:"getMinimumLedgerSlot",value:(We=_(O().mark((function e(){var t,n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("minimumLedgerSlot",[]);case 2:if(t=e.sent,!("error"in(n=co(t,lc(wo()))))){e.next=6;break}throw new Ku(n.error,"failed to get minimum ledger slot");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return We.apply(this,arguments)})},{key:"getFirstAvailableBlock",value:(Qe=_(O().mark((function e(){var t,n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getFirstAvailableBlock",[]);case 2:if(t=e.sent,!("error"in(n=co(t,Cc)))){e.next=6;break}throw new Ku(n.error,"failed to get first available block");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return Qe.apply(this,arguments)})},{key:"getSupply",value:(Ue=_(O().mark((function e(t){var n,r,i;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={},n="string"==typeof t?{commitment:t}:t?C(C({},t),{},{commitment:t&&t.commitment||this.commitment}):{commitment:this.commitment},e.next=4,this._rpcRequest("getSupply",[n]);case 4:if(r=e.sent,!("error"in(i=co(r,Oc)))){e.next=8;break}throw new Ku(i.error,"failed to get supply");case 8:return e.abrupt("return",i.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return Ue.apply(this,arguments)})},{key:"getTokenSupply",value:(Re=_(O().mark((function e(t,n){var r,i,o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgs([t.toBase58()],n),e.next=3,this._rpcRequest("getTokenSupply",r);case 3:if(i=e.sent,!("error"in(o=co(i,hc(zc))))){e.next=7;break}throw new Ku(o.error,"failed to get token supply");case 7:return e.abrupt("return",o.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return Re.apply(this,arguments)})},{key:"getTokenAccountBalance",value:(Be=_(O().mark((function e(t,n){var r,i,o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgs([t.toBase58()],n),e.next=3,this._rpcRequest("getTokenAccountBalance",r);case 3:if(i=e.sent,!("error"in(o=co(i,hc(zc))))){e.next=7;break}throw new Ku(o.error,"failed to get token account balance");case 7:return e.abrupt("return",o.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return Be.apply(this,arguments)})},{key:"getTokenAccountsByOwner",value:(_e=_(O().mark((function e(t,n,r){var i,o,a,s,u,c,l;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=sc(r),o=i.commitment,a=i.config,s=[t.toBase58()],"mint"in n?s.push({mint:n.mint.toBase58()}):s.push({programId:n.programId.toBase58()}),u=this._buildArgs(s,o,"base64",a),e.next=6,this._rpcRequest("getTokenAccountsByOwner",u);case 6:if(c=e.sent,!("error"in(l=co(c,_c)))){e.next=10;break}throw new Ku(l.error,"failed to get token accounts owned by account ".concat(t.toBase58()));case 10:return e.abrupt("return",l.result);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return _e.apply(this,arguments)})},{key:"getParsedTokenAccountsByOwner",value:(Pe=_(O().mark((function e(t,n,r){var i,o,a,s;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=[t.toBase58()],"mint"in n?i.push({mint:n.mint.toBase58()}):i.push({programId:n.programId.toBase58()}),o=this._buildArgs(i,r,"jsonParsed"),e.next=5,this._rpcRequest("getTokenAccountsByOwner",o);case 5:if(a=e.sent,!("error"in(s=co(a,Rc)))){e.next=9;break}throw new Ku(s.error,"failed to get token accounts owned by account ".concat(t.toBase58()));case 9:return e.abrupt("return",s.result);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return Pe.apply(this,arguments)})},{key:"getLargestAccounts",value:(ze=_(O().mark((function e(t){var n,r,i,o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=C(C({},t),{},{commitment:t&&t.commitment||this.commitment}),r=n.filter||n.commitment?[n]:[],e.next=4,this._rpcRequest("getLargestAccounts",r);case 4:if(i=e.sent,!("error"in(o=co(i,Uc)))){e.next=8;break}throw new Ku(o.error,"failed to get largest accounts");case 8:return e.abrupt("return",o.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return ze.apply(this,arguments)})},{key:"getTokenLargestAccounts",value:(Oe=_(O().mark((function e(t,n){var r,i,o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgs([t.toBase58()],n),e.next=3,this._rpcRequest("getTokenLargestAccounts",r);case 3:if(i=e.sent,!("error"in(o=co(i,Pc)))){e.next=7;break}throw new Ku(o.error,"failed to get token largest accounts");case 7:return e.abrupt("return",o.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return Oe.apply(this,arguments)})},{key:"getAccountInfoAndContext",value:(Ce=_(O().mark((function e(t,n){var r,i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=this._buildArgs([t.toBase58()],i,"base64",o),e.next=4,this._rpcRequest("getAccountInfo",a);case 4:if(s=e.sent,!("error"in(u=co(s,hc(vo(Qc)))))){e.next=8;break}throw new Ku(u.error,"failed to get info about account ".concat(t.toBase58()));case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ce.apply(this,arguments)})},{key:"getParsedAccountInfo",value:(De=_(O().mark((function e(t,n){var r,i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=this._buildArgs([t.toBase58()],i,"jsonParsed",o),e.next=4,this._rpcRequest("getAccountInfo",a);case 4:if(s=e.sent,!("error"in(u=co(s,hc(vo(Fc)))))){e.next=8;break}throw new Ku(u.error,"failed to get info about account ".concat(t.toBase58()));case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return De.apply(this,arguments)})},{key:"getAccountInfo",value:(je=_(O().mark((function e(t,n){var r;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getAccountInfoAndContext(t,n);case 3:return r=e.sent,e.abrupt("return",r.value);case 7:throw e.prev=7,e.t0=e.catch(0),new Error("failed to get info about account "+t.toBase58()+": "+e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e,t){return je.apply(this,arguments)})},{key:"getMultipleParsedAccounts",value:(Se=_(O().mark((function e(t,n){var r,i,o,a,s,u,c;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=t.map((function(e){return e.toBase58()})),s=this._buildArgs([a],i,"jsonParsed",o),e.next=5,this._rpcRequest("getMultipleAccounts",s);case 5:if(u=e.sent,!("error"in(c=co(u,hc(po(vo(Fc))))))){e.next=9;break}throw new Ku(c.error,"failed to get info for accounts ".concat(a));case 9:return e.abrupt("return",c.result);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return Se.apply(this,arguments)})},{key:"getMultipleAccountsInfoAndContext",value:(Le=_(O().mark((function e(t,n){var r,i,o,a,s,u,c;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=t.map((function(e){return e.toBase58()})),s=this._buildArgs([a],i,"base64",o),e.next=5,this._rpcRequest("getMultipleAccounts",s);case 5:if(u=e.sent,!("error"in(c=co(u,hc(po(vo(Qc))))))){e.next=9;break}throw new Ku(c.error,"failed to get info for accounts ".concat(a));case 9:return e.abrupt("return",c.result);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return Le.apply(this,arguments)})},{key:"getMultipleAccountsInfo",value:(ke=_(O().mark((function e(t,n){var r;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getMultipleAccountsInfoAndContext(t,n);case 2:return r=e.sent,e.abrupt("return",r.value);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return ke.apply(this,arguments)})},{key:"getStakeActivation",value:(xe=_(O().mark((function e(t,n,r){var i,o,a,s,u,c;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=sc(n),o=i.commitment,a=i.config,s=this._buildArgs([t.toBase58()],o,void 0,C(C({},a),{},{epoch:null!=r?r:null==a?void 0:a.epoch})),e.next=4,this._rpcRequest("getStakeActivation",s);case 4:if(u=e.sent,!("error"in(c=co(u,lc(Hc))))){e.next=8;break}throw new Ku(c.error,"failed to get Stake Activation ".concat(t.toBase58()));case 8:return e.abrupt("return",c.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return xe.apply(this,arguments)})},{key:"getProgramAccounts",value:(Ee=_(O().mark((function e(t,n){var r,i,o,a,s,u,c,l,h,d;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,s=(a=o||{}).encoding,u=q(a,Cs),c=this._buildArgs([t.toBase58()],i,s||"base64",u),e.next=5,this._rpcRequest("getProgramAccounts",c);case 5:if(l=e.sent,h=po(Wc),!("error"in(d=!0===u.withContext?co(l,hc(h)):co(l,lc(h))))){e.next=10;break}throw new Ku(d.error,"failed to get accounts owned by program ".concat(t.toBase58()));case 10:return e.abrupt("return",d.result);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ee.apply(this,arguments)})},{key:"getParsedProgramAccounts",value:(Te=_(O().mark((function e(t,n){var r,i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=this._buildArgs([t.toBase58()],i,"jsonParsed",o),e.next=4,this._rpcRequest("getProgramAccounts",a);case 4:if(s=e.sent,!("error"in(u=co(s,lc(po(Vc)))))){e.next=8;break}throw new Ku(u.error,"failed to get accounts owned by program ".concat(t.toBase58()));case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return Te.apply(this,arguments)})},{key:"confirmTransaction",value:(Ie=_(O().mark((function e(t,n){var r,i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("string"!=typeof t){e.next=4;break}r=t,e.next=8;break;case 4:if(null===(i=(o=t).abortSignal)||void 0===i||!i.aborted){e.next=7;break}return e.abrupt("return",Promise.reject(o.abortSignal.reason));case 7:r=o.signature;case 8:e.prev=8,a=dr.decode(r),e.next=15;break;case 12:throw e.prev=12,e.t0=e.catch(8),new Error("signature must be base58 encoded: "+r);case 15:if(su(64===a.length,"signature has invalid length"),"string"!=typeof t){e.next=22;break}return e.next=19,this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:n||this.commitment,signature:r});case 19:return e.abrupt("return",e.sent);case 22:if(!("lastValidBlockHeight"in t)){e.next=28;break}return e.next=25,this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:n||this.commitment,strategy:t});case 25:return e.abrupt("return",e.sent);case 28:return e.next=30,this.confirmTransactionUsingDurableNonceStrategy({commitment:n||this.commitment,strategy:t});case 30:return e.abrupt("return",e.sent);case 31:case"end":return e.stop()}}),e,this,[[8,12]])}))),function(e,t){return Ie.apply(this,arguments)})},{key:"getCancellationPromise",value:function(e){return new Promise((function(t,n){null!=e&&(e.aborted?n(e.reason):e.addEventListener("abort",(function(){n(e.reason)})))}))}},{key:"getTransactionConfirmationPromise",value:function(e){var t,n,r=this,i=e.commitment,o=e.signature,a=!1;return{abortConfirmation:function(){n&&(n(),n=void 0),null!=t&&(r.removeSignatureListener(t),t=void 0)},confirmationPromise:new Promise((function(e,s){try{t=r.onSignature(o,(function(n,r){t=void 0;var i={context:r,value:n};e({__type:du.PROCESSED,response:i})}),i);var u=new Promise((function(e){null==t?e():n=r._onSubscriptionStateChange(t,(function(t){"subscribed"===t&&e()}))}));_(O().mark((function t(){var n,c,l;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,u;case 2:if(!a){t.next=4;break}return t.abrupt("return");case 4:return t.next=6,r.getSignatureStatus(o);case 6:if(n=t.sent,!a){t.next=9;break}return t.abrupt("return");case 9:if(null!=n){t.next=11;break}return t.abrupt("return");case 11:if(c=n.context,null!=(l=n.value)){t.next=14;break}return t.abrupt("return");case 14:if(null==l||!l.err){t.next=18;break}s(l.err),t.next=29;break;case 18:t.t0=i,t.next="confirmed"===t.t0||"single"===t.t0||"singleGossip"===t.t0?21:"finalized"===t.t0||"max"===t.t0||"root"===t.t0?24:("processed"===t.t0||t.t0,27);break;case 21:if("processed"!==l.confirmationStatus){t.next=23;break}return t.abrupt("return");case 23:return t.abrupt("break",27);case 24:if("processed"!==l.confirmationStatus&&"confirmed"!==l.confirmationStatus){t.next=26;break}return t.abrupt("return");case 26:return t.abrupt("break",27);case 27:a=!0,e({__type:du.PROCESSED,response:{context:c,value:l}});case 29:case"end":return t.stop()}}),t)})))()}catch(e){s(e)}}))}}},{key:"confirmTransactionUsingBlockHeightExceedanceStrategy",value:(Ae=_(O().mark((function e(t){var n,r,i,o,a,s,u,c,l,h,d,f,p,y=this;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.commitment,r=t.strategy,i=r.abortSignal,o=r.lastValidBlockHeight,a=r.signature,s=!1,u=new Promise((function(e){var t=function(){var e=_(O().mark((function e(){var t;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,y.getBlockHeight(n);case 3:return t=e.sent,e.abrupt("return",t);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",-1);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}();_(O().mark((function n(){var r;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t();case 2:if(r=n.sent,!s){n.next=5;break}return n.abrupt("return");case 5:if(!(r<=o)){n.next=17;break}return n.next=8,Lu(1e3);case 8:if(!s){n.next=10;break}return n.abrupt("return");case 10:return n.next=12,t();case 12:if(r=n.sent,!s){n.next=15;break}return n.abrupt("return");case 15:n.next=5;break;case 17:e({__type:du.BLOCKHEIGHT_EXCEEDED});case 18:case"end":return n.stop()}}),n)})))()})),c=this.getTransactionConfirmationPromise({commitment:n,signature:a}),l=c.abortConfirmation,h=c.confirmationPromise,d=this.getCancellationPromise(i),e.prev=5,e.next=8,Promise.race([d,h,u]);case 8:if((p=e.sent).__type!==du.PROCESSED){e.next=13;break}f=p.response,e.next=14;break;case 13:throw new Xs(a);case 14:return e.prev=14,s=!0,l(),e.finish(14);case 18:return e.abrupt("return",f);case 19:case"end":return e.stop()}}),e,this,[[5,,14,18]])}))),function(e){return Ae.apply(this,arguments)})},{key:"confirmTransactionUsingDurableNonceStrategy",value:(Me=_(O().mark((function e(t){var n,r,i,o,a,s,u,c,l,h,d,f,p,y,m,g,v,w,b,M,A,I=this;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.commitment,r=t.strategy,i=r.abortSignal,o=r.minContextSlot,a=r.nonceAccountPubkey,s=r.nonceValue,u=r.signature,c=!1,l=new Promise((function(e){var t=s,r=null,i=function(){var e=_(O().mark((function e(){var i,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,I.getNonceAndContext(a,{commitment:n,minContextSlot:o});case 3:return i=e.sent,s=i.context,u=i.value,r=s.slot,e.abrupt("return",null==u?void 0:u.nonce);case 10:return e.prev=10,e.t0=e.catch(0),e.abrupt("return",t);case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(){return e.apply(this,arguments)}}();_(O().mark((function n(){return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i();case 2:if(t=n.sent,!c){n.next=5;break}return n.abrupt("return");case 5:if(s===t){n.next=9;break}return e({__type:du.NONCE_INVALID,slotInWhichNonceDidAdvance:r}),n.abrupt("return");case 9:return n.next=11,Lu(2e3);case 11:if(!c){n.next=13;break}return n.abrupt("return");case 13:return n.next=15,i();case 15:if(t=n.sent,!c){n.next=18;break}return n.abrupt("return");case 18:n.next=5;break;case 20:case"end":return n.stop()}}),n)})))()})),h=this.getTransactionConfirmationPromise({commitment:n,signature:u}),d=h.abortConfirmation,f=h.confirmationPromise,p=this.getCancellationPromise(i),e.prev=5,e.next=8,Promise.race([p,f,l]);case 8:if((m=e.sent).__type!==du.PROCESSED){e.next=13;break}y=m.response,e.next=47;break;case 13:return e.next=16,this.getSignatureStatus(u);case 16:if(null!=(b=e.sent)){e.next=19;break}return e.abrupt("break",27);case 19:if(!(b.context.slot<(null!==(w=m.slotInWhichNonceDidAdvance)&&void 0!==w?w:o))){e.next=23;break}return e.next=22,Lu(400);case 22:return e.abrupt("continue",13);case 23:return v=b,e.abrupt("break",27);case 27:if(null===(g=v)||void 0===g||!g.value){e.next=46;break}M=n||"finalized",A=v.value.confirmationStatus,e.t0=M,e.next="processed"===e.t0||"recent"===e.t0?33:"confirmed"===e.t0||"single"===e.t0||"singleGossip"===e.t0?36:"finalized"===e.t0||"max"===e.t0||"root"===e.t0?39:42;break;case 33:if("processed"===A||"confirmed"===A||"finalized"===A){e.next=35;break}throw new $s(u);case 35:return e.abrupt("break",43);case 36:if("confirmed"===A||"finalized"===A){e.next=38;break}throw new $s(u);case 38:return e.abrupt("break",43);case 39:if("finalized"===A){e.next=41;break}throw new $s(u);case 41:return e.abrupt("break",43);case 42:case 43:y={context:v.context,value:{err:v.value.err}},e.next=47;break;case 46:throw new $s(u);case 47:return e.prev=47,c=!0,d(),e.finish(47);case 51:return e.abrupt("return",y);case 52:case"end":return e.stop()}}),e,this,[[5,,47,51]])}))),function(e){return Me.apply(this,arguments)})},{key:"confirmTransactionUsingLegacyTimeoutStrategy",value:(be=_(O().mark((function e(t){var n,r,i,o,a,s,u,c,l,h=this;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.commitment,r=t.signature,o=new Promise((function(e){var t=h._confirmTransactionInitialTimeout||6e4;switch(n){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":t=h._confirmTransactionInitialTimeout||3e4}i=setTimeout((function(){return e({__type:du.TIMED_OUT,timeoutMs:t})}),t)})),a=this.getTransactionConfirmationPromise({commitment:n,signature:r}),s=a.abortConfirmation,u=a.confirmationPromise,e.prev=3,e.next=6,Promise.race([u,o]);case 6:if((l=e.sent).__type!==du.PROCESSED){e.next=11;break}c=l.response,e.next=12;break;case 11:throw new Ks(r,l.timeoutMs/1e3);case 12:return e.prev=12,clearTimeout(i),s(),e.finish(12);case 16:return e.abrupt("return",c);case 17:case"end":return e.stop()}}),e,this,[[3,,12,16]])}))),function(e){return be.apply(this,arguments)})},{key:"getClusterNodes",value:(we=_(O().mark((function e(){var t,n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getClusterNodes",[]);case 2:if(t=e.sent,!("error"in(n=co(t,lc(po(il)))))){e.next=6;break}throw new Ku(n.error,"failed to get cluster nodes");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return we.apply(this,arguments)})},{key:"getVoteAccounts",value:(ve=_(O().mark((function e(t){var n,r,i;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._buildArgs([],t),e.next=3,this._rpcRequest("getVoteAccounts",n);case 3:if(r=e.sent,!("error"in(i=co(r,al)))){e.next=7;break}throw new Ku(i.error,"failed to get vote accounts");case 7:return e.abrupt("return",i.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return ve.apply(this,arguments)})},{key:"getSlot",value:(ge=_(O().mark((function e(t){var n,r,i,o,a,s;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=sc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),e.next=4,this._rpcRequest("getSlot",o);case 4:if(a=e.sent,!("error"in(s=co(a,lc(wo()))))){e.next=8;break}throw new Ku(s.error,"failed to get slot");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return ge.apply(this,arguments)})},{key:"getSlotLeader",value:(me=_(O().mark((function e(t){var n,r,i,o,a,s;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=sc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),e.next=4,this._rpcRequest("getSlotLeader",o);case 4:if(a=e.sent,!("error"in(s=co(a,lc(Ao()))))){e.next=8;break}throw new Ku(s.error,"failed to get slot leader");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return me.apply(this,arguments)})},{key:"getSlotLeaders",value:(ye=_(O().mark((function e(t,n){var r,i,o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=[t,n],e.next=3,this._rpcRequest("getSlotLeaders",r);case 3:if(i=e.sent,!("error"in(o=co(i,lc(po(ic)))))){e.next=7;break}throw new Ku(o.error,"failed to get slot leaders");case 7:return e.abrupt("return",o.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return ye.apply(this,arguments)})},{key:"getSignatureStatus",value:(pe=_(O().mark((function e(t,n){var r,i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSignatureStatuses([t],n);case 2:return r=e.sent,i=r.context,su(1===(o=r.value).length),a=o[0],e.abrupt("return",{context:i,value:a});case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return pe.apply(this,arguments)})},{key:"getSignatureStatuses",value:(fe=_(O().mark((function e(t,n){var r,i,o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=[t],n&&r.push(n),e.next=4,this._rpcRequest("getSignatureStatuses",r);case 4:if(i=e.sent,!("error"in(o=co(i,cl)))){e.next=8;break}throw new Ku(o.error,"failed to get signature status");case 8:return e.abrupt("return",o.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return fe.apply(this,arguments)})},{key:"getTransactionCount",value:(de=_(O().mark((function e(t){var n,r,i,o,a,s;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=sc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),e.next=4,this._rpcRequest("getTransactionCount",o);case 4:if(a=e.sent,!("error"in(s=co(a,lc(wo()))))){e.next=8;break}throw new Ku(s.error,"failed to get transaction count");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return de.apply(this,arguments)})},{key:"getTotalSupply",value:(he=_(O().mark((function e(t){var n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0});case 2:return n=e.sent,e.abrupt("return",n.value.total);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return he.apply(this,arguments)})},{key:"getInflationGovernor",value:(le=_(O().mark((function e(t){var n,r,i;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._buildArgs([],t),e.next=3,this._rpcRequest("getInflationGovernor",n);case 3:if(r=e.sent,!("error"in(i=co(r,xc)))){e.next=7;break}throw new Ku(i.error,"failed to get inflation");case 7:return e.abrupt("return",i.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return le.apply(this,arguments)})},{key:"getInflationReward",value:(ce=_(O().mark((function e(t,n,r){var i,o,a,s,u,c;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=sc(r),o=i.commitment,a=i.config,s=this._buildArgs([t.map((function(e){return e.toBase58()}))],o,void 0,C(C({},a),{},{epoch:null!=n?n:null==a?void 0:a.epoch})),e.next=4,this._rpcRequest("getInflationReward",s);case 4:if(u=e.sent,!("error"in(c=co(u,yc)))){e.next=8;break}throw new Ku(c.error,"failed to get inflation reward");case 8:return e.abrupt("return",c.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ce.apply(this,arguments)})},{key:"getInflationRate",value:(ue=_(O().mark((function e(){var t,n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getInflationRate",[]);case 2:if(t=e.sent,!("error"in(n=co(t,kc)))){e.next=6;break}throw new Ku(n.error,"failed to get inflation rate");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return ue.apply(this,arguments)})},{key:"getEpochInfo",value:(se=_(O().mark((function e(t){var n,r,i,o,a,s;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=sc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),e.next=4,this._rpcRequest("getEpochInfo",o);case 4:if(a=e.sent,!("error"in(s=co(a,Sc)))){e.next=8;break}throw new Ku(s.error,"failed to get epoch info");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return se.apply(this,arguments)})},{key:"getEpochSchedule",value:(ae=_(O().mark((function e(){var t,n,r;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getEpochSchedule",[]);case 2:if(t=e.sent,!("error"in(n=co(t,jc)))){e.next=6;break}throw new Ku(n.error,"failed to get epoch schedule");case 6:return r=n.result,e.abrupt("return",new Ju(r.slotsPerEpoch,r.leaderScheduleSlotOffset,r.warmup,r.firstNormalEpoch,r.firstNormalSlot));case 8:case"end":return e.stop()}}),e,this)}))),function(){return ae.apply(this,arguments)})},{key:"getLeaderSchedule",value:(oe=_(O().mark((function e(){var t,n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getLeaderSchedule",[]);case 2:if(t=e.sent,!("error"in(n=co(t,Dc)))){e.next=6;break}throw new Ku(n.error,"failed to get leader schedule");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return oe.apply(this,arguments)})},{key:"getMinimumBalanceForRentExemption",value:(ie=_(O().mark((function e(t,n){var r,i,o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgs([t],n),e.next=3,this._rpcRequest("getMinimumBalanceForRentExemption",r);case 3:if(i=e.sent,!("error"in(o=co(i,ll)))){e.next=8;break}return console.warn("Unable to fetch minimum balance for rent exemption"),e.abrupt("return",0);case 8:return e.abrupt("return",o.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return ie.apply(this,arguments)})},{key:"getRecentBlockhashAndContext",value:(re=_(O().mark((function e(t){var n,r,i;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._buildArgs([],t),e.next=3,this._rpcRequest("getRecentBlockhash",n);case 3:if(r=e.sent,!("error"in(i=co(r,zl)))){e.next=7;break}throw new Ku(i.error,"failed to get recent blockhash");case 7:return e.abrupt("return",i.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return re.apply(this,arguments)})},{key:"getRecentPerformanceSamples",value:(ne=_(O().mark((function e(t){var n,r;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]);case 2:if(n=e.sent,!("error"in(r=co(n,Bl)))){e.next=6;break}throw new Ku(r.error,"failed to get recent performance samples");case 6:return e.abrupt("return",r.result);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return ne.apply(this,arguments)})},{key:"getFeeCalculatorForBlockhash",value:($=_(O().mark((function e(t,n){var r,i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgs([t],n),e.next=3,this._rpcRequest("getFeeCalculatorForBlockhash",r);case 3:if(i=e.sent,!("error"in(o=co(i,Rl)))){e.next=7;break}throw new Ku(o.error,"failed to get fee calculator");case 7:return a=o.result,s=a.context,u=a.value,e.abrupt("return",{context:s,value:null!==u?u.feeCalculator:null});case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return $.apply(this,arguments)})},{key:"getFeeForMessage",value:(K=_(O().mark((function e(t,n){var r,i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Ys(t.serialize()).toString("base64"),i=this._buildArgs([r],n),e.next=4,this._rpcRequest("getFeeForMessage",i);case 4:if(o=e.sent,!("error"in(a=co(o,hc(vo(wo())))))){e.next=8;break}throw new Ku(a.error,"failed to get fee for message");case 8:if(null!==a.result){e.next=10;break}throw new Error("invalid blockhash");case 10:return e.abrupt("return",a.result);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return K.apply(this,arguments)})},{key:"getRecentPrioritizationFees",value:(X=_(O().mark((function e(t){var n,r,i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=null==t||null===(n=t.lockedWritableAccounts)||void 0===n?void 0:n.map((function(e){return e.toBase58()})),i=null!=r&&r.length?[r]:[],e.next=4,this._rpcRequest("getRecentPrioritizationFees",i);case 4:if(o=e.sent,!("error"in(a=co(o,Lc)))){e.next=8;break}throw new Ku(a.error,"failed to get recent prioritization fees");case 8:return e.abrupt("return",a.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return X.apply(this,arguments)})},{key:"getRecentBlockhash",value:(J=_(O().mark((function e(t){var n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getRecentBlockhashAndContext(t);case 3:return n=e.sent,e.abrupt("return",n.value);case 7:throw e.prev=7,e.t0=e.catch(0),new Error("failed to get recent blockhash: "+e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e){return J.apply(this,arguments)})},{key:"getLatestBlockhash",value:(Z=_(O().mark((function e(t){var n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getLatestBlockhashAndContext(t);case 3:return n=e.sent,e.abrupt("return",n.value);case 7:throw e.prev=7,e.t0=e.catch(0),new Error("failed to get recent blockhash: "+e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e){return Z.apply(this,arguments)})},{key:"getLatestBlockhashAndContext",value:(G=_(O().mark((function e(t){var n,r,i,o,a,s;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=sc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),e.next=4,this._rpcRequest("getLatestBlockhash",o);case 4:if(a=e.sent,!("error"in(s=co(a,Pl)))){e.next=8;break}throw new Ku(s.error,"failed to get latest blockhash");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return G.apply(this,arguments)})},{key:"isBlockhashValid",value:(H=_(O().mark((function e(t,n){var r,i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=this._buildArgs([t],i,void 0,o),e.next=4,this._rpcRequest("isBlockhashValid",a);case 4:if(s=e.sent,!("error"in(u=co(s,_l)))){e.next=8;break}throw new Ku(u.error,"failed to determine if the blockhash `"+t+"`is valid");case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return H.apply(this,arguments)})},{key:"getVersion",value:(V=_(O().mark((function e(){var t,n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getVersion",[]);case 2:if(t=e.sent,!("error"in(n=co(t,lc(Nc))))){e.next=6;break}throw new Ku(n.error,"failed to get version");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return V.apply(this,arguments)})},{key:"getGenesisHash",value:(F=_(O().mark((function e(){var t,n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getGenesisHash",[]);case 2:if(t=e.sent,!("error"in(n=co(t,lc(Ao()))))){e.next=6;break}throw new Ku(n.error,"failed to get genesis hash");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return F.apply(this,arguments)})},{key:"getBlock",value:(Y=_(O().mark((function e(t,n){var r,i,o,a,s,u,c,l,h;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([t],i,void 0,o),e.next=4,this._rpcRequest("getBlock",a);case 4:s=e.sent,e.prev=5,e.t0=null==o?void 0:o.transactionDetails,e.next="accounts"===e.t0?9:"none"===e.t0?13:17;break;case 9:if(!("error"in(u=co(s,xl)))){e.next=12;break}throw u.error;case 12:return e.abrupt("return",u.result);case 13:if(!("error"in(c=co(s,El)))){e.next=16;break}throw c.error;case 16:return e.abrupt("return",c.result);case 17:if(!("error"in(l=co(s,Tl)))){e.next=20;break}throw l.error;case 20:return h=l.result,e.abrupt("return",h?C(C({},h),{},{transactions:h.transactions.map((function(e){var t=e.transaction,n=e.meta,r=e.version;return{meta:n,transaction:C(C({},t),{},{message:fc(r,t.message)}),version:r}}))}):null);case 22:e.next=27;break;case 24:throw e.prev=24,e.t1=e.catch(5),new Ku(e.t1,"failed to get confirmed block");case 27:case"end":return e.stop()}}),e,this,[[5,24]])}))),function(e,t){return Y.apply(this,arguments)})},{key:"getParsedBlock",value:(W=_(O().mark((function e(t,n){var r,i,o,a,s,u,c,l;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([t],i,"jsonParsed",o),e.next=4,this._rpcRequest("getBlock",a);case 4:s=e.sent,e.prev=5,e.t0=null==o?void 0:o.transactionDetails,e.next="accounts"===e.t0?9:"none"===e.t0?13:17;break;case 9:if(!("error"in(u=co(s,Ll)))){e.next=12;break}throw u.error;case 12:return e.abrupt("return",u.result);case 13:if(!("error"in(c=co(s,Sl)))){e.next=16;break}throw c.error;case 16:return e.abrupt("return",c.result);case 17:if(!("error"in(l=co(s,kl)))){e.next=20;break}throw l.error;case 20:return e.abrupt("return",l.result);case 21:e.next=26;break;case 23:throw e.prev=23,e.t1=e.catch(5),new Ku(e.t1,"failed to get block");case 26:case"end":return e.stop()}}),e,this,[[5,23]])}))),function(e,t){return W.apply(this,arguments)})},{key:"getBlockProduction",value:(Q=_(O().mark((function e(t){var n,r,i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"string"==typeof t?r=t:t&&(i=t.commitment,o=q(t,Os),r=i,n=o),a=this._buildArgs([],r,"base64",n),e.next=4,this._rpcRequest("getBlockProduction",a);case 4:if(s=e.sent,!("error"in(u=co(s,Ec)))){e.next=8;break}throw new Ku(u.error,"failed to get block production information");case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return Q.apply(this,arguments)})},{key:"getTransaction",value:(R=_(O().mark((function e(t,n){var r,i,o,a,s,u,c;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([t],i,void 0,o),e.next=4,this._rpcRequest("getTransaction",a);case 4:if(s=e.sent,!("error"in(u=co(s,Cl)))){e.next=8;break}throw new Ku(u.error,"failed to get transaction");case 8:if(c=u.result){e.next=11;break}return e.abrupt("return",c);case 11:return e.abrupt("return",C(C({},c),{},{transaction:C(C({},c.transaction),{},{message:fc(c.version,c.transaction.message)})}));case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return R.apply(this,arguments)})},{key:"getParsedTransaction",value:(P=_(O().mark((function e(t,n){var r,i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([t],i,"jsonParsed",o),e.next=4,this._rpcRequest("getTransaction",a);case 4:if(s=e.sent,!("error"in(u=co(s,Ol)))){e.next=8;break}throw new Ku(u.error,"failed to get transaction");case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return P.apply(this,arguments)})},{key:"getParsedTransactions",value:(D=_(O().mark((function e(t,n){var r,i,o,a,s,u,c=this;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=t.map((function(e){return{methodName:"getTransaction",args:c._buildArgsAtLeastConfirmed([e],i,"jsonParsed",o)}})),e.next=4,this._rpcBatchRequest(a);case 4:return s=e.sent,u=s.map((function(e){var t=co(e,Ol);if("error"in t)throw new Ku(t.error,"failed to get transactions");return t.result})),e.abrupt("return",u);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return D.apply(this,arguments)})},{key:"getTransactions",value:(j=_(O().mark((function e(t,n){var r,i,o,a,s,u,c=this;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=t.map((function(e){return{methodName:"getTransaction",args:c._buildArgsAtLeastConfirmed([e],i,void 0,o)}})),e.next=4,this._rpcBatchRequest(a);case 4:return s=e.sent,u=s.map((function(e){var t=co(e,Cl);if("error"in t)throw new Ku(t.error,"failed to get transactions");var n=t.result;return n?C(C({},n),{},{transaction:C(C({},n.transaction),{},{message:fc(n.version,n.transaction.message)})}):n})),e.abrupt("return",u);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return j.apply(this,arguments)})},{key:"getConfirmedBlock",value:(S=_(O().mark((function e(t,n){var r,i,o,a,s;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgsAtLeastConfirmed([t],n),e.next=3,this._rpcRequest("getConfirmedBlock",r);case 3:if(i=e.sent,!("error"in(o=co(i,jl)))){e.next=7;break}throw new Ku(o.error,"failed to get confirmed block");case 7:if(a=o.result){e.next=10;break}throw new Error("Confirmed block "+t+" not found");case 10:return s=C(C({},a),{},{transactions:a.transactions.map((function(e){var t=e.transaction,n=e.meta,r=new cu(t.message);return{meta:n,transaction:C(C({},t),{},{message:r})}}))}),e.abrupt("return",C(C({},s),{},{transactions:s.transactions.map((function(e){var t=e.transaction;return{meta:e.meta,transaction:yu.populate(t.message,t.signatures)}}))}));case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"getBlocks",value:(L=_(O().mark((function e(t,n,r){var i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this._buildArgsAtLeastConfirmed(void 0!==n?[t,n]:[t],r),e.next=3,this._rpcRequest("getBlocks",i);case 3:if(o=e.sent,!("error"in(a=co(o,lc(po(wo())))))){e.next=7;break}throw new Ku(a.error,"failed to get blocks");case 7:return e.abrupt("return",a.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return L.apply(this,arguments)})},{key:"getBlockSignatures",value:(k=_(O().mark((function e(t,n){var r,i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgsAtLeastConfirmed([t],n,void 0,{transactionDetails:"signatures",rewards:!1}),e.next=3,this._rpcRequest("getBlock",r);case 3:if(i=e.sent,!("error"in(o=co(i,Dl)))){e.next=7;break}throw new Ku(o.error,"failed to get block");case 7:if(a=o.result){e.next=10;break}throw new Error("Block "+t+" not found");case 10:return e.abrupt("return",a);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return k.apply(this,arguments)})},{key:"getConfirmedBlockSignatures",value:(x=_(O().mark((function e(t,n){var r,i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgsAtLeastConfirmed([t],n,void 0,{transactionDetails:"signatures",rewards:!1}),e.next=3,this._rpcRequest("getConfirmedBlock",r);case 3:if(i=e.sent,!("error"in(o=co(i,Dl)))){e.next=7;break}throw new Ku(o.error,"failed to get confirmed block");case 7:if(a=o.result){e.next=10;break}throw new Error("Confirmed block "+t+" not found");case 10:return e.abrupt("return",a);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return x.apply(this,arguments)})},{key:"getConfirmedTransaction",value:(E=_(O().mark((function e(t,n){var r,i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgsAtLeastConfirmed([t],n),e.next=3,this._rpcRequest("getConfirmedTransaction",r);case 3:if(i=e.sent,!("error"in(o=co(i,Cl)))){e.next=7;break}throw new Ku(o.error,"failed to get transaction");case 7:if(a=o.result){e.next=10;break}return e.abrupt("return",a);case 10:return s=new cu(a.transaction.message),u=a.transaction.signatures,e.abrupt("return",C(C({},a),{},{transaction:yu.populate(s,u)}));case 13:case"end":return e.stop()}}),e,this)}))),function(e,t){return E.apply(this,arguments)})},{key:"getParsedConfirmedTransaction",value:(T=_(O().mark((function e(t,n){var r,i,o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed"),e.next=3,this._rpcRequest("getConfirmedTransaction",r);case 3:if(i=e.sent,!("error"in(o=co(i,Ol)))){e.next=7;break}throw new Ku(o.error,"failed to get confirmed transaction");case 7:return e.abrupt("return",o.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return T.apply(this,arguments)})},{key:"getParsedConfirmedTransactions",value:(N=_(O().mark((function e(t,n){var r,i,o,a=this;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.map((function(e){return{methodName:"getConfirmedTransaction",args:a._buildArgsAtLeastConfirmed([e],n,"jsonParsed")}})),e.next=3,this._rpcBatchRequest(r);case 3:return i=e.sent,o=i.map((function(e){var t=co(e,Ol);if("error"in t)throw new Ku(t.error,"failed to get confirmed transactions");return t.result})),e.abrupt("return",o);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return N.apply(this,arguments)})},{key:"getConfirmedSignaturesForAddress",value:(I=_(O().mark((function e(t,n,r){var i,o,a,s,u,c;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i={},e.next=3,this.getFirstAvailableBlock();case 3:o=e.sent;case 4:if("until"in i){e.next=24;break}if(!(--n<=0||n<o)){e.next=8;break}return e.abrupt("break",24);case 8:return e.prev=8,e.next=11,this.getConfirmedBlockSignatures(n,"finalized");case 11:(a=e.sent).signatures.length>0&&(i.until=a.signatures[a.signatures.length-1].toString()),e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(8),!(e.t0 instanceof Error&&e.t0.message.includes("skipped"))){e.next=21;break}return e.abrupt("continue",4);case 21:throw e.t0;case 22:e.next=4;break;case 24:return e.next=26,this.getSlot("finalized");case 26:s=e.sent;case 27:if("before"in i){e.next=47;break}if(!(++r>s)){e.next=31;break}return e.abrupt("break",47);case 31:return e.prev=31,e.next=34,this.getConfirmedBlockSignatures(r);case 34:(u=e.sent).signatures.length>0&&(i.before=u.signatures[u.signatures.length-1].toString()),e.next=45;break;case 38:if(e.prev=38,e.t1=e.catch(31),!(e.t1 instanceof Error&&e.t1.message.includes("skipped"))){e.next=44;break}return e.abrupt("continue",27);case 44:throw e.t1;case 45:e.next=27;break;case 47:return e.next=49,this.getConfirmedSignaturesForAddress2(t,i);case 49:return c=e.sent,e.abrupt("return",c.map((function(e){return e.signature})));case 51:case"end":return e.stop()}}),e,this,[[8,15],[31,38]])}))),function(e,t,n){return I.apply(this,arguments)})},{key:"getConfirmedSignaturesForAddress2",value:(A=_(O().mark((function e(t,n,r){var i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this._buildArgsAtLeastConfirmed([t.toBase58()],r,void 0,n),e.next=3,this._rpcRequest("getConfirmedSignaturesForAddress2",i);case 3:if(o=e.sent,!("error"in(a=co(o,Gc)))){e.next=7;break}throw new Ku(a.error,"failed to get confirmed signatures for address");case 7:return e.abrupt("return",a.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return A.apply(this,arguments)})},{key:"getSignaturesForAddress",value:(M=_(O().mark((function e(t,n,r){var i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this._buildArgsAtLeastConfirmed([t.toBase58()],r,void 0,n),e.next=3,this._rpcRequest("getSignaturesForAddress",i);case 3:if(o=e.sent,!("error"in(a=co(o,qc)))){e.next=7;break}throw new Ku(a.error,"failed to get signatures for address");case 7:return e.abrupt("return",a.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return M.apply(this,arguments)})},{key:"getAddressLookupTable",value:(b=_(O().mark((function e(t,n){var r,i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getAccountInfoAndContext(t,n);case 2:return r=e.sent,i=r.context,o=r.value,a=null,null!==o&&(a=new tc({key:t,state:tc.deserialize(o.data)})),e.abrupt("return",{context:i,value:a});case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return b.apply(this,arguments)})},{key:"getNonceAndContext",value:(w=_(O().mark((function e(t,n){var r,i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getAccountInfoAndContext(t,n);case 2:return r=e.sent,i=r.context,o=r.value,a=null,null!==o&&(a=Pu.fromAccountData(o.data)),e.abrupt("return",{context:i,value:a});case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"getNonce",value:(v=_(O().mark((function e(t,n){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getNonceAndContext(t,n).then((function(e){return e.value})).catch((function(e){throw new Error("failed to get nonce for account "+t.toBase58()+": "+e)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"requestAirdrop",value:(g=_(O().mark((function e(t,n){var r,i;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("requestAirdrop",[t.toBase58(),n]);case 2:if(r=e.sent,!("error"in(i=co(r,Ul)))){e.next=6;break}throw new Ku(i.error,"airdrop to ".concat(t.toBase58()," failed"));case 6:return e.abrupt("return",i.result);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return g.apply(this,arguments)})},{key:"_blockhashWithExpiryBlockHeight",value:(m=_(O().mark((function e(t){var n,r;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=10;break}case 1:if(!this._pollingBlockhash){e.next=6;break}return e.next=4,Lu(100);case 4:e.next=1;break;case 6:if(n=Date.now()-this._blockhashInfo.lastFetch,r=n>=3e4,null===this._blockhashInfo.latestBlockhash||r){e.next=10;break}return e.abrupt("return",this._blockhashInfo.latestBlockhash);case 10:return e.next=12,this._pollNewBlockhash();case 12:return e.abrupt("return",e.sent);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"_pollNewBlockhash",value:(y=_(O().mark((function e(){var t,n,r,i,o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._pollingBlockhash=!0,e.prev=1,t=Date.now(),n=this._blockhashInfo.latestBlockhash,r=n?n.blockhash:null,i=0;case 6:if(!(i<50)){e.next=18;break}return e.next=9,this.getLatestBlockhash("finalized");case 9:if(o=e.sent,r===o.blockhash){e.next=13;break}return this._blockhashInfo={latestBlockhash:o,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},e.abrupt("return",o);case 13:return e.next=15,Lu(200);case 15:i++,e.next=6;break;case 18:throw new Error("Unable to obtain a new blockhash after ".concat(Date.now()-t,"ms"));case 19:return e.prev=19,this._pollingBlockhash=!1,e.finish(19);case 22:case"end":return e.stop()}}),e,this,[[1,,19,22]])}))),function(){return y.apply(this,arguments)})},{key:"getStakeMinimumDelegation",value:(p=_(O().mark((function e(t){var n,r,i,o,a,s;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=sc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,"base64",i),e.next=4,this._rpcRequest("getStakeMinimumDelegation",o);case 4:if(a=e.sent,!("error"in(s=co(a,hc(wo()))))){e.next=8;break}throw new Ku(s.error,"failed to get stake minimum delegation");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"simulateTransaction",value:(f=_(O().mark((function e(t,n,r){var i,o,a,s,u,c,l,h,d,f,p,y,m,g,v,w,b,M,A,I,N,T,E,x,k,L;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!("message"in t)){e.next=17;break}if(i=t.serialize(),o=Ne.from(i).toString("base64"),!Array.isArray(n)&&void 0===r){e.next=6;break}throw new Error("Invalid arguments");case 6:return(a=n||{}).encoding="base64","commitment"in a||(a.commitment=this.commitment),s=[o,a],e.next=12,this._rpcRequest("simulateTransaction",s);case 12:if(u=e.sent,!("error"in(c=co(u,Tc)))){e.next=16;break}throw new Error("failed to simulate transaction: "+c.error.message);case 16:return e.abrupt("return",c.result);case 17:if(t instanceof yu?(h=t,(l=new yu).feePayer=h.feePayer,l.instructions=t.instructions,l.nonceInfo=h.nonceInfo,l.signatures=h.signatures):(l=yu.populate(t))._message=l._json=void 0,void 0===n||Array.isArray(n)){e.next=20;break}throw new Error("Invalid arguments");case 20:if(d=n,!l.nonceInfo||!d){e.next=25;break}(f=l).sign.apply(f,te(d)),e.next=45;break;case 25:p=this._disableBlockhashCaching;case 26:return e.next=28,this._blockhashWithExpiryBlockHeight(p);case 28:if(m=e.sent,l.lastValidBlockHeight=m.lastValidBlockHeight,l.recentBlockhash=m.blockhash,d){e.next=33;break}return e.abrupt("break",45);case 33:if((y=l).sign.apply(y,te(d)),l.signature){e.next=36;break}throw new Error("!signature");case 36:if(g=l.signature.toString("base64"),this._blockhashInfo.simulatedSignatures.includes(g)||this._blockhashInfo.transactionSignatures.includes(g)){e.next=42;break}return this._blockhashInfo.simulatedSignatures.push(g),e.abrupt("break",45);case 42:p=!0;case 43:e.next=26;break;case 45:return v=l._compile(),w=v.serialize(),b=l._serialize(w),M=b.toString("base64"),A={encoding:"base64",commitment:this.commitment},r&&(I=(Array.isArray(r)?r:v.nonProgramIds()).map((function(e){return e.toBase58()})),A.accounts={encoding:"base64",addresses:I}),d&&(A.sigVerify=!0),N=[M,A],e.next=55,this._rpcRequest("simulateTransaction",N);case 55:if(T=e.sent,!("error"in(E=co(T,Tc)))){e.next=60;break}throw"data"in E.error&&(x=E.error.data.logs)&&Array.isArray(x)&&(L=(k="\n ")+x.join(k),console.error(E.error.message,L)),new Xu("failed to simulate transaction: "+E.error.message,x);case 60:return e.abrupt("return",E.result);case 61:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return f.apply(this,arguments)})},{key:"sendTransaction",value:(d=_(O().mark((function e(t,n,r){var i,o,a,s,u,c;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!("version"in t)){e.next=7;break}if(!n||!Array.isArray(n)){e.next=3;break}throw new Error("Invalid arguments");case 3:return i=t.serialize(),e.next=6,this.sendRawTransaction(i,n);case 6:return e.abrupt("return",e.sent);case 7:if(void 0!==n&&Array.isArray(n)){e.next=9;break}throw new Error("Invalid arguments");case 9:if(o=n,!t.nonceInfo){e.next=14;break}t.sign.apply(t,te(o)),e.next=32;break;case 14:a=this._disableBlockhashCaching;case 15:return e.next=17,this._blockhashWithExpiryBlockHeight(a);case 17:if(s=e.sent,t.lastValidBlockHeight=s.lastValidBlockHeight,t.recentBlockhash=s.blockhash,t.sign.apply(t,te(o)),t.signature){e.next=23;break}throw new Error("!signature");case 23:if(u=t.signature.toString("base64"),this._blockhashInfo.transactionSignatures.includes(u)){e.next=29;break}return this._blockhashInfo.transactionSignatures.push(u),e.abrupt("break",32);case 29:a=!0;case 30:e.next=15;break;case 32:return c=t.serialize(),e.next=35,this.sendRawTransaction(c,r);case 35:return e.abrupt("return",e.sent);case 36:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return d.apply(this,arguments)})},{key:"sendRawTransaction",value:(h=_(O().mark((function e(t,n){var r,i;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Ys(t).toString("base64"),e.next=3,this.sendEncodedTransaction(r,n);case 3:return i=e.sent,e.abrupt("return",i);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"sendEncodedTransaction",value:(l=_(O().mark((function e(t,n){var r,i,o,a,s,u,c;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={encoding:"base64"},i=n&&n.skipPreflight,o=n&&n.preflightCommitment||this.commitment,n&&null!=n.maxRetries&&(r.maxRetries=n.maxRetries),n&&null!=n.minContextSlot&&(r.minContextSlot=n.minContextSlot),i&&(r.skipPreflight=i),o&&(r.preflightCommitment=o),a=[t,r],e.next=10,this._rpcRequest("sendTransaction",a);case 10:if(s=e.sent,!("error"in(u=co(s,Ql)))){e.next=15;break}throw"data"in u.error&&(c=u.error.data.logs),new Xu("failed to send transaction: "+u.error.message,c);case 15:return e.abrupt("return",u.result);case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"_wsOnOpen",value:function(){var e=this;this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((function(){_(O().mark((function t(){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._rpcWebSocket.notify("ping");case 3:t.next=7;break;case 5:t.prev=5,t.t0=t.catch(0);case 7:case"end":return t.stop()}}),t,null,[[0,5]])})))()}),5e3),this._updateSubscriptions()}},{key:"_wsOnError",value:function(e){this._rpcWebSocketConnected=!1,console.error("ws error:",e.message)}},{key:"_wsOnClose",value:function(e){var t=this;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),1e3!==e?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((function(e){var n=ee(e,2),r=n[0],i=n[1];t._setSubscription(r,C(C({},i),{},{state:"pending"}))}))):this._updateSubscriptions()}},{key:"_setSubscription",value:function(e,t){var n,r=null===(n=this._subscriptionsByHash[e])||void 0===n?void 0:n.state;if(this._subscriptionsByHash[e]=t,r!==t.state){var i=this._subscriptionStateChangeCallbacksByHash[e];i&&i.forEach((function(e){try{e(t.state)}catch(e){}}))}}},{key:"_onSubscriptionStateChange",value:function(e,t){var n,r=this,i=this._subscriptionHashByClientSubscriptionId[e];if(null==i)return function(){};var o=(n=this._subscriptionStateChangeCallbacksByHash)[i]||(n[i]=new Set);return o.add(t),function(){o.delete(t),0===o.size&&delete r._subscriptionStateChangeCallbacksByHash[i]}}},{key:"_updateSubscriptions",value:(c=_(O().mark((function e(){var t,n,r=this;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==Object.keys(this._subscriptionsByHash).length){e.next=3;break}return this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((function(){r._rpcWebSocketIdleTimeout=null;try{r._rpcWebSocket.close()}catch(e){e instanceof Error&&console.log("Error when closing socket connection: ".concat(e.message))}}),500)),e.abrupt("return");case 3:if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),this._rpcWebSocketConnected){e.next=7;break}return this._rpcWebSocket.connect(),e.abrupt("return");case 7:return t=this._rpcWebSocketGeneration,n=function(){return t===r._rpcWebSocketGeneration},e.next=11,Promise.all(Object.keys(this._subscriptionsByHash).map(function(){var e=_(O().mark((function e(t){var i;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==(i=r._subscriptionsByHash[t])){e.next=3;break}return e.abrupt("return");case 3:e.t0=i.state,e.next="pending"===e.t0||"unsubscribed"===e.t0?6:"subscribed"===e.t0?15:19;break;case 6:if(0!==i.callbacks.size){e.next=12;break}return delete r._subscriptionsByHash[t],"unsubscribed"===i.state&&delete r._subscriptionCallbacksByServerSubscriptionId[i.serverSubscriptionId],e.next=11,r._updateSubscriptions();case 11:return e.abrupt("return");case 12:return e.next=14,_(O().mark((function e(){var o,a,s;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=i.args,a=i.method,e.prev=1,r._setSubscription(t,C(C({},i),{},{state:"subscribing"})),e.next=5,r._rpcWebSocket.call(a,o);case 5:return s=e.sent,r._setSubscription(t,C(C({},i),{},{serverSubscriptionId:s,state:"subscribed"})),r._subscriptionCallbacksByServerSubscriptionId[s]=i.callbacks,e.next=10,r._updateSubscriptions();case 10:e.next=20;break;case 12:if(e.prev=12,e.t0=e.catch(1),e.t0 instanceof Error&&console.error("".concat(a," error for argument"),o,e.t0.message),n()){e.next=17;break}return e.abrupt("return");case 17:return r._setSubscription(t,C(C({},i),{},{state:"pending"})),e.next=20,r._updateSubscriptions();case 20:case"end":return e.stop()}}),e,null,[[1,12]])})))();case 14:return e.abrupt("break",19);case 15:if(0!==i.callbacks.size){e.next=18;break}return e.next=18,_(O().mark((function e(){var o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=i.serverSubscriptionId,a=i.unsubscribeMethod,!r._subscriptionsAutoDisposedByRpc.has(o)){e.next=5;break}r._subscriptionsAutoDisposedByRpc.delete(o),e.next=21;break;case 5:return r._setSubscription(t,C(C({},i),{},{state:"unsubscribing"})),r._setSubscription(t,C(C({},i),{},{state:"unsubscribing"})),e.prev=7,e.next=10,r._rpcWebSocket.call(a,[o]);case 10:e.next=21;break;case 12:if(e.prev=12,e.t0=e.catch(7),e.t0 instanceof Error&&console.error("".concat(a," error:"),e.t0.message),n()){e.next=17;break}return e.abrupt("return");case 17:return r._setSubscription(t,C(C({},i),{},{state:"subscribed"})),e.next=20,r._updateSubscriptions();case 20:return e.abrupt("return");case 21:return r._setSubscription(t,C(C({},i),{},{state:"unsubscribed"})),e.next=24,r._updateSubscriptions();case 24:case"end":return e.stop()}}),e,null,[[7,12]])})))();case 18:return e.abrupt("break",19);case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 11:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"_handleServerNotification",value:function(e,t){var n=this._subscriptionCallbacksByServerSubscriptionId[e];void 0!==n&&n.forEach((function(e){try{e.apply(void 0,te(t))}catch(e){console.error(e)}}))}},{key:"_wsOnAccountNotification",value:function(e){var t=co(e,Zc),n=t.result,r=t.subscription;this._handleServerNotification(r,[n.value,n.context])}},{key:"_makeSubscription",value:function(e,t){var n=this,r=this._nextClientSubscriptionId++,i=qu([e.method,t],!0),o=this._subscriptionsByHash[i];return void 0===o?this._subscriptionsByHash[i]=C(C({},e),{},{args:t,callbacks:new Set([e.callback]),state:"pending"}):o.callbacks.add(e.callback),this._subscriptionHashByClientSubscriptionId[r]=i,this._subscriptionDisposeFunctionsByClientSubscriptionId[r]=_(O().mark((function t(){var o;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return delete n._subscriptionDisposeFunctionsByClientSubscriptionId[r],delete n._subscriptionHashByClientSubscriptionId[r],su(void 0!==(o=n._subscriptionsByHash[i]),"Could not find a `Subscription` when tearing down client subscription #".concat(r)),o.callbacks.delete(e.callback),t.next=7,n._updateSubscriptions();case 7:case"end":return t.stop()}}),t)}))),this._updateSubscriptions(),r}},{key:"onAccountChange",value:function(e,t,n){var r=this._buildArgs([e.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:t,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}},{key:"removeAccountChangeListener",value:(u=_(O().mark((function e(t){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"account change");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"_wsOnProgramAccountNotification",value:function(e){var t=co(e,Xc),n=t.result,r=t.subscription;this._handleServerNotification(r,[{accountId:n.value.pubkey,accountInfo:n.value.account},n.context])}},{key:"onProgramAccountChange",value:function(e,t,n,r){var i=this._buildArgs([e.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:t,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}},{key:"removeProgramAccountChangeListener",value:(s=_(O().mark((function e(t){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"program account change");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"onLogs",value:function(e,t,n){var r=this._buildArgs(["object"===z(e)?{mentions:[e.toString()]}:e],n||this._commitment||"finalized");return this._makeSubscription({callback:t,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}},{key:"removeOnLogsListener",value:(a=_(O().mark((function e(t){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"logs");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"_wsOnLogsNotification",value:function(e){var t=co(e,Yl),n=t.result,r=t.subscription;this._handleServerNotification(r,[n.value,n.context])}},{key:"_wsOnSlotNotification",value:function(e){var t=co(e,$c),n=t.result,r=t.subscription;this._handleServerNotification(r,[n])}},{key:"onSlotChange",value:function(e){return this._makeSubscription({callback:e,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}},{key:"removeSlotChangeListener",value:(o=_(O().mark((function e(t){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"slot change");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"_wsOnSlotUpdatesNotification",value:function(e){var t=co(e,tl),n=t.result,r=t.subscription;this._handleServerNotification(r,[n])}},{key:"onSlotUpdate",value:function(e){return this._makeSubscription({callback:e,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}},{key:"removeSlotUpdateListener",value:(i=_(O().mark((function e(t){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"slot update");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"_unsubscribeClientSubscription",value:(r=_(O().mark((function e(t,n){var r;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this._subscriptionDisposeFunctionsByClientSubscriptionId[t])){e.next=6;break}return e.next=4,r();case 4:e.next=7;break;case 6:console.warn("Ignored unsubscribe request because an active subscription with id "+"`".concat(t,"` for '").concat(n,"' events ")+"could not be found.");case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"_buildArgs",value:function(e,t,n,r){var i=t||this._commitment;if(i||n||r){var o={};n&&(o.encoding=n),i&&(o.commitment=i),r&&(o=Object.assign(o,r)),e.push(o)}return e}},{key:"_buildArgsAtLeastConfirmed",value:function(e,t,n,r){var i=t||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(e,t,n,r)}},{key:"_wsOnSignatureNotification",value:function(e){var t=co(e,nl),n=t.result,r=t.subscription;"receivedSignature"!==n.value&&this._subscriptionsAutoDisposedByRpc.add(r),this._handleServerNotification(r,"receivedSignature"===n.value?[{type:"received"},n.context]:[{type:"status",result:n.value},n.context])}},{key:"onSignature",value:function(e,t,n){var r=this,i=this._buildArgs([e],n||this._commitment||"finalized"),o=this._makeSubscription({callback:function(e,n){if("status"===e.type){t(e.result,n);try{r.removeSignatureListener(o)}catch(e){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return o}},{key:"onSignatureWithOptions",value:function(e,t,n){var r=this,i=C(C({},n),{},{commitment:n&&n.commitment||this._commitment||"finalized"}),o=i.commitment,a=q(i,zs),s=this._buildArgs([e],o,void 0,a),u=this._makeSubscription({callback:function(e,n){t(e,n);try{r.removeSignatureListener(u)}catch(e){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},s);return u}},{key:"removeSignatureListener",value:(n=_(O().mark((function e(t){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"signature result");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"_wsOnRootNotification",value:function(e){var t=co(e,rl),n=t.result,r=t.subscription;this._handleServerNotification(r,[n])}},{key:"onRootChange",value:function(e){return this._makeSubscription({callback:e,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}},{key:"removeRootChangeListener",value:(t=_(O().mark((function e(t){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"root change");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}(),Hl=function(){function e(t){B(this,e),this._keypair=void 0,this._keypair=null!=t?t:_s()}return U(e,[{key:"publicKey",get:function(){return new qs(this._keypair.publicKey)}},{key:"secretKey",get:function(){return new Uint8Array(this._keypair.secretKey)}}],[{key:"generate",value:function(){return new e(_s())}},{key:"fromSecretKey",value:function(t,n){if(64!==t.byteLength)throw new Error("bad secret key size");var r=t.slice(32,64);if(!n||!n.skipValidation)for(var i=t.slice(0,32),o=Bs(i),a=0;a<32;a++)if(r[a]!==o[a])throw new Error("provided secretKey is invalid");return new e({publicKey:r,secretKey:t})}},{key:"fromSeed",value:function(t){var n=Bs(t),r=new Uint8Array(64);return r.set(t),r.set(n,32),new e({publicKey:n,secretKey:r})}}]),e}(),Gl=Object.freeze({CreateLookupTable:{index:0,layout:Fi([Qi("instruction"),_u("recentSlot"),Ri("bumpSeed")])},FreezeLookupTable:{index:1,layout:Fi([Qi("instruction")])},ExtendLookupTable:{index:2,layout:Fi([Qi("instruction"),_u(),Vi(tu(),Bi(Qi(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Fi([Qi("instruction")])},CloseLookupTable:{index:4,layout:Fi([Qi("instruction")])}}),ql=function(){function e(){B(this,e)}return U(e,null,[{key:"decodeInstructionType",value:function(e){this.checkProgramId(e.programId);for(var t,n=Qi("instruction").decode(e.data),r=0,i=Object.entries(Gl);r<i.length;r++){var o=ee(i[r],2),a=o[0];if(o[1].index==n){t=a;break}}if(!t)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return t}},{key:"decodeCreateLookupTable",value:function(e){this.checkProgramId(e.programId),this.checkKeysLength(e.keys,4);var t=ju(Gl.CreateLookupTable,e.data).recentSlot;return{authority:e.keys[1].pubkey,payer:e.keys[2].pubkey,recentSlot:Number(t)}}},{key:"decodeExtendLookupTable",value:function(e){if(this.checkProgramId(e.programId),e.keys.length<2)throw new Error("invalid instruction; found ".concat(e.keys.length," keys, expected at least 2"));var t=ju(Gl.ExtendLookupTable,e.data).addresses;return{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey,payer:e.keys.length>2?e.keys[2].pubkey:void 0,addresses:t.map((function(e){return new qs(e)}))}}},{key:"decodeCloseLookupTable",value:function(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,3),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey,recipient:e.keys[2].pubkey}}},{key:"decodeFreezeLookupTable",value:function(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,2),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey}}},{key:"decodeDeactivateLookupTable",value:function(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,2),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey}}},{key:"checkProgramId",value:function(e){if(!e.equals(Zl.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}},{key:"checkKeysLength",value:function(e,t){if(e.length<t)throw new Error("invalid instruction; found ".concat(e.length," keys, expected at least ").concat(t))}}]),e}(),Zl=function(){function e(){B(this,e)}return U(e,null,[{key:"createLookupTable",value:function(e){var t=ee(qs.findProgramAddressSync([e.authority.toBuffer(),Zi(BigInt(e.recentSlot),8)],this.programId),2),n=t[0],r=t[1],i=Su(Gl.CreateLookupTable,{recentSlot:BigInt(e.recentSlot),bumpSeed:r}),o=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:Uu.programId,isSigner:!1,isWritable:!1}];return[new pu({programId:this.programId,keys:o,data:i}),n]}},{key:"freezeLookupTable",value:function(e){var t=Su(Gl.FreezeLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new pu({programId:this.programId,keys:n,data:t})}},{key:"extendLookupTable",value:function(e){var t=Su(Gl.ExtendLookupTable,{addresses:e.addresses.map((function(e){return e.toBytes()}))}),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return e.payer&&n.push({pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:Uu.programId,isSigner:!1,isWritable:!1}),new pu({programId:this.programId,keys:n,data:t})}},{key:"deactivateLookupTable",value:function(e){var t=Su(Gl.DeactivateLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new pu({programId:this.programId,keys:n,data:t})}},{key:"closeLookupTable",value:function(e){var t=Su(Gl.CloseLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.recipient,isSigner:!1,isWritable:!0}];return new pu({programId:this.programId,keys:n,data:t})}}]),e}();Zl.programId=new qs("AddressLookupTab1e1111111111111111111111111");var Jl=function(){function e(){B(this,e)}return U(e,null,[{key:"decodeInstructionType",value:function(e){this.checkProgramId(e.programId);for(var t,n=Ri("instruction").decode(e.data),r=0,i=Object.entries(Xl);r<i.length;r++){var o=ee(i[r],2),a=o[0];if(o[1].index==n){t=a;break}}if(!t)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return t}},{key:"decodeRequestUnits",value:function(e){this.checkProgramId(e.programId);var t=ju(Xl.RequestUnits,e.data);return{units:t.units,additionalFee:t.additionalFee}}},{key:"decodeRequestHeapFrame",value:function(e){return this.checkProgramId(e.programId),{bytes:ju(Xl.RequestHeapFrame,e.data).bytes}}},{key:"decodeSetComputeUnitLimit",value:function(e){return this.checkProgramId(e.programId),{units:ju(Xl.SetComputeUnitLimit,e.data).units}}},{key:"decodeSetComputeUnitPrice",value:function(e){return this.checkProgramId(e.programId),{microLamports:ju(Xl.SetComputeUnitPrice,e.data).microLamports}}},{key:"checkProgramId",value:function(e){if(!e.equals(Kl.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}}]),e}(),Xl=Object.freeze({RequestUnits:{index:0,layout:Fi([Ri("instruction"),Qi("units"),Qi("additionalFee")])},RequestHeapFrame:{index:1,layout:Fi([Ri("instruction"),Qi("bytes")])},SetComputeUnitLimit:{index:2,layout:Fi([Ri("instruction"),Qi("units")])},SetComputeUnitPrice:{index:3,layout:Fi([Ri("instruction"),_u("microLamports")])}}),Kl=function(){function e(){B(this,e)}return U(e,null,[{key:"requestUnits",value:function(e){var t=Su(Xl.RequestUnits,e);return new pu({keys:[],programId:this.programId,data:t})}},{key:"requestHeapFrame",value:function(e){var t=Su(Xl.RequestHeapFrame,e);return new pu({keys:[],programId:this.programId,data:t})}},{key:"setComputeUnitLimit",value:function(e){var t=Su(Xl.SetComputeUnitLimit,e);return new pu({keys:[],programId:this.programId,data:t})}},{key:"setComputeUnitPrice",value:function(e){var t=Su(Xl.SetComputeUnitPrice,{microLamports:BigInt(e.microLamports)});return new pu({keys:[],programId:this.programId,data:t})}}]),e}();Kl.programId=new qs("ComputeBudget111111111111111111111111111111");var $l=Fi([Ri("numSignatures"),Ri("padding"),Ui("signatureOffset"),Ui("signatureInstructionIndex"),Ui("publicKeyOffset"),Ui("publicKeyInstructionIndex"),Ui("messageDataOffset"),Ui("messageDataSize"),Ui("messageInstructionIndex")]),eh=function(){function e(){B(this,e)}return U(e,null,[{key:"createInstructionWithPublicKey",value:function(t){var n=t.publicKey,r=t.message,i=t.signature,o=t.instructionIndex;su(32===n.length,"Public Key must be ".concat(32," bytes but received ").concat(n.length," bytes")),su(64===i.length,"Signature must be ".concat(64," bytes but received ").concat(i.length," bytes"));var a=$l.span,s=a+n.length,u=s+i.length,c=Ne.alloc(u+r.length),l=null==o?65535:o;return $l.encode({numSignatures:1,padding:0,signatureOffset:s,signatureInstructionIndex:l,publicKeyOffset:a,publicKeyInstructionIndex:l,messageDataOffset:u,messageDataSize:r.length,messageInstructionIndex:l},c),c.fill(n,a),c.fill(i,s),c.fill(r,u),new pu({keys:[],programId:e.programId,data:c})}},{key:"createInstructionWithPrivateKey",value:function(e){var t=e.privateKey,n=e.message,r=e.instructionIndex;su(64===t.length,"Private key must be ".concat(64," bytes but received ").concat(t.length," bytes"));try{var i=Hl.fromSecretKey(t),o=i.publicKey.toBytes(),a=Qs(n,i.secretKey);return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:a,instructionIndex:r})}catch(e){throw new Error("Error creating instruction; ".concat(e))}}}]),e}();eh.programId=new qs("Ed25519SigVerify111111111111111111111111111");js.utils.isValidPrivateKey;var th,nh=js.getPublicKey,rh=Fi([Ri("numSignatures"),Ui("signatureOffset"),Ri("signatureInstructionIndex"),Ui("ethAddressOffset"),Ri("ethAddressInstructionIndex"),Ui("messageDataOffset"),Ui("messageDataSize"),Ri("messageInstructionIndex"),Hi(20,"ethAddress"),Hi(64,"signature"),Ri("recoveryId")]),ih=function(){function e(){B(this,e)}return U(e,null,[{key:"publicKeyToEthAddress",value:function(e){su(64===e.length,"Public key must be ".concat(64," bytes but received ").concat(e.length," bytes"));try{return Ne.from(ps(Ys(e))).slice(-20)}catch(e){throw new Error("Error constructing Ethereum address: ".concat(e))}}},{key:"createInstructionWithPublicKey",value:function(t){var n=t.publicKey,r=t.message,i=t.signature,o=t.recoveryId,a=t.instructionIndex;return e.createInstructionWithEthAddress({ethAddress:e.publicKeyToEthAddress(n),message:r,signature:i,recoveryId:o,instructionIndex:a})}},{key:"createInstructionWithEthAddress",value:function(t){var n,r=t.ethAddress,i=t.message,o=t.signature,a=t.recoveryId,s=t.instructionIndex,u=void 0===s?0:s;su(20===(n="string"==typeof r?r.startsWith("0x")?Ne.from(r.substr(2),"hex"):Ne.from(r,"hex"):r).length,"Address must be ".concat(20," bytes but received ").concat(n.length," bytes"));var c=12+n.length,l=c+o.length+1,h=Ne.alloc(rh.span+i.length);return rh.encode({numSignatures:1,signatureOffset:c,signatureInstructionIndex:u,ethAddressOffset:12,ethAddressInstructionIndex:u,messageDataOffset:l,messageDataSize:i.length,messageInstructionIndex:u,signature:Ys(o),ethAddress:Ys(n),recoveryId:a},h),h.fill(Ys(i),rh.span),new pu({keys:[],programId:e.programId,data:h})}},{key:"createInstructionWithPrivateKey",value:function(e){var t=e.privateKey,n=e.message,r=e.instructionIndex;su(32===t.length,"Private key must be ".concat(32," bytes but received ").concat(t.length," bytes"));try{var i=Ys(t),o=nh(i,!1).slice(1),a=ee(function(e,t){var n=js.sign(e,t);return[n.toCompactRawBytes(),n.recovery]}(Ne.from(ps(Ys(n))),i),2),s=a[0],u=a[1];return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:s,recoveryId:u,instructionIndex:r})}catch(e){throw new Error("Error creating instruction; ".concat(e))}}}]),e}();ih.programId=new qs("KeccakSecp256k11111111111111111111111111111");var oh=new qs("StakeConfig11111111111111111111111111111111"),ah=U((function e(t,n){B(this,e),this.staker=void 0,this.withdrawer=void 0,this.staker=t,this.withdrawer=n})),sh=U((function e(t,n,r){B(this,e),this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=n,this.custodian=r}));th=sh,sh.default=new th(0,0,qs.default);var uh=function(){function e(){B(this,e)}return U(e,null,[{key:"decodeInstructionType",value:function(e){this.checkProgramId(e.programId);for(var t,n=Qi("instruction").decode(e.data),r=0,i=Object.entries(ch);r<i.length;r++){var o=ee(i[r],2),a=o[0];if(o[1].index==n){t=a;break}}if(!t)throw new Error("Instruction type incorrect; not a StakeInstruction");return t}},{key:"decodeInitialize",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=ju(ch.Initialize,e.data),n=t.authorized,r=t.lockup;return{stakePubkey:e.keys[0].pubkey,authorized:new ah(new qs(n.staker),new qs(n.withdrawer)),lockup:new sh(r.unixTimestamp,r.epoch,new qs(r.custodian))}}},{key:"decodeDelegate",value:function(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,6),ju(ch.Delegate,e.data),{stakePubkey:e.keys[0].pubkey,votePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[5].pubkey}}},{key:"decodeAuthorize",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=ju(ch.Authorize,e.data),n=t.newAuthorized,r=t.stakeAuthorizationType,i={stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new qs(n),stakeAuthorizationType:{index:r}};return e.keys.length>3&&(i.custodianPubkey=e.keys[3].pubkey),i}},{key:"decodeAuthorizeWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=ju(ch.AuthorizeWithSeed,e.data),n=t.newAuthorized,r=t.stakeAuthorizationType,i=t.authoritySeed,o=t.authorityOwner,a={stakePubkey:e.keys[0].pubkey,authorityBase:e.keys[1].pubkey,authoritySeed:i,authorityOwner:new qs(o),newAuthorizedPubkey:new qs(n),stakeAuthorizationType:{index:r}};return e.keys.length>3&&(a.custodianPubkey=e.keys[3].pubkey),a}},{key:"decodeSplit",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=ju(ch.Split,e.data).lamports;return{stakePubkey:e.keys[0].pubkey,splitStakePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[2].pubkey,lamports:t}}},{key:"decodeMerge",value:function(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),ju(ch.Merge,e.data),{stakePubkey:e.keys[0].pubkey,sourceStakePubKey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey}}},{key:"decodeWithdraw",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);var t=ju(ch.Withdraw,e.data).lamports,n={stakePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:t};return e.keys.length>5&&(n.custodianPubkey=e.keys[5].pubkey),n}},{key:"decodeDeactivate",value:function(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),ju(ch.Deactivate,e.data),{stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}},{key:"checkProgramId",value:function(e){if(!e.equals(hh.programId))throw new Error("invalid instruction; programId is not StakeProgram")}},{key:"checkKeyLength",value:function(e,t){if(e.length<t)throw new Error("invalid instruction; found ".concat(e.length," keys, expected at least ").concat(t))}}]),e}(),ch=Object.freeze({Initialize:{index:0,layout:Fi([Qi("instruction"),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"authorized";return Fi([tu("staker"),tu("withdrawer")],e)}(),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"lockup";return Fi([Yi("unixTimestamp"),Yi("epoch"),tu("custodian")],e)}()])},Authorize:{index:1,layout:Fi([Qi("instruction"),tu("newAuthorized"),Qi("stakeAuthorizationType")])},Delegate:{index:2,layout:Fi([Qi("instruction")])},Split:{index:3,layout:Fi([Qi("instruction"),Yi("lamports")])},Withdraw:{index:4,layout:Fi([Qi("instruction"),Yi("lamports")])},Deactivate:{index:5,layout:Fi([Qi("instruction")])},Merge:{index:7,layout:Fi([Qi("instruction")])},AuthorizeWithSeed:{index:8,layout:Fi([Qi("instruction"),tu("newAuthorized"),Qi("stakeAuthorizationType"),ru("authoritySeed"),tu("authorityOwner")])}}),lh=Object.freeze({Staker:{index:0},Withdrawer:{index:1}}),hh=function(){function e(){B(this,e)}return U(e,null,[{key:"initialize",value:function(e){var t=e.stakePubkey,n=e.authorized,r=e.lockup||sh.default,i=Su(ch.Initialize,{authorized:{staker:Ys(n.staker.toBuffer()),withdrawer:Ys(n.withdrawer.toBuffer())},lockup:{unixTimestamp:r.unixTimestamp,epoch:r.epoch,custodian:Ys(r.custodian.toBuffer())}}),o={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Au,isSigner:!1,isWritable:!1}],programId:this.programId,data:i};return new pu(o)}},{key:"createAccountWithSeed",value:function(e){var t=new yu;t.add(Uu.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:this.space,programId:this.programId}));var n=e.stakePubkey,r=e.authorized,i=e.lockup;return t.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}},{key:"createAccount",value:function(e){var t=new yu;t.add(Uu.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,lamports:e.lamports,space:this.space,programId:this.programId}));var n=e.stakePubkey,r=e.authorized,i=e.lockup;return t.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}},{key:"delegate",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=e.votePubkey,i=Su(ch.Delegate);return(new yu).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:vu,isSigner:!1,isWritable:!1},{pubkey:Eu,isSigner:!1,isWritable:!1},{pubkey:oh,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}},{key:"authorize",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=e.newAuthorizedPubkey,i=e.stakeAuthorizationType,o=e.custodianPubkey,a=Su(ch.Authorize,{newAuthorized:Ys(r.toBuffer()),stakeAuthorizationType:i.index}),s=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:vu,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new yu).add({keys:s,programId:this.programId,data:a})}},{key:"authorizeWithSeed",value:function(e){var t=e.stakePubkey,n=e.authorityBase,r=e.authoritySeed,i=e.authorityOwner,o=e.newAuthorizedPubkey,a=e.stakeAuthorizationType,s=e.custodianPubkey,u=Su(ch.AuthorizeWithSeed,{newAuthorized:Ys(o.toBuffer()),stakeAuthorizationType:a.index,authoritySeed:r,authorityOwner:Ys(i.toBuffer())}),c=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:vu,isSigner:!1,isWritable:!1}];return s&&c.push({pubkey:s,isSigner:!1,isWritable:!1}),(new yu).add({keys:c,programId:this.programId,data:u})}},{key:"splitInstruction",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=e.splitStakePubkey,i=e.lamports,o=Su(ch.Split,{lamports:i});return new pu({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}},{key:"split",value:function(e){var t=new yu;return t.add(Uu.createAccount({fromPubkey:e.authorizedPubkey,newAccountPubkey:e.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),t.add(this.splitInstruction(e))}},{key:"splitWithSeed",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=e.splitStakePubkey,i=e.basePubkey,o=e.seed,a=e.lamports,s=new yu;return s.add(Uu.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),s.add(this.splitInstruction({stakePubkey:t,authorizedPubkey:n,splitStakePubkey:r,lamports:a}))}},{key:"merge",value:function(e){var t=e.stakePubkey,n=e.sourceStakePubKey,r=e.authorizedPubkey,i=Su(ch.Merge);return(new yu).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:vu,isSigner:!1,isWritable:!1},{pubkey:Eu,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}},{key:"withdraw",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=e.toPubkey,i=e.lamports,o=e.custodianPubkey,a=Su(ch.Withdraw,{lamports:i}),s=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:vu,isSigner:!1,isWritable:!1},{pubkey:Eu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new yu).add({keys:s,programId:this.programId,data:a})}},{key:"deactivate",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=Su(ch.Deactivate);return(new yu).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:vu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}]),e}();hh.programId=new qs("Stake11111111111111111111111111111111111111"),hh.space=200;var dh=U((function e(t,n,r,i){B(this,e),this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=t,this.authorizedVoter=n,this.authorizedWithdrawer=r,this.commission=i})),fh=function(){function e(){B(this,e)}return U(e,null,[{key:"decodeInstructionType",value:function(e){this.checkProgramId(e.programId);for(var t,n=Qi("instruction").decode(e.data),r=0,i=Object.entries(ph);r<i.length;r++){var o=ee(i[r],2),a=o[0];if(o[1].index==n){t=a;break}}if(!t)throw new Error("Instruction type incorrect; not a VoteInstruction");return t}},{key:"decodeInitializeAccount",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,4);var t=ju(ph.InitializeAccount,e.data).voteInit;return{votePubkey:e.keys[0].pubkey,nodePubkey:e.keys[3].pubkey,voteInit:new dh(new qs(t.nodePubkey),new qs(t.authorizedVoter),new qs(t.authorizedWithdrawer),t.commission)}}},{key:"decodeAuthorize",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=ju(ph.Authorize,e.data),n=t.newAuthorized,r=t.voteAuthorizationType;return{votePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new qs(n),voteAuthorizationType:{index:r}}}},{key:"decodeAuthorizeWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=ju(ph.AuthorizeWithSeed,e.data).voteAuthorizeWithSeedArgs,n=t.currentAuthorityDerivedKeyOwnerPubkey,r=t.currentAuthorityDerivedKeySeed,i=t.newAuthorized,o=t.voteAuthorizationType;return{currentAuthorityDerivedKeyBasePubkey:e.keys[2].pubkey,currentAuthorityDerivedKeyOwnerPubkey:new qs(n),currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:new qs(i),voteAuthorizationType:{index:o},votePubkey:e.keys[0].pubkey}}},{key:"decodeWithdraw",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=ju(ph.Withdraw,e.data).lamports;return{votePubkey:e.keys[0].pubkey,authorizedWithdrawerPubkey:e.keys[2].pubkey,lamports:t,toPubkey:e.keys[1].pubkey}}},{key:"checkProgramId",value:function(e){if(!e.equals(mh.programId))throw new Error("invalid instruction; programId is not VoteProgram")}},{key:"checkKeyLength",value:function(e,t){if(e.length<t)throw new Error("invalid instruction; found ".concat(e.length," keys, expected at least ").concat(t))}}]),e}(),ph=Object.freeze({InitializeAccount:{index:0,layout:Fi([Qi("instruction"),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteInit";return Fi([tu("nodePubkey"),tu("authorizedVoter"),tu("authorizedWithdrawer"),Ri("commission")],e)}()])},Authorize:{index:1,layout:Fi([Qi("instruction"),tu("newAuthorized"),Qi("voteAuthorizationType")])},Withdraw:{index:3,layout:Fi([Qi("instruction"),Yi("lamports")])},AuthorizeWithSeed:{index:10,layout:Fi([Qi("instruction"),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteAuthorizeWithSeedArgs";return Fi([Qi("voteAuthorizationType"),tu("currentAuthorityDerivedKeyOwnerPubkey"),ru("currentAuthorityDerivedKeySeed"),tu("newAuthorized")],e)}()])}}),yh=Object.freeze({Voter:{index:0},Withdrawer:{index:1}}),mh=function(){function e(){B(this,e)}return U(e,null,[{key:"initializeAccount",value:function(e){var t=e.votePubkey,n=e.nodePubkey,r=e.voteInit,i=Su(ph.InitializeAccount,{voteInit:{nodePubkey:Ys(r.nodePubkey.toBuffer()),authorizedVoter:Ys(r.authorizedVoter.toBuffer()),authorizedWithdrawer:Ys(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Au,isSigner:!1,isWritable:!1},{pubkey:vu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new pu(o)}},{key:"createAccount",value:function(e){var t=new yu;return t.add(Uu.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.votePubkey,lamports:e.lamports,space:this.space,programId:this.programId})),t.add(this.initializeAccount({votePubkey:e.votePubkey,nodePubkey:e.voteInit.nodePubkey,voteInit:e.voteInit}))}},{key:"authorize",value:function(e){var t=e.votePubkey,n=e.authorizedPubkey,r=e.newAuthorizedPubkey,i=e.voteAuthorizationType,o=Su(ph.Authorize,{newAuthorized:Ys(r.toBuffer()),voteAuthorizationType:i.index}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:vu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new yu).add({keys:a,programId:this.programId,data:o})}},{key:"authorizeWithSeed",value:function(e){var t=e.currentAuthorityDerivedKeyBasePubkey,n=e.currentAuthorityDerivedKeyOwnerPubkey,r=e.currentAuthorityDerivedKeySeed,i=e.newAuthorizedPubkey,o=e.voteAuthorizationType,a=e.votePubkey,s=Su(ph.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Ys(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:Ys(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:vu,isSigner:!1,isWritable:!1},{pubkey:t,isSigner:!0,isWritable:!1}];return(new yu).add({keys:u,programId:this.programId,data:s})}},{key:"withdraw",value:function(e){var t=e.votePubkey,n=e.authorizedWithdrawerPubkey,r=e.lamports,i=e.toPubkey,o=Su(ph.Withdraw,{lamports:r}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new yu).add({keys:a,programId:this.programId,data:o})}},{key:"safeWithdraw",value:function(t,n,r){if(t.lamports>n-r)throw new Error("Withdraw will leave vote account with insuffcient funds.");return e.withdraw(t)}}]),e}();mh.programId=new qs("Vote111111111111111111111111111111111111111"),mh.space=3731;var gh=new qs("Va1idator1nfo111111111111111111111111111111"),vh=No({name:Ao(),website:bo(Ao()),details:bo(Ao()),keybaseUsername:bo(Ao())}),wh=function(){function e(t,n){B(this,e),this.key=void 0,this.info=void 0,this.key=t,this.info=n}return U(e,null,[{key:"fromConfigData",value:function(t){var n=te(t);if(2!==ou(n))return null;for(var r=[],i=0;i<2;i++){var o=new qs(n.slice(0,32)),a=1===(n=n.slice(32)).slice(0,1)[0];n=n.slice(1),r.push({publicKey:o,isSigner:a})}if(r[0].publicKey.equals(gh)&&r[1].isSigner){var s=ru().decode(Ne.from(n)),u=JSON.parse(s);return uo(u,vh),new e(r[1].publicKey,u)}return null}}]),e}(),bh=new qs("Vote111111111111111111111111111111111111111"),Mh=Fi([tu("nodePubkey"),tu("authorizedWithdrawer"),Ri("commission"),Wi(),Vi(Fi([Wi("slot"),Qi("confirmationCount")]),Bi(Qi(),-8),"votes"),Ri("rootSlotValid"),Wi("rootSlot"),Wi(),Vi(Fi([Wi("epoch"),tu("authorizedVoter")]),Bi(Qi(),-8),"authorizedVoters"),Fi([Vi(Fi([tu("authorizedPubkey"),Wi("epochOfLastAuthorizedSwitch"),Wi("targetEpoch")]),32,"buf"),Wi("idx"),Ri("isEmpty")],"priorVoters"),Wi(),Vi(Fi([Wi("epoch"),Wi("credits"),Wi("prevCredits")]),Bi(Qi(),-8),"epochCredits"),Fi([Wi("slot"),Wi("timestamp")],"lastTimestamp")]),Ah=function(){function e(t){B(this,e),this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=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}return U(e,null,[{key:"fromAccountData",value:function(t){var n=Mh.decode(Ys(t),4),r=n.rootSlot;return n.rootSlotValid||(r=null),new e({nodePubkey:new qs(n.nodePubkey),authorizedWithdrawer:new qs(n.authorizedWithdrawer),commission:n.commission,votes:n.votes,rootSlot:r,authorizedVoters:n.authorizedVoters.map(Ih),priorVoters:Th(n.priorVoters),epochCredits:n.epochCredits,lastTimestamp:n.lastTimestamp})}}]),e}();function Ih(e){var t=e.authorizedVoter;return{epoch:e.epoch,authorizedVoter:new qs(t)}}function Nh(e){var t=e.authorizedPubkey,n=e.epochOfLastAuthorizedSwitch,r=e.targetEpoch;return{authorizedPubkey:new qs(t),epochOfLastAuthorizedSwitch:n,targetEpoch:r}}function Th(e){var t=e.buf,n=e.idx;return e.isEmpty?[]:[].concat(te(t.slice(n+1).map(Nh)),te(t.slice(0,n).map(Nh)))}var Eh={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};function xh(){return(xh=_(O().mark((function e(t,n,r,i){var o,a,s,u,c,l,h;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r&&Object.prototype.hasOwnProperty.call(r,"lastValidBlockHeight")||r&&Object.prototype.hasOwnProperty.call(r,"nonceValue")?(o=r,a=i):a=r,s=a&&{skipPreflight:a.skipPreflight,preflightCommitment:a.preflightCommitment||a.commitment,minContextSlot:a.minContextSlot},e.next=4,t.sendRawTransaction(n,s);case 4:return u=e.sent,c=a&&a.commitment,l=o?t.confirmTransaction(o,c):t.confirmTransaction(u,c),e.next=9,l;case 9:if(!(h=e.sent.value).err){e.next=12;break}throw new Error("Raw transaction ".concat(u," failed (").concat(JSON.stringify(h),")"));case 12:return e.abrupt("return",u);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var kh=j(Object.freeze({__proto__:null,Account:Zs,AddressLookupTableAccount:tc,AddressLookupTableInstruction:ql,AddressLookupTableProgram:Zl,Authorized:ah,BLOCKHASH_CACHE_TIMEOUT_MS:3e4,BPF_LOADER_DEPRECATED_PROGRAM_ID:Js,BPF_LOADER_PROGRAM_ID:Wu,BpfLoader:Yu,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:Xl,ComputeBudgetInstruction:Jl,ComputeBudgetProgram:Kl,Connection:Vl,Ed25519Program:eh,Enum:Vs,EpochSchedule:Ju,FeeCalculatorLayout:Cu,Keypair:Hl,LAMPORTS_PER_SOL:1e9,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:Gl,Loader:Qu,Lockup:sh,MAX_SEED_LENGTH:32,Message:cu,MessageAccountKeys:eu,MessageV0:lu,NONCE_ACCOUNT_LENGTH:zu,NonceAccount:Pu,PACKET_DATA_SIZE:1232,PUBLIC_KEY_LENGTH:32,PublicKey:qs,SIGNATURE_LENGTH_IN_BYTES:64,SOLANA_SCHEMA:Hs,STAKE_CONFIG_ID:oh,STAKE_INSTRUCTION_LAYOUTS:ch,SYSTEM_INSTRUCTION_LAYOUTS:Ru,SYSVAR_CLOCK_PUBKEY:vu,SYSVAR_EPOCH_SCHEDULE_PUBKEY:wu,SYSVAR_INSTRUCTIONS_PUBKEY:bu,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:Mu,SYSVAR_RENT_PUBKEY:Au,SYSVAR_REWARDS_PUBKEY:Iu,SYSVAR_SLOT_HASHES_PUBKEY:Nu,SYSVAR_SLOT_HISTORY_PUBKEY:Tu,SYSVAR_STAKE_HISTORY_PUBKEY:Eu,Secp256k1Program:ih,SendTransactionError:Xu,SolanaJSONRPCError:Ku,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:lh,StakeInstruction:uh,StakeProgram:hh,Struct:Fs,SystemInstruction:Bu,SystemProgram:Uu,Transaction:yu,TransactionExpiredBlockheightExceededError:Xs,TransactionExpiredNonceInvalidError:$s,TransactionExpiredTimeoutError:Ks,TransactionInstruction:pu,TransactionMessage:mu,TransactionStatus:du,VALIDATOR_INFO_KEY:gh,VERSION_PREFIX_MASK:127,VOTE_PROGRAM_ID:bh,ValidatorInfo:wh,VersionedMessage:hu,VersionedTransaction:gu,VoteAccount:Ah,VoteAuthorizationLayout:yh,VoteInit:dh,VoteInstruction:fh,VoteProgram:mh,clusterApiUrl:function(e,t){var n=!1===t?"http":"https";if(!e)return Eh[n].devnet;var r=Eh[n][e];if(!r)throw new Error("Unknown ".concat(n," cluster: ").concat(e));return r},sendAndConfirmRawTransaction:function(e,t,n,r){return xh.apply(this,arguments)},sendAndConfirmTransaction:xu})),Lh={};Object.defineProperty(Lh,"__esModule",{value:!0});var Sh={ERROR_ASSOCIATION_PORT_OUT_OF_RANGE:"ERROR_ASSOCIATION_PORT_OUT_OF_RANGE",ERROR_FORBIDDEN_WALLET_BASE_URL:"ERROR_FORBIDDEN_WALLET_BASE_URL",ERROR_SECURE_CONTEXT_REQUIRED:"ERROR_SECURE_CONTEXT_REQUIRED",ERROR_SESSION_CLOSED:"ERROR_SESSION_CLOSED",ERROR_SESSION_TIMEOUT:"ERROR_SESSION_TIMEOUT",ERROR_WALLET_NOT_FOUND:"ERROR_WALLET_NOT_FOUND"},jh=function(e){W(n,G(Error));var t=X(n);function n(){var e;B(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var a=i[0],s=i[1],u=i[2];return(e=t.call(this,s)).code=a,e.data=u,e.name="SolanaMobileWalletAdapterError",e}return U(n)}(),Dh=function(e){W(n,G(Error));var t=X(n);function n(){var e;B(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var a=i[0],s=i[1],u=i[2],c=i[3];return(e=t.call(this,u)).code=s,e.data=c,e.jsonRpcMessageId=a,e.name="SolanaMobileWalletAdapterProtocolError",e}return U(n)}();function Ch(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function Oh(e,t){return Ch(this,void 0,void 0,O().mark((function n(){var r,i,o;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,crypto.subtle.exportKey("raw",e);case 2:return r=n.sent,n.next=5,crypto.subtle.sign({hash:"SHA-256",name:"ECDSA"},t,r);case 5:return i=n.sent,(o=new Uint8Array(r.byteLength+i.byteLength)).set(new Uint8Array(r),0),o.set(new Uint8Array(i),r.byteLength),n.abrupt("return",o);case 10:case"end":return n.stop()}}),n)})))}function zh(e){if(e>=4294967296)throw new Error("Outbound sequence number overflow. The maximum sequence number is 32-bytes.");var t=new ArrayBuffer(4);return new DataView(t).setUint32(0,e,!1),new Uint8Array(t)}function Ph(){return Ch(this,void 0,void 0,O().mark((function e(){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign"]);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))}function _h(){return Ch(this,void 0,void 0,O().mark((function e(){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!1,["deriveKey","deriveBits"]);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))}var Bh;function Rh(e,t){return Ch(this,void 0,void 0,O().mark((function n(){var r,i,o,a,s;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=JSON.stringify(e),i=zh(e.id),o=new Uint8Array(12),crypto.getRandomValues(o),n.next=6,crypto.subtle.encrypt(Qh(i,o),t,(new TextEncoder).encode(r));case 6:return a=n.sent,(s=new Uint8Array(i.byteLength+o.byteLength+a.byteLength)).set(new Uint8Array(i),0),s.set(new Uint8Array(o),i.byteLength),s.set(new Uint8Array(a),i.byteLength+o.byteLength),n.abrupt("return",s);case 12:case"end":return n.stop()}}),n)})))}function Uh(e,t){return Ch(this,void 0,void 0,O().mark((function n(){var r,i,o,a,s,u;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.slice(0,4),i=e.slice(4,16),o=e.slice(16),n.next=5,crypto.subtle.decrypt(Qh(r,i),t,o);case 5:if(a=n.sent,s=Wh().decode(a),u=JSON.parse(s),!Object.hasOwnProperty.call(u,"error")){n.next=10;break}throw new Dh(u.id,u.error.code,u.error.message);case 10:return n.abrupt("return",u);case 11:case"end":return n.stop()}}),n)})))}function Qh(e,t){return{additionalData:e,iv:t,name:"AES-GCM",tagLength:128}}function Wh(){return void 0===Bh&&(Bh=new TextDecoder("utf-8")),Bh}function Yh(e,t,n){return Ch(this,void 0,void 0,O().mark((function r(){var i,o,a,s,u,c,l;return O().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,Promise.all([crypto.subtle.exportKey("raw",t),crypto.subtle.importKey("raw",e,{name:"ECDH",namedCurve:"P-256"},!1,[])]);case 2:return i=r.sent,o=ee(i,2),a=o[0],s=o[1],r.next=8,crypto.subtle.deriveBits({name:"ECDH",public:s},n,256);case 8:return u=r.sent,r.next=11,crypto.subtle.importKey("raw",u,"HKDF",!1,["deriveKey"]);case 11:return c=r.sent,r.next=14,crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:new Uint8Array(a),info:new Uint8Array},c,{name:"AES-GCM",length:128},!1,["encrypt","decrypt"]);case 14:return l=r.sent,r.abrupt("return",l);case 16:case"end":return r.stop()}}),r)})))}function Fh(e){if(e<49152||e>65535)throw new jh(Sh.ERROR_ASSOCIATION_PORT_OUT_OF_RANGE,"Association port number must be between 49152 and 65535. ".concat(e," given."),{port:e});return e}function Vh(e){for(var t="",n=new Uint8Array(e),r=n.byteLength,i=0;i<r;i++)t+=String.fromCharCode(n[i]);return window.btoa(t)}function Hh(e){return e.replace(/(^\/+|\/+$)/g,"").split("/")}function Gh(e,t){var n=null;if(t){try{n=new URL(t)}catch(e){}if("https:"!==(null==n?void 0:n.protocol))throw new jh(Sh.ERROR_FORBIDDEN_WALLET_BASE_URL,"Base URLs supplied by wallets must be valid `https` URLs")}n||(n=new URL("".concat("solana-wallet",":/")));var r=e.startsWith("/")?e:[].concat(te(Hh(n.pathname)),te(Hh(e))).join("/");return new URL(r,n)}function qh(e,t,n){return Ch(this,void 0,void 0,O().mark((function r(){var i,o,a,s;return O().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=Fh(t),r.next=3,crypto.subtle.exportKey("raw",e);case 3:return o=r.sent,a=Vh(o),(s=Gh("v1/associate/local",n)).searchParams.set("association",a.replace(/[/+=]/g,(function(e){return{"/":"_","+":"-","=":"."}[e]}))),s.searchParams.set("port","".concat(i)),r.abrupt("return",s);case 9:case"end":return r.stop()}}),r)})))}var Zh=0,Jh=1;var Xh=null;function Kh(e,t){return Ch(this,void 0,void 0,O().mark((function n(){var r,i,o,a;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=Fh(49152+Math.floor(16384*Math.random())),n.next=3,qh(e,r,t);case 3:if("https:"!==(i=n.sent).protocol){n.next=8;break}window.location.assign(i),n.next=26;break;case 8:n.prev=8,o=-1!==navigator.userAgent.indexOf("Firefox/")?Zh:Jh,n.t0=o,n.next=n.t0===Zh?13:n.t0===Jh?15:20;break;case 13:return s=i,null==Xh&&((Xh=document.createElement("iframe")).style.display="none",document.body.appendChild(Xh)),Xh.contentWindow.location.href=s.toString(),n.abrupt("break",21);case 15:return a=new Promise((function(e,t){function n(){clearTimeout(i),window.removeEventListener("blur",r)}function r(){n(),e()}window.addEventListener("blur",r);var i=setTimeout((function(){n(),t()}),2e3)})),window.location.assign(i),n.next=19,a;case 19:return n.abrupt("break",21);case 20:case 21:n.next=26;break;case 23:throw n.prev=23,n.t1=n.catch(8),new jh(Sh.ERROR_WALLET_NOT_FOUND,"Found no installed wallet that supports the mobile wallet protocol.");case 26:return n.abrupt("return",r);case 27:case"end":return n.stop()}var s}),n,null,[[8,23]])})))}var $h=[150,150,200,500,500,750,750,1e3],ed=3e4;function td(){if("undefined"==typeof window||!0!==window.isSecureContext)throw new jh(Sh.ERROR_SECURE_CONTEXT_REQUIRED,"The mobile wallet adapter protocol must be used in a secure context (`https`).")}function nd(e){var t;try{t=new URL(e)}catch(e){throw new jh(Sh.ERROR_FORBIDDEN_WALLET_BASE_URL,"Invalid base URL supplied by wallet")}if("https:"!==t.protocol)throw new jh(Sh.ERROR_FORBIDDEN_WALLET_BASE_URL,"Base URLs supplied by wallets must be valid `https` URLs")}Lh.SolanaMobileWalletAdapterError=jh,Lh.SolanaMobileWalletAdapterErrorCode=Sh,Lh.SolanaMobileWalletAdapterProtocolError=Dh,Lh.SolanaMobileWalletAdapterProtocolErrorCode={ERROR_AUTHORIZATION_FAILED:-1,ERROR_INVALID_PAYLOADS:-2,ERROR_NOT_SIGNED:-3,ERROR_NOT_SUBMITTED:-4,ERROR_TOO_MANY_PAYLOADS:-5,ERROR_ATTEST_ORIGIN_ANDROID:-100},Lh.transact=function(e,t){return Ch(this,void 0,void 0,O().mark((function n(){var r,i,o,a,s,u,c,l,h=this;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return td(),n.next=3,Ph();case 3:return r=n.sent,n.next=6,Kh(r.publicKey,null==t?void 0:t.baseUri);case 6:return i=n.sent,o="ws://localhost:".concat(i,"/solana-wallet"),s=function(){var e=te($h);return function(){return e.length>1?e.shift():e[0]}}(),u=1,c=0,l={__type:"disconnected"},n.abrupt("return",new Promise((function(t,n){var d,f,p,y={},m=function e(){return Ch(h,void 0,void 0,O().mark((function t(){var n,r;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("connecting"===l.__type){t.next=3;break}return console.warn("Expected adapter state to be `connecting` at the moment the websocket opens. "+"Got `".concat(l.__type,"`.")),t.abrupt("return");case 3:return n=l.associationKeypair,d.removeEventListener("open",e),t.next=7,_h();case 7:return r=t.sent,t.t0=d,t.next=11,Oh(r.publicKey,n.privateKey);case 11:t.t1=t.sent,t.t0.send.call(t.t0,t.t1),l={__type:"hello_req_sent",associationPublicKey:n.publicKey,ecdhPrivateKey:r.privateKey};case 14:case"end":return t.stop()}}),t)})))},g=function(e){e.wasClean?l={__type:"disconnected"}:n(new jh(Sh.ERROR_SESSION_CLOSED,"The wallet session dropped unexpectedly (".concat(e.code,": ").concat(e.reason,")."),{closeEvent:e})),f()},v=function(e){return Ch(h,void 0,void 0,O().mark((function e(){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(f(),!(Date.now()-a>=ed)){e.next=5;break}n(new jh(Sh.ERROR_SESSION_TIMEOUT,"Failed to connect to the wallet websocket on port ".concat(i,"."))),e.next=8;break;case 5:return e.next=7,new Promise((function(e){var t=s();p=window.setTimeout(e,t)}));case 7:b();case 8:case"end":return e.stop()}}),e)})))},w=function(r){return Ch(h,void 0,void 0,O().mark((function i(){var o,a,s,h,p,m,g,v;return O().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,r.data.arrayBuffer();case 2:o=i.sent,i.t0=l.__type,i.next="connected"===i.t0?6:"hello_req_sent"===i.t0?30:51;break;case 6:if(i.prev=6,a=o.slice(0,4),(s=new DataView(a).getUint32(0,!1))===c+1){i.next=11;break}throw new Error("Encrypted message has invalid sequence number");case 11:return c=s,i.next=14,Uh(o,l.sharedSecret);case 14:h=i.sent,p=y[h.id],delete y[h.id],p.resolve(h.result),i.next=29;break;case 20:if(i.prev=20,i.t1=i.catch(6),!(i.t1 instanceof Dh)){i.next=28;break}m=y[i.t1.jsonRpcMessageId],delete y[i.t1.jsonRpcMessageId],m.reject(i.t1),i.next=29;break;case 28:throw i.t1;case 29:return i.abrupt("break",51);case 30:return i.next=32,Yh(o,l.associationPublicKey,l.ecdhPrivateKey);case 32:return g=i.sent,l={__type:"connected",sharedSecret:g},v=new Proxy({},{get:function(e,t){if(null==e[t]){var n=t.toString().replace(/[A-Z]/g,(function(e){return"_".concat(e.toLowerCase())})).toLowerCase();e[t]=function(e){return Ch(this,void 0,void 0,O().mark((function r(){var i;return O().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=u++,r.t0=d,r.next=4,Rh({id:i,jsonrpc:"2.0",method:n,params:null!=e?e:{}},g);case 4:return r.t1=r.sent,r.t0.send.call(r.t0,r.t1),r.abrupt("return",new Promise((function(e,n){y[i]={resolve:function(r){switch(t){case"authorize":case"reauthorize":var i=r.wallet_uri_base;if(null!=i)try{nd(i)}catch(e){return void n(e)}}e(r)},reject:n}})));case 7:case"end":return r.stop()}}),r)})))}}return e[t]},defineProperty:function(){return!1},deleteProperty:function(){return!1}}),i.prev=35,i.t2=t,i.next=39,e(v);case 39:i.t3=i.sent,(0,i.t2)(i.t3),i.next=46;break;case 43:i.prev=43,i.t4=i.catch(35),n(i.t4);case 46:return i.prev=46,f(),d.close(),i.finish(46);case 50:return i.abrupt("break",51);case 51:case"end":return i.stop()}}),i,null,[[6,20],[35,43,46,50]])})))},b=function(){f&&f(),l={__type:"connecting",associationKeypair:r},void 0===a&&(a=Date.now()),(d=new WebSocket(o,["com.solana.mobilewalletadapter.v1"])).addEventListener("open",m),d.addEventListener("close",g),d.addEventListener("error",v),d.addEventListener("message",w),f=function(){window.clearTimeout(p),d.removeEventListener("open",m),d.removeEventListener("close",g),d.removeEventListener("error",v),d.removeEventListener("message",w)}};b()})));case 13:case"end":return n.stop()}}),n)})))};var rd=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var r=0;r<e.length;r++){var i=e.charAt(r),o=i.charCodeAt(0);if(255!==t[o])throw new TypeError(i+" is ambiguous");t[o]=r}var a=e.length,s=e.charAt(0),u=Math.log(a)/Math.log(256),c=Math.log(256)/Math.log(a);function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;for(var n=0,r=0,i=0;e[n]===s;)r++,n++;for(var o=(e.length-n)*u+1>>>0,c=new Uint8Array(o);e[n];){var l=t[e.charCodeAt(n)];if(255===l)return;for(var h=0,d=o-1;(0!==l||h<i)&&-1!==d;d--,h++)l+=a*c[d]>>>0,c[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=h,n++}for(var f=o-i;f!==o&&0===c[f];)f++;for(var p=new Uint8Array(r+(o-f)),y=r;f!==o;)p[y++]=c[f++];return p}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var u=(o-i)*c+1>>>0,l=new Uint8Array(u);i!==o;){for(var h=t[i],d=0,f=u-1;(0!==h||d<r)&&-1!==f;f--,d++)h+=256*l[f]>>>0,l[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");r=d,i++}for(var p=u-r;p!==u&&0===l[p];)p++;for(var y=s.repeat(n);p<u;++p)y+=e.charAt(l[p]);return y},decodeUnsafe:l,decode:function(e){var t=l(e);if(t)return t;throw new Error("Non-base"+a+" character")}}}("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");Object.defineProperty(ue,"__esModule",{value:!0});var id=kh,od=Lh;function ad(e){return e&&"object"===z(e)&&"default"in e?e:{default:e}}var sd=ad(rd);function ud(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function cd(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function ld(e){var t;return window.btoa((t=String.fromCharCode).call.apply(t,[null].concat(te(e))))}function hd(e){return new Uint8Array(window.atob(e).split("").map((function(e){return e.charCodeAt(0)})))}function dd(e){return ld("version"in e?e.serialize():e.serialize({requireAllSignatures:!1,verifySignatures:!1}))}function fd(e){var t=e[0]*id.SIGNATURE_LENGTH_IN_BYTES+1;return"legacy"===id.VersionedMessage.deserializeMessageVersion(e.slice(t,e.length))?id.Transaction.from(e):id.VersionedTransaction.deserialize(e)}ue.transact=function(e,t){return cd(this,void 0,void 0,O().mark((function n(){var r;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=function(t){var n=new Proxy({},{get:function(e,n){if(null==e[n])switch(n){case"signAndSendTransactions":e[n]=function(e){var n=e.minContextSlot,r=e.transactions,i=ud(e,["minContextSlot","transactions"]);return cd(this,void 0,void 0,O().mark((function e(){var o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=r.map(dd),e.next=3,t.signAndSendTransactions(Object.assign(Object.assign(Object.assign({},i),null!=n?{options:{min_context_slot:n}}:null),{payloads:o}));case 3:return a=e.sent,s=a.signatures,u=s.map(hd).map(sd.default.encode),e.abrupt("return",u);case 7:case"end":return e.stop()}}),e)})))};break;case"signMessages":e[n]=function(e){var n=e.payloads,r=ud(e,["payloads"]);return cd(this,void 0,void 0,O().mark((function e(){var i,o,a,s;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.map(ld),e.next=3,t.signMessages(Object.assign(Object.assign({},r),{payloads:i}));case 3:return o=e.sent,a=o.signed_payloads,s=a.map(hd),e.abrupt("return",s);case 7:case"end":return e.stop()}}),e)})))};break;case"signTransactions":e[n]=function(e){var n=e.transactions,r=ud(e,["transactions"]);return cd(this,void 0,void 0,O().mark((function e(){var i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.map(dd),e.next=3,t.signTransactions(Object.assign(Object.assign({},r),{payloads:i}));case 3:return o=e.sent,a=o.signed_payloads,s=a.map(hd),u=s.map(fd),e.abrupt("return",u);case 8:case"end":return e.stop()}}),e)})))};break;default:e[n]=t[n]}return e[n]},defineProperty:function(){return!1},deleteProperty:function(){return!1}});return e(n)},n.next=3,od.transact(r,t);case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n)})))};var pd={},yd=function(){function e(t,n){if(B(this,e),!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=n}return U(e,[{key:"makeDestinationObject",value:function(){return{}}},{key:"decode",value:function(e,t){throw new Error("Layout is abstract")}},{key:"encode",value:function(e,t,n){throw new Error("Layout is abstract")}},{key:"getSpan",value:function(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}},{key:"replicate",value:function(e){var t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}},{key:"fromArray",value:function(e){}}]),e}();function md(e,t){return t.property?e+"["+t.property+"]":e}pd.Layout=yd,pd.nameWithProperty=md,pd.bindConstructorLayout=function(e,t){if("function"!=typeof e)throw new TypeError("Class must be constructor");if(e.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof yd))throw new TypeError("layout must be a Layout");if(t.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");e.layout_=t,t.boundConstructor_=e,t.makeDestinationObject=function(){return new e},Object.defineProperty(e.prototype,"encode",{value:function(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(e,"decode",{value:function(e,n){return t.decode(e,n)},writable:!0})};var gd=function(e){W(n,yd);var t=X(n);function n(){return B(this,n),t.apply(this,arguments)}return U(n,[{key:"isCount",value:function(){throw new Error("ExternalLayout is abstract")}}]),n}(),vd=function(e){W(n,gd);var t=X(n);function n(e,r){var i;if(B(this,n),void 0===e&&(e=1),!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");return(i=t.call(this,-1,r)).elementSpan=e,i}return U(n,[{key:"isCount",value:function(){return!0}},{key:"decode",value:function(e,t){void 0===t&&(t=0);var n=e.length-t;return Math.floor(n/this.elementSpan)}},{key:"encode",value:function(e,t,n){return 0}}]),n}(),wd=function(e){W(n,gd);var t=X(n);function n(e,r,i){var o;if(B(this,n),!(e instanceof yd))throw new TypeError("layout must be a Layout");if(void 0===r)r=0;else if(!Number.isInteger(r))throw new TypeError("offset must be integer or undefined");return(o=t.call(this,e.span,i||e.property)).layout=e,o.offset=r,o}return U(n,[{key:"isCount",value:function(){return this.layout instanceof bd||this.layout instanceof Md}},{key:"decode",value:function(e,t){return void 0===t&&(t=0),this.layout.decode(e,t+this.offset)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),this.layout.encode(e,t,n+this.offset)}}]),n}(),bd=function(e){W(n,yd);var t=X(n);function n(e,r){var i;if(B(this,n),6<(i=t.call(this,e,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readUIntLE(t,this.span)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeUIntLE(e,n,this.span),this.span}}]),n}(),Md=function(e){W(n,yd);var t=X(n);function n(e,r){var i;if(B(this,n),6<(i=t.call(this,e,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readUIntBE(t,this.span)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeUIntBE(e,n,this.span),this.span}}]),n}(),Ad=function(e){W(n,yd);var t=X(n);function n(e,r){var i;if(B(this,n),6<(i=t.call(this,e,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readIntLE(t,this.span)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeIntLE(e,n,this.span),this.span}}]),n}(),Id=function(e){W(n,yd);var t=X(n);function n(e,r){var i;if(B(this,n),6<(i=t.call(this,e,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readIntBE(t,this.span)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeIntBE(e,n,this.span),this.span}}]),n}(),Nd=Math.pow(2,32);function Td(e){var t=Math.floor(e/Nd);return{hi32:t,lo32:e-t*Nd}}function Ed(e,t){return e*Nd+t}var xd=function(e){W(n,yd);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return U(n,[{key:"decode",value:function(e,t){void 0===t&&(t=0);var n=e.readUInt32LE(t);return Ed(e.readUInt32LE(t+4),n)}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=Td(e);return t.writeUInt32LE(r.lo32,n),t.writeUInt32LE(r.hi32,n+4),8}}]),n}(),kd=function(e){W(n,yd);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return U(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),Ed(e.readUInt32BE(t),e.readUInt32BE(t+4))}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=Td(e);return t.writeUInt32BE(r.hi32,n),t.writeUInt32BE(r.lo32,n+4),8}}]),n}(),Ld=function(e){W(n,yd);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return U(n,[{key:"decode",value:function(e,t){void 0===t&&(t=0);var n=e.readUInt32LE(t);return Ed(e.readInt32LE(t+4),n)}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=Td(e);return t.writeUInt32LE(r.lo32,n),t.writeInt32LE(r.hi32,n+4),8}}]),n}(),Sd=function(e){W(n,yd);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return U(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),Ed(e.readInt32BE(t),e.readUInt32BE(t+4))}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=Td(e);return t.writeInt32BE(r.hi32,n),t.writeUInt32BE(r.lo32,n+4),8}}]),n}(),jd=function(e){W(n,yd);var t=X(n);function n(e){return B(this,n),t.call(this,4,e)}return U(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readFloatLE(t)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeFloatLE(e,n),4}}]),n}(),Dd=function(e){W(n,yd);var t=X(n);function n(e){return B(this,n),t.call(this,4,e)}return U(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readFloatBE(t)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeFloatBE(e,n),4}}]),n}(),Cd=function(e){W(n,yd);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return U(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readDoubleLE(t)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeDoubleLE(e,n),8}}]),n}(),Od=function(e){W(n,yd);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return U(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readDoubleBE(t)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeDoubleBE(e,n),8}}]),n}(),zd=function(e){W(n,yd);var t=X(n);function n(e,r,i){var o;if(B(this,n),!(e instanceof yd))throw new TypeError("elementLayout must be a Layout");if(!(r instanceof gd&&r.isCount()||Number.isInteger(r)&&0<=r))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");var a=-1;return!(r instanceof gd)&&0<e.span&&(a=r*e.span),(o=t.call(this,a,i)).elementLayout=e,o.count=r,o}return U(n,[{key:"getSpan",value:function(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);var n=0,r=this.count;if(r instanceof gd&&(r=r.decode(e,t)),0<this.elementLayout.span)n=r*this.elementLayout.span;else for(var i=0;i<r;)n+=this.elementLayout.getSpan(e,t+n),++i;return n}},{key:"decode",value:function(e,t){void 0===t&&(t=0);var n=[],r=0,i=this.count;for(i instanceof gd&&(i=i.decode(e,t));r<i;)n.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),r+=1;return n}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=this.elementLayout,i=e.reduce((function(e,i){return e+r.encode(i,t,n+e)}),0);return this.count instanceof gd&&this.count.encode(e.length,t,n),i}}]),n}(),Pd=function(e){W(n,yd);var t=X(n);function n(e,r,i){var o;if(B(this,n),!Array.isArray(e)||!e.reduce((function(e,t){return e&&t instanceof yd}),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof r&&void 0===i&&(i=r,r=void 0);var a,s=se(e);try{for(s.s();!(a=s.n()).done;){var u=a.value;if(0>u.span&&void 0===u.property)throw new Error("fields cannot contain unnamed variable-length layout")}}catch(e){s.e(e)}finally{s.f()}var c=-1;try{c=e.reduce((function(e,t){return e+t.getSpan()}),0)}catch(e){}return(o=t.call(this,c,r)).fields=e,o.decodePrefixes=!!i,o}return U(n,[{key:"getSpan",value:function(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);var n=0;try{n=this.fields.reduce((function(n,r){var i=r.getSpan(e,t);return t+=i,n+i}),0)}catch(e){throw new RangeError("indeterminate span")}return n}},{key:"decode",value:function(e,t){void 0===t&&(t=0);var n,r=this.makeDestinationObject(),i=se(this.fields);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(void 0!==o.property&&(r[o.property]=o.decode(e,t)),t+=o.getSpan(e,t),this.decodePrefixes&&e.length===t)break}}catch(e){i.e(e)}finally{i.f()}return r}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r,i=n,o=0,a=0,s=se(this.fields);try{for(s.s();!(r=s.n()).done;){var u=r.value,c=u.span;if(a=0<c?c:0,void 0!==u.property){var l=e[u.property];void 0!==l&&(a=u.encode(l,t,n),0>c&&(c=u.getSpan(t,n)))}o=n,n+=c}}catch(e){s.e(e)}finally{s.f()}return o+a-i}},{key:"fromArray",value:function(e){var t,n=this.makeDestinationObject(),r=se(this.fields);try{for(r.s();!(t=r.n()).done;){var i=t.value;void 0!==i.property&&0<e.length&&(n[i.property]=e.shift())}}catch(e){r.e(e)}finally{r.f()}return n}},{key:"layoutFor",value:function(e){if("string"!=typeof e)throw new TypeError("property must be string");var t,n=se(this.fields);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.property===e)return r}}catch(e){n.e(e)}finally{n.f()}}},{key:"offsetOf",value:function(e){if("string"!=typeof e)throw new TypeError("property must be string");var t,n=0,r=se(this.fields);try{for(r.s();!(t=r.n()).done;){var i=t.value;if(i.property===e)return n;0>i.span?n=-1:0<=n&&(n+=i.span)}}catch(e){r.e(e)}finally{r.f()}}}]),n}(),_d=function(){function e(t){B(this,e),this.property=t}return U(e,[{key:"decode",value:function(){throw new Error("UnionDiscriminator is abstract")}},{key:"encode",value:function(){throw new Error("UnionDiscriminator is abstract")}}]),e}(),Bd=function(e){W(n,_d);var t=X(n);function n(e,r){var i;if(B(this,n),!(e instanceof gd&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");return(i=t.call(this,r||e.property||"variant")).layout=e,i}return U(n,[{key:"decode",value:function(e,t){return this.layout.decode(e,t)}},{key:"encode",value:function(e,t,n){return this.layout.encode(e,t,n)}}]),n}(),Rd=function(e){W(n,yd);var t=X(n);function n(e,r,i){var o;B(this,n);var a=e instanceof bd||e instanceof Md;if(a)e=new Bd(new wd(e));else if(e instanceof gd&&e.isCount())e=new Bd(e);else if(!(e instanceof _d))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===r&&(r=null),!(null===r||r instanceof yd))throw new TypeError("defaultLayout must be null or a Layout");if(null!==r){if(0>r.span)throw new Error("defaultLayout must have constant span");void 0===r.property&&(r=r.replicate("content"))}var s=-1;r&&0<=(s=r.span)&&a&&(s+=e.layout.span),(o=t.call(this,s,i)).discriminator=e,o.usesPrefixDiscriminator=a,o.defaultLayout=r,o.registry={};var u=o.defaultGetSourceVariant.bind(Z(o));return o.getSourceVariant=function(e){return u(e)},o.configGetSourceVariant=function(e){u=e.bind(this)},o}return U(n,[{key:"getSpan",value:function(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);var n=this.getVariant(e,t);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,t)}},{key:"defaultGetSourceVariant",value:function(e){if(e.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&e.hasOwnProperty(this.defaultLayout.property))return;var t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||e.hasOwnProperty(t.property)))return t}else for(var n in this.registry){var r=this.registry[n];if(e.hasOwnProperty(r.property))return r}throw new Error("unable to infer src variant")}},{key:"decode",value:function(e,t){var n;void 0===t&&(t=0);var r=this.discriminator,i=r.decode(e,t),o=this.registry[i];if(void 0===o){var a=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(a=r.layout.span),(n=this.makeDestinationObject())[r.property]=i,n[o.property]=this.defaultLayout.decode(e,t+a)}else n=o.decode(e,t);return n}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=this.getSourceVariant(e);if(void 0===r){var i=this.discriminator,o=this.defaultLayout,a=0;return this.usesPrefixDiscriminator&&(a=i.layout.span),i.encode(e[i.property],t,n),a+o.encode(e[o.property],t,n+a)}return r.encode(e,t,n)}},{key:"addVariant",value:function(e,t,n){var r=new Ud(this,e,t,n);return this.registry[e]=r,r}},{key:"getVariant",value:function(e,t){var n=e;return Ne.isBuffer(e)&&(void 0===t&&(t=0),n=this.discriminator.decode(e,t)),this.registry[n]}}]),n}(),Ud=function(e){W(n,yd);var t=X(n);function n(e,r,i,o){var a;if(B(this,n),!(e instanceof Rd))throw new TypeError("union must be a Union");if(!Number.isInteger(r)||0>r)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof i&&void 0===o&&(o=i,i=null),i){if(!(i instanceof yd))throw new TypeError("layout must be a Layout");if(null!==e.defaultLayout&&0<=i.span&&i.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof o)throw new TypeError("variant must have a String property")}var s=e.span;return 0>e.span&&0<=(s=i?i.span:0)&&e.usesPrefixDiscriminator&&(s+=e.discriminator.layout.span),(a=t.call(this,s,o)).union=e,a.variant=r,a.layout=i||null,a}return U(n,[{key:"getSpan",value:function(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);var n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(e,t+n)}},{key:"decode",value:function(e,t){var n=this.makeDestinationObject();if(void 0===t&&(t=0),this!==this.union.getVariant(e,t))throw new Error("variant mismatch");var r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(e,t+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!e.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,n);var i=r;if(this.layout&&(this.layout.encode(e[this.property],t,n+r),i+=this.layout.getSpan(t,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}},{key:"fromArray",value:function(e){if(this.layout)return this.layout.fromArray(e)}}]),n}();function Qd(e){return 0>e&&(e+=4294967296),e}var Wd=function(e){W(n,yd);var t=X(n);function n(e,r,i){var o;if(B(this,n),!(e instanceof bd||e instanceof Md))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof r&&void 0===i&&(i=r,r=void 0),4<e.span)throw new RangeError("word cannot exceed 32 bits");(o=t.call(this,e.span,i)).word=e,o.msb=!!r,o.fields=[];var a=0;return o._packedSetValue=function(e){return a=Qd(e),this},o._packedGetValue=function(){return a},o}return U(n,[{key:"decode",value:function(e,t){var n=this.makeDestinationObject();void 0===t&&(t=0);var r=this.word.decode(e,t);this._packedSetValue(r);var i,o=se(this.fields);try{for(o.s();!(i=o.n()).done;){var a=i.value;void 0!==a.property&&(n[a.property]=a.decode(r))}}catch(e){o.e(e)}finally{o.f()}return n}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=this.word.decode(t,n);this._packedSetValue(r);var i,o=se(this.fields);try{for(o.s();!(i=o.n()).done;){var a=i.value;if(void 0!==a.property){var s=e[a.property];void 0!==s&&a.encode(s)}}}catch(e){o.e(e)}finally{o.f()}return this.word.encode(this._packedGetValue(),t,n)}},{key:"addField",value:function(e,t){var n=new Yd(this,e,t);return this.fields.push(n),n}},{key:"addBoolean",value:function(e){var t=new Fd(this,e);return this.fields.push(t),t}},{key:"fieldFor",value:function(e){if("string"!=typeof e)throw new TypeError("property must be string");var t,n=se(this.fields);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.property===e)return r}}catch(e){n.e(e)}finally{n.f()}}}]),n}(),Yd=function(){function e(t,n,r){if(B(this,e),!(t instanceof Wd))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(n)||0>=n)throw new TypeError("bits must be positive integer");var i=8*t.span,o=t.fields.reduce((function(e,t){return e+t.bits}),0);if(n+o>i)throw new Error("bits too long for span remainder ("+(i-o)+" of "+i+" remain)");this.container=t,this.bits=n,this.valueMask=(1<<n)-1,32===n&&(this.valueMask=4294967295),this.start=o,this.container.msb&&(this.start=i-o-n),this.wordMask=Qd(this.valueMask<<this.start),this.property=r}return U(e,[{key:"decode",value:function(){return Qd(this.container._packedGetValue()&this.wordMask)>>>this.start}},{key:"encode",value:function(e){if(!Number.isInteger(e)||e!==Qd(e&this.valueMask))throw new TypeError(md("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);var t=this.container._packedGetValue(),n=Qd(e<<this.start);this.container._packedSetValue(Qd(t&~this.wordMask)|n)}}]),e}(),Fd=function(e){W(n,Yd);var t=X(n);function n(e,r){return B(this,n),t.call(this,e,1,r)}return U(n,[{key:"decode",value:function(e,t){return!!Yd.prototype.decode.call(this,e,t)}},{key:"encode",value:function(e){return"boolean"==typeof e&&(e=+e),Yd.prototype.encode.call(this,e)}}]),n}(),Vd=function(e){W(n,yd);var t=X(n);function n(e,r){var i;if(B(this,n),!(e instanceof gd&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");var o=-1;return e instanceof gd||(o=e),(i=t.call(this,o,r)).length=e,i}return U(n,[{key:"getSpan",value:function(e,t){var n=this.span;return 0>n&&(n=this.length.decode(e,t)),n}},{key:"decode",value:function(e,t){void 0===t&&(t=0);var n=this.span;return 0>n&&(n=this.length.decode(e,t)),e.slice(t,t+n)}},{key:"encode",value:function(e,t,n){var r=this.length;if(this.length instanceof gd&&(r=e.length),!Ne.isBuffer(e)||r!==e.length)throw new TypeError(md("Blob.encode",this)+" requires (length "+r+") Buffer as src");if(n+r>t.length)throw new RangeError("encoding overruns Buffer");return t.write(e.toString("hex"),n,r,"hex"),this.length instanceof gd&&this.length.encode(r,t,n),r}}]),n}(),Hd=function(e){W(n,yd);var t=X(n);function n(e){return B(this,n),t.call(this,-1,e)}return U(n,[{key:"getSpan",value:function(e,t){if(!Ne.isBuffer(e))throw new TypeError("b must be a Buffer");void 0===t&&(t=0);for(var n=t;n<e.length&&0!==e[n];)n+=1;return 1+n-t}},{key:"decode",value:function(e,t,n){void 0===t&&(t=0);var r=this.getSpan(e,t);return e.slice(t,t+r-1).toString("utf-8")}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0),"string"!=typeof e&&(e=e.toString());var r=new Ne(e,"utf8"),i=r.length;if(n+i>t.length)throw new RangeError("encoding overruns Buffer");return r.copy(t,n),t[n+i]=0,i+1}}]),n}(),Gd=function(e){W(n,yd);var t=X(n);function n(e,r){var i;if(B(this,n),"string"==typeof e&&void 0===r&&(r=e,e=void 0),void 0===e)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");return(i=t.call(this,-1,r)).maxSpan=e,i}return U(n,[{key:"getSpan",value:function(e,t){if(!Ne.isBuffer(e))throw new TypeError("b must be a Buffer");return void 0===t&&(t=0),e.length-t}},{key:"decode",value:function(e,t,n){void 0===t&&(t=0);var r=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return e.slice(t,t+r).toString("utf-8")}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0),"string"!=typeof e&&(e=e.toString());var r=new Ne(e,"utf8"),i=r.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(n+i>t.length)throw new RangeError("encoding overruns Buffer");return r.copy(t,n),i}}]),n}(),qd=function(e){W(n,yd);var t=X(n);function n(e,r){var i;return B(this,n),(i=t.call(this,0,r)).value=e,i}return U(n,[{key:"decode",value:function(e,t,n){return this.value}},{key:"encode",value:function(e,t,n){return 0}}]),n}();pd.ExternalLayout=gd,pd.GreedyCount=vd,pd.OffsetLayout=wd,pd.UInt=bd,pd.UIntBE=Md,pd.Int=Ad,pd.IntBE=Id,pd.Float=jd,pd.FloatBE=Dd,pd.Double=Cd,pd.DoubleBE=Od,pd.Sequence=zd,pd.Structure=Pd,pd.UnionDiscriminator=_d,pd.UnionLayoutDiscriminator=Bd,pd.Union=Rd,pd.VariantLayout=Ud,pd.BitStructure=Wd,pd.BitField=Yd,pd.Boolean=Fd,pd.Blob=Vd,pd.CString=Hd,pd.UTF8=Gd,pd.Constant=qd,pd.greedy=function(e,t){return new vd(e,t)},pd.offset=function(e,t,n){return new wd(e,t,n)},pd.u8=function(e){return new bd(1,e)},pd.u16=function(e){return new bd(2,e)},pd.u24=function(e){return new bd(3,e)},pd.u32=function(e){return new bd(4,e)},pd.u40=function(e){return new bd(5,e)},pd.u48=function(e){return new bd(6,e)},pd.nu64=function(e){return new xd(e)},pd.u16be=function(e){return new Md(2,e)},pd.u24be=function(e){return new Md(3,e)},pd.u32be=function(e){return new Md(4,e)},pd.u40be=function(e){return new Md(5,e)},pd.u48be=function(e){return new Md(6,e)},pd.nu64be=function(e){return new kd(e)},pd.s8=function(e){return new Ad(1,e)},pd.s16=function(e){return new Ad(2,e)},pd.s24=function(e){return new Ad(3,e)},pd.s32=function(e){return new Ad(4,e)},pd.s40=function(e){return new Ad(5,e)},pd.s48=function(e){return new Ad(6,e)},pd.ns64=function(e){return new Ld(e)},pd.s16be=function(e){return new Id(2,e)},pd.s24be=function(e){return new Id(3,e)},pd.s32be=function(e){return new Id(4,e)},pd.s40be=function(e){return new Id(5,e)},pd.s48be=function(e){return new Id(6,e)},pd.ns64be=function(e){return new Sd(e)},pd.f32=function(e){return new jd(e)},pd.f32be=function(e){return new Dd(e)},pd.f64=function(e){return new Cd(e)},pd.f64be=function(e){return new Od(e)},pd.struct=function(e,t,n){return new Pd(e,t,n)},pd.bits=function(e,t,n){return new Wd(e,t,n)};var Zd=pd.seq=function(e,t,n){return new zd(e,t,n)};pd.union=function(e,t,n){return new Rd(e,t,n)},pd.unionLayoutDiscriminator=function(e,t){return new Bd(e,t)},pd.blob=function(e,t){return new Vd(e,t)},pd.cstr=function(e){return new Hd(e)},pd.utf8=function(e,t){return new Gd(e,t)},pd.const=function(e,t){return new qd(e,t)};var Jd={},Xd={exports:{}};!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var o;"object"===z(e)?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:ur.Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function s(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,r,i){for(var o=0,a=0,s=Math.min(e.length,r),u=t;u<s;u++){var c=e.charCodeAt(u)-48;o*=i,a=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a<i,"Invalid character"),o+=a}return o}function c(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.isBN=function(e){return e instanceof i||null!==e&&"object"===z(e)&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"===z(e))return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<e.length;i+=3)a=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=e.length-1;r>=t;r-=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(e,l,l+r,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(e,l,e.length,t),l=0;l<a;l++)h*=t;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){c(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(e){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","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"],d=[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],f=[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 p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=67108863&u,d=Math.min(c,t.length-1),f=Math.max(0,c-e.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|e.words[p])*(o=0|t.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=d[e],l=f[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(e);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n++]=255&a,n<e.length&&(e[n++]=a>>8&255),n<e.length&&(e[n++]=a>>16&255),6===o?(n<e.length&&(e[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n--]=255&a,n>=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return n(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a<r.length;a++)o=(t=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<n.length;a++)o=(t=(0|n.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var y=function(e,t,n){var r,i,o,a=e.words,s=t.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],I=8191&A,N=A>>>13,T=0|a[5],E=8191&T,x=T>>>13,k=0|a[6],L=8191&k,S=k>>>13,j=0|a[7],D=8191&j,C=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,W=U>>>13,Y=0|s[1],F=8191&Y,V=Y>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,ee=K>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,le=0|s[8],he=8191&le,de=le>>>13,fe=0|s[9],pe=8191&fe,ye=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,W))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,W))+Math.imul(y,Q)|0,o=Math.imul(y,W);var ge=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,W))+Math.imul(v,Q)|0,o=Math.imul(v,W),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var ve=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,W))+Math.imul(M,Q)|0,o=Math.imul(M,W),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var we=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(I,Q),i=(i=Math.imul(I,W))+Math.imul(N,Q)|0,o=Math.imul(N,W),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var be=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,Q),i=(i=Math.imul(E,W))+Math.imul(x,Q)|0,o=Math.imul(x,W),r=r+Math.imul(I,F)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0;var Me=(c+(r=r+Math.imul(h,ne)|0)|0)+((8191&(i=(i=i+Math.imul(h,re)|0)+Math.imul(d,ne)|0))<<13)|0;c=((o=o+Math.imul(d,re)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,W))+Math.imul(S,Q)|0,o=Math.imul(S,W),r=r+Math.imul(E,F)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(x,F)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(I,G)|0,i=(i=i+Math.imul(I,q)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0;var Ae=(c+(r=r+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ae)|0)+Math.imul(d,oe)|0))<<13)|0;c=((o=o+Math.imul(d,ae)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(D,Q),i=(i=Math.imul(D,W))+Math.imul(C,Q)|0,o=Math.imul(C,W),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(E,G)|0,i=(i=i+Math.imul(E,q)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,q)|0,r=r+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(g,ne)|0,i=(i=i+Math.imul(g,re)|0)+Math.imul(v,ne)|0,o=o+Math.imul(v,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0;var Ie=(c+(r=r+Math.imul(h,ue)|0)|0)+((8191&(i=(i=i+Math.imul(h,ce)|0)+Math.imul(d,ue)|0))<<13)|0;c=((o=o+Math.imul(d,ce)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,W))+Math.imul(P,Q)|0,o=Math.imul(P,W),r=r+Math.imul(D,F)|0,i=(i=i+Math.imul(D,V)|0)+Math.imul(C,F)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0,r=r+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,ce)|0;var Ne=(c+(r=r+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;c=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,W))+Math.imul(R,Q)|0,o=Math.imul(R,W),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(D,G)|0,i=(i=i+Math.imul(D,q)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,r=r+Math.imul(g,ue)|0,i=(i=i+Math.imul(g,ce)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,ce)|0,r=r+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(y,he)|0,o=o+Math.imul(y,de)|0;var Te=(c+(r=r+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ye)|0)+Math.imul(d,pe)|0))<<13)|0;c=((o=o+Math.imul(d,ye)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(D,J)|0,i=(i=i+Math.imul(D,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,ee)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,ae)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,ae)|0,r=r+Math.imul(b,ue)|0,i=(i=i+Math.imul(b,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,r=r+Math.imul(g,he)|0,i=(i=i+Math.imul(g,de)|0)+Math.imul(v,he)|0,o=o+Math.imul(v,de)|0;var Ee=(c+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ye)|0)+Math.imul(y,pe)|0))<<13)|0;c=((o=o+Math.imul(y,ye)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(D,$)|0,i=(i=i+Math.imul(D,ee)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(L,ne)|0,i=(i=i+Math.imul(L,re)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,ae)|0,r=r+Math.imul(I,ue)|0,i=(i=i+Math.imul(I,ce)|0)+Math.imul(N,ue)|0,o=o+Math.imul(N,ce)|0,r=r+Math.imul(b,he)|0,i=(i=i+Math.imul(b,de)|0)+Math.imul(M,he)|0,o=o+Math.imul(M,de)|0;var xe=(c+(r=r+Math.imul(g,pe)|0)|0)+((8191&(i=(i=i+Math.imul(g,ye)|0)+Math.imul(v,pe)|0))<<13)|0;c=((o=o+Math.imul(v,ye)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,ee)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,ee)|0,r=r+Math.imul(D,ne)|0,i=(i=i+Math.imul(D,re)|0)+Math.imul(C,ne)|0,o=o+Math.imul(C,re)|0,r=r+Math.imul(L,oe)|0,i=(i=i+Math.imul(L,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,ce)|0)+Math.imul(x,ue)|0,o=o+Math.imul(x,ce)|0,r=r+Math.imul(I,he)|0,i=(i=i+Math.imul(I,de)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,de)|0;var ke=(c+(r=r+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ye)|0)+Math.imul(M,pe)|0))<<13)|0;c=((o=o+Math.imul(M,ye)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,ee))+Math.imul(R,$)|0,o=Math.imul(R,ee),r=r+Math.imul(z,ne)|0,i=(i=i+Math.imul(z,re)|0)+Math.imul(P,ne)|0,o=o+Math.imul(P,re)|0,r=r+Math.imul(D,oe)|0,i=(i=i+Math.imul(D,ae)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,ae)|0,r=r+Math.imul(L,ue)|0,i=(i=i+Math.imul(L,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,r=r+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(x,he)|0,o=o+Math.imul(x,de)|0;var Le=(c+(r=r+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,ye)|0)+Math.imul(N,pe)|0))<<13)|0;c=((o=o+Math.imul(N,ye)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,r=Math.imul(B,ne),i=(i=Math.imul(B,re))+Math.imul(R,ne)|0,o=Math.imul(R,re),r=r+Math.imul(z,oe)|0,i=(i=i+Math.imul(z,ae)|0)+Math.imul(P,oe)|0,o=o+Math.imul(P,ae)|0,r=r+Math.imul(D,ue)|0,i=(i=i+Math.imul(D,ce)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,ce)|0,r=r+Math.imul(L,he)|0,i=(i=i+Math.imul(L,de)|0)+Math.imul(S,he)|0,o=o+Math.imul(S,de)|0;var Se=(c+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,ye)|0)+Math.imul(x,pe)|0))<<13)|0;c=((o=o+Math.imul(x,ye)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(B,oe),i=(i=Math.imul(B,ae))+Math.imul(R,oe)|0,o=Math.imul(R,ae),r=r+Math.imul(z,ue)|0,i=(i=i+Math.imul(z,ce)|0)+Math.imul(P,ue)|0,o=o+Math.imul(P,ce)|0,r=r+Math.imul(D,he)|0,i=(i=i+Math.imul(D,de)|0)+Math.imul(C,he)|0,o=o+Math.imul(C,de)|0;var je=(c+(r=r+Math.imul(L,pe)|0)|0)+((8191&(i=(i=i+Math.imul(L,ye)|0)+Math.imul(S,pe)|0))<<13)|0;c=((o=o+Math.imul(S,ye)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,r=Math.imul(B,ue),i=(i=Math.imul(B,ce))+Math.imul(R,ue)|0,o=Math.imul(R,ce),r=r+Math.imul(z,he)|0,i=(i=i+Math.imul(z,de)|0)+Math.imul(P,he)|0,o=o+Math.imul(P,de)|0;var De=(c+(r=r+Math.imul(D,pe)|0)|0)+((8191&(i=(i=i+Math.imul(D,ye)|0)+Math.imul(C,pe)|0))<<13)|0;c=((o=o+Math.imul(C,ye)|0)+(i>>>13)|0)+(De>>>26)|0,De&=67108863,r=Math.imul(B,he),i=(i=Math.imul(B,de))+Math.imul(R,he)|0,o=Math.imul(R,de);var Ce=(c+(r=r+Math.imul(z,pe)|0)|0)+((8191&(i=(i=i+Math.imul(z,ye)|0)+Math.imul(P,pe)|0))<<13)|0;c=((o=o+Math.imul(P,ye)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863;var Oe=(c+(r=Math.imul(B,pe))|0)+((8191&(i=(i=Math.imul(B,ye))+Math.imul(R,pe)|0))<<13)|0;return c=((o=Math.imul(R,ye))+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,u[0]=me,u[1]=ge,u[2]=ve,u[3]=we,u[4]=be,u[5]=Me,u[6]=Ae,u[7]=Ie,u[8]=Ne,u[9]=Te,u[10]=Ee,u[11]=xe,u[12]=ke,u[13]=Le,u[14]=Se,u[15]=je,u[16]=De,u[17]=Ce,u[18]=Oe,0!==c&&(u[19]=c,n.length++),n};function m(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var l=o-c,h=(0|e.words[l])*(0|t.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(e,t,n){return m(e,t,n)}Math.imul||(y=p),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?y(this,e,t):n<63?p(this,e,t):n<1024?m(this,e,t):g(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*e,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var o=n.sqr();r<t.length;r++,o=o.sqr())0!==t[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r||!(this.words[r]&i))},i.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,r){var i,o,a=e.length+r;this._expand(a);var s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+r])+s;var u=(0|e.words[i])*t;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==t){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(o,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var o,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=t.clone();!t.isZero();){for(var d=0,f=1;0==(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(u)):(r.isub(t),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(t.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new N(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},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(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function I(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function N(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function T(e){N.call(this,e),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)}w.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},r(b,w),b.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(M,w),r(A,w),r(I,w),I.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(v[e])return v[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new M;else if("p192"===e)t=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new I}return v[e]=t,t},N.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},N.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},N.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(c(e,e.umod(this.m)._forceRed(this)),e)},N.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},N.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},N.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},N.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},N.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},N.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},N.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},N.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},N.prototype.isqr=function(e){return this.imul(e,e.clone())},N.prototype.sqr=function(e){return this.mul(e,e)},N.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),d=this.pow(e,o.addn(1).iushrn(1)),f=this.pow(e,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m<p);var g=this.pow(h,new i(1).iushln(p-m-1));d=d.redMul(g),h=g.redSqr(),f=f.redMul(h),p=m}return d},N.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},N.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var o=n[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var c=t.words[r],l=u-1;l>=0;l--){var h=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},N.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},N.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new T(e)},r(T,N),T.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},T.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},T.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},T.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(Xd,L),function(e){var t=L&&L.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.map=e.array=e.rustEnum=e.str=e.vecU8=e.tagged=e.vec=e.bool=e.option=e.publicKey=e.i128=e.u128=e.i64=e.u64=e.struct=e.f64=e.f32=e.i32=e.u32=e.i16=e.u16=e.i8=e.u8=void 0;var n=pd,r=kh,i=t(Xd.exports),o=pd;Object.defineProperty(e,"u8",{enumerable:!0,get:function(){return o.u8}}),Object.defineProperty(e,"i8",{enumerable:!0,get:function(){return o.s8}}),Object.defineProperty(e,"u16",{enumerable:!0,get:function(){return o.u16}}),Object.defineProperty(e,"i16",{enumerable:!0,get:function(){return o.s16}}),Object.defineProperty(e,"u32",{enumerable:!0,get:function(){return o.u32}}),Object.defineProperty(e,"i32",{enumerable:!0,get:function(){return o.s32}}),Object.defineProperty(e,"f32",{enumerable:!0,get:function(){return o.f32}}),Object.defineProperty(e,"f64",{enumerable:!0,get:function(){return o.f64}}),Object.defineProperty(e,"struct",{enumerable:!0,get:function(){return o.struct}});var a=function(e){W(r,e);var t=X(r);function r(e,i,o){var a;return B(this,r),(a=t.call(this,e,o)).blob=n.blob(e),a.signed=i,a}return U(r,[{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new i.default(this.blob.decode(e,t),10,"le");return this.signed?n.fromTwos(8*this.span).clone():n}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.signed&&(e=e.toTwos(8*this.span)),this.blob.encode(e.toArrayLike(Ne,"le",this.span),t,n)}}]),r}(n.Layout);function s(e){return new a(8,!1,e)}e.u64=s,e.i64=function(e){return new a(8,!0,e)},e.u128=function(e){return new a(16,!1,e)},e.i128=function(e){return new a(16,!0,e)};var u=function(e){W(n,e);var t=X(n);function n(e,r,i,o){var a;return B(this,n),(a=t.call(this,e.span,o)).layout=e,a.decoder=r,a.encoder=i,a}return U(n,[{key:"decode",value:function(e,t){return this.decoder(this.layout.decode(e,t))}},{key:"encode",value:function(e,t,n){return this.layout.encode(this.encoder(e),t,n)}},{key:"getSpan",value:function(e,t){return this.layout.getSpan(e,t)}}]),n}(n.Layout);e.publicKey=function(e){return new u(n.blob(32),(function(e){return new r.PublicKey(e)}),(function(e){return e.toBuffer()}),e)};var c=function(e){W(r,e);var t=X(r);function r(e,i){var o;return B(this,r),(o=t.call(this,-1,i)).layout=e,o.discriminator=n.u8(),o}return U(r,[{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return null==e?this.discriminator.encode(0,t,n):(this.discriminator.encode(1,t,n),this.layout.encode(e,t,n+1)+1)}},{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator.decode(e,t);if(0===n)return null;if(1===n)return this.layout.decode(e,t+1);throw new Error("Invalid option "+this.property)}},{key:"getSpan",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator.decode(e,t);if(0===n)return 1;if(1===n)return this.layout.getSpan(e,t+1)+1;throw new Error("Invalid option "+this.property)}}]),r}(n.Layout);function l(e){if(0===e)return!1;if(1===e)return!0;throw new Error("Invalid bool: "+e)}function h(e){return e?1:0}function d(e){var t=n.u32("length"),r=n.struct([t,n.blob(n.offset(t,-t.span),"data")]);return new u(r,(function(e){return e.data}),(function(e){return{data:e}}),e)}e.option=function(e,t){return new c(e,t)},e.bool=function(e){return new u(n.u8(),l,h,e)},e.vec=function(e,t){var r=n.u32("length"),i=n.struct([r,n.seq(e,n.offset(r,-r.span),"values")]);return new u(i,(function(e){return e.values}),(function(e){return{values:e}}),t)},e.tagged=function(e,t,r){var i=n.struct([s("tag"),t.replicate("data")]);return new u(i,(function(t){var n=t.tag,r=t.data;if(!n.eq(e))throw new Error("Invalid tag, expected: "+e.toString("hex")+", got: "+n.toString("hex"));return r}),(function(t){return{tag:e,data:t}}),r)},e.vecU8=d,e.str=function(e){return new u(d(),(function(e){return e.toString("utf-8")}),(function(e){return Ne.from(e,"utf-8")}),e)},e.rustEnum=function(e,t,r){var i=n.union(null!=r?r:n.u8(),t);return e.forEach((function(e,t){return i.addVariant(t,e,e.property)})),i},e.array=function(e,t,r){var i=n.struct([n.seq(e,t,"values")]);return new u(i,(function(e){return e.values}),(function(e){return{values:e}}),r)};var f=function(e){W(n,e);var t=X(n);function n(e,r,i){var o;return B(this,n),(o=t.call(this,e.span+r.span,i)).keyLayout=e,o.valueLayout=r,o}return U(n,[{key:"decode",value:function(e,t){return t=t||0,[this.keyLayout.decode(e,t),this.valueLayout.decode(e,t+this.keyLayout.getSpan(e,t))]}},{key:"encode",value:function(e,t,n){n=n||0;var r=this.keyLayout.encode(e[0],t,n);return r+this.valueLayout.encode(e[1],t,n+r)}},{key:"getSpan",value:function(e,t){return this.keyLayout.getSpan(e,t)+this.valueLayout.getSpan(e,t)}}]),n}(n.Layout);e.map=function(e,t,r){var i=n.u32("length"),o=n.struct([i,n.seq(new f(e,t),n.offset(i,-i.span),"values")]);return new u(o,(function(e){var t=e.values;return new Map(t)}),(function(e){return{values:Array.from(e.entries())}}),r)}}(Jd),ue.Web3MobileWallet;var Kd=ue.transact,$d=ur.Buffer,ef=br.exports,tf=Jd.struct([Jd.publicKey("mint"),Jd.publicKey("owner"),Jd.u64("amount"),Jd.u32("delegateOption"),Jd.publicKey("delegate"),Jd.u8("state"),Jd.u32("isNativeOption"),Jd.u64("isNative"),Jd.u64("delegatedAmount"),Jd.u32("closeAuthorityOption"),Jd.publicKey("closeAuthority")]);Jd.array;var nf=Jd.bool,rf=Jd.i128;Jd.i16;var of=Jd.i32,af=Jd.i64;Jd.i8,Jd.map;var sf=Jd.option,uf=Jd.publicKey,cf=Jd.rustEnum,lf=Jd.str,hf=Jd.struct;Jd.tagged;var df=Jd.u128,ff=Jd.u16,pf=Jd.u32,yf=Jd.u64,mf=Jd.u8,gf=Jd.vec;Jd.vecU8;const vf="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0yOTkuMyAyMzcuNSA1MDAgMTIybDIwMC43IDExNS41LTczLjUgNDIuNkw1MDAgMjA4LjJsLTEyNy4xIDcxLjktNzMuNi00Mi42em00MDEuNCAxNDYtNzMuNS00Mi42LTEyNy4xIDczTDM3MyAzNDAuNGwtNzMuNSA0My4xdjg1LjdsMTI3LjEgNzN2MTQ1LjRsNzMuNSA0My4xIDczLjUtNDMuMVY1NDIuMWwxMjcuMS03M3YtODUuNnptMCAyMzIuMXYtODUuN2wtNzMuNSA0Mi42djg1LjdjLS4xLS42IDczLjUtNDIuNiA3My41LTQyLjZ6bTUxLjkgMjkuMy0xMjcuMSA3M3Y4NS43TDgyNi4xIDY4OFY0NTYuNGwtNzMuNSA0My4xdjE0NS40em0tNzMuNS0zMzQuNCA3My41IDQzLjF2ODUuN2w3My41LTQzLjF2LTg1LjdsLTczLjUtNDMuMS03My41IDQzLjF6TTQyNi41IDc0OS40djg1LjdsNzMuNSA0My4xIDczLjUtNDMuMXYtODUuN2wtNzMuNSA0Mi03My41LTQyek0yOTkuMyA2MTUuNmw3My41IDQzLjF2LTg2LjJMMjk5LjMgNTMwdjg1LjZ6bTEyNy4yLTMwNS4xIDczLjUgNDMuMSA3My41LTQzLjEtNzMuNS00Mi42YzAtLjUtNzMuNSA0Mi42LTczLjUgNDIuNnptLTE3OS4xIDQzLjEgNzMuNS00My4xLTczLjUtNDMuMS03My41IDQzLjF2ODUuN2w3My41IDQzLjF2LTg1Ljd6bTAgMTQ1LjQtNzMuNS00Mi42VjY4OGwyMDAuNyAxMTUuNXYtODUuN2wtMTI3LjEtNzNjLS4xLjEtLjEtMTQ1LjgtLjEtMTQ1Ljh6IiBmaWxsPSIjZjBiOTBiIi8+PC9zdmc+",wf="https://assets.trustwalletapp.com/blockchains/smartchain/info/logo.png";var bf={name:"bsc",id:"0x38",networkId:"56",namespace:"eip155",platform:"evm",label:"BNB Smart Chain",fullName:"BNB Smart Chain Mainnet",logo:vf,logoBackgroundColor:"#000000",logoWhiteBackground:vf,currency:{name:"BNB",symbol:"BNB",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:wf},wrapped:{address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/logo.png"},stables:{usd:["0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d","0x55d398326f99059fF775485246999027B3197955"]},explorer:"https://bscscan.com",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://bscscan.com/tx/${e.id||e}`:t?`https://bscscan.com/token/${t}`:n?`https://bscscan.com/address/${n}`:void 0,endpoints:["https://binance.llamarpc.com","https://bsc-rpc.publicnode.com","https://bsc.rpc.blxrbdn.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"BNB",name:"Binance Coin",decimals:18,logo:wf,type:"NATIVE"},{address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",symbol:"WBNB",name:"Wrapped BNB",decimals:18,logo:"https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/smartchain/assets/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/logo.png",type:"20"},{address:"0x55d398326f99059fF775485246999027B3197955",symbol:"USDT",name:"Tether USD",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x55d398326f99059fF775485246999027B3197955/logo.png",type:"20"},{address:"0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",symbol:"USDC",name:"USD Coin",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d/logo.png",type:"20"},{address:"0x2170Ed0880ac9A755fd29B2688956BD959F933F8",symbol:"ETH",name:"Ethereum Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x2170Ed0880ac9A755fd29B2688956BD959F933F8/logo.png",type:"20"},{address:"0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82",symbol:"Cake",name:"PancakeSwap Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82/logo.png",type:"20"},{address:"0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c",symbol:"BTCB",name:"BTCB Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c/logo.png",type:"20"},{address:"0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",blockTime:3e3};const Mf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAADxdJREFUeJztXVtzFMcVplwuP8VVeYmf7HJ+RKqSl/AQP6X8H+yqXUEIjhMnQY5jO9oVCIzA5mowdzAYG4xAGAyWLC5G3IyDL8gOASUYKrarYGZWC7qi23b6692VV6uZ7e6ZnT3di07VV6JUaLfnnG+6z+lz+vScOXUoL6SzP52/2PtlQ9p7piHlLU2k3P2JJqcjkXLO8589/OdN/tPjvx8VEP8Wv+sp/J8O/A3+Fp+Bz8JnUj/XrPjIwjT7ybxm57fJlLsy2eR2cwPe4QZksYB/Nr4D34XvxHdTP/8DJ+k0e4S/lb9Jpr2WZJNzgRtjPDaDS4DvFmPgY8GYMDZq/dStNKQzv0qmnA1c6RkqgysQIoMxYqzU+qoLWZDO/jyZdl7lir1ObdwQZLiOseMZqPVonSTS7i+4AtsTTW6O2pDR4ebEs/Bnotar8dKw2Pk1n0I76Y0W16zgdOIZqfVsnCSbvaeEB2+AkWpCBEQS/Jmp9U4u3Fl6nIdWB6gNQgb+7NABtR1qLjxcejiZdhfxKXGA3AjUswHXAXQBnVDbpSbCPeO5fAr8hlrxpgE6gW6o7ROb5N96Z3l9ePZxgUcMXEd1NxssbMk8kWxyztEr2A5AV3XjGySb3acTSLYYoFjL4EF31PYLLXwaeyiZcltnp/woEJtIrdAltT21BEkR7tnuo1dgfQC6tCbRlGh1H02k3C5qpalg/bt3WdOGDPk4lACdct1S27eiLEgPPMbDmcvkylLAgiUOc/sm2LHuITavmX48KoBun1828DNqO/tKsiX7JF+zeqmVpIqPzg2xyckc++Sfw2ImoB6POtxe6Jra3tMEb75Nxv/Hmxk2MZGbIsCpz4bZn1d45OPSIQF0Tm13IViXbJn2i+i9NcYgRQIA+zsGyMelA6Fzap8AnqktDl8RO9r7WVFKCQAs3dJHPj4tcN2TRQcizrcs1Hv+NZf1D04GEqDj/JBwDqnHqYNCiFj7fYL8Jg+9AnTQfXmYlUo5AYAtbffIx6lNAm6L2hpfbO/atcO3dGsfy+VyUgIAL66yySEE3FzNto2R2ElYtrffkHbYd7fHWbkEEeDQyUHk6cnHrQkPtonV+CKla2FWDx6+nwQRAFi5K0s+bl3ANrGmkvP5fPoH1cFfX/fYyP2cNgG6Lg6z55a55OPXJgG3UVzGn2vbug98fvW+r/FlBADePtJPPn59iKKS6lYW5ad++8q4Vu+5G2h8FQIAr663JFlUAtiqqksBZ1Uj9UPp4neLHeb0TUQmwNEzg2xemv559OE2VsX4KE2ysXoXhpOJCgGAdXttShblAZtVpayMe5Zt1A+ji5fXZdj4uL/jF4YApy4NsxdaLXQIue2iGb/Ze4r6IcLg6rejUuPrEAB47yO7kkVTJIhyAsnG41rYylUVHQIAizdZlixqyh9DC2V8HGKkHrwuELffHZiUWz4kAVBEAueS+jl1EepAqo2ndLFW64guAYBNB2xMFjmdWsbHWXbqQesC0zMMGjcBgEVv2JYs4tDpT5BvzmDAoBWBxM2tH8a0jB+FAAe77EsWwaZKxkdLE9u2fPce65dbu4oEAFp32JYscnNK7WrQ14Z+sOpAMefwiLrjVy0CdF0cYguX2rU3ANtKCWBTdS9wqWcklPGjEgDYcdiuZBEaV1U0PtqbUQ9SB6/vyoY2fjUIALy81q5kUcUWduhxRz1AVcxvdthtb2aVT60JcOT0oKg4otaHKmBjX+OLA50GN2Esx+FT8mRPLQgAIO1MrQ91ArgZ31JytDqlHpwqXlrjsbExvZg/TgKcvDTM/rjcHocQtp45/ae9FuqBqeLr/6gle2pFAAChKLVeVAFbzyRAk3OBemAq2LhfPdlTSwIA6Y12JItg62nGR9tzyq7bqljY4rK+e5WrfCgJcPzskHBOqfUkJQC39bRW9+h9Tz0oFXx8Yahqxo+DAMCGfXY4hLB5SfjnrqQekAypjRntZA8FAU5/NixK0an1JQNsXrL+m1/4ceM7/WRPJcExsas3Rtn7nQNVJ8GBj82vHppWKBLrNStVAOrzqyWjPHzEWQGEbjBW81t9bPn2LNt9tF/UE1SLBMu2Ge4QcpsL4+MyJPLBVADi68HhcMmeUrnbP8kufDUyw8ggQBHoD7Dt4D3WyX2NqASAv/L7Fnr9VYK4CAs3YlEPpBLOfxk+2QP5wRlnZy7ztTnAUKUEKGLJpj72JnfmUFoehQTbDpldPQTb8/Xfe5Z6IEHA1BxWem+N8rdd/ib7EaAUq/dkxZoelgTYtaTWYxBwJR7y/8uoB+IHnMbB26sjY+M59uU1vr5/qj6FywhQxIodWfbOh/2ioZQOAZCzMLV6CLafU7hUkXww5Wjr8j/S7Sdo+3LxyojSGx+WAFN+wtY+tp1P7V0afsIbbxtaPcRtb2T1b+Mqj90flcf8t91x1v158PoeBwGKWLy5j23kfsIxBT/h5KfDoj8RtV7LIaqFTcwBfHUt+Eg35L//G2WnqxSyhSVAKdZwP+FgV2U/Yc9R85JFIieQwH25BgymCHTt9JPxiRy7ch3xe/QQrdoEKGLlzqzICgb5CQb2Je6ZU7g0mXogAmjR5mWnJ3uwB3Dp65nxu4kEKGIZ9xN2tN9jJy5OJ6txfYm57TEDGNPwCdm0otzJTLCzX+T31uMwfJwEmNpP2NLHNu2/y453/0gEw/oSe3MK16dTD2Sqf+/N78diN3qtCDDlMG7qY2v33mWHTg6Y1ZeY294YAhw7Ozi1P19L1IIA0/yEXdxpfMeQWUAQwJAlAClUtHOrdwL8fW3GpBPGnlFOIIDp8lh3dT19EwiAJe4PprWdKziBRoWBALaB1/JpEhsothMAdYJY8w3dDhZh4HkDBuIL7J7t+qDfWgKg57BRYV85uO0xA3SQD0SCl9ZkRP9eWwjwyrqM8bUABXQYkwySpU0xhb62Lcs6z5u7E4idPpUDIn8ypeOYSAYZkg5esTPLPr0yIu2+gd1CnA3QTcvGSYA0B6IY2TpfXNLQxo5a30BDyluKI2HPUA+kCHj/qNlDDl0WKsGxevd49LAxqvGxPM2XjBV+AJpNYp/DpJ1AURBiUkkYvP9i9S9yAnjTZX+DaffoJ+H9g7CGR1j3nEKDCIS12OLGd6HGwaRoQJSEmVYU+rfVHhu+/2MR6LWbo+JMQGUmO6Lo4kSIsDFMWKfSNRRLWWnJOdrPm3aAVBSFmlgWXt7sEQc4kB+QKRBv5Pb2e7ERAIUqssbROL629eDMMSzZbFiZeLEs3NSDISjhLpeh4Umx7ssaMiD+bpMUaOgQAE6b7DYxjAkdS7ouzoxScFUdtT7LMe1giIlHw/AmORn/g6AoFlWps0OdP7p7hiUA/AuVUi74A+gU4vf5KC2XOYkkBCg9Gmbq4VBMm0gRBwkqgGX7B1A+PO+ggpKgsO4vK+VhHXwBVAAFkQuhqqk3kE07HGry8XDU5FcStIWHl40Zo9LnwH9AXZ6MAHBCZUe8EaLiFLBsL2LVbjOrgWccDze5QQTeQpX27zj6tV3hJM4r6zPsg5Lpemr7lv9eRiIA5V4dCruR+wxuLz+jQYTpLWIwHQ8MqZ0P/Pb7MdYiuQMYpMLOI87vIcRU2ZrFUnPwhNp+A7arTb5xzLdFjOlNorCTpio4+o0zhSBOpc+EZy+LKJDD33lYLyNpYPXvNPg2ibKhTRzqA3QE9wUiHAzTtgXx/po9+jUJpreTD2wTlw8HzW4UCY/e7wpYmSCc1NmDRxQQpioJOQzTbxgLbBSZXwbMbxWLmDtsj8B/3RiteA8gMnr7QtYlItEjW3JMQMVWsflZwL1OPUgZEM6FFWwrI2dQWp+H4o3NB/S2kMuBo+zUepFB2ixaEMCSdvFf/Lvy+UGZIKpAW5hiNBDF+Cae+/MlgEq7eFsujMAWbdSegdXoEoZNKFmewAwoXhhRWAasuDIGTRuitI57kNrFK18ZA7Hp0qgPz4RvHhmVACZV90ihc2lUfhYwr3GEHxrS4XsIRiEAchQmVfdUgva1cRCbLo58sayKKG4CIOdvWnVPxZckzMWRYhYwsFAkCDpXxkYlgHHVPRUQ+upYQQDLLo/W7SkYhgAoOaN+Ti0CRLk8GpJIOQeoH0IVSOfeCagiqgYBUH1sYnVPILjtIhkf0pDOPM6diAHyh1EEpufxClVEYQmA4o9Gi66Mhc1gu8gEgCTT7iLqB9KBrIooDAGM7fUXRABus6oYH5JOs4e5M/EN9UNpsF+0gq8WAd4zuLrH9/m5rWCzqhEAkkw7c23YIi4CmTl0EI1KAFHdY9UVsW4Otqqq8UtIsJz+AdWBJhNRCYD0M/Vz6AA2isX4kPxS4JyjfkgdVKoikhHgrfctC/m4bao+9ZfLwpbMEwlDGkupoFIVUSUCtJ80v7qnDB5sE6vxi5Jsdp+2yR9AFdCoTxVREAEwaxjTy08JfN3nNqmJ8adIkHJb6R9cHbt9qoiCCIBOJNTj1QFsUVPjQ/ha8xCPNfdRP7wOcFmUjAC7j9hR3TNlfG4D2KLmBCiQ4JFEyu2iVoIqyquIyglgT3VPAVz3gSXetZJEq/tossm9TK4MRbSWVBGVEwDtXqjHpwqhc657UuMXZUF64DHuiPRSK0UVOLJdTgCcPKIelzrcXuic2u7TJNmSfdIWEhSriIoEsKm6BzqGrqnt7StgpS3LAc7to+MIqntMvM/HD9CtcW9+uWBdssUxxDk+dPGiHocSoFNT1nyZiIOmloWIJqMQ6tF6+7oi9gnEZpE9O4bmwc1Bh2RxfjUkv21sT+7AIHg1396NS5CksC2LSAnoqmaJnVqJSCWLeoLZJSEYophjeewpXUpBtYpN5WW1AnQSWyWPaQKGc7Y32lRtHJvhhQ7cxrp+64NElJw3OW3URqB76522qpVu2yw4vWLTMbTohne7I5/YqUfBIUZbTiWHMjx/ttAHNR8kwVn2fJOKeogYxGZOu/b5/FnJt6vJ9yyyI8tYZvhejF25LcusVBa0N0OPO5ObWWJsGKO0FdushBckRdDqFP1u0fSYsss5vluMgY8FY7IuYVMPgrbn6H2PCxBEJBHn9Tf8s4UHz78L3zmj5fqsmCG4DAk3YiWbvGfFvYgpdz888EJL/J7Chdkerk8XEP8Wv+vJzyo8EsHf8L/FZ+Czpi5YqjP5P2ey0rAsl+yGAAAAAElFTkSuQmCC",Af="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png";var If={name:"ethereum",id:"0x1",networkId:"1",namespace:"eip155",platform:"evm",label:"Ethereum",fullName:"Ethereum Mainnet",logo:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbC1vcGFjaXR5Oi42MDJ9LnN0MCwuc3Qxe2ZpbGw6I2ZmZn08L3N0eWxlPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik01MTEuNCA3My4zdjMxNS41TDc3OCA1MDggNTExLjQgNzMuM3oiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJNNTExLjQgNzMuMyAyNDQuNyA1MDhsMjY2LjYtMTE5LjJWNzMuM3oiLz48cGF0aCBjbGFzcz0ic3QwIiBkPSJNNTExLjQgNzEyLjN2MjE0LjVsMjY2LjgtMzY5LjEtMjY2LjggMTU0LjZ6Ii8+PHBhdGggY2xhc3M9InN0MSIgZD0iTTUxMS40IDkyNi43VjcxMi4zTDI0NC43IDU1Ny42bDI2Ni43IDM2OS4xeiIvPjxwYXRoIGQ9Ik01MTEuNCA2NjIuNyA3NzggNTA4IDUxMS40IDM4OC44djI3My45eiIgZmlsbD0iI2ZmZiIgZmlsbC1vcGFjaXR5PSIuMiIvPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Im0yNDQuNyA1MDggMjY2LjYgMTU0LjdWMzg4LjhMMjQ0LjcgNTA4eiIvPjwvc3ZnPgo=",logoBackgroundColor:"#5683ec",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGltYWdlLXJlbmRlcmluZz0ib3B0aW1pemVRdWFsaXR5IiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiIgdGV4dC1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4PSIwIiB5PSIwIiB2aWV3Qm94PSIwIDAgMTAwMCAxMDAwIiB4bWw6c3BhY2U9InByZXNlcnZlIj48c3R5bGU+LnN0MXtmaWxsOiM4YzhjOGN9PC9zdHlsZT48cGF0aCBkPSJtNDk5LjggNzcuNS01LjUgMTl2NTU5LjFsNS41IDUuNSAyNTkuNy0xNTMuNUw0OTkuOCA3Ny41eiIgZmlsbD0iIzM0MzQzNCIvPjxwYXRoIGNsYXNzPSJzdDEiIGQ9Im00OTkuOCA3Ny41LTI1OS4zIDQzMEw0OTkuOCA2NjFWNzcuNXoiLz48cGF0aCBkPSJtNDk5LjggNzEwLjMtMi45IDR2MTk5LjFsMi45IDkuMSAyNTkuNy0zNjUuOC0yNTkuNyAxNTMuNnoiIGZpbGw9IiMzYzNjM2IiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJNNDk5LjggOTIyLjVWNzEwLjNMMjQwLjUgNTU2LjdsMjU5LjMgMzY1Ljh6Ii8+PHBhdGggZD0ibTQ5OS44IDY2MSAyNTkuNy0xNTMuNS0yNTkuNy0xMTcuOFY2NjF6IiBmaWxsPSIjMTQxNDE0Ii8+PHBhdGggZD0iTTI0MC41IDUwNy41IDQ5OS44IDY2MVYzODkuN0wyNDAuNSA1MDcuNXoiIGZpbGw9IiMzOTM5MzkiLz48L3N2Zz4K",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Mf},wrapped:{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",logo:Af,logoBackgroundColor:"#FFFFFF"},stables:{usd:["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7"]},explorer:"https://etherscan.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://etherscan.io/tx/${e.id||e}`:t?`https://etherscan.io/token/${t}`:n?`https://etherscan.io/address/${n}`:void 0,endpoints:["https://eth.llamarpc.com","https://ethereum.publicnode.com","https://eth.rpc.blxrbdn.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:Mf,type:"NATIVE"},{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:Af,type:"20"},{address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",symbol:"EUROC",name:"EURO Coin",decimals:6,logo:"https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/ethereum/assets/0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c/logo.png",type:"20"},{address:"0xdAC17F958D2ee523a2206206994597C13D831ec7",symbol:"USDT",name:"Tether USD",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0x6B175474E89094C44Da98b954EedeAC495271d0F",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x853d955aCEf822Db058eb8505911ED77F175b99e",symbol:"FRAX",name:"Frax",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x853d955aCEf822Db058eb8505911ED77F175b99e/logo.png",type:"20"},{address:"0x956F47F50A910163D8BF957Cf5846D573E7f87CA",symbol:"FEI",name:"Fei USD",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x956F47F50A910163D8BF957Cf5846D573E7f87CA/logo.png",type:"20"},{address:"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",symbol:"WBTC",name:"Wrapped BTC",decimals:8,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",type:"20"},{address:"0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",blockTime:12e3};const Nf="https://assets.trustwalletapp.com/blockchains/fantom/info/logo.png",Tf="https://assets.trustwalletapp.com/blockchains/fantom/assets/0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83/logo.png";var Ef={name:"fantom",id:"0xfa",networkId:"250",namespace:"eip155",label:"Fantom",fullName:"Fantom Opera",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00NjcgMTM1LjVjMTgtOS4zIDQ1LjEtOS4zIDYzIDBsMTgzLjQgOTdjMTAuNyA2LjEgMTYuNiAxNCAxOCAyMy4zdjQ4Ni42YzAgOS4zLTYuMSAxOS4yLTE4IDI1LjJsLTE4My4yIDk3Yy0xOCA5LjMtNDUuMSA5LjMtNjMgMGwtMTgzLjMtOTdjLTExLjktNi4xLTE3LjItMTUuOS0xOC0yNS4yVjI1NS43Yy43LTguNyA2LjctMTcuMiAxNy4yLTIzLjNMNDY3IDEzNS41em0yMzUuOCAzODkuNy0xNzIuNiA5MC45Yy0xOCA5LjMtNDUuMSA5LjMtNjMgMGwtMTcxLjktOTAuM3YyMTQuNGwxNzEuOSA5MC4zYzEwIDUuMyAyMC42IDEwLjcgMzEuMiAxMS4zaC43YzEwIDAgMjAtNS4zIDMwLjUtMTBsMTc0LTkyLjMtLjgtMjE0LjN6TTIzNy4zIDczMS4xYzAgMTguNiAyIDMxLjIgNi43IDM5LjggMy4zIDcuMyA4LjcgMTIuNiAxOC42IDE5LjJsLjcuN2MyIDEuNCA0LjcgMi42IDcuMyA0LjdsMy4zIDIgMTAuNyA2LjEtMTQuNiAyNC42LTExLjMtNy4zLTItMS40Yy0zLjMtMi02LjEtNC04LjctNS4zLTI3LjktMTguNi0zNy44LTM5LjItMzcuOC04MS42di0xLjRoMjcuMXpNNDg1IDM5Ni40Yy0xLjQuNy0yLjYuNy00IDEuNGwtMTgzLjIgOTYuOWgtLjcuN2wxODMuMyA5N2MxLjQuNyAyLjYgMS40IDQgMS40bC0uMS0xOTYuN3ptMjkuMyAwdjE5Ny44YzEuNC0uNyAyLjYtLjcgNC0xLjRsMTgzLjMtOTdoLjctLjdsLTE4My4zLTk4LjJjLTEuNC0uNS0yLjgtMS4yLTQtMS4yem0xODguNS0xMDctMTY0LjcgODYuMyAxNjQuNyA4Ni40VjI4OS40em0tNDA3LjcgMHYxNzMuM2wxNjQuNy04Ni4zLTE2NC43LTg3em0yMjIuNS0xMjhjLTkuMy01LjMtMjYuNS01LjMtMzYuNiAwbC0xODMuMiA5N2gtLjcuN2wxODMuMyA5N2M5LjMgNS4zIDI2LjUgNS4zIDM2LjYgMGwxODMuMy05N2guNy0uN2wtMTgzLjQtOTd6bTIxMi41IDkuMyAxMS4zIDcuMyAyIDEuNGMzLjMgMiA2LjEgNCA4LjcgNS4zIDI3LjkgMTguNiAzNy44IDM5LjIgMzcuOCA4MS42djEuNGgtMjguN2MwLTE4LjYtMi0zMS4yLTYuNy0zOS44LTMuMy03LjMtOC43LTEyLjYtMTguNi0xOS4ybC0uNy0uN2MtMi0xLjQtNC43LTIuNi03LjMtNC43bC0zLjMtMi0xMC43LTYuMSAxNi4yLTI0LjV6IiBmaWxsPSIjZmZmIi8+PC9zdmc+",logoBackgroundColor:"#226efb",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxjaXJjbGUgY3g9IjUwMCIgY3k9IjUwMCIgcj0iNDI1IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iIzE5NjlmZiIvPjxwYXRoIGQ9Ik00NzQuMSAyMTAuM2MxNC4zLTcuNCAzNS45LTcuNCA1MC4yIDBsMTQ1LjkgNzcuMmM4LjUgNC44IDEzLjIgMTEuMSAxNC4zIDE4LjV2Mzg3LjVjMCA3LjQtNC44IDE1LjMtMTQuMyAyMC4xbC0xNDUuOSA3Ny4yYy0xNC4zIDcuNC0zNS45IDcuNC01MC4yIDBsLTE0NS45LTc3LjJjLTkuNS00LjgtMTMuNy0xMi43LTE0LjMtMjAuMVYzMDZjLjUtNi45IDUuMy0xMy43IDEzLjctMTguNS4xIDAgMTQ2LjUtNzcuMiAxNDYuNS03Ny4yem0xODcuNyAzMTAuM0w1MjQuMyA1OTNjLTE0LjMgNy40LTM1LjkgNy40LTUwLjIgMGwtMTM2LjktNzEuOXYxNzAuN2wxMzYuOSA3MS45YzcuOSA0LjIgMTYuNCA4LjUgMjQuOCA5aC41YzcuOSAwIDE1LjktNC4yIDI0LjMtNy45bDEzOC41LTczLjVWNTIwLjZoLS40ek0yOTEuMiA2ODQuNWMwIDE0LjggMS42IDI0LjggNS4zIDMxLjcgMi42IDUuOCA2LjkgMTAgMTQuOCAxNS4zbC41LjVjMS42IDEuMSAzLjcgMi4xIDUuOCAzLjdsMi42IDEuNiA4LjUgNC44LTExLjYgMTkuNi05LTUuOC0xLjYtMS4xYy0yLjYtMS42LTQuOC0zLjItNi45LTQuMi0yMi4yLTE0LjgtMzAuMS0zMS4yLTMwLjEtNjV2LTEuMWgyMS43em0xOTcuMi0yNjYuNGMtMS4xLjUtMi4xLjUtMy4yIDEuMWwtMTQ1LjkgNzcuMmgtLjUuNWwxNDUuOSA3Ny4yYzEuMS41IDIuMSAxLjEgMy4yIDEuMVY0MTguMXptMjMuMiAwdjE1Ny41YzEuMS0uNSAyLjEtLjUgMy4yLTEuMWwxNDUuOS03Ny4yaC41LS41bC0xNDUuOS03OC4yYy0xLjEtLjUtMi4xLTEtMy4yLTF6TTY2MS44IDMzM2wtMTMxLjEgNjguNyAxMzEuMSA2OC43VjMzM3ptLTMyNC42IDB2MTM4bDEzMS4xLTY4LjdjMC0uMS0xMzEuMS02OS4zLTEzMS4xLTY5LjN6bTE3Ny4xLTEwMi4xYy03LjQtNC4yLTIxLjEtNC4yLTI5LjEgMGwtMTQ1LjkgNzcuMmgtLjUuNWwxNDUuOSA3Ny4yYzcuNCA0LjIgMjEuMSA0LjIgMjkuMSAwbDE0NS45LTc3LjJoLjUtLjVsLTE0NS45LTc3LjJ6bTE2OS4xIDcuNCA5IDUuOCAxLjYgMS4xYzIuNiAxLjYgNC44IDMuMiA2LjkgNC4yIDIyLjIgMTQuOCAzMC4xIDMxLjIgMzAuMSA2NXYxLjFoLTIyLjdjMC0xNC44LTEuNi0yNC44LTUuMy0zMS43LTIuNi01LjgtNi45LTEwLTE0LjgtMTUuM2wtLjUtLjVjLTEuNi0xLjEtMy43LTIuMS01LjgtMy43bC0yLjYtMS42LTguNS00LjggMTIuNi0xOS42eiIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==",currency:{name:"Fantom",symbol:"FTM",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Nf},wrapped:{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",logo:Tf},stables:{usd:["0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf","0x1B6382DBDEa11d97f24495C9A90b7c88469134a4"]},explorer:"https://ftmscan.com",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://ftmscan.com/tx/${e.id||e}`:t?`https://ftmscan.com/token/${t}`:n?`https://ftmscan.com/address/${n}`:void 0,endpoints:["https://rpc.fantom.network","https://fantom.publicnode.com","https://rpc2.fantom.network"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"FTM",name:"Fantom",decimals:18,logo:Nf,type:"NATIVE"},{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",symbol:"WFTM",name:"Wrapped Fantom",decimals:18,logo:Tf,type:"20"},{address:"0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf",symbol:"lzUSDC",name:"LayerZero USDC",decimals:6,logo:"https://ftmscan.com/token/images/axlusdc_32.png",type:"20"},{address:"0x1B6382DBDEa11d97f24495C9A90b7c88469134a4",symbol:"axlUSDC",name:"Axelar Wrapped USDC",decimals:6,logo:"https://ftmscan.com/token/images/axlusdc_32.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",blockTime:1e3};const xf="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/polygon/info/logo.png",kf="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/polygon/assets/0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270/logo.png";var Lf={name:"polygon",id:"0x89",networkId:"137",namespace:"eip155",label:"Polygon (POS)",fullName:"Polygon (POS) Mainnet",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0xMzEuNSA0NTkuM2MtMTQuNCA5LjYtMjQgMjQtMjQgNDMuMnYxOTQuNGMwIDE5LjIgOS42IDM2IDI0IDQzLjJsMTY1LjYgOTZjMTQuNCA5LjYgMzMuNiA5LjYgNDggMGwxNjUuNi05NmMxNC40LTkuNiAyNC0yNCAyNC00My4ydi02OS42bC03Ni44LTQzLjJ2NjQuOGMwIDE5LjItOS42IDM2LTI0IDQzLjJsLTg2LjQgNTIuOGMtMTQuNCA5LjYtMzMuNiA5LjYtNDggMGwtODYuNC01MC40Yy0xNC40LTkuNi0yNC0yNC0yNC00My4yVjU1MC41YzAtMTkuMiA5LjYtMzYgMjQtNDMuMmw4OC44LTUwLjRjMTQuNC05LjYgMzMuNi05LjYgNDggMGwxMTIuOCA2NC44IDc2LjggNDUuNiAxMTIuOCA2NC44YzE0LjQgOS42IDMzLjYgOS42IDQ4IDBsMTY4LTk2YzE0LjQtOS42IDI0LTI0IDI0LTQzLjJ2LTE5MmMwLTE0LjQtOS42LTMxLjItMjQtNDAuOGwtMTY4LTk2Yy0xNC40LTkuNi0zMy42LTkuNi00OCAwbC0xNjUuNiA5NmMtMTQuNCA5LjYtMjQgMjQtMjQgNDMuMnY2OS42bDc2LjggNDUuNnYtNjkuNmMwLTE5LjIgOS42LTM2IDI0LTQzLjJsODguOC01Mi44YzE0LjQtOS42IDMzLjYtOS42IDQ4IDBsODguOCA1MC40YzE0LjQgOS42IDI0IDI0IDI0IDQzLjJ2MTAwLjhjMCAxOS4yLTEyIDM2LTI0IDQzLjJsLTg4LjggNTIuOGMtMTQuNCA5LjYtMzMuNiA5LjYtNDggMGwtMTEyLjgtNjkuNi03OS4yLTQzLjItMTE3LjYtNjkuNmMtMTQuNC05LjYtMzMuNi05LjYtNDggMCAwIDIuNC0xNjAuOCA5OC40LTE2My4yIDk4LjR6IiBmaWxsPSIjZmZmIi8+PC9zdmc+",logoBackgroundColor:"#824ee2",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0xMDkuNyA0NTljLTE2LjQgOS40LTI1LjggMjUuOC0yNS44IDQ2Ljl2MjA2LjNjMCAyMS4xIDkuNCAzNy41IDI1LjggNDYuOWwxNzUuOCAxMDMuMWMxNi40IDkuNCAzNS4yIDkuNCA1MS42IDBsMTc1LjgtMTAzLjFjMTYuNC05LjQgMjUuOC0yNS44IDI1LjgtNDYuOXYtNzIuN2wtODItNDYuOXY2OGMwIDIxLjEtOS40IDM3LjUtMjUuOCA0Ni45TDMzNyA3NjEuNGMtMTYuNCA5LjQtMzUuMiA5LjQtNTEuNiAwTDE5NCA3MDcuNWMtMTYuNC05LjQtMjUuOC0yNS44LTI1LjgtNDYuOVY1NTIuOGMwLTIxLjEgOS40LTM3LjUgMjUuOC00Ni45bDkzLjgtNTMuOWMxNC4xLTkuNCAzNS4yLTkuNCA1MS42IDBsMTE5LjUgNjggODIgNDkuMiAxMTkuNSA2OGMxNi40IDkuNCAzNS4yIDkuNCA1MS42IDBMODkwLjIgNTM0YzE2LjQtOS40IDI1LjgtMjUuOCAyNS44LTQ2LjlWMjgzLjJjMC0xNi40LTkuNC0zMi44LTI1LjgtNDIuMkw3MTIuMSAxMzcuOWMtMTYuNC05LjQtMzUuMi05LjQtNTEuNiAwTDQ4NC43IDI0MWMtMTYuNCA5LjQtMjUuOCAyNS44LTI1LjggNDYuOXY3NWw4MiA0OS4ydi03Mi43YzAtMjEuMSA5LjQtMzcuNSAyNS44LTQ2LjlsOTMuOC01Ni4zYzE2LjQtOS40IDM1LjItOS40IDUxLjYgMGw5My44IDUzLjljMTQuMSA5LjQgMjUuOCAyNS44IDI1LjggNDYuOXYxMDhjMCAyMS4xLTExLjcgMzcuNS0yNS44IDQ2LjlsLTkzLjggNTYuM2MtMTQuMSA5LjQtMzUuMiA5LjQtNTEuNiAwTDU0MSA0NzUuNGwtODItNDYuOS0xMjQuMi03Mi43Yy0xNC4xLTkuNC0zNS4yLTkuNC01MS42IDAtLjEuMS0xNzEuMiAxMDMuMi0xNzMuNSAxMDMuMnoiIGZpbGw9IiM4MjQ3ZTUiLz48L3N2Zz4=",currency:{name:"Polygon",symbol:"MATIC",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:xf},wrapped:{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",logo:kf},stables:{usd:["0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359","0xc2132D05D31c914a87C6611C10748AEb04B58e8F"]},explorer:"https://polygonscan.com",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://polygonscan.com/tx/${e.id||e}`:t?`https://polygonscan.com/token/${t}`:n?`https://polygonscan.com/address/${n}`:void 0,endpoints:["https://polygon-bor-rpc.publicnode.com","https://polygon.llamarpc.com","https://polygon-bor.publicnode.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"MATIC",name:"Polygon",decimals:18,logo:xf,type:"NATIVE"},{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",symbol:"WMATIC",name:"Wrapped Matic",decimals:18,logo:kf,type:"20"},{address:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",symbol:"USDT",name:"Tether USD",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",type:"20"},{address:"0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6",symbol:"WBTC",name:"Wrapped BTC",decimals:8,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",type:"20"},{address:"0xf6261529C6C2fBEB313aB25cDEcD243613b40EB5",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",blockTime:2e3};const Sf="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDF7ZmlsbDp1cmwoI1NWR0lEXzAwMDAwMDE5Njc2ODQzODE5NzI3MzAwODIwMDAwMDA1OTQ3NjMyODMzODYxMjM4OTE3Xyl9LnN0MntmaWxsOnVybCgjU1ZHSURfMDAwMDAwNjQzMjA1MjE4MTcxODM4NzM1NjAwMDAwMDMxNzkyNDIxNTkzMzkwODM5NjdfKX08L3N0eWxlPjxsaW5lYXJHcmFkaWVudCBpZD0iU1ZHSURfMV8iIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iODE1Ljg1NiIgeTE9IjcwLjgyNCIgeDI9IjM4OC4zMzYiIHkyPSItNzQ4LjA1MiIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDE5MS40MzUpIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiMwMGZmYTMiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNkYzFmZmYiLz48L2xpbmVhckdyYWRpZW50PjxwYXRoIGQ9Ik0yMzcuOSA2NTcuOWM0LjktNC45IDEyLjItNy4zIDE3LjEtNy4zaDYxOS43YzEyLjIgMCAxNy4xIDE0LjcgOS44IDIyTDc2Mi4xIDc5NS4xYy00LjkgNC45LTEyLjIgNy4zLTE3LjEgNy4zSDEyNS4zYy0xMi4yIDAtMTcuMS0xNC43LTkuOC0yNC41bDEyMi40LTEyMHoiIGZpbGw9InVybCgjU1ZHSURfMV8pIi8+PGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8wMDAwMDE1MDgxNTQ0MzI2NzI2OTc2MDQ0MDAwMDAxMzQ2MDgyNDM3MDQwMzE3MjU0M18iIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iNjI4LjQ4MSIgeTE9IjE2NC4xMzQiIHgyPSIyMDAuOTYyIiB5Mj0iLTY1NC43NCIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDE5MS40MzUpIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiMwMGZmYTMiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNkYzFmZmYiLz48L2xpbmVhckdyYWRpZW50PjxwYXRoIGQ9Ik0yMzcuOSAyMDQuOGM0LjktNC45IDEyLjItNy4zIDE3LjEtNy4zaDYxOS43YzEyLjIgMCAxNy4xIDE0LjcgOS44IDIyTDc2Mi4xIDM0MmMtNC45IDQuOS0xMi4yIDcuMy0xNy4xIDcuM0gxMjUuM2MtMTIuMiAwLTE3LjEtMTQuNy05LjgtMjJsMTIyLjQtMTIyLjV6IiBmaWxsPSJ1cmwoI1NWR0lEXzAwMDAwMTUwODE1NDQzMjY3MjY5NzYwNDQwMDAwMDEzNDYwODI0MzcwNDAzMTcyNTQzXykiLz48bGluZWFyR3JhZGllbnQgaWQ9IlNWR0lEXzAwMDAwMDA3NDA5ODc3MzYzMTA0OTgxNjMwMDAwMDE1MTMzNzA1NTcwNjgwMDk3NzA5XyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI3MjAuOTIzIiB5MT0iMTE1Ljg3IiB4Mj0iMjkzLjQwNiIgeTI9Ii03MDMuMDAzIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIC0xIDAgMTkxLjQzNSkiPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzAwZmZhMyIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2RjMWZmZiIvPjwvbGluZWFyR3JhZGllbnQ+PHBhdGggZD0iTTc2Mi4xIDQzMC4xYy00LjktNC45LTEyLjItNy4zLTE3LjEtNy4zSDEyNS4zYy0xMi4yIDAtMTcuMSAxNC43LTkuOCAyMkwyMzggNTY3LjNjNC45IDQuOSAxMi4yIDcuMyAxNy4xIDcuM2g2MTkuN2MxMi4yIDAgMTcuMS0xNC43IDkuOC0yMkw3NjIuMSA0MzAuMXoiIGZpbGw9InVybCgjU1ZHSURfMDAwMDAwMDc0MDk4NzczNjMxMDQ5ODE2MzAwMDAwMTUxMzM3MDU1NzA2ODAwOTc3MDlfKSIvPjwvc3ZnPgo=",jf="https://img.raydium.io/icon/So11111111111111111111111111111111111111112.png";var Df={name:"solana",networkId:"solana",namespace:"solana",label:"Solana",fullName:"Solana Mainnet Beta",logo:Sf,logoBackgroundColor:"#000000",logoWhiteBackground:Sf,currency:{name:"Solana",symbol:"SOL",decimals:9,address:"11111111111111111111111111111111",logo:jf},wrapped:{address:"So11111111111111111111111111111111111111112",logo:jf},stables:{usd:["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"]},explorer:"https://solscan.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://solscan.io/tx/${e.id||e}`:t?`https://solscan.io/token/${t}`:n?`https://solscan.io/address/${n}`:void 0,endpoints:["https://solana-mainnet.g.alchemy.com/v2/demo","https://solana-rpc.publicnode.com","https://endpoints.omniatech.io/v1/sol/mainnet/public"],sockets:["wss://solana.drpc.org","wss://mainnet-beta.solflare.network","wss://solana-rpc.publicnode.com"],tokens:[{address:"11111111111111111111111111111111",symbol:"SOL",name:"Solana",decimals:9,logo:jf,type:"NATIVE"},{address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://img.raydium.io/icon/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v.png",type:"SPL"},{address:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",symbol:"USDT",name:"USDT",decimals:6,logo:"https://img.raydium.io/icon/Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB.png",type:"SPL"},{address:"7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj",symbol:"stSOL",name:"Lido Staked SOL",decimals:9,logo:"https://img.raydium.io/icon/7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj.png",type:"SPL"},{address:"DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",symbol:"BONK",name:"BONK",decimals:5,logo:"https://img.raydium.io/icon/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263.png",type:"SPL"},{address:"7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",symbol:"SAMO",name:"Samoyed Coin",decimals:9,logo:"https://img.raydium.io/icon/7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU.png",type:"SPL"},{address:"DePay1miDBPWXs6PVQrdC5Vch2jemgEPaiyXLNLLa2NF",symbol:"DEPAY",name:"DePay",decimals:9,logo:"https://depay.com/favicon.png",type:"SPL"}],zero:"0",maxInt:"340282366920938463463374607431768211455",permit2:void 0,blockTime:500};const Cf="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDF7ZmlsbDojMjEzMTQ3fTwvc3R5bGU+PHBhdGggZD0iTTkyIDkyaDgxNnY4MTZIOTJWOTJ6IiBmaWxsPSJub25lIi8+PHBhdGggY2xhc3M9InN0MSIgZD0iTTE2NS44IDM0MC4xVjY2MGMwIDIwLjYgMTAuOCAzOS4yIDI4LjcgNDkuNmwyNzcuMSAxNTkuOWMxNy42IDEwLjEgMzkuNSAxMC4xIDU3LjEgMGwyNzcuMS0xNTkuOWMxNy42LTEwLjEgMjguNy0yOSAyOC43LTQ5LjZWMzQwLjFjMC0yMC42LTEwLjgtMzkuMi0yOC43LTQ5LjZsLTI3Ny4xLTE2MGMtMTcuNi0xMC4xLTM5LjUtMTAuMS01Ny4xIDBsLTI3Ny4xIDE2MGMtMTcuNiAxMC4xLTI4LjQgMjktMjguNCA0OS42aC0uM3oiLz48cGF0aCBkPSJtNTYwLjQgNTYyLTM5LjUgMTA4LjRjLTEgMi45LTEgNi4yIDAgOS41bDY3LjkgMTg2LjQgNzguNi00NS40LTk0LjMtMjU4LjhjLTIuMy02LTEwLjQtNi0xMi43LS4xem03OS4zLTE4Mi4xYy0yLjMtNS45LTEwLjQtNS45LTEyLjcgMGwtMzkuNSAxMDguNGMtMSAyLjktMSA2LjIgMCA5LjVMNjk4LjggODAzbDc4LjYtNDUuNC0xMzcuNy0zNzcuNHYtLjN6IiBmaWxsPSIjMTJhYWZmIi8+PHBhdGggZD0iTTUwMCAxNDIuNmMyIDAgMy45LjYgNS41IDEuNmwyOTkuNiAxNzNjMy42IDIgNS41IDUuOSA1LjUgOS44djM0NmMwIDMuOS0yLjMgNy44LTUuNSA5LjhsLTI5OS42IDE3M2MtMS42IDEtMy42IDEuNi01LjUgMS42cy0zLjktLjYtNS41LTEuNmwtMjk5LjYtMTczYy0zLjYtMi01LjUtNS45LTUuNS05LjhWMzI2LjdjMC0zLjkgMi4zLTcuOCA1LjUtOS44bDI5OS42LTE3M2MxLjYtMSAzLjYtMS42IDUuNS0xLjZ2LjN6bTAtNTAuNmMtMTAuOCAwLTIxLjIgMi42LTMxIDguMmwtMjk5LjYgMTczYy0xOS4yIDExLjEtMzEgMzEuMy0zMSA1My41djM0NmMwIDIyLjIgMTEuOCA0Mi40IDMxIDUzLjVsMjk5LjYgMTczYzkuNSA1LjUgMjAuMiA4LjIgMzEgOC4yczIxLjItMi42IDMxLTguMmwyOTkuNi0xNzNjMTkuMi0xMS4xIDMxLTMxLjMgMzEtNTMuNXYtMzQ2YzAtMjIuMi0xMS44LTQyLjQtMzEtNTMuNWwtMjk5LjktMTczYy05LjUtNS41LTIwLjItOC4yLTMxLTguMmguM3oiIGZpbGw9IiM5ZGNjZWQiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJtMzAxLjUgODAzLjIgMjcuOC03NS43IDU1LjUgNDYtNTEuOSA0Ny43LTMxLjQtMTh6Ii8+PHBhdGggZD0iTTQ3NC41IDMwMi4yaC03Ni4xYy01LjUgMC0xMC44IDMuNi0xMi43IDguOEwyMjIuOSA3NTcuNWw3OC42IDQ1LjRMNDgxLjEgMzExYzEuNi00LjYtMS42LTkuMS02LjItOS4xbC0uNC4zem0xMzMuMiAwaC03Ni4xYy01LjUgMC0xMC44IDMuNi0xMi43IDguOGwtMTg2IDUwOS44IDc4LjYgNDUuNEw2MTMuOSAzMTFjMS42LTQuNi0xLjYtOS4xLTYuMi05LjF2LjN6IiBmaWxsPSIjZmZmIi8+PC9zdmc+Cg==";var Of={name:"arbitrum",id:"0xa4b1",networkId:"42161",namespace:"eip155",platform:"evm",label:"Arbitrum",fullName:"Arbitrum One",logo:Cf,logoBackgroundColor:"#2b354d",logoWhiteBackground:Cf,currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:If.currency.logo},wrapped:{address:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",logo:If.wrapped.logo},stables:{usd:["0xaf88d065e77c8cC2239327C5EDb3A432268e5831","0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"]},explorer:"https://arbiscan.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://arbiscan.io/tx/${e.id||e}`:t?`https://arbiscan.io/token/${t}`:n?`https://arbiscan.io/address/${n}`:void 0,endpoints:["https://arbitrum.llamarpc.com","https://arbitrum-one.publicnode.com","https://arbitrum.rpc.thirdweb.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:If.currency.logo,type:"NATIVE"},{address:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:If.wrapped.logo,type:"20"},{address:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8/logo.png",type:"20"},{address:"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9/logo.png",type:"20"},{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1/logo.png",type:"20"},{address:"0x912CE59144191C1204E64559FE8253a0e49E6548",symbol:"ARB",name:"Arbitrum",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0x912CE59144191C1204E64559FE8253a0e49E6548/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",blockTime:250};const zf="https://traderjoexyz.com/static/media/avalanche.7c81486190237e87e238c029fd746008.svg",Pf="https://raw.githubusercontent.com/traderjoe-xyz/joe-tokenlists/main/logos/0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7/logo.png";var _f={name:"avalanche",id:"0xa86a",networkId:"43114",namespace:"eip155",platform:"evm",label:"Avalanche",fullName:"Avalanche C-Chain",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0zNTkuMSA3NTEuMWgtOTUuM2MtMjAgMC0yOS45IDAtMzYtMy44LTYuNi00LjMtMTAuNC0xMS4zLTEwLjktMTguOS0uMy03LjEgNC42LTE1LjggMTQuNC0zM2wyMzUtNDE0LjNjMTAuMS0xNy42IDE1LjEtMjYuNCAyMS40LTI5LjYgNi45LTMuNSAxNS4xLTMuNSAyMS45IDAgNi40IDMuMyAxMS40IDEyIDIxLjQgMjkuNmw0OC40IDg0LjMuMi41YzEwLjggMTguOSAxNi4zIDI4LjUgMTguNiAzOC41IDIuNiAxMC45IDIuNiAyMi42IDAgMzMuNS0yLjQgMTAuMS03LjggMTkuOC0xOC44IDM4LjlMNDU2LjIgNjk0LjlsLS4zLjVjLTEwLjggMTktMTYuMyAyOC43LTI0LjEgMzYtOC4zIDgtMTguMyAxMy43LTI5LjMgMTYuOS05LjkgMi44LTIxLjEgMi44LTQzLjQgMi44em0yNDAuMyAwaDEzNi40YzIwLjIgMCAzMC4yIDAgMzYuMy00IDYuNi00LjMgMTAuNi0xMS4zIDEwLjktMTkuMS4zLTYuOS00LjUtMTUuMi0xMy45LTMxLjZsLTEtMS43TDY5OS44IDU3OGwtLjgtMS4yYy05LjYtMTYuMy0xNC40LTI0LjUtMjAuNy0yNy42LTYuOS0zLjYtMTUtMy42LTIxLjcgMC02LjIgMy4zLTExLjMgMTEuOC0yMS4zIDI5bC02OC4xIDExNi45LS4yLjNjLTEwLjEgMTcuMi0xNSAyNS44LTE0LjUgMzIuOC41IDcuNyA0LjUgMTQuOSAxMC45IDE5IDUuNyAzLjkgMTUuOCAzLjkgMzYgMy45eiIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",logoBackgroundColor:"#E84142",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0yMzUuNiAyNTkuNWg1MjguOXY0ODFIMjM1LjZ2LTQ4MXoiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJNOTI4IDUwMGMwIDIzNi40LTE5MS42IDQyOC00MjggNDI4UzcyIDczNi40IDcyIDUwMCAyNjMuNiA3MiA1MDAgNzJzNDI4IDE5MS42IDQyOCA0Mjh6TTM3OC43IDY3MC4zaC04My4xYy0xNy41IDAtMjYuMSAwLTMxLjMtMy40LTUuNy0zLjctOS4xLTkuOC05LjYtMTYuNS0uMy02LjIgNC0xMy44IDEyLjYtMjguOUw0NzIuNSAyNjBjOC43LTE1LjQgMTMuMS0yMyAxOC43LTI1LjkgNi0zIDEzLjEtMyAxOS4xIDAgNS42IDIuOCAxMCAxMC41IDE4LjcgMjUuOWw0Mi4yIDczLjYuMi40YzkuNCAxNi41IDE0LjIgMjQuOCAxNi4zIDMzLjYgMi4zIDkuNiAyLjMgMTkuNiAwIDI5LjItMi4xIDguOC02LjggMTcuMi0xNi40IDM0TDQ2My42IDYyMS4ybC0uMy41Yy05LjUgMTYuNi0xNC4zIDI1LTIxIDMxLjQtNy4zIDYuOS0xNiAxMi0yNS41IDE0LjgtOC43IDIuNC0xOC41IDIuNC0zOC4xIDIuNHptMjA5LjggMGgxMTljMTcuNiAwIDI2LjQgMCAzMS43LTMuNSA1LjctMy43IDkuMi05LjkgOS42LTE2LjYuMy02LTMuOS0xMy4zLTEyLjItMjcuNWwtLjktMS41LTU5LjYtMTAyLS43LTEuMWMtOC40LTE0LjItMTIuNi0yMS4zLTE4LTI0LjEtNi0zLTEzLjEtMy0xOSAwLTUuNSAyLjgtOS45IDEwLjMtMTguNiAyNS4zbC01OS40IDEwMi0uMi40Yy04LjcgMTUtMTMgMjIuNS0xMi43IDI4LjcuNCA2LjcgMy45IDEyLjkgOS42IDE2LjYgNSAzLjMgMTMuOCAzLjMgMzEuNCAzLjN6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2U4NDE0MiIvPjwvc3ZnPg==",currency:{name:"Avalanche",symbol:"AVAX",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:zf},wrapped:{address:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",logo:Pf},stables:{usd:["0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7","0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"]},explorer:"https://snowtrace.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://snowtrace.io/tx/${e.id||e}`:t?`https://snowtrace.io/token/${t}`:n?`https://snowtrace.io/address/${n}`:void 0,endpoints:["https://avalanche-c-chain-rpc.publicnode.com","https://avalanche-c-chain.publicnode.com","https://avalanche-api.flare.network/ext/bc/C/rpc"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"AVAX",name:"Avalanche",decimals:18,logo:zf,type:"NATIVE"},{address:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",symbol:"WAVAX",name:"Wrapped AVAX",decimals:18,logo:Pf,type:"20"},{address:"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7/logo.png",type:"20"},{address:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E/logo.png",type:"20"},{address:"0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xd586E7F844cEa2F87f50152665BCbc2C279D8d70/logo.png",type:"20"},{address:"0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD",symbol:"EUROC",name:"EURO Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",blockTime:2e3};const Bf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALsAAAC7CAMAAAAKTh9YAAAAYFBMVEVHcEz////////////////////////////////////j++ma6qVj5nsl5lAK4zpA6mXO79aD8Zyr87uCvq0J2TkItEkOhl4EeVsKzSwLrxMNtQpjsZG42dEeuxyF2oU6wzjPwJjeAAAACnRSTlMAEUB9r9j/YO+Kf6/iMwAABD1JREFUeAHU1EESQjEMAlBIAq33v7ArV7+OLss7AZOB4IDVI/kW0nQRf+Ca7QvNwg/s7VtpGJP8oPFNybdT4aidoPHEcYZn6ymnEEOjH8KPk0zeTI+DLacpfMhpxKTGnFtDB9o8/Jisw8uxh1/OtGIrYw9Ah9pEOVWhnaoxTvWCnErR2Z3rzX59JMYOAkEYXr1gRJfIzP1PalbOpZm2aEf+tcKnCCz7bS37si/7si/7si/7si/7srvRHAE5kJHdbV4wkn076Q9RMMLu04fYnceT/An9JnhMkr19Ezwvvvee73ieOL1dfdN15yQlwas2S7vbgTn4iLfaDO0emIPPeLtgZt+AOfhcQHJGdieYg88VLG9k98AUfG7gBRu7YAo+9wpeNLEnYAY+915wkIndQ4Xn9IajgoV9hwbP6b3iqGRhF5zH537VHi3swGl87tft3tB+Ap/7Z9lFhef0z3hndmjwnP4Z32qEAs/po4//Rwao8JzeC3hiMyeACs/ppnMCUlThOf3wxjurObAKz+kHNz5arT0CNHhO5zde7NZ8UYXn9N4K2Utnt8NzOsFL+Kuz2+EJneA5nduN8bmTWsXzKqNzuyX+FZ3rL43Sud0Un/txtV7KqNY+6Hq7Kb71Gxt0W7seX5od/Z6a+8BuGASCMMwraRK4103A9z9leq+Q3zCYC+h7oy7tbr6d4zGd2zme04Ed4AEd2AEe0Kmd4wGd2jke0Kmd4wGd2jke0Kmd4wGd2jke0Kmd4wGd2Tl+B+jQzvH7j/ThnNub4Xd7Rud2gLc9pyM7wO9sz+nEDvA7e8G/0vX2IeTan/DXPdWL+cwD/hl/c3r2lT2u7XbWk31aYt9vesp9yD5Xn1ZPx7svtNtMYwfX9/hqjwAvuq8awIufZwzgxc+RZgAvfn43gBe/N5lxPLAD+sTs2HgnS53jnS51jHfC1CneKVOHeCdNneGdNnWEd+LUCd6pUwd4p04d4J06dYB3tekAL64nSAAvr+PgeGYHdI6ndkDneGoHdI4HdkAvxw/V7IsiegU8sIdSejk+VbIvyumveBY8twdQh51A8PL691x8PBf3HRD8oO33QPhR2mfD8EnZ3wTxXthXRvFe18+H8anbPsqkOVfnnJ6DF/RmPdE5vs69aQiYnoH3rXuzXukcP6jmE3C8734uxAgfgSvM4+D4RcV37SmgZ+BT6/kz0yd6KT5+kcex9bel+fDPupXP+MOs8byl6esGYfRxbDPnanG0OVf+8ODeH9Ks5f+mE50vJlp37d23EQQhFATRr6Yg/4RPuSe9o6tmIni7gN2222677bbbbrvttttuu5sw/7EP1j7kfhO6m5Wbak90Jw7d54NeGsV9jb0y1B+f+P5qpHB08XvD8M4zrq9N7pqje/L8jj/twXa8XOl4uSoe4/363RnvlyOo/LE1R8JnZfywrB7pGLY0Xa/gV5AhY9e5oJHCAAAAAElFTkSuQmCC",Rf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALsAAAC7CAYAAAA9kO9qAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0PSURBVHgB7d1LbFzVHcfx37l3/CDGxgkhxEnU2K1EgxoUN0kVUglhIhbdVAo7dpCiSl2BqbqphIRpuy5u95SwY1XSWlXVIhFXtGqjJsXQSJRCsXklaQiJ8zCxPTP3cv53cuOxZ8bjmbmP8z/n/5GMHcfjmPHXZ86ce++xQpJGxwdRwChCtQ9Q+nU4qt87CIVhCLGeEHP6v/NQag5h8DY8TKOEGcxMziMhCp2iwD0c1V/kE/QnUNxCJGdavxzHmRdfQYfajz2K3HsGKhyHBC7SN6dznUY5eEGP9nNoQ+uxS+Qib6GawL9++QJa1FrsB8fH9D/0sn5rGELka04PuMdwenJ6ozfwN/qB2D/+vP7ZOA4ZzYUZdIfqSQx9Fzj/979s5AbNR3aatvieHs3DoxDCSOqEnssfa7Zys37s0VKiOqmXhUYhhMlCvUwZhI+sF3zj2CV0wU2T4L2GN6Spi4QuOFG612jKXV/9J6j0ZFThRxCCnz2NnrTWTmMqy4snIQRnSk9n1ixL1k5jKuvoQvBGHdPzziqrY4/W0uWAkbDCMDw1Xv2OlWnM6PgwfDULIewxj3I4Eq/OrIzsvpqAEHYZrB7dq6cxD0MI2yg8E8/dK7HvH38SMlcXdqpcb4E49sqFF0LY6VbfqnKil7oCIewVPVH1omtGhbBbdG20hwBjEMJ2AcWuvH0QwnYK+zyE4TCEsF2oaGSXy+yEA3TntPQ4DCHsN+xBCEdI7MIZErtwhsQunCGxC2dI7MIZErtwhsQunCGxC2dI7MIZErtwhsQunCGxC2dI7MIZErtwRgEWU30loK9c+cOCj3DB6v/dtqltS7ffDi/2wFZWffcpbv/IJXh7r8Hfe70SexWKPZjdhPKpzdGLzd/Y9dD9Uzh0BR69VIUeo/somO1D6c0tCN6y50I2hQPPhmCORqauxz9D4cjnLd2u9MY9KL6605noC9+/EN1PaweB9dB9Q/cR3VfcsY+9nW/gWsWpIRRf+hpspUa+RM/T/4OnX7eLol987n7WAwPb2Cnurqdn9cPxZSTBhm9mPfRo1/XUxx0NBtWWX9qN0tR2cMRyNYa+cT2/eDex0KPPqadCvfpzqjpzWK4Kj51D99MfJhY66X7qo+jRlCOWsdNI1clDciM2Be8/9AW6n/gEaaDg6UkuN+xip1Gl1SeirbAheH/0Krp/OIc09fz0v4k+YmSBVewUYBYPoZyD976xgMLjn0INpBui0scv6BGWE1ax06qLl1GAHIOn0D09qvt7biAL9Airdic/nUwLq9iznidyCj4KXb/438l2q/2uR9ObUiaNTex+g6N9aeMQfBx69PaORWTJPyKxJ45iz4vJwVeHrrYupz5XX4vm7mpkARywiT3v0EwMvjr0SH8RefBHeMzb2cTuGXCHmhR8Tej0Pj2y54HLk3g+I7sha7omBF8v9EhPgDxI7BbLM/iGoedpyQcHbGIPDDtBK4/gm4a+lM+3M7zK47IINrGbeDZilsFvZEQPr3UhD3ShBwd8Yp/dBBNlEfxGpy7huV7kIfjkDnDAJvbSqc0wVZrBtzJHD68X9Oie7ZSCHnHz+iFrFZ85+9kBoy+YTiP4dp6MBu/diSwV/3gvuGC1GlOaMvuOTTL4dlddyu/chTDDJ6rlv20BF8xiHzJuVWatJILvaHlRhx68M4AsFF/dxeoyRlaxhws+ln/9dZiuk+CTWEePRveU5+7xrgOcsDuoRHN3DndyO8EndsBIj+6l3w2lNp2h5050cTo3LI+g0sOnbcEnfWSUVmZKJ5IPPg6d4y4MPnYcngBDNMIT2vnLZHQKLO2+RTuQocFqUmqnANz0EX5wZ3QSnUrgvJnwcjcWJ/YYe8yjGbaxExuCT/1cl2VPx9kXxa46OCuy/O8BLP38Pr2mzuMAUj2sYyecg8/spC4dPB3SD/7T33L0wWe9KP15G5Z/sxuY7wZnVuz1SLoe/zS6INt08c5jqr+U29mL9G+rHYt6erMQnRZMf7799ekfDFzqRqBfwvf6EdzwUT6tf0Cv898D15rYCZvg9dy3+Id7jQ8oLCprQidWnc/OZpVmyzK6jp4H+s3dZMi20Il1F2+wCV6HbmrwNoZOrLxSSYJvn62hE2svy5PgW2dz6MTqa1Al+I2zPXRi/QXXEnxzLoROnNhdQIJvzJXQiTNbaUjwtVwKnTi1b4wEv8K10IlzmyRJ8G6GTpzcEczl4F0NnTi7/R234NWmzi/idjl04vRej6yCf/R9qJ4OfmnvTc/p0InzG5tyCR67+tB94FRbwUvoFbKLL3gF3/PAmy0Ffzv0mzx22k2TxH4Lh+DDzVug+pY2HLyEvprEXsX44H0fwcBdUL1fNg1eQq8lsa9BwZemtsNYd1QueG4WvIReS2KvI9rWzdRNVLtXLnpuFHxAu+pK6DUk9jpom73gbD9MFPau3sqiXvDhZzy2kM6axN4ABc9FTfBlBVFLYm9Abcvn1yw2VS7Xffft4PuuAr35/NY800nsddDejP7eazBSg9hJHLw/fBGilsReh8l7z6jFm+v/faGI3u+9Dm/7FxCrSexr0EZLhSOfw1Tqxo3mH6OD3/SD30vwa0jsVTjsKKYWmscefVzvsgS/hsR+C4vQr1xed85e8/ES/CoSO/jsEen9/wJaJcGvcD52LqGrS/p5xHJ7y6ESfIXTsXMJnSL3znX2dUrwDsfOKXT/ww+QBNeDdzJ2dqEvJ3c01+XgnYvd5dBjrgbvVOwS+goXg3cmdgm9lmvBOxG7hN6YS8FbH7uE3pwrwVsdu4S+cS4Eb23sEnrrbA/eytgl9PbZHLx1sUvonbM1eKtiZ/Mbrq8pY0OP2Ri8NbGzCf1iDxZ/sg9Lf3oAprMteCtiZxX6c/dHr5dPHsTSyQMwnU3Bs4+dY+gxCT5brGPnHHpMgs8O29htCD0mwWeDZew2hR7jFrwavA5u2MVeOHTZutBjvIKf0q87/6VmWeIX+1Mfw3TthB7jErynR/auw2fBCavYaacub5vZo0knoce4BN99+B1Wozuv2A2fviQReoxD8DSd4TS6s4nd23vN6FE9ydBjHILv+vZ74IJN7IVDV2CqNEKPmR48zd25rMywiV2NtP/bndOUZugx04P3R86BAz6xGziFySL0mMnBezKyJ8u0+XqWocdMDd7r57EiI7v4tiGP0GNcliVNxCZ2U34vaZ6hx0wLPrie333RCj6xX+xG3kwIPWZS8MH8ZnDAJvbg7ADyZFLoMVOCD84PggM2sZdO5Td6mBh6LO/gg/l+BBfuBgd8pjGzfbnM200OPZZn8OXZIXDB6Amqj9LUvcgSh9BjeQW/pP9dLlgtPZamhjIb3TmFHss6+OJb9yHU0xguWMVOo3vx1R1IG8fQYxT84m/HkDaaq3Ma1Qm7g0o0upfeuAdp4Rx6rDjzzdSDX5p6mNWoTlgeQS2+tBvB7CYkzYbQY2kGv/j6gyi9vxPc+NhxeALcFD2U/7oVatdNeLsWkQT64Vn62R4rQo8FF7YivNIPf+Q8VGHjvxm7kXCxR4/oD6F46lvgSOHAsyEYS2KngdLUdv1cYKcxpyQkjc5KvOPYFLzN7Z+dGJy/Gzdfe4TNmno97GMndPovRV84cqml25X1UVmKPO+js1mhq4q6x860FD09EV1+cz+K/9wD7qyIPUbR0+V7/qEr8Pdeh+orrfp7GrlpulLWR2PLb2y1diRvxh8+F4VPmx35Q6s3PApLXQg+H0B5Ti8EvDuiX6e/+pUVq2Kv5/ZFH3rZ0tW4m4l2COitbJ/NbYWlFdZ/9216wpkWeuKJRfvvJ7l4QzhDYhfOkNiFMyR24QyJXThDYhfOkNiFMyR24QyJXThDYhfOkNiFMyR24QyJXThDYhfOkNiFMyj2OQhhvzkPIeYhhO105zr28G0IYTsVfuRBYQZC2C7EjKdn7RK7sJ+HaQ+lKHaZtwu7lWhkn5mk0GV0Fzabps4r6+xh+AqEsNdx+k8l9gAnIFMZYaNQH0c682I0mFdip6lMGP4KQthGhdPxmyunCwSYhIzuwjZlvBC/uRK7jO7CNkqHPjM5F/9x9YlgNLqHcq6MsAB1fPrFiep3rY6dRncvPAYhuKvTsV/zQef+MYedDyr9GDAGITii6cvpyeO1727kwI9f048FRyEEK+EJnJl8rN7fNL54oxwco5NnIAQX1GsZDafhat0bj44PwlMn9UeNQgiTUehB+Mit01/qWv+yPLohfQKoExDCWHrq0iR0sv7IXu3g+ARC9TyEMEn0ZHT1EmPjD23FwfExBOplfathCJEnWken5cXTk9MbvUlrscdklBd5oWumPX2kv6QPgDaZtqzVXuxkdHwYvtLR42EZ6UXqOog81n7s1faPP6k/0xNyIEokigJX4Yx+/Up0GnqbkceSiT1GS5UFvUwZYEx/5n36ixzW/8SgjPyiqeicrHC+sgGAmtGRvx1dMtph4NW+AiZycfiu2QTRAAAAAElFTkSuQmCC";var Uf={name:"gnosis",id:"0x64",networkId:"100",namespace:"eip155",label:"Gnosis",fullName:"Gnosis Chain",logo:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbDojZmZmfTwvc3R5bGU+PHBhdGggY2xhc3M9InN0MCIgZD0iTTMzMS45IDU1Ni41YzIzLjUgMCA0Ni40LTcuOCA2NS0yMi4yTDI0OCAzODUuNGMtMzUuOSA0Ni40LTI3LjQgMTEyLjkgMTguOSAxNDguOCAxOC42IDE0IDQxLjUgMjEuOSA2NSAyMS45di40em00NDIuMy0xMDYuMWMwLTIzLjUtNy44LTQ2LjQtMjIuMi02NUw2MDMuMiA1MzQuMmM0Ni40IDM1LjkgMTEyLjkgMjcuNCAxNDguOC0xOC45IDE0LjMtMTguNiAyMi4yLTQxLjQgMjIuMi02NC45eiIvPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Im04NDkuMiAyODguNS02NS45IDY1LjljNTIuOSA2My42IDQ0LjcgMTU4LTE4LjkgMjExLjItNTUuNiA0Ni43LTEzNi42IDQ2LjctMTkyLjIgMEw1MDAgNjM3LjdsLTcyLjEtNzIuMWMtNjMuNiA1Mi45LTE1OCA0NC43LTIxMS4yLTE4LjktNDYuNy01NS42LTQ2LjctMTM2LjYgMC0xOTIuMmwtMzMuNi0zMy42LTMyLTMyLjNDMTEyLjMgMzUyLjIgOTIgNDI1LjMgOTIgNTAwYzAgMjI1LjIgMTgyLjggNDA4IDQwOCA0MDhzNDA4LTE4Mi44IDQwOC00MDhjLjMtNzQuNC0yMC42LTE0Ny44LTU4LjgtMjExLjV6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0iTTc5NS4xIDIxOC4zYy0xNTUuNC0xNjIuOC00MTMuNi0xNjktNTc2LjQtMTMuNy00LjkgNC42LTkuNSA5LjEtMTMuNyAxMy43LTEwLjEgMTAuOC0xOS42IDIxLjktMjguNyAzMy4zTDUwMCA1NzUuNGwzMjMuOC0zMjMuOGMtOC44LTExLjctMTguNi0yMi44LTI4LjctMzMuM3pNNTAwIDE0NS4yYzk1LjMgMCAxODQuMSAzNi45IDI1MSAxMDMuOEw1MDAgNTAwIDI0OSAyNDljNjYuNi02Ny4yIDE1NS43LTEwMy44IDI1MS0xMDMuOHoiLz48L3N2Zz4K",logoBackgroundColor:"#406958",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbDojM2U2OTU3fTwvc3R5bGU+PHBhdGggY2xhc3M9InN0MCIgZD0iTTMyNC4yIDU1OS4xYzI0LjYgMCA0OC41LTguMiA2Ny45LTIzLjJMMjM2LjUgMzgwLjJjLTM3LjUgNDguNS0yOC43IDExOC4xIDE5LjggMTU1LjYgMTkuNSAxNC43IDQzLjMgMjIuOSA2Ny45IDIyLjl2LjR6TTc4Ni43IDQ0OC4xYzAtMjQuNi04LjItNDguNS0yMy4yLTY3LjlMNjA3LjkgNTM1LjhjNDguNSAzNy41IDExOC4xIDI4LjcgMTU1LjYtMTkuOCAxNS0xOS40IDIzLjItNDMuMyAyMy4yLTY3Ljl6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0ibTg2NS4yIDI3OC44LTY4LjkgNjguOWM1NS4zIDY2LjYgNDYuOCAxNjUuMi0xOS44IDIyMC44LTU4LjQgNDguOC0xNDIuNyA0OC44LTIwMSAwTDUwMCA2NDRsLTc1LjQtNzUuNGMtNjYuNiA1NS4zLTE2NS4yIDQ2LjgtMjIwLjgtMTkuOC00OC44LTU4LjQtNDguOC0xNDIuNyAwLTIwMWwtMzUuMi0zNS4yLTMzLjQtMzMuOGMtNDAuNiA2Ni42LTYxLjggMTQzLTYxLjggMjIxLjIgMCAyMzUuNSAxOTEuMSA0MjYuNiA0MjYuNiA0MjYuNlM5MjYuNiA3MzUuNSA5MjYuNiA1MDBjLjQtNzcuOC0yMS41LTE1NC42LTYxLjQtMjIxLjJ6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0iTTgwOC42IDIwNS41QzY0Ni4xIDM1LjEgMzc2LjEgMjguNyAyMDUuOCAxOTEuMWMtNS4xIDQuOC05LjkgOS42LTE0LjMgMTQuMy0xMC42IDExLjMtMjAuNSAyMi45LTMwIDM0LjhMNTAwIDU3OC44bDMzOC42LTMzOC42Yy05LjItMTIuMi0xOS41LTIzLjgtMzAtMzQuN3pNNTAwIDEyOWM5OS43IDAgMTkyLjUgMzguNiAyNjIuNSAxMDguNUw1MDAgNTAwIDIzNy41IDIzNy41QzMwNy4yIDE2Ny4yIDQwMC4zIDEyOSA1MDAgMTI5eiIvPjwvc3ZnPgo=",currency:{name:"xDAI",symbol:"xDAI",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Bf},wrapped:{address:"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",logo:Rf},stables:{usd:["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83"]},explorer:"https://gnosisscan.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://gnosisscan.io/tx/${e.id||e}`:t?`https://gnosisscan.io/token/${t}`:n?`https://gnosisscan.io/address/${n}`:void 0,endpoints:["https://rpc.gnosis.gateway.fm","https://rpc.gnosischain.com","https://gnosis-rpc.publicnode.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"xDAI",name:"xDAI",decimals:18,logo:Bf,type:"NATIVE"},{address:"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",symbol:"WXDAI",name:"Wrapped XDAI",decimals:18,logo:Rf,type:"20"},{address:"0x4ECaBa5870353805a9F068101A40E0f32ed605C6",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb",symbol:"GNO",name:"Gnosis",decimals:18,logo:"https://cdn.sushi.com/image/upload/f_auto,c_limit,w_16,q_auto/tokens/100/0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb.jpg",type:"20"},{address:"0xD057604A14982FE8D88c5fC25Aac3267eA142a08",symbol:"HOPR",name:"HOPR",decimals:18,logo:"https://hoprnet.org/assets/icons/hopr_icon.svg",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",blockTime:5e3};var Qf={name:"optimism",id:"0xa",networkId:"10",namespace:"eip155",label:"Optimism",fullName:"Optimism",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00ODcuMSAzOTUuN2MtNS4yLTE1LjgtMTMuMi0zMS43LTI2LjQtNDIuMi0xMy4yLTEwLjUtMjYuNC0yMS4yLTQ0LjktMjYuNC0xOC41LTUuMi0zNy04LTU4LjEtOC00Ny41IDAtODcuMSAxMC41LTExNi4xIDM0LjQtMjkgMjMuOC00Ny41IDU4LjEtNjAuNyAxMDIuOS0yLjYgMTUuOC04IDI5LTEwLjUgNDQuOS0yLjYgMTMuMi01LjIgMjktOCA0Mi4yLTIuNiAyMy44LTIuNiA0Mi4yIDIuNiA2MC43IDUuMiAxNS44IDEzLjIgMzEuNyAyNi40IDQyLjIgMTMuMiAxMC41IDI2LjQgMjEuMiA0NC45IDI2LjQgMTguNCA1LjIgMzcgOCA1OC4xIDggNDcuNSAwIDg3LjEtMTAuNSAxMTYuMS0zNC40czQ3LjUtNTguMSA2MC43LTEwMi45YzIuNi0xMy4yIDUuMi0yOSAxMC41LTQyLjIgMi42LTEzLjIgNS4yLTI5IDgtNDQuOSAyLjgtMjMuOCAyLjgtNDQuOC0yLjYtNjAuN3ptLTkyLjQgNjAuOGMtMi42IDEzLjItNS4yIDI2LjQtOCAzOS41LTIuNiAxMy4yLTUuMiAyNi40LTEwLjUgNDIuMi01LjIgMjMuOC0xNS44IDM5LjUtMjkgNTAuMi0xMy4yIDEwLjUtMjkgMTUuOC00Ny41IDE1LjgtMTguNCAwLTMxLjctNS4yLTM5LjUtMTUuOC04LTEwLjUtMTAuNS0yOS01LjItNTAuMiAyLjYtMTUuOCA1LjItMjkgOC00Mi4yIDIuNi0xMy4yIDUuMi0yNi40IDEwLjUtMzkuNSA1LjItMjMuOCAxNS44LTM5LjUgMjktNTAuMiAxMy4yLTEwLjUgMjktMTUuOCA0Ny41LTE1LjggMTguNCAwIDMxLjcgNS4yIDM5LjUgMTUuOCA3LjkgMTAuNiAxMC41IDI2LjMgNS4yIDUwLjJ6bTQ0MC45LTY4LjZjLTUuMi0xNS44LTEzLjItMjYuNC0yMy44LTM3cy0yMy44LTE1LjgtNDIuMi0yMS4yYy0xNS44LTUuMi0zNC40LTgtNTUuNC04SDU3OS43Yy0yLjYgMC01LjIgMC0xMC41IDIuNi0yLjYgMi42LTUuMiA1LjItNS4yIDhsLTY4LjYgMzI3LjRjMCAyLjYgMCA4IDIuNiA4IDIuNiAyLjYgNS4yIDIuNiA4IDIuNmg2OC42YzIuNiAwIDggMCAxMC41LTIuNnM1LjItNS4yIDUuMi04bDIzLjgtMTEwLjloNjguNmM0Mi4yIDAgNzYuNi04IDEwMi45LTI2LjQgMjYuNC0xOC40IDQyLjItNDcuNSA1MC4yLTg0LjYgNS4xLTE4LjQgNS4xLTM2LjctLjItNDkuOXpNNzQzLjEgNDM4Yy0yLjYgMTUuOC0xMC41IDI2LjQtMjEuMiAzNC40cy0yMy44IDEwLjUtMzcgMTAuNWgtNTguMWwxOC40LTg5LjdoNjAuN2MxMy4yIDAgMjEuMiAyLjYgMjYuNCA1LjIgNS4yIDUuMiAxMC41IDEwLjUgMTAuNSAxNS44IDMgNS4yIDMgMTMuMi4zIDIzLjh6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==",logoBackgroundColor:"#FF0420",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxjaXJjbGUgY3g9IjUwMCIgY3k9IjUwMCIgcj0iMzk2LjYiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJNNTAwIDg5Ni42YzIxOS4xIDAgMzk2LjYtMTc3LjYgMzk2LjYtMzk2LjZTNzE5LjEgMTAzLjQgNTAwIDEwMy40IDEwMy40IDI4MC45IDEwMy40IDUwMCAyODAuOSA4OTYuNiA1MDAgODk2LjZ6TTM1MC43IDYwOWMxMC45IDMuNCAyMi42IDUuMSAzNS4zIDUuMSAyOS4xIDAgNTIuNC02LjcgNjkuNi0yMC4yIDE3LjMtMTMuNyAyOS4zLTM0LjMgMzYuMi02MS44IDItOC42IDMuOS0xNy4zIDUuNy0yNS45IDItOC42IDMuNy0xNy40IDUuMS0yNi4yIDIuNC0xMy43IDItMjUuNi0xLjItMzUuOS0zLTEwLjItOC4zLTE4LjktMTYtMjUuOS03LjQtNy0xNi42LTEyLjMtMjcuNC0xNS43LTEwLjctMy42LTIyLjMtNS40LTM1LTUuNC0yOS4zIDAtNTIuNyA3LTY5LjkgMjEuMXMtMjkuMiAzNC43LTM1LjkgNjEuOGMtMiA4LjgtNCAxNy42LTYgMjYuMi0xLjggOC42LTMuNSAxNy4zLTUuMSAyNS45LTIuMiAxMy43LTEuOCAyNS42IDEuMiAzNS45IDMuMiAxMC4yIDguNSAxOC44IDE2IDI1LjYgNy40IDYuOCAxNi42IDExLjkgMjcuNCAxNS40em02Ny44LTQ4Yy04LjIgNi40LTE3LjggOS42LTI4LjYgOS42LTExLjEgMC0xOS0zLjItMjMuOC05LjYtNC44LTYuNC02LTE2LjctMy42LTMwLjcgMS42LTguOCAzLjItMTcuMiA0LjgtMjUgMS44LTcuOCAzLjgtMTYgNi0yNC40IDMuNC0xNC4xIDkuMS0yNC4zIDE3LjItMzAuNyA4LjItNi40IDE3LjgtOS42IDI4LjYtOS42czE4LjggMy4yIDIzLjggOS42IDYuMiAxNi43IDMuNiAzMC43Yy0xLjQgOC40LTMgMTYuNi00LjggMjQuNC0xLjYgNy44LTMuNSAxNi4yLTUuNyAyNS0zLjQgMTQtOS4yIDI0LjMtMTcuNSAzMC43em05MS43IDQ4YzEuMiAxLjQgMi44IDIuMSA0LjggMi4xaDQxYzIuMiAwIDQuMS0uNyA1LjctMi4xIDEuOC0xLjQgMi45LTMuMiAzLjMtNS40bDEzLjktNjZoNDAuN2MyNS45IDAgNDYuNS01LjUgNjEuOC0xNi42IDE1LjUtMTEuMSAyNS43LTI4LjEgMzAuNy01MS4yIDIuNC0xMS43IDIuMy0yMS44LS4zLTMwLjQtMi42LTguOC03LjItMTYuMi0xMy45LTIyLTYuNi01LjgtMTUtMTAuMS0yNS0xMy05LjgtMi44LTIwLjktNC4yLTMzLjItNC4yaC04MC4yYy0yIDAtMy45LjctNS43IDIuMS0xLjggMS40LTIuOSAzLjItMy4zIDUuNEw1MDkgNjAzLjVjLS40IDIuMiAwIDQgMS4yIDUuNXptMTExLjItMTEzLjFoLTM0LjdsMTEuOC01NGgzNi4yYzcuMiAwIDEyLjYgMS4yIDE2IDMuNiAzLjYgMi40IDUuNyA1LjYgNi4zIDkuNi42IDQgLjQgOC42LS42IDEzLjktMiA5LTYuMyAxNS44LTEzIDIwLjItNi40IDQuNS0xMy44IDYuNy0yMiA2Ljd6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2ZmMDQyMCIvPjwvc3ZnPg==",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:If.currency.logo},wrapped:{address:"0x4200000000000000000000000000000000000006",logo:If.wrapped.logo},stables:{usd:["0x94b008aA00579c1307B0EF2c499aD98a8ce58e58","0x7F5c764cBc14f9669B88837ca1490cCa17c31607"]},explorer:"https://optimistic.etherscan.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://optimistic.etherscan.io/tx/${e.id||e}`:t?`https://optimistic.etherscan.io/token/${t}`:n?`https://optimistic.etherscan.io/address/${n}`:void 0,endpoints:["https://optimism.llamarpc.com","https://optimism.publicnode.com","https://optimism.rpc.thirdweb.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:If.currency.logo,type:"NATIVE"},{address:"0x4200000000000000000000000000000000000006",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:If.wrapped.logo,type:"20"},{address:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/assets/0x94b008aA00579c1307B0EF2c499aD98a8ce58e58/logo.png",type:"20"},{address:"0x7F5c764cBc14f9669B88837ca1490cCa17c31607",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/assets/0x7F5c764cBc14f9669B88837ca1490cCa17c31607/logo.png",type:"20"},{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x4200000000000000000000000000000000000042",symbol:"OP",name:"Optimism",decimals:18,logo:"https://user-images.githubusercontent.com/1300064/219575413-d7990d69-1d21-44ef-a2b1-e9c682c79802.svg",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",blockTime:2e3};var Wf={name:"base",id:"0x2105",networkId:"8453",namespace:"eip155",label:"Base",fullName:"Base",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00OTguNiA4NDJDNjg4IDg0MiA4NDIgNjg4LjkgODQyIDQ5OS41UzY4OCAxNTcgNDk4LjYgMTU3QzMxOSAxNTcgMTcxLjIgMjk1LjEgMTU3IDQ3MC4zaDQ1My4xdjU3LjVIMTU3QzE3MiA3MDMuOSAzMTkgODQyIDQ5OC42IDg0MnoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",logoBackgroundColor:"#0052FF",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00OTguOSA4NDVDNjkwLjEgODQ1IDg0NSA2OTAuMyA4NDUgNDk5LjVTNjkwLjEgMTU0IDQ5OC45IDE1NEMzMTcuNiAxNTQgMTY4LjggMjkzLjMgMTU0IDQ3MC41aDQ1Ny40djU4LjFIMTU0QzE2OC44IDcwNS44IDMxNy42IDg0NSA0OTguOSA4NDV6IiBmaWxsPSIjMDA1MmZmIi8+PC9zdmc+",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:If.currency.logo},wrapped:{address:"0x4200000000000000000000000000000000000006",logo:If.wrapped.logo},stables:{usd:["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA"]},explorer:"https://basescan.org",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://basescan.org/tx/${e.id||e}`:t?`https://basescan.org/token/${t}`:n?`https://basescan.org/address/${n}`:void 0,endpoints:["https://base-rpc.publicnode.com","https://base.llamarpc.com","https://base.rpc.thirdweb.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:If.currency.logo,type:"NATIVE"},{address:"0x4200000000000000000000000000000000000006",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:If.wrapped.logo,type:"20"},{address:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://ethereum-optimism.github.io/data/USDC/logo.png",type:"20"},{address:"0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA",symbol:"USDbC",name:"USD Base Coin",decimals:6,logo:"https://ethereum-optimism.github.io/data/USDC/logo.png",type:"20"},{address:"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",blockTime:2e3};var Yf={name:"worldchain",id:"0x1e0",networkId:"480",namespace:"eip155",platform:"evm",label:"World Chain",fullName:"World Chain Mainnet",logo:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIj4KICA8Zz4KICAgIDxnPgogICAgICA8cGF0aCBmaWxsPSIjRkZGRkZGIiBkPSJNMjQuNSwxMi40Yy0uNS0xLjEtMS4xLTIuMS0yLTIuOS0uOS0uOS0xLjgtMS41LTIuOS0yLTEuMS0uNS0yLjMtLjctMy42LS43cy0yLjUuMi0zLjYuN2MtMS4xLjUtMi4xLDEuMS0yLjksMi0uOS45LTEuNSwxLjgtMiwyLjktLjUsMS4xLS43LDIuNC0uNywzLjZzLjIsMi40LjcsMy42Yy41LDEuMSwxLjEsMi4xLDIsMi45LjkuOSwxLjgsMS41LDIuOSwyLDEuMS41LDIuNC43LDMuNi43czIuNC0uMiwzLjYtLjdjMS4xLS41LDIuMS0xLjEsMi45LTIsLjktLjksMS41LTEuOCwyLTIuOS41LTEuMS43LTIuNC43LTMuNnMtLjItMi40LS43LTMuNlpNMTMsMTUuMWMuMy0xLjUsMS43LTIuNSwzLjMtMi41aDYuNGMuNC44LjcsMS43LjcsMi41aC0xMC41Wk0yMy40LDE2LjljLS4xLjktLjMsMS44LS43LDIuNWgtNi40Yy0xLjYsMC0yLjktMS4xLTMuMy0yLjUsMCwwLDEwLjUsMCwxMC41LDBaTTEwLjcsMTAuN2MxLjQtMS40LDMuMy0yLjIsNS4zLTIuMnMzLjkuNyw1LjMsMi4yaC4xYzAsLjEtNS4yLjEtNS4yLjEtMS40LDAtMi42LjUtMy42LDEuNS0uNy43LTEuMywxLjctMS40LDIuOGgtMi42Yy4yLTEuNy45LTMuMiwyLjEtNC40aDBaTTE2LDIzLjVjLTIsMC0zLjktLjctNS4zLTIuMi0xLjItMS4yLTItMi44LTIuMS00LjRoMi42Yy4yLDEsLjcsMiwxLjQsMi44LDEsMSwyLjIsMS41LDMuNiwxLjVoNS4yLS4xYy0xLjQsMS42LTMuMywyLjMtNS4zLDIuM2gwWiIvPgogICAgPC9nPgogIDwvZz4KPC9zdmc+Cg==",logoBackgroundColor:"#000000",logoWhiteBackground:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIj4KICA8Zz4KICAgIDxnPgogICAgICA8cGF0aCBmaWxsPSIjMDAwMDAwIiBkPSJNMjQuNSwxMi40Yy0uNS0xLjEtMS4xLTIuMS0yLTIuOS0uOS0uOS0xLjgtMS41LTIuOS0yLTEuMS0uNS0yLjMtLjctMy42LS43cy0yLjUuMi0zLjYuN2MtMS4xLjUtMi4xLDEuMS0yLjksMi0uOS45LTEuNSwxLjgtMiwyLjktLjUsMS4xLS43LDIuNC0uNywzLjZzLjIsMi40LjcsMy42Yy41LDEuMSwxLjEsMi4xLDIsMi45LjkuOSwxLjgsMS41LDIuOSwyLDEuMS41LDIuNC43LDMuNi43czIuNC0uMiwzLjYtLjdjMS4xLS41LDIuMS0xLjEsMi45LTIsLjktLjksMS41LTEuOCwyLTIuOS41LTEuMS43LTIuNC43LTMuNnMtLjItMi40LS43LTMuNlpNMTMsMTUuMWMuMy0xLjUsMS43LTIuNSwzLjMtMi41aDYuNGMuNC44LjcsMS43LjcsMi41aC0xMC41Wk0yMy40LDE2LjljLS4xLjktLjMsMS44LS43LDIuNWgtNi40Yy0xLjYsMC0yLjktMS4xLTMuMy0yLjUsMCwwLDEwLjUsMCwxMC41LDBaTTEwLjcsMTAuN2MxLjQtMS40LDMuMy0yLjIsNS4zLTIuMnMzLjkuNyw1LjMsMi4yaC4xYzAsLjEtNS4yLjEtNS4yLjEtMS40LDAtMi42LjUtMy42LDEuNS0uNy43LTEuMywxLjctMS40LDIuOGgtMi42Yy4yLTEuNy45LTMuMiwyLjEtNC40aDBaTTE2LDIzLjVjLTIsMC0zLjktLjctNS4zLTIuMi0xLjItMS4yLTItMi44LTIuMS00LjRoMi42Yy4yLDEsLjcsMiwxLjQsMi44LDEsMSwyLjIsMS41LDMuNiwxLjVoNS4yLS4xYy0xLjQsMS42LTMuMywyLjMtNS4zLDIuM2gwWiIvPgogICAgPC9nPgogIDwvZz4KPC9zdmc+Cg==",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:If.currency.logo},wrapped:{address:"0x4200000000000000000000000000000000000006",logo:If.wrapped.logo},stables:{usd:["0x79A02482A880bCE3F13e09Da970dC34db4CD24d1"]},explorer:"https://worldchain-mainnet.explorer.alchemy.com",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://worldchain-mainnet.explorer.alchemy.com/tx/${e.id||e}`:t?`https://worldchain-mainnet.explorer.alchemy.com/token/${t}`:n?`https://worldchain-mainnet.explorer.alchemy.com/address/${n}`:void 0,endpoints:["https://worldchain-mainnet.g.alchemy.com/public","https://480.rpc.thirdweb.com"],tokens:[{address:"0x2cFc85d8E48F8EAB294be644d9E25C3030863003",symbol:"WLD",name:"Worldcoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/assets/0xdC6fF44d5d932Cbd77B52E5612Ba0529DC6226F1/logo.png",type:"20"},{address:"0x79A02482A880bCE3F13e09Da970dC34db4CD24d1",symbol:"USDC.e",name:"Bridged USDC",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/assets/0x7F5c764cBc14f9669B88837ca1490cCa17c31607/logo.png",type:"20"},{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:If.currency.logo,type:"NATIVE"},{address:"0x4200000000000000000000000000000000000006",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:If.wrapped.logo,type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",blockTime:2e3};const Ff=[If,bf,Lf,Df,Ef,Of,_f,Uf,Qf,Wf,Yf];var Vf={ethereum:If,bsc:bf,polygon:Lf,solana:Df,fantom:Ef,arbitrum:Of,avalanche:_f,gnosis:Uf,optimism:Qf,base:Wf,worldchain:Yf,all:Ff,findById:function(e){let t=e;return t.match("0x0")&&(t=t.replace(/0x0+/,"0x")),Ff.find((e=>e.id&&e.id.toLowerCase()==t.toLowerCase()))},findByNetworkId:function(e){return e=e.toString(),Ff.find((t=>t.networkId==e))},findByName:function(e){return Ff.find((t=>t.name==e))}},Hf="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Gf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function qf(e){var t={exports:{}};return e(t,t.exports),t.exports}for(var Zf=function(e){var t=ip(e),n=t[0],r=t[1];return 3*(n+r)/4-r},Jf=function(e){var t,n,r=ip(e),i=r[0],o=r[1],a=new ep(function(e,t,n){return 3*(t+n)/4-n}(0,i,o)),s=0,u=o>0?i-4:i;for(n=0;n<u;n+=4)t=$f[e.charCodeAt(n)]<<18|$f[e.charCodeAt(n+1)]<<12|$f[e.charCodeAt(n+2)]<<6|$f[e.charCodeAt(n+3)],a[s++]=t>>16&255,a[s++]=t>>8&255,a[s++]=255&t;2===o&&(t=$f[e.charCodeAt(n)]<<2|$f[e.charCodeAt(n+1)]>>4,a[s++]=255&t);1===o&&(t=$f[e.charCodeAt(n)]<<10|$f[e.charCodeAt(n+1)]<<4|$f[e.charCodeAt(n+2)]>>2,a[s++]=t>>8&255,a[s++]=255&t);return a},Xf=function(e){for(var t,n=e.length,r=n%3,i=[],o=16383,a=0,s=n-r;a<s;a+=o)i.push(op(e,a,a+o>s?s:a+o));1===r?(t=e[n-1],i.push(Kf[t>>2]+Kf[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],i.push(Kf[t>>10]+Kf[t>>4&63]+Kf[t<<2&63]+"="));return i.join("")},Kf=[],$f=[],ep="undefined"!=typeof Uint8Array?Uint8Array:Array,tp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",np=0,rp=tp.length;np<rp;++np)Kf[np]=tp[np],$f[tp.charCodeAt(np)]=np;function ip(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function op(e,t,n){for(var r,i,o=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(Kf[(i=r)>>18&63]+Kf[i>>12&63]+Kf[i>>6&63]+Kf[63&i]);return o.join("")}$f["-".charCodeAt(0)]=62,$f["_".charCodeAt(0)]=63;var ap={byteLength:Zf,toByteArray:Jf,fromByteArray:Xf},sp=function(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<<s)-1,c=u>>1,l=-7,h=n?i-1:0,d=n?-1:1,f=e[t+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+e[t+h],h+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+e[t+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)},up=function(e,t,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(t*u-1)*Math.pow(2,i),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;e[n+f]=255&a,f+=p,a/=256,c-=8);e[n+f-p]|=128*y},cp=qf((function(e,t){const n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=o,t.SlowBuffer=function(e){+e!=e&&(e=0);return o.alloc(+e)},t.INSPECT_MAX_BYTES=50;const r=2147483647;function i(e){if(e>r)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return a(e,t,n)}function a(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|d(e,t);let r=i(n);const a=r.write(e,t);a!==n&&(r=r.slice(0,a));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(H(e,Uint8Array)){const t=new Uint8Array(e);return l(t.buffer,t.byteOffset,t.byteLength)}return c(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(H(e,ArrayBuffer)||e&&H(e.buffer,ArrayBuffer))return l(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(H(e,SharedArrayBuffer)||e&&H(e.buffer,SharedArrayBuffer)))return l(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return o.from(r,t,n);const a=function(e){if(o.isBuffer(e)){const t=0|h(e.length),n=i(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||G(e.length)?i(0):c(e);if("Buffer"===e.type&&Array.isArray(e.data))return c(e.data)}(e);if(a)return a;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function s(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return s(e),i(e<0?0:0|h(e))}function c(e){const t=e.length<0?0:0|h(e.length),n=i(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function l(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,o.prototype),r}function h(e){if(e>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|e}function d(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||H(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return Y(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(e).length;default:if(i)return r?-1:Y(e).length;t=(""+t).toLowerCase(),i=!0}}function f(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return E(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function p(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),G(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:m(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):m(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,n,r,i){let o,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){let r=-1;for(o=n;o<s;o++)if(c(e,o)===c(t,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===u)return r*a}else-1!==r&&(o-=o-r),r=-1}else for(n+u>s&&(n=s-u),o=n;o>=0;o--){let n=!0;for(let r=0;r<u;r++)if(c(e,o+r)!==c(t,r)){n=!1;break}if(n)return o}return-1}function g(e,t,n,r){n=Number(n)||0;const i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=t.length;let a;for(r>o/2&&(r=o/2),a=0;a<r;++a){const r=parseInt(t.substr(2*a,2),16);if(G(r))return a;e[n+a]=r}return a}function v(e,t,n,r){return V(Y(t,e.length-n),e,n,r)}function w(e,t,n,r){return V(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function b(e,t,n,r){return V(F(t),e,n,r)}function M(e,t,n,r){return V(function(e,t){let n,r,i;const o=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)n=e.charCodeAt(a),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function A(e,t,n){return 0===t&&n===e.length?ap.fromByteArray(e):ap.fromByteArray(e.slice(t,n))}function I(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i<n;){const t=e[i];let o=null,a=t>239?4:t>223?3:t>191?2:1;if(i+a<=n){let n,r,s,u;switch(a){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128==(192&n)&&(u=(31&t)<<6|63&n,u>127&&(o=u));break;case 3:n=e[i+1],r=e[i+2],128==(192&n)&&128==(192&r)&&(u=(15&t)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(u=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return function(e){const t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=N));return n}(r)}t.kMaxLength=r,o.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,n){return a(e,t,n)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,n){return function(e,t,n){return s(e),e<=0?i(e):void 0!==t?"string"==typeof n?i(e).fill(t,n):i(e).fill(t):i(e)}(e,t,n)},o.allocUnsafe=function(e){return u(e)},o.allocUnsafeSlow=function(e){return u(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(H(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),H(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=o.allocUnsafe(t);let i=0;for(n=0;n<e.length;++n){let t=e[n];if(H(t,Uint8Array))i+t.length>r.length?(o.isBuffer(t)||(t=o.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!o.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},o.byteLength=d,o.prototype._isBuffer=!0,o.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)p(this,t,t+1);return this},o.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)p(this,t,t+3),p(this,t+1,t+2);return this},o.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)p(this,t,t+7),p(this,t+1,t+6),p(this,t+2,t+5),p(this,t+3,t+4);return this},o.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?I(this,0,e):f.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){let e="";const n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(e,t,n,r,i){if(H(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let a=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0);const u=Math.min(a,s),c=this.slice(r,i),l=e.slice(t,n);for(let e=0;e<u;++e)if(c[e]!==l[e]){a=c[e],s=l[e];break}return a<s?-1:s<a?1:0},o.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},o.prototype.indexOf=function(e,t,n){return y(this,e,t,n,!0)},o.prototype.lastIndexOf=function(e,t,n){return y(this,e,t,n,!1)},o.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return g(this,e,t,n);case"utf8":case"utf-8":return v(this,e,t,n);case"ascii":case"latin1":case"binary":return w(this,e,t,n);case"base64":return b(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const N=4096;function T(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function E(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function x(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=t;r<n;++r)i+=q[e[r]];return i}function k(e,t,n){const r=e.slice(t,n);let i="";for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+256*r[e+1]);return i}function L(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function S(e,t,n,r,i,a){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function j(e,t,n,r,i){R(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function D(e,t,n,r,i){R(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function C(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function O(e,t,n,r,i){return t=+t,n>>>=0,i||C(e,0,n,4),up(e,t,n,r,23,4),n+4}function z(e,t,n,r,i){return t=+t,n>>>=0,i||C(e,0,n,8),up(e,t,n,r,52,8),n+8}o.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,o.prototype),r},o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[e+o]*i;return r},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=Z((function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Q(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),o.prototype.readBigUInt64BE=Z((function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Q(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),o.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[e+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=Z((function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Q(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),o.prototype.readBigInt64BE=Z((function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Q(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),o.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),sp(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),sp(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),sp(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),sp(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){S(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){S(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigUInt64LE=Z((function(e,t=0){return j(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=Z((function(e,t=0){return D(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);S(this,e,t,n,r-1,-r)}let i=0,o=1,a=0;for(this[t]=255&e;++i<n&&(o*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);S(this,e,t,n,r-1,-r)}let i=n-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigInt64LE=Z((function(e,t=0){return j(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=Z((function(e,t=0){return D(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(e,t,n){return O(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return O(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return z(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return z(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);const i=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},o.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let i;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{const a=o.isBuffer(e)?e:o.from(e,r),s=a.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=a[i%s]}return this};const P={};function _(e,t,n){P[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function B(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function R(e,t,n,r,i,o){if(e>n||e<t){const r="bigint"==typeof t?"n":"";let i;throw i=o>3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new P.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){U(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||Q(t,e.length-(n+1))}(r,i,o)}function U(e,t){if("number"!=typeof e)throw new P.ERR_INVALID_ARG_TYPE(t,"number",e)}function Q(e,t,n){if(Math.floor(e)!==e)throw U(e,n),new P.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new P.ERR_BUFFER_OUT_OF_BOUNDS;throw new P.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}_("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),_("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),_("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=B(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=B(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r}),RangeError);const W=/[^+/0-9A-Za-z-_]/g;function Y(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let a=0;a<r;++a){if(n=e.charCodeAt(a),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function F(e){return ap.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function V(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function H(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function G(e){return e!=e}const q=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function Z(e){return"undefined"==typeof BigInt?J:e}function J(){throw new Error("BigInt not supported")}})),lp=qf((function(e){!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var o;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:cp.Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function s(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,r,i){for(var o=0,a=0,s=Math.min(e.length,r),u=t;u<s;u++){var c=e.charCodeAt(u)-48;o*=i,a=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a<i,"Invalid character"),o+=a}return o}function c(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<e.length;i+=3)a=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=e.length-1;r>=t;r-=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(e,l,l+r,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(e,l,e.length,t),l=0;l<a;l++)h*=t;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){c(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(e){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","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"],d=[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],f=[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(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=d[e],l=f[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(e);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=67108863&u,d=Math.min(c,t.length-1),f=Math.max(0,c-e.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|e.words[p])*(o=0|t.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n++]=255&a,n<e.length&&(e[n++]=a>>8&255),n<e.length&&(e[n++]=a>>16&255),6===o?(n<e.length&&(e[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n--]=255&a,n>=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return n(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a<r.length;a++)o=(t=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<n.length;a++)o=(t=(0|n.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var y=function(e,t,n){var r,i,o,a=e.words,s=t.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],I=8191&A,N=A>>>13,T=0|a[5],E=8191&T,x=T>>>13,k=0|a[6],L=8191&k,S=k>>>13,j=0|a[7],D=8191&j,C=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,W=U>>>13,Y=0|s[1],F=8191&Y,V=Y>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,ee=K>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,le=0|s[8],he=8191&le,de=le>>>13,fe=0|s[9],pe=8191&fe,ye=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,W))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,W))+Math.imul(y,Q)|0,o=Math.imul(y,W);var ge=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,W))+Math.imul(v,Q)|0,o=Math.imul(v,W),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var ve=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,W))+Math.imul(M,Q)|0,o=Math.imul(M,W),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var we=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(I,Q),i=(i=Math.imul(I,W))+Math.imul(N,Q)|0,o=Math.imul(N,W),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var be=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,Q),i=(i=Math.imul(E,W))+Math.imul(x,Q)|0,o=Math.imul(x,W),r=r+Math.imul(I,F)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0;var Me=(c+(r=r+Math.imul(h,ne)|0)|0)+((8191&(i=(i=i+Math.imul(h,re)|0)+Math.imul(d,ne)|0))<<13)|0;c=((o=o+Math.imul(d,re)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,W))+Math.imul(S,Q)|0,o=Math.imul(S,W),r=r+Math.imul(E,F)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(x,F)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(I,G)|0,i=(i=i+Math.imul(I,q)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0;var Ae=(c+(r=r+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ae)|0)+Math.imul(d,oe)|0))<<13)|0;c=((o=o+Math.imul(d,ae)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(D,Q),i=(i=Math.imul(D,W))+Math.imul(C,Q)|0,o=Math.imul(C,W),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(E,G)|0,i=(i=i+Math.imul(E,q)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,q)|0,r=r+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(g,ne)|0,i=(i=i+Math.imul(g,re)|0)+Math.imul(v,ne)|0,o=o+Math.imul(v,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0;var Ie=(c+(r=r+Math.imul(h,ue)|0)|0)+((8191&(i=(i=i+Math.imul(h,ce)|0)+Math.imul(d,ue)|0))<<13)|0;c=((o=o+Math.imul(d,ce)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,W))+Math.imul(P,Q)|0,o=Math.imul(P,W),r=r+Math.imul(D,F)|0,i=(i=i+Math.imul(D,V)|0)+Math.imul(C,F)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0,r=r+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,ce)|0;var Ne=(c+(r=r+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;c=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,W))+Math.imul(R,Q)|0,o=Math.imul(R,W),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(D,G)|0,i=(i=i+Math.imul(D,q)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,r=r+Math.imul(g,ue)|0,i=(i=i+Math.imul(g,ce)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,ce)|0,r=r+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(y,he)|0,o=o+Math.imul(y,de)|0;var Te=(c+(r=r+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ye)|0)+Math.imul(d,pe)|0))<<13)|0;c=((o=o+Math.imul(d,ye)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(D,J)|0,i=(i=i+Math.imul(D,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,ee)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,ae)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,ae)|0,r=r+Math.imul(b,ue)|0,i=(i=i+Math.imul(b,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,r=r+Math.imul(g,he)|0,i=(i=i+Math.imul(g,de)|0)+Math.imul(v,he)|0,o=o+Math.imul(v,de)|0;var Ee=(c+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ye)|0)+Math.imul(y,pe)|0))<<13)|0;c=((o=o+Math.imul(y,ye)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(D,$)|0,i=(i=i+Math.imul(D,ee)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(L,ne)|0,i=(i=i+Math.imul(L,re)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,ae)|0,r=r+Math.imul(I,ue)|0,i=(i=i+Math.imul(I,ce)|0)+Math.imul(N,ue)|0,o=o+Math.imul(N,ce)|0,r=r+Math.imul(b,he)|0,i=(i=i+Math.imul(b,de)|0)+Math.imul(M,he)|0,o=o+Math.imul(M,de)|0;var xe=(c+(r=r+Math.imul(g,pe)|0)|0)+((8191&(i=(i=i+Math.imul(g,ye)|0)+Math.imul(v,pe)|0))<<13)|0;c=((o=o+Math.imul(v,ye)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,ee)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,ee)|0,r=r+Math.imul(D,ne)|0,i=(i=i+Math.imul(D,re)|0)+Math.imul(C,ne)|0,o=o+Math.imul(C,re)|0,r=r+Math.imul(L,oe)|0,i=(i=i+Math.imul(L,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,ce)|0)+Math.imul(x,ue)|0,o=o+Math.imul(x,ce)|0,r=r+Math.imul(I,he)|0,i=(i=i+Math.imul(I,de)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,de)|0;var ke=(c+(r=r+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ye)|0)+Math.imul(M,pe)|0))<<13)|0;c=((o=o+Math.imul(M,ye)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,ee))+Math.imul(R,$)|0,o=Math.imul(R,ee),r=r+Math.imul(z,ne)|0,i=(i=i+Math.imul(z,re)|0)+Math.imul(P,ne)|0,o=o+Math.imul(P,re)|0,r=r+Math.imul(D,oe)|0,i=(i=i+Math.imul(D,ae)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,ae)|0,r=r+Math.imul(L,ue)|0,i=(i=i+Math.imul(L,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,r=r+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(x,he)|0,o=o+Math.imul(x,de)|0;var Le=(c+(r=r+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,ye)|0)+Math.imul(N,pe)|0))<<13)|0;c=((o=o+Math.imul(N,ye)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,r=Math.imul(B,ne),i=(i=Math.imul(B,re))+Math.imul(R,ne)|0,o=Math.imul(R,re),r=r+Math.imul(z,oe)|0,i=(i=i+Math.imul(z,ae)|0)+Math.imul(P,oe)|0,o=o+Math.imul(P,ae)|0,r=r+Math.imul(D,ue)|0,i=(i=i+Math.imul(D,ce)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,ce)|0,r=r+Math.imul(L,he)|0,i=(i=i+Math.imul(L,de)|0)+Math.imul(S,he)|0,o=o+Math.imul(S,de)|0;var Se=(c+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,ye)|0)+Math.imul(x,pe)|0))<<13)|0;c=((o=o+Math.imul(x,ye)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(B,oe),i=(i=Math.imul(B,ae))+Math.imul(R,oe)|0,o=Math.imul(R,ae),r=r+Math.imul(z,ue)|0,i=(i=i+Math.imul(z,ce)|0)+Math.imul(P,ue)|0,o=o+Math.imul(P,ce)|0,r=r+Math.imul(D,he)|0,i=(i=i+Math.imul(D,de)|0)+Math.imul(C,he)|0,o=o+Math.imul(C,de)|0;var je=(c+(r=r+Math.imul(L,pe)|0)|0)+((8191&(i=(i=i+Math.imul(L,ye)|0)+Math.imul(S,pe)|0))<<13)|0;c=((o=o+Math.imul(S,ye)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,r=Math.imul(B,ue),i=(i=Math.imul(B,ce))+Math.imul(R,ue)|0,o=Math.imul(R,ce),r=r+Math.imul(z,he)|0,i=(i=i+Math.imul(z,de)|0)+Math.imul(P,he)|0,o=o+Math.imul(P,de)|0;var De=(c+(r=r+Math.imul(D,pe)|0)|0)+((8191&(i=(i=i+Math.imul(D,ye)|0)+Math.imul(C,pe)|0))<<13)|0;c=((o=o+Math.imul(C,ye)|0)+(i>>>13)|0)+(De>>>26)|0,De&=67108863,r=Math.imul(B,he),i=(i=Math.imul(B,de))+Math.imul(R,he)|0,o=Math.imul(R,de);var Ce=(c+(r=r+Math.imul(z,pe)|0)|0)+((8191&(i=(i=i+Math.imul(z,ye)|0)+Math.imul(P,pe)|0))<<13)|0;c=((o=o+Math.imul(P,ye)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863;var Oe=(c+(r=Math.imul(B,pe))|0)+((8191&(i=(i=Math.imul(B,ye))+Math.imul(R,pe)|0))<<13)|0;return c=((o=Math.imul(R,ye))+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,u[0]=me,u[1]=ge,u[2]=ve,u[3]=we,u[4]=be,u[5]=Me,u[6]=Ae,u[7]=Ie,u[8]=Ne,u[9]=Te,u[10]=Ee,u[11]=xe,u[12]=ke,u[13]=Le,u[14]=Se,u[15]=je,u[16]=De,u[17]=Ce,u[18]=Oe,0!==c&&(u[19]=c,n.length++),n};function m(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var l=o-c,h=(0|e.words[l])*(0|t.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(e,t,n){return m(e,t,n)}Math.imul||(y=p),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?y(this,e,t):n<63?p(this,e,t):n<1024?m(this,e,t):g(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*e,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var o=n.sqr();r<t.length;r++,o=o.sqr())0!==t[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r)&&!!(this.words[r]&i)},i.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,r){var i,o,a=e.length+r;this._expand(a);var s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+r])+s;var u=(0|e.words[i])*t;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,a=0|o.words[o.length-1];0!==(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==t){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(o,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var o,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=t.clone();!t.isZero();){for(var d=0,f=1;0==(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(u)):(r.isub(t),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(t.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new N(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},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(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function I(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function N(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function T(e){N.call(this,e),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)}w.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},r(b,w),b.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(M,w),r(A,w),r(I,w),I.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(v[e])return v[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new M;else if("p192"===e)t=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new I}return v[e]=t,t},N.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},N.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},N.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(c(e,e.umod(this.m)._forceRed(this)),e)},N.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},N.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},N.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},N.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},N.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},N.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},N.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},N.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},N.prototype.isqr=function(e){return this.imul(e,e.clone())},N.prototype.sqr=function(e){return this.mul(e,e)},N.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),d=this.pow(e,o.addn(1).iushrn(1)),f=this.pow(e,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m<p);var g=this.pow(h,new i(1).iushln(p-m-1));d=d.redMul(g),h=g.redSqr(),f=f.redMul(h),p=m}return d},N.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},N.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var o=n[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var c=t.words[r],l=u-1;l>=0;l--){var h=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},N.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},N.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new T(e)},r(T,N),T.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},T.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},T.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},T.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,Hf)}));
10
+ var Ts=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),Es=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),xs=BigInt(1),ks=BigInt(2),Ls=function(e,t){return(e+t/ks)/t};var Ss=On(Ts,void 0,void 0,{sqrt:function(e){var t=Ts,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),a=BigInt(23),s=BigInt(44),u=BigInt(88),c=e*e*e%t,l=c*c*e%t,h=xn(l,n,t)*l%t,d=xn(h,n,t)*l%t,f=xn(d,ks,t)*c%t,p=xn(f,i,t)*f%t,y=xn(p,o,t)*p%t,m=xn(y,s,t)*y%t,g=xn(m,u,t)*m%t,v=xn(g,s,t)*y%t,w=xn(v,n,t)*l%t,b=xn(w,a,t)*p%t,M=xn(b,r,t)*c%t,A=xn(M,ks,t);if(!Ss.eql(Ss.sqr(A),e))throw new Error("Cannot find square root");return A}}),js=function(e,t){var n=function(t){return As(C(C({},e),function(e){return{hash:e,hmac:function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return Ns(e,t,Mt.apply(void 0,r))},randomBytes:Nt}}(t)))};return Object.freeze(C(C({},n(t)),{},{create:n}))}({a:BigInt(0),b:BigInt(7),Fp:Ss,n:Es,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:function(e){var t=Es,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-xs*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,a=BigInt("0x100000000000000000000000000000000"),s=Ls(o*e,t),u=Ls(-r*e,t),c=Tn(e-s*n-u*i,t),l=Tn(-s*r-u*o,t),h=c>a,d=l>a;if(h&&(c=t-c),d&&(l=t-l),c>a||l>a)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:h,k1:c,k2neg:d,k2:l}}}},vr);BigInt(0),js.ProjectivePoint;var Ds=["commitment"],Cs=["encoding"],Os=["commitment"],zs=["commitment"],Ps=ir.utils.randomPrivateKey,_s=function(){var e=ir.utils.randomPrivateKey(),t=Bs(e),n=new Uint8Array(64);return n.set(e),n.set(t,32),{publicKey:t,secretKey:n}},Bs=ir.getPublicKey;function Rs(e){try{return ir.ExtendedPoint.fromHex(e),!0}catch(e){return!1}}var Us,Qs=function(e,t){return ir.sign(e,t.slice(0,32))},Ws=ir.verify,Ys=function(e){return Ne.isBuffer(e)?e:e instanceof Uint8Array?Ne.from(e.buffer,e.byteOffset,e.byteLength):Ne.from(e)},Fs=function(){function e(t){B(this,e),Object.assign(this,t)}return U(e,[{key:"encode",value:function(){return Ne.from(Jr(Hs,this))}}],[{key:"decode",value:function(e){return $r(Hs,this,e)}},{key:"decodeUnchecked",value:function(e){return Br(Hs,this,e)}}]),e}(),Vs=function(e){W(n,Fs);var t=X(n);function n(e){var r;if(B(this,n),(r=t.call(this,e)).enum="",1!==Object.keys(e).length)throw new Error("Enum can only take single value");return Object.keys(e).map((function(e){r.enum=e})),r}return U(n)}(),Hs=new Map;var Gs=1,qs=function(e,t){W(a,Fs);var n,r,i,o=X(a);function a(e){var t;if(B(this,a),(t=o.call(this,{}))._bn=void 0,function(e){return void 0!==e._bn}(e))t._bn=e._bn;else{if("string"==typeof e){var n=dr.decode(e);if(32!=n.length)throw new Error("Invalid public key input");t._bn=new cr(n)}else t._bn=new cr(e);if(t._bn.byteLength()>32)throw new Error("Invalid public key input")}return t}return U(a,[{key:"equals",value:function(e){return this._bn.eq(e._bn)}},{key:"toBase58",value:function(){return dr.encode(this.toBytes())}},{key:"toJSON",value:function(){return this.toBase58()}},{key:"toBytes",value:function(){var e=this.toBuffer();return new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}},{key:"toBuffer",value:function(){var e=this._bn.toArrayLike(Ne);if(32===e.length)return e;var t=Ne.alloc(32);return e.copy(t,32-e.length),t}},{key:t,get:function(){return"PublicKey(".concat(this.toString(),")")}},{key:"toString",value:function(){return this.toBase58()}}],[{key:"unique",value:function(){var e=new a(Gs);return Gs+=1,new a(e.toBuffer())}},{key:"createWithSeed",value:(i=_(O().mark((function e(t,n,r){var i,o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=Ne.concat([t.toBuffer(),Ne.from(n),r.toBuffer()]),o=vr(i),e.abrupt("return",new a(o));case 3:case"end":return e.stop()}}),e)}))),function(e,t,n){return i.apply(this,arguments)})},{key:"createProgramAddressSync",value:function(e,t){var n=Ne.alloc(0);e.forEach((function(e){if(e.length>32)throw new TypeError("Max seed length exceeded");n=Ne.concat([n,Ys(e)])})),n=Ne.concat([n,t.toBuffer(),Ne.from("ProgramDerivedAddress")]);var r=vr(n);if(Rs(r))throw new Error("Invalid seeds, address must fall off the curve");return new a(r)}},{key:"createProgramAddress",value:(r=_(O().mark((function e(t,n){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.createProgramAddressSync(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"findProgramAddressSync",value:function(e,t){for(var n,r=255;0!=r;){try{var i=e.concat(Ne.from([r]));n=this.createProgramAddressSync(i,t)}catch(e){if(e instanceof TypeError)throw e;r--;continue}return[n,r]}throw new Error("Unable to find a viable program address nonce")}},{key:"findProgramAddress",value:(n=_(O().mark((function e(t,n){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.findProgramAddressSync(t,n));case 1:case"end":return e.stop()}}),e,this)}))),function(e,t){return n.apply(this,arguments)})},{key:"isOnCurve",value:function(e){return Rs(new a(e).toBytes())}}]),a}(0,Symbol.toStringTag);Us=qs,qs.default=new Us("11111111111111111111111111111111"),Hs.set(qs,{kind:"struct",fields:[["_bn","u256"]]});var Zs=function(){function e(t){if(B(this,e),this._publicKey=void 0,this._secretKey=void 0,t){var n=Ys(t);if(64!==t.length)throw new Error("bad secret key size");this._publicKey=n.slice(32,64),this._secretKey=n.slice(0,32)}else this._secretKey=Ys(Ps()),this._publicKey=Ys(Bs(this._secretKey))}return U(e,[{key:"publicKey",get:function(){return new qs(this._publicKey)}},{key:"secretKey",get:function(){return Ne.concat([this._secretKey,this._publicKey],64)}}]),e}(),Js=new qs("BPFLoader1111111111111111111111111111111111"),Xs=function(e){W(n,G(Error));var t=X(n);function n(e){var r;return B(this,n),(r=t.call(this,"Signature ".concat(e," has expired: block height exceeded."))).signature=void 0,r.signature=e,r}return U(n)}();Object.defineProperty(Xs.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});var Ks=function(e){W(n,G(Error));var t=X(n);function n(e,r){var i;return B(this,n),(i=t.call(this,"Transaction was not confirmed in ".concat(r.toFixed(2)," seconds. It is ")+"unknown if it succeeded or failed. Check signature "+"".concat(e," using the Solana Explorer or CLI tools."))).signature=void 0,i.signature=e,i}return U(n)}();Object.defineProperty(Ks.prototype,"name",{value:"TransactionExpiredTimeoutError"});var $s=function(e){W(n,G(Error));var t=X(n);function n(e){var r;return B(this,n),(r=t.call(this,"Signature ".concat(e," has expired: the nonce is no longer valid."))).signature=void 0,r.signature=e,r}return U(n)}();Object.defineProperty($s.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});var eu=function(){function e(t,n){B(this,e),this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=n}return U(e,[{key:"keySegments",value:function(){var e=[this.staticAccountKeys];return this.accountKeysFromLookups&&(e.push(this.accountKeysFromLookups.writable),e.push(this.accountKeysFromLookups.readonly)),e}},{key:"get",value:function(e){var t,n=se(this.keySegments());try{for(n.s();!(t=n.n()).done;){var r=t.value;if(e<r.length)return r[e];e-=r.length}}catch(e){n.e(e)}finally{n.f()}}},{key:"length",get:function(){return this.keySegments().flat().length}},{key:"compileInstructions",value:function(e){if(this.length>256)throw new Error("Account index overflow encountered during compilation");var t=new Map;this.keySegments().flat().forEach((function(e,n){t.set(e.toBase58(),n)}));var n=function(e){var n=t.get(e.toBase58());if(void 0===n)throw new Error("Encountered an unknown instruction account key during compilation");return n};return e.map((function(e){return{programIdIndex:n(e.programId),accountKeyIndexes:e.keys.map((function(e){return n(e.pubkey)})),data:e.data}}))}}]),e}(),tu=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"publicKey";return Hi(32,e)},nu=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"signature";return Hi(64,e)},ru=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"string",t=Fi([Qi("length"),Qi("lengthPadding"),Hi(Bi(Qi(),-8),"chars")],e),n=t.decode.bind(t),r=t.encode.bind(t),i=t;return i.decode=function(e,t){return n(e,t).chars.toString()},i.encode=function(e,t,n){var i={chars:Ne.from(e,"utf8")};return r(i,t,n)},i.alloc=function(e){return Qi().span+Qi().span+Ne.from(e,"utf8").length},i};function iu(e,t){var n=function e(n){if(n.span>=0)return n.span;if("function"==typeof n.alloc)return n.alloc(t[n.property]);if("count"in n&&"elementLayout"in n){var r=t[n.property];if(Array.isArray(r))return r.length*e(n.elementLayout)}else if("fields"in n)return iu({layout:n},t[n.property]);return 0},r=0;return e.layout.fields.forEach((function(e){r+=n(e)})),r}function ou(e){for(var t=0,n=0;;){var r=e.shift();if(t|=(127&r)<<7*n,n+=1,0==(128&r))break}return t}function au(e,t){for(var n=t;;){var r=127&n;if(0==(n>>=7)){e.push(r);break}r|=128,e.push(r)}}function su(e,t){if(!e)throw new Error(t||"Assertion failed")}var uu=function(){function e(t,n){B(this,e),this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=n}return U(e,[{key:"getMessageComponents",value:function(){var e=te(this.keyMetaMap.entries());su(e.length<=256,"Max static account keys length exceeded");var t=e.filter((function(e){var t=ee(e,2)[1];return t.isSigner&&t.isWritable})),n=e.filter((function(e){var t=ee(e,2)[1];return t.isSigner&&!t.isWritable})),r=e.filter((function(e){var t=ee(e,2)[1];return!t.isSigner&&t.isWritable})),i=e.filter((function(e){var t=ee(e,2)[1];return!t.isSigner&&!t.isWritable})),o={numRequiredSignatures:t.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:i.length};return su(t.length>0,"Expected at least one writable signer key"),su(ee(t[0],1)[0]===this.payer.toBase58(),"Expected first writable signer key to be the fee payer"),[o,[].concat(te(t.map((function(e){var t=ee(e,1)[0];return new qs(t)}))),te(n.map((function(e){var t=ee(e,1)[0];return new qs(t)}))),te(r.map((function(e){var t=ee(e,1)[0];return new qs(t)}))),te(i.map((function(e){var t=ee(e,1)[0];return new qs(t)}))))]}},{key:"extractTableLookup",value:function(e){var t=ee(this.drainKeysFoundInLookupTable(e.state.addresses,(function(e){return!e.isSigner&&!e.isInvoked&&e.isWritable})),2),n=t[0],r=t[1],i=ee(this.drainKeysFoundInLookupTable(e.state.addresses,(function(e){return!e.isSigner&&!e.isInvoked&&!e.isWritable})),2),o=i[0],a=i[1];if(0!==n.length||0!==o.length)return[{accountKey:e.key,writableIndexes:n,readonlyIndexes:o},{writable:r,readonly:a}]}},{key:"drainKeysFoundInLookupTable",value:function(e,t){var n,r=this,i=new Array,o=new Array,a=se(this.keyMetaMap.entries());try{var s=function(){var a=ee(n.value,2),s=a[0],u=a[1];if(t(u)){var c=new qs(s),l=e.findIndex((function(e){return e.equals(c)}));l>=0&&(su(l<256,"Max lookup table index exceeded"),i.push(l),o.push(c),r.keyMetaMap.delete(s))}};for(a.s();!(n=a.n()).done;)s()}catch(e){a.e(e)}finally{a.f()}return[i,o]}}],[{key:"compile",value:function(t,n){var r=new Map,i=function(e){var t=e.toBase58(),n=r.get(t);return void 0===n&&(n={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(t,n)),n},o=i(n);o.isSigner=!0,o.isWritable=!0;var a,s=se(t);try{for(s.s();!(a=s.n()).done;){var u=a.value;i(u.programId).isInvoked=!0;var c,l=se(u.keys);try{for(l.s();!(c=l.n()).done;){var h=c.value,d=i(h.pubkey);d.isSigner||(d.isSigner=h.isSigner),d.isWritable||(d.isWritable=h.isWritable)}}catch(e){l.e(e)}finally{l.f()}}}catch(e){s.e(e)}finally{s.f()}return new e(n,r)}}]),e}(),cu=function(){function e(t){var n=this;B(this,e),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((function(e){return new qs(e)})),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach((function(e){return n.indexToProgramIds.set(e.programIdIndex,n.accountKeys[e.programIdIndex])}))}return U(e,[{key:"version",get:function(){return"legacy"}},{key:"staticAccountKeys",get:function(){return this.accountKeys}},{key:"compiledInstructions",get:function(){return this.instructions.map((function(e){return{programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:dr.decode(e.data)}}))}},{key:"addressTableLookups",get:function(){return[]}},{key:"getAccountKeys",value:function(){return new eu(this.staticAccountKeys)}},{key:"isAccountSigner",value:function(e){return e<this.header.numRequiredSignatures}},{key:"isAccountWritable",value:function(e){var t=this.header.numRequiredSignatures;return e>=this.header.numRequiredSignatures?e-t<this.accountKeys.length-t-this.header.numReadonlyUnsignedAccounts:e<t-this.header.numReadonlySignedAccounts}},{key:"isProgramId",value:function(e){return this.indexToProgramIds.has(e)}},{key:"programIds",value:function(){return te(this.indexToProgramIds.values())}},{key:"nonProgramIds",value:function(){var e=this;return this.accountKeys.filter((function(t,n){return!e.isProgramId(n)}))}},{key:"serialize",value:function(){var e=this.accountKeys.length,t=[];au(t,e);var n=this.instructions.map((function(e){var t=e.accounts,n=e.programIdIndex,r=Array.from(dr.decode(e.data)),i=[];au(i,t.length);var o=[];return au(o,r.length),{programIdIndex:n,keyIndicesCount:Ne.from(i),keyIndices:t,dataLength:Ne.from(o),data:r}})),r=[];au(r,n.length);var i=Ne.alloc(1232);Ne.from(r).copy(i);var o=r.length;n.forEach((function(e){var t=Fi([Ri("programIdIndex"),Hi(e.keyIndicesCount.length,"keyIndicesCount"),Vi(Ri("keyIndex"),e.keyIndices.length,"keyIndices"),Hi(e.dataLength.length,"dataLength"),Vi(Ri("userdatum"),e.data.length,"data")]).encode(e,i,o);o+=t})),i=i.slice(0,o);var a=Fi([Hi(1,"numRequiredSignatures"),Hi(1,"numReadonlySignedAccounts"),Hi(1,"numReadonlyUnsignedAccounts"),Hi(t.length,"keyCount"),Vi(tu("key"),e,"keys"),tu("recentBlockhash")]),s={numRequiredSignatures:Ne.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:Ne.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:Ne.from([this.header.numReadonlyUnsignedAccounts]),keyCount:Ne.from(t),keys:this.accountKeys.map((function(e){return Ys(e.toBytes())})),recentBlockhash:dr.decode(this.recentBlockhash)},u=Ne.alloc(2048),c=a.encode(s,u);return i.copy(u,c),u.slice(0,c+i.length)}}],[{key:"compile",value:function(t){var n=ee(uu.compile(t.instructions,t.payerKey).getMessageComponents(),2),r=n[0],i=n[1],o=new eu(i).compileInstructions(t.instructions).map((function(e){return{programIdIndex:e.programIdIndex,accounts:e.accountKeyIndexes,data:dr.encode(e.data)}}));return new e({header:r,accountKeys:i,recentBlockhash:t.recentBlockhash,instructions:o})}},{key:"from",value:function(t){var n=te(t),r=n.shift();if(r!==(127&r))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");for(var i=n.shift(),o=n.shift(),a=ou(n),s=[],u=0;u<a;u++){var c=n.slice(0,32);n=n.slice(32),s.push(new qs(Ne.from(c)))}for(var l=n.slice(0,32),h=ou(n=n.slice(32)),d=[],f=0;f<h;f++){var p=n.shift(),y=ou(n),m=n.slice(0,y),g=ou(n=n.slice(y)),v=n.slice(0,g),w=dr.encode(Ne.from(v));n=n.slice(g),d.push({programIdIndex:p,accounts:m,data:w})}return new e({header:{numRequiredSignatures:r,numReadonlySignedAccounts:i,numReadonlyUnsignedAccounts:o},recentBlockhash:dr.encode(Ne.from(l)),accountKeys:s,instructions:d})}}]),e}(),lu=function(){function e(t){B(this,e),this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=t.header,this.staticAccountKeys=t.staticAccountKeys,this.recentBlockhash=t.recentBlockhash,this.compiledInstructions=t.compiledInstructions,this.addressTableLookups=t.addressTableLookups}return U(e,[{key:"version",get:function(){return 0}},{key:"numAccountKeysFromLookups",get:function(){var e,t=0,n=se(this.addressTableLookups);try{for(n.s();!(e=n.n()).done;){var r=e.value;t+=r.readonlyIndexes.length+r.writableIndexes.length}}catch(e){n.e(e)}finally{n.f()}return t}},{key:"getAccountKeys",value:function(e){var t;if(e&&"accountKeysFromLookups"in e&&e.accountKeysFromLookups){if(this.numAccountKeysFromLookups!=e.accountKeysFromLookups.writable.length+e.accountKeysFromLookups.readonly.length)throw new Error("Failed to get account keys because of a mismatch in the number of account keys from lookups");t=e.accountKeysFromLookups}else if(e&&"addressLookupTableAccounts"in e&&e.addressLookupTableAccounts)t=this.resolveAddressTableLookups(e.addressLookupTableAccounts);else if(this.addressTableLookups.length>0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new eu(this.staticAccountKeys,t)}},{key:"isAccountSigner",value:function(e){return e<this.header.numRequiredSignatures}},{key:"isAccountWritable",value:function(e){var t=this.header.numRequiredSignatures,n=this.staticAccountKeys.length;return e>=n?e-n<this.addressTableLookups.reduce((function(e,t){return e+t.writableIndexes.length}),0):e>=this.header.numRequiredSignatures?e-t<n-t-this.header.numReadonlyUnsignedAccounts:e<t-this.header.numReadonlySignedAccounts}},{key:"resolveAddressTableLookups",value:function(e){var t,n={writable:[],readonly:[]},r=se(this.addressTableLookups);try{var i=function(){var r=t.value,i=e.find((function(e){return e.key.equals(r.accountKey)}));if(!i)throw new Error("Failed to find address lookup table account for table key ".concat(r.accountKey.toBase58()));var o,a=se(r.writableIndexes);try{for(a.s();!(o=a.n()).done;){var s=o.value;if(!(s<i.state.addresses.length))throw new Error("Failed to find address for index ".concat(s," in address lookup table ").concat(r.accountKey.toBase58()));n.writable.push(i.state.addresses[s])}}catch(e){a.e(e)}finally{a.f()}var u,c=se(r.readonlyIndexes);try{for(c.s();!(u=c.n()).done;){var l=u.value;if(!(l<i.state.addresses.length))throw new Error("Failed to find address for index ".concat(l," in address lookup table ").concat(r.accountKey.toBase58()));n.readonly.push(i.state.addresses[l])}}catch(e){c.e(e)}finally{c.f()}};for(r.s();!(t=r.n()).done;)i()}catch(e){r.e(e)}finally{r.f()}return n}},{key:"serialize",value:function(){var e=Array();au(e,this.staticAccountKeys.length);var t=this.serializeInstructions(),n=Array();au(n,this.compiledInstructions.length);var r=this.serializeAddressTableLookups(),i=Array();au(i,this.addressTableLookups.length);var o=Fi([Ri("prefix"),Fi([Ri("numRequiredSignatures"),Ri("numReadonlySignedAccounts"),Ri("numReadonlyUnsignedAccounts")],"header"),Hi(e.length,"staticAccountKeysLength"),Vi(tu(),this.staticAccountKeys.length,"staticAccountKeys"),tu("recentBlockhash"),Hi(n.length,"instructionsLength"),Hi(t.length,"serializedInstructions"),Hi(i.length,"addressTableLookupsLength"),Hi(r.length,"serializedAddressTableLookups")]),a=new Uint8Array(1232),s=o.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(e),staticAccountKeys:this.staticAccountKeys.map((function(e){return e.toBytes()})),recentBlockhash:dr.decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:t,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:r},a);return a.slice(0,s)}},{key:"serializeInstructions",value:function(){var e,t=0,n=new Uint8Array(1232),r=se(this.compiledInstructions);try{for(r.s();!(e=r.n()).done;){var i=e.value,o=Array();au(o,i.accountKeyIndexes.length);var a=Array();au(a,i.data.length),t+=Fi([Ri("programIdIndex"),Hi(o.length,"encodedAccountKeyIndexesLength"),Vi(Ri(),i.accountKeyIndexes.length,"accountKeyIndexes"),Hi(a.length,"encodedDataLength"),Hi(i.data.length,"data")]).encode({programIdIndex:i.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(o),accountKeyIndexes:i.accountKeyIndexes,encodedDataLength:new Uint8Array(a),data:i.data},n,t)}}catch(e){r.e(e)}finally{r.f()}return n.slice(0,t)}},{key:"serializeAddressTableLookups",value:function(){var e,t=0,n=new Uint8Array(1232),r=se(this.addressTableLookups);try{for(r.s();!(e=r.n()).done;){var i=e.value,o=Array();au(o,i.writableIndexes.length);var a=Array();au(a,i.readonlyIndexes.length),t+=Fi([tu("accountKey"),Hi(o.length,"encodedWritableIndexesLength"),Vi(Ri(),i.writableIndexes.length,"writableIndexes"),Hi(a.length,"encodedReadonlyIndexesLength"),Vi(Ri(),i.readonlyIndexes.length,"readonlyIndexes")]).encode({accountKey:i.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(o),writableIndexes:i.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(a),readonlyIndexes:i.readonlyIndexes},n,t)}}catch(e){r.e(e)}finally{r.f()}return n.slice(0,t)}}],[{key:"compile",value:function(t){var n,r=uu.compile(t.instructions,t.payerKey),i=new Array,o={writable:new Array,readonly:new Array},a=se(t.addressLookupTableAccounts||[]);try{for(a.s();!(n=a.n()).done;){var s=n.value,u=r.extractTableLookup(s);if(void 0!==u){var c,l,h=ee(u,2),d=h[0],f=h[1],p=f.writable,y=f.readonly;i.push(d),(c=o.writable).push.apply(c,te(p)),(l=o.readonly).push.apply(l,te(y))}}}catch(e){a.e(e)}finally{a.f()}var m=ee(r.getMessageComponents(),2),g=m[0],v=m[1],w=new eu(v,o).compileInstructions(t.instructions);return new e({header:g,staticAccountKeys:v,recentBlockhash:t.recentBlockhash,compiledInstructions:w,addressTableLookups:i})}},{key:"deserialize",value:function(t){var n=te(t),r=n.shift(),i=127&r;su(r!==i,"Expected versioned message but received legacy message");su(0===i,"Expected versioned message with version 0 but found version ".concat(i));for(var o={numRequiredSignatures:n.shift(),numReadonlySignedAccounts:n.shift(),numReadonlyUnsignedAccounts:n.shift()},a=[],s=ou(n),u=0;u<s;u++)a.push(new qs(n.splice(0,32)));for(var c=dr.encode(n.splice(0,32)),l=ou(n),h=[],d=0;d<l;d++){var f=n.shift(),p=ou(n),y=n.splice(0,p),m=ou(n),g=new Uint8Array(n.splice(0,m));h.push({programIdIndex:f,accountKeyIndexes:y,data:g})}for(var v=ou(n),w=[],b=0;b<v;b++){var M=new qs(n.splice(0,32)),A=ou(n),I=n.splice(0,A),N=ou(n),T=n.splice(0,N);w.push({accountKey:M,writableIndexes:I,readonlyIndexes:T})}return new e({header:o,staticAccountKeys:a,recentBlockhash:c,compiledInstructions:h,addressTableLookups:w})}}]),e}(),hu={deserializeMessageVersion:function(e){var t=e[0],n=127&t;return n===t?"legacy":n},deserialize:function(e){var t=hu.deserializeMessageVersion(e);if("legacy"===t)return cu.from(e);if(0===t)return lu.deserialize(e);throw new Error("Transaction message version ".concat(t," deserialization is not supported"))}},du=function(e){return e[e.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",e[e.PROCESSED=1]="PROCESSED",e[e.TIMED_OUT=2]="TIMED_OUT",e[e.NONCE_INVALID=3]="NONCE_INVALID",e}({}),fu=Ne.alloc(64).fill(0),pu=function(){function e(t){B(this,e),this.keys=void 0,this.programId=void 0,this.data=Ne.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}return U(e,[{key:"toJSON",value:function(){return{keys:this.keys.map((function(e){var t=e.pubkey,n=e.isSigner,r=e.isWritable;return{pubkey:t.toJSON(),isSigner:n,isWritable:r}})),programId:this.programId.toJSON(),data:te(this.data)}}}]),e}(),yu=function(){function e(t){if(B(this,e),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")){var n=t.minContextSlot,r=t.nonceInfo;this.minNonceContextSlot=n,this.nonceInfo=r}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){var i=t.blockhash,o=t.lastValidBlockHeight;this.recentBlockhash=i,this.lastValidBlockHeight=o}else{var a=t.recentBlockhash,s=t.nonceInfo;s&&(this.nonceInfo=s),this.recentBlockhash=a}}var t;return U(e,[{key:"signature",get:function(){return this.signatures.length>0?this.signatures[0].signature:null}},{key:"toJSON",value:function(){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((function(e){return e.toJSON()})),signers:this.signatures.map((function(e){return e.publicKey.toJSON()}))}}},{key:"add",value:function(){for(var e=this,t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(0===n.length)throw new Error("No instructions");return n.forEach((function(t){"instructions"in t?e.instructions=e.instructions.concat(t.instructions):"data"in t&&"programId"in t&&"keys"in t?e.instructions.push(t):e.instructions.push(new pu(t))})),this}},{key:"compileMessage",value:function(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;var e,t,n;if(this.nonceInfo?(e=this.nonceInfo.nonce,t=this.instructions[0]!=this.nonceInfo.nonceInstruction?[this.nonceInfo.nonceInstruction].concat(te(this.instructions)):this.instructions):(e=this.recentBlockhash,t=this.instructions),!e)throw new Error("Transaction recentBlockhash required");if(t.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(var r=0;r<t.length;r++)if(void 0===t[r].programId)throw new Error("Transaction instruction index ".concat(r," has undefined program id"));var i=[],o=[];t.forEach((function(e){e.keys.forEach((function(e){o.push(C({},e))}));var t=e.programId.toString();i.includes(t)||i.push(t)})),i.forEach((function(e){o.push({pubkey:new qs(e),isSigner:!1,isWritable:!1})}));var a=[];o.forEach((function(e){var t=e.pubkey.toString(),n=a.findIndex((function(e){return e.pubkey.toString()===t}));n>-1?(a[n].isWritable=a[n].isWritable||e.isWritable,a[n].isSigner=a[n].isSigner||e.isSigner):a.push(e)})),a.sort((function(e,t){if(e.isSigner!==t.isSigner)return e.isSigner?-1:1;if(e.isWritable!==t.isWritable)return e.isWritable?-1:1;return e.pubkey.toBase58().localeCompare(t.pubkey.toBase58(),"en",{localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"})}));var s=a.findIndex((function(e){return e.pubkey.equals(n)}));if(s>-1){var u=ee(a.splice(s,1),1)[0];u.isSigner=!0,u.isWritable=!0,a.unshift(u)}else a.unshift({pubkey:n,isSigner:!0,isWritable:!0});var c,l=se(this.signatures);try{var h=function(){var e=c.value,t=a.findIndex((function(t){return t.pubkey.equals(e.publicKey)}));if(!(t>-1))throw new Error("unknown signer: ".concat(e.publicKey.toString()));a[t].isSigner||(a[t].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."))};for(l.s();!(c=l.n()).done;)h()}catch(e){l.e(e)}finally{l.f()}var d=0,f=0,p=0,y=[],m=[];a.forEach((function(e){var t=e.pubkey,n=e.isSigner,r=e.isWritable;n?(y.push(t.toString()),d+=1,r||(f+=1)):(m.push(t.toString()),r||(p+=1))}));var g=y.concat(m),v=t.map((function(e){var t=e.data,n=e.programId;return{programIdIndex:g.indexOf(n.toString()),accounts:e.keys.map((function(e){return g.indexOf(e.pubkey.toString())})),data:dr.encode(t)}}));return v.forEach((function(e){su(e.programIdIndex>=0),e.accounts.forEach((function(e){return su(e>=0)}))})),new cu({header:{numRequiredSignatures:d,numReadonlySignedAccounts:f,numReadonlyUnsignedAccounts:p},accountKeys:g,recentBlockhash:e,instructions:v})}},{key:"_compile",value:function(){var e=this.compileMessage(),t=e.accountKeys.slice(0,e.header.numRequiredSignatures);if(this.signatures.length===t.length&&this.signatures.every((function(e,n){return t[n].equals(e.publicKey)})))return e;return this.signatures=t.map((function(e){return{signature:null,publicKey:e}})),e}},{key:"serializeMessage",value:function(){return this._compile().serialize()}},{key:"getEstimatedFee",value:(t=_(O().mark((function e(t){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getFeeForMessage(this.compileMessage());case 2:return e.abrupt("return",e.sent.value);case 3:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})},{key:"setSigners",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)throw new Error("No signers");var r=new Set;this.signatures=t.filter((function(e){var t=e.toString();return!r.has(t)&&(r.add(t),!0)})).map((function(e){return{signature:null,publicKey:e}}))}},{key:"sign",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)throw new Error("No signers");for(var r=new Set,i=[],o=0,a=t;o<a.length;o++){var s=a[o],u=s.publicKey.toString();r.has(u)||(r.add(u),i.push(s))}this.signatures=i.map((function(e){return{signature:null,publicKey:e.publicKey}}));var c=this._compile();this._partialSign.apply(this,[c].concat(i))}},{key:"partialSign",value:function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];if(0===t.length)throw new Error("No signers");for(var r=new Set,i=[],o=0,a=t;o<a.length;o++){var s=a[o],u=s.publicKey.toString();r.has(u)||(r.add(u),i.push(s))}var c=this._compile();this._partialSign.apply(this,[c].concat(i))}},{key:"_partialSign",value:function(e){for(var t=this,n=e.serialize(),r=arguments.length,i=new Array(r>1?r-1:0),o=1;o<r;o++)i[o-1]=arguments[o];i.forEach((function(e){var r=Qs(n,e.secretKey);t._addSignature(e.publicKey,Ys(r))}))}},{key:"addSignature",value:function(e,t){this._compile(),this._addSignature(e,t)}},{key:"_addSignature",value:function(e,t){su(64===t.length);var n=this.signatures.findIndex((function(t){return e.equals(t.publicKey)}));if(n<0)throw new Error("unknown signer: ".concat(e.toString()));this.signatures[n].signature=Ne.from(t)}},{key:"verifySignatures",value:function(e){return this._verifySignatures(this.serializeMessage(),void 0===e||e)}},{key:"_verifySignatures",value:function(e,t){var n,r=se(this.signatures);try{for(r.s();!(n=r.n()).done;){var i=n.value,o=i.signature,a=i.publicKey;if(null===o){if(t)return!1}else if(!Ws(o,e,a.toBytes()))return!1}}catch(e){r.e(e)}finally{r.f()}return!0}},{key:"serialize",value:function(e){var t=Object.assign({requireAllSignatures:!0,verifySignatures:!0},e),n=t.requireAllSignatures,r=t.verifySignatures,i=this.serializeMessage();if(r&&!this._verifySignatures(i,n))throw new Error("Signature verification failed");return this._serialize(i)}},{key:"_serialize",value:function(e){var t=this.signatures,n=[];au(n,t.length);var r=n.length+64*t.length+e.length,i=Ne.alloc(r);return su(t.length<256),Ne.from(n).copy(i,0),t.forEach((function(e,t){var r=e.signature;null!==r&&(su(64===r.length,"signature has invalid length"),Ne.from(r).copy(i,n.length+64*t))})),e.copy(i,n.length+64*t.length),su(i.length<=1232,"Transaction too large: ".concat(i.length," > ").concat(1232)),i}},{key:"keys",get:function(){return su(1===this.instructions.length),this.instructions[0].keys.map((function(e){return e.pubkey}))}},{key:"programId",get:function(){return su(1===this.instructions.length),this.instructions[0].programId}},{key:"data",get:function(){return su(1===this.instructions.length),this.instructions[0].data}}],[{key:"from",value:function(t){for(var n=te(t),r=ou(n),i=[],o=0;o<r;o++){var a=n.slice(0,64);n=n.slice(64),i.push(dr.encode(Ne.from(a)))}return e.populate(cu.from(n),i)}},{key:"populate",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],r=new e;return r.recentBlockhash=t.recentBlockhash,t.header.numRequiredSignatures>0&&(r.feePayer=t.accountKeys[0]),n.forEach((function(e,n){var i={signature:e==dr.encode(fu)?null:dr.decode(e),publicKey:t.accountKeys[n]};r.signatures.push(i)})),t.instructions.forEach((function(e){var n=e.accounts.map((function(e){var n=t.accountKeys[e];return{pubkey:n,isSigner:r.signatures.some((function(e){return e.publicKey.toString()===n.toString()}))||t.isAccountSigner(e),isWritable:t.isAccountWritable(e)}}));r.instructions.push(new pu({keys:n,programId:t.accountKeys[e.programIdIndex],data:dr.decode(e.data)}))})),r._message=t,r._json=r.toJSON(),r}}]),e}(),mu=function(){function e(t){B(this,e),this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=t.payerKey,this.instructions=t.instructions,this.recentBlockhash=t.recentBlockhash}return U(e,[{key:"compileToLegacyMessage",value:function(){return cu.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions})}},{key:"compileToV0Message",value:function(e){return lu.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions,addressLookupTableAccounts:e})}}],[{key:"decompile",value:function(t,n){var r=t.header,i=t.compiledInstructions,o=t.recentBlockhash,a=r.numRequiredSignatures,s=r.numReadonlySignedAccounts,u=r.numReadonlyUnsignedAccounts,c=a-s;su(c>0,"Message header is invalid");var l=t.staticAccountKeys.length-a-u;su(l>=0,"Message header is invalid");var h=t.getAccountKeys(n),d=h.get(0);if(void 0===d)throw new Error("Failed to decompile message because no account keys were found");var f,p=[],y=se(i);try{for(y.s();!(f=y.n()).done;){var m,g=f.value,v=[],w=se(g.accountKeyIndexes);try{for(w.s();!(m=w.n()).done;){var b=m.value,M=h.get(b);if(void 0===M)throw new Error("Failed to find key for account key index ".concat(b));var A=void 0;A=b<a?b<c:b<h.staticAccountKeys.length?b-a<l:b-h.staticAccountKeys.length<h.accountKeysFromLookups.writable.length,v.push({pubkey:M,isSigner:b<r.numRequiredSignatures,isWritable:A})}}catch(e){w.e(e)}finally{w.f()}var I=h.get(g.programIdIndex);if(void 0===I)throw new Error("Failed to find program id for program id index ".concat(g.programIdIndex));p.push(new pu({programId:I,data:Ys(g.data),keys:v}))}}catch(e){y.e(e)}finally{y.f()}return new e({payerKey:d,instructions:p,recentBlockhash:o})}}]),e}(),gu=function(){function e(t,n){if(B(this,e),this.signatures=void 0,this.message=void 0,void 0!==n)su(n.length===t.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=n;else{for(var r=[],i=0;i<t.header.numRequiredSignatures;i++)r.push(new Uint8Array(64));this.signatures=r}this.message=t}return U(e,[{key:"version",get:function(){return this.message.version}},{key:"serialize",value:function(){var e=this.message.serialize(),t=Array();au(t,this.signatures.length);var n=Fi([Hi(t.length,"encodedSignaturesLength"),Vi(nu(),this.signatures.length,"signatures"),Hi(e.length,"serializedMessage")]),r=new Uint8Array(2048),i=n.encode({encodedSignaturesLength:new Uint8Array(t),signatures:this.signatures,serializedMessage:e},r);return r.slice(0,i)}},{key:"sign",value:function(e){var t,n=this,r=this.message.serialize(),i=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures),o=se(e);try{var a=function(){var e=t.value,o=i.findIndex((function(t){return t.equals(e.publicKey)}));su(o>=0,"Cannot sign with non signer key ".concat(e.publicKey.toBase58())),n.signatures[o]=Qs(r,e.secretKey)};for(o.s();!(t=o.n()).done;)a()}catch(e){o.e(e)}finally{o.f()}}},{key:"addSignature",value:function(e,t){su(64===t.byteLength,"Signature must be 64 bytes long");var n=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex((function(t){return t.equals(e)}));su(n>=0,"Can not add signature; `".concat(e.toBase58(),"` is not required to sign this transaction")),this.signatures[n]=t}}],[{key:"deserialize",value:function(t){for(var n=te(t),r=[],i=ou(n),o=0;o<i;o++)r.push(new Uint8Array(n.splice(0,64)));return new e(hu.deserialize(new Uint8Array(n)),r)}}]),e}(),vu=new qs("SysvarC1ock11111111111111111111111111111111"),wu=new qs("SysvarEpochSchedu1e111111111111111111111111"),bu=new qs("Sysvar1nstructions1111111111111111111111111"),Mu=new qs("SysvarRecentB1ockHashes11111111111111111111"),Au=new qs("SysvarRent111111111111111111111111111111111"),Iu=new qs("SysvarRewards111111111111111111111111111111"),Nu=new qs("SysvarS1otHashes111111111111111111111111111"),Tu=new qs("SysvarS1otHistory11111111111111111111111111"),Eu=new qs("SysvarStakeHistory1111111111111111111111111");function xu(e,t,n,r){return ku.apply(this,arguments)}function ku(){return(ku=_(O().mark((function e(t,n,r,i){var o,a,s,u,c;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=i&&{skipPreflight:i.skipPreflight,preflightCommitment:i.preflightCommitment||i.commitment,maxRetries:i.maxRetries,minContextSlot:i.minContextSlot},e.next=3,t.sendTransaction(n,r,o);case 3:if(a=e.sent,null==n.recentBlockhash||null==n.lastValidBlockHeight){e.next=10;break}return e.next=7,t.confirmTransaction({abortSignal:null==i?void 0:i.abortSignal,signature:a,blockhash:n.recentBlockhash,lastValidBlockHeight:n.lastValidBlockHeight},i&&i.commitment);case 7:s=e.sent.value,e.next=22;break;case 10:if(null==n.minNonceContextSlot||null==n.nonceInfo){e.next=18;break}return u=n.nonceInfo.nonceInstruction,c=u.keys[0].pubkey,e.next=15,t.confirmTransaction({abortSignal:null==i?void 0:i.abortSignal,minContextSlot:n.minNonceContextSlot,nonceAccountPubkey:c,nonceValue:n.nonceInfo.nonce,signature:a},i&&i.commitment);case 15:s=e.sent.value,e.next=22;break;case 18:return null!=(null==i?void 0:i.abortSignal)&&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."),e.next=21,t.confirmTransaction(a,i&&i.commitment);case 21:s=e.sent.value;case 22:if(!s.err){e.next=24;break}throw new Error("Transaction ".concat(a," failed (").concat(JSON.stringify(s),")"));case 24:return e.abrupt("return",a);case 25:case"end":return e.stop()}}),e)})))).apply(this,arguments)}function Lu(e){return new Promise((function(t){return setTimeout(t,e)}))}function Su(e,t){var n=e.layout.span>=0?e.layout.span:iu(e,t),r=Ne.alloc(n),i=Object.assign({instruction:e.index},t);return e.layout.encode(i,r),r}function ju(e,t){var n;try{n=e.layout.decode(t)}catch(e){throw new Error("invalid instruction; "+e)}if(n.instruction!==e.index)throw new Error("invalid instruction; instruction index mismatch ".concat(n.instruction," != ").concat(e.index));return n}var Du,Cu=Wi("lamportsPerSignature"),Ou=Fi([Qi("version"),Qi("state"),tu("authorizedPubkey"),tu("nonce"),Fi([Cu],"feeCalculator")]),zu=Ou.span,Pu=function(){function e(t){B(this,e),this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}return U(e,null,[{key:"fromAccountData",value:function(t){var n=Ou.decode(Ys(t),0);return new e({authorizedPubkey:new qs(n.authorizedPubkey),nonce:new qs(n.nonce).toString(),feeCalculator:n.feeCalculator})}}]),e}(),_u=(Du=8,function(e){var t=Hi(Du,e),n=function(e){return{decode:e.decode.bind(e),encode:e.encode.bind(e)}}(t),r=n.encode,i=n.decode,o=t;return o.decode=function(e,t){var n=i(e,t);return qi(Ne.from(n))},o.encode=function(e,t,n){var i=Zi(e,Du);return r(i,t,n)},o}),Bu=function(){function e(){B(this,e)}return U(e,null,[{key:"decodeInstructionType",value:function(e){this.checkProgramId(e.programId);for(var t,n=Qi("instruction").decode(e.data),r=0,i=Object.entries(Ru);r<i.length;r++){var o=ee(i[r],2),a=o[0];if(o[1].index==n){t=a;break}}if(!t)throw new Error("Instruction type incorrect; not a SystemInstruction");return t}},{key:"decodeCreateAccount",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=ju(Ru.Create,e.data),n=t.lamports,r=t.space,i=t.programId;return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,lamports:n,space:r,programId:new qs(i)}}},{key:"decodeTransfer",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=ju(Ru.Transfer,e.data).lamports;return{fromPubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,lamports:t}}},{key:"decodeTransferWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=ju(Ru.TransferWithSeed,e.data),n=t.lamports,r=t.seed,i=t.programId;return{fromPubkey:e.keys[0].pubkey,basePubkey:e.keys[1].pubkey,toPubkey:e.keys[2].pubkey,lamports:n,seed:r,programId:new qs(i)}}},{key:"decodeAllocate",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);var t=ju(Ru.Allocate,e.data).space;return{accountPubkey:e.keys[0].pubkey,space:t}}},{key:"decodeAllocateWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);var t=ju(Ru.AllocateWithSeed,e.data),n=t.base,r=t.seed,i=t.space,o=t.programId;return{accountPubkey:e.keys[0].pubkey,basePubkey:new qs(n),seed:r,space:i,programId:new qs(o)}}},{key:"decodeAssign",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);var t=ju(Ru.Assign,e.data).programId;return{accountPubkey:e.keys[0].pubkey,programId:new qs(t)}}},{key:"decodeAssignWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,1);var t=ju(Ru.AssignWithSeed,e.data),n=t.base,r=t.seed,i=t.programId;return{accountPubkey:e.keys[0].pubkey,basePubkey:new qs(n),seed:r,programId:new qs(i)}}},{key:"decodeCreateWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=ju(Ru.CreateWithSeed,e.data),n=t.base,r=t.seed,i=t.lamports,o=t.space,a=t.programId;return{fromPubkey:e.keys[0].pubkey,newAccountPubkey:e.keys[1].pubkey,basePubkey:new qs(n),seed:r,lamports:i,space:o,programId:new qs(a)}}},{key:"decodeNonceInitialize",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=ju(Ru.InitializeNonceAccount,e.data).authorized;return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:new qs(t)}}},{key:"decodeNonceAdvance",value:function(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),ju(Ru.AdvanceNonceAccount,e.data),{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}},{key:"decodeNonceWithdraw",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);var t=ju(Ru.WithdrawNonceAccount,e.data).lamports;return{noncePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:t}}},{key:"decodeNonceAuthorize",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=ju(Ru.AuthorizeNonceAccount,e.data).authorized;return{noncePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[1].pubkey,newAuthorizedPubkey:new qs(t)}}},{key:"checkProgramId",value:function(e){if(!e.equals(Uu.programId))throw new Error("invalid instruction; programId is not SystemProgram")}},{key:"checkKeyLength",value:function(e,t){if(e.length<t)throw new Error("invalid instruction; found ".concat(e.length," keys, expected at least ").concat(t))}}]),e}(),Ru=Object.freeze({Create:{index:0,layout:Fi([Qi("instruction"),Yi("lamports"),Yi("space"),tu("programId")])},Assign:{index:1,layout:Fi([Qi("instruction"),tu("programId")])},Transfer:{index:2,layout:Fi([Qi("instruction"),_u("lamports")])},CreateWithSeed:{index:3,layout:Fi([Qi("instruction"),tu("base"),ru("seed"),Yi("lamports"),Yi("space"),tu("programId")])},AdvanceNonceAccount:{index:4,layout:Fi([Qi("instruction")])},WithdrawNonceAccount:{index:5,layout:Fi([Qi("instruction"),Yi("lamports")])},InitializeNonceAccount:{index:6,layout:Fi([Qi("instruction"),tu("authorized")])},AuthorizeNonceAccount:{index:7,layout:Fi([Qi("instruction"),tu("authorized")])},Allocate:{index:8,layout:Fi([Qi("instruction"),Yi("space")])},AllocateWithSeed:{index:9,layout:Fi([Qi("instruction"),tu("base"),ru("seed"),Yi("space"),tu("programId")])},AssignWithSeed:{index:10,layout:Fi([Qi("instruction"),tu("base"),ru("seed"),tu("programId")])},TransferWithSeed:{index:11,layout:Fi([Qi("instruction"),_u("lamports"),ru("seed"),tu("programId")])},UpgradeNonceAccount:{index:12,layout:Fi([Qi("instruction")])}}),Uu=function(){function e(){B(this,e)}return U(e,null,[{key:"createAccount",value:function(e){var t=Su(Ru.Create,{lamports:e.lamports,space:e.space,programId:Ys(e.programId.toBuffer())});return new pu({keys:[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!0,isWritable:!0}],programId:this.programId,data:t})}},{key:"transfer",value:function(e){var t,n;"basePubkey"in e?(t=Su(Ru.TransferWithSeed,{lamports:BigInt(e.lamports),seed:e.seed,programId:Ys(e.programId.toBuffer())}),n=[{pubkey:e.fromPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]):(t=Su(Ru.Transfer,{lamports:BigInt(e.lamports)}),n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0}]);return new pu({keys:n,programId:this.programId,data:t})}},{key:"assign",value:function(e){var t,n;"basePubkey"in e?(t=Su(Ru.AssignWithSeed,{base:Ys(e.basePubkey.toBuffer()),seed:e.seed,programId:Ys(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]):(t=Su(Ru.Assign,{programId:Ys(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]);return new pu({keys:n,programId:this.programId,data:t})}},{key:"createAccountWithSeed",value:function(e){var t=Su(Ru.CreateWithSeed,{base:Ys(e.basePubkey.toBuffer()),seed:e.seed,lamports:e.lamports,space:e.space,programId:Ys(e.programId.toBuffer())}),n=[{pubkey:e.fromPubkey,isSigner:!0,isWritable:!0},{pubkey:e.newAccountPubkey,isSigner:!1,isWritable:!0}];return e.basePubkey!=e.fromPubkey&&n.push({pubkey:e.basePubkey,isSigner:!0,isWritable:!1}),new pu({keys:n,programId:this.programId,data:t})}},{key:"createNonceAccount",value:function(t){var n=new yu;"basePubkey"in t&&"seed"in t?n.add(e.createAccountWithSeed({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,basePubkey:t.basePubkey,seed:t.seed,lamports:t.lamports,space:zu,programId:this.programId})):n.add(e.createAccount({fromPubkey:t.fromPubkey,newAccountPubkey:t.noncePubkey,lamports:t.lamports,space:zu,programId:this.programId}));var r={noncePubkey:t.noncePubkey,authorizedPubkey:t.authorizedPubkey};return n.add(this.nonceInitialize(r)),n}},{key:"nonceInitialize",value:function(e){var t=Su(Ru.InitializeNonceAccount,{authorized:Ys(e.authorizedPubkey.toBuffer())}),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:Mu,isSigner:!1,isWritable:!1},{pubkey:Au,isSigner:!1,isWritable:!1}],programId:this.programId,data:t};return new pu(n)}},{key:"nonceAdvance",value:function(e){var t=Su(Ru.AdvanceNonceAccount),n={keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:Mu,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t};return new pu(n)}},{key:"nonceWithdraw",value:function(e){var t=Su(Ru.WithdrawNonceAccount,{lamports:e.lamports});return new pu({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.toPubkey,isSigner:!1,isWritable:!0},{pubkey:Mu,isSigner:!1,isWritable:!1},{pubkey:Au,isSigner:!1,isWritable:!1},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}},{key:"nonceAuthorize",value:function(e){var t=Su(Ru.AuthorizeNonceAccount,{authorized:Ys(e.newAuthorizedPubkey.toBuffer())});return new pu({keys:[{pubkey:e.noncePubkey,isSigner:!1,isWritable:!0},{pubkey:e.authorizedPubkey,isSigner:!0,isWritable:!1}],programId:this.programId,data:t})}},{key:"allocate",value:function(e){var t,n;"basePubkey"in e?(t=Su(Ru.AllocateWithSeed,{base:Ys(e.basePubkey.toBuffer()),seed:e.seed,space:e.space,programId:Ys(e.programId.toBuffer())}),n=[{pubkey:e.accountPubkey,isSigner:!1,isWritable:!0},{pubkey:e.basePubkey,isSigner:!0,isWritable:!1}]):(t=Su(Ru.Allocate,{space:e.space}),n=[{pubkey:e.accountPubkey,isSigner:!0,isWritable:!0}]);return new pu({keys:n,programId:this.programId,data:t})}}]),e}();Uu.programId=new qs("11111111111111111111111111111111");var Qu=function(){function e(){B(this,e)}var t;return U(e,null,[{key:"getMinNumSignatures",value:function(t){return 2*(Math.ceil(t/e.chunkSize)+1+1)}},{key:"load",value:(t=_(O().mark((function t(n,r,i,o,a){var s,u,c,l,h,d,f,p,y,m,g,v,w,b,M,A,I,N,T;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.getMinimumBalanceForRentExemption(a.length);case 2:return s=t.sent,t.next=5,n.getAccountInfo(i.publicKey,"confirmed");case 5:if(u=t.sent,c=null,null===u){t.next=16;break}if(!u.executable){t.next=11;break}return console.error("Program load failed, account is already executable"),t.abrupt("return",!1);case 11:u.data.length!==a.length&&(c=c||new yu).add(Uu.allocate({accountPubkey:i.publicKey,space:a.length})),u.owner.equals(o)||(c=c||new yu).add(Uu.assign({accountPubkey:i.publicKey,programId:o})),u.lamports<s&&(c=c||new yu).add(Uu.transfer({fromPubkey:r.publicKey,toPubkey:i.publicKey,lamports:s-u.lamports})),t.next=17;break;case 16:c=(new yu).add(Uu.createAccount({fromPubkey:r.publicKey,newAccountPubkey:i.publicKey,lamports:s>0?s:1,space:a.length,programId:o}));case 17:if(null===c){t.next=20;break}return t.next=20,xu(n,c,[r,i],{commitment:"confirmed"});case 20:l=Fi([Qi("instruction"),Qi("offset"),Qi("bytesLength"),Qi("bytesLengthPadding"),Vi(Ri("byte"),Bi(Qi(),-8),"bytes")]),h=e.chunkSize,d=0,f=a,p=[];case 25:if(!(f.length>0)){t.next=39;break}if(y=f.slice(0,h),m=Ne.alloc(h+16),l.encode({instruction:0,offset:d,bytes:y,bytesLength:0,bytesLengthPadding:0},m),g=(new yu).add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0}],programId:o,data:m}),p.push(xu(n,g,[r,i],{commitment:"confirmed"})),!n._rpcEndpoint.includes("solana.com")){t.next=35;break}return t.next=35,Lu(250);case 35:d+=h,f=f.slice(h),t.next=25;break;case 39:return t.next=41,Promise.all(p);case 41:return v=Fi([Qi("instruction")]),w=Ne.alloc(v.span),v.encode({instruction:1},w),b=(new yu).add({keys:[{pubkey:i.publicKey,isSigner:!0,isWritable:!0},{pubkey:Au,isSigner:!1,isWritable:!1}],programId:o,data:w}),M="processed",t.next=48,n.sendTransaction(b,[r,i],{preflightCommitment:M});case 48:return A=t.sent,t.next=51,n.confirmTransaction({signature:A,lastValidBlockHeight:b.lastValidBlockHeight,blockhash:b.recentBlockhash},M);case 51:if(I=t.sent,N=I.context,!(T=I.value).err){t.next=56;break}throw new Error("Transaction ".concat(A," failed (").concat(JSON.stringify(T),")"));case 56:return t.prev=57,t.next=60,n.getSlot({commitment:M});case 60:if(!(t.sent>N.slot)){t.next=63;break}return t.abrupt("break",71);case 63:t.next=67;break;case 65:t.prev=65,t.t0=t.catch(57);case 67:return t.next=69,new Promise((function(e){return setTimeout(e,Math.round(200))}));case 69:t.next=56;break;case 71:return t.abrupt("return",!0);case 72:case"end":return t.stop()}}),t,null,[[57,65]])}))),function(e,n,r,i,o){return t.apply(this,arguments)})}]),e}();Qu.chunkSize=932;var Wu=new qs("BPFLoader2111111111111111111111111111111111"),Yu=function(){function e(){B(this,e)}return U(e,null,[{key:"getMinNumSignatures",value:function(e){return Qu.getMinNumSignatures(e)}},{key:"load",value:function(e,t,n,r,i){return Qu.load(e,t,n,i,r)}}]),e}();function Fu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Vu=Object.prototype.toString,Hu=Object.keys||function(e){var t=[];for(var n in e)t.push(n);return t};function Gu(e,t){var n,r,i,o,a,s,u;if(!0===e)return"true";if(!1===e)return"false";switch(z(e)){case"object":if(null===e)return null;if(e.toJSON&&"function"==typeof e.toJSON)return Gu(e.toJSON(),t);if("[object Array]"===(u=Vu.call(e))){for(i="[",r=e.length-1,n=0;n<r;n++)i+=Gu(e[n],!0)+",";return r>-1&&(i+=Gu(e[n],!0)),i+"]"}if("[object Object]"===u){for(r=(o=Hu(e).sort()).length,i="",n=0;n<r;)void 0!==(s=Gu(e[a=o[n]],!1))&&(i&&(i+=","),i+=JSON.stringify(a)+":"+s),n++;return"{"+i+"}"}return JSON.stringify(e);case"function":case"undefined":return t?null:void 0;case"string":return JSON.stringify(e);default:return isFinite(e)?e:null}}var qu=Fu((function(e){var t=Gu(e,!1);if(void 0!==t)return""+t}));function Zu(e){for(var t=0;e>1;)e/=2,t++;return t}var Ju=function(){function e(t,n,r,i,o){B(this,e),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=n,this.warmup=r,this.firstNormalEpoch=i,this.firstNormalSlot=o}return U(e,[{key:"getEpoch",value:function(e){return this.getEpochAndSlotIndex(e)[0]}},{key:"getEpochAndSlotIndex",value:function(e){if(e<this.firstNormalSlot){var t=Zu(function(e){return 0===e?1:(e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,1+(e|=e>>32))}(e+32+1))-Zu(32)-1;return[t,e-(this.getSlotsInEpoch(t)-32)]}var n=e-this.firstNormalSlot,r=Math.floor(n/this.slotsPerEpoch);return[this.firstNormalEpoch+r,n%this.slotsPerEpoch]}},{key:"getFirstSlotInEpoch",value:function(e){return e<=this.firstNormalEpoch?32*(Math.pow(2,e)-1):(e-this.firstNormalEpoch)*this.slotsPerEpoch+this.firstNormalSlot}},{key:"getLastSlotInEpoch",value:function(e){return this.getFirstSlotInEpoch(e)+this.getSlotsInEpoch(e)-1}},{key:"getSlotsInEpoch",value:function(e){return e<this.firstNormalEpoch?Math.pow(2,e+Zu(32)):this.slotsPerEpoch}}]),e}(),Xu=function(e){W(n,G(Error));var t=X(n);function n(e,r){var i;return B(this,n),(i=t.call(this,e)).logs=void 0,i.logs=r,i}return U(n)}(),Ku=function(e){W(n,G(Error));var t=X(n);function n(e,r){var i,o=e.code,a=e.message,s=e.data;return B(this,n),(i=t.call(this,null!=r?"".concat(r,": ").concat(a):a)).code=void 0,i.data=void 0,i.code=o,i.data=s,i.name="SolanaJSONRPCError",i}return U(n)}(),$u=globalThis.fetch,ec=function(e){W(n,Ya);var t=X(n);function n(e,r,i){var o;B(this,n);return(o=t.call(this,(function(e){var t=Va(e,C({autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3},r));return o.underlyingSocket="socket"in t?t.socket:t,t}),e,r,i)).underlyingSocket=void 0,o}return U(n,[{key:"call",value:function(){for(var e,t,r=null===(e=this.underlyingSocket)||void 0===e?void 0:e.readyState,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return 1===r?(t=$(Y(n.prototype),"call",this)).call.apply(t,[this].concat(o)):Promise.reject(new Error("Tried to call a JSON-RPC method `"+o[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+r+")"))}},{key:"notify",value:function(){for(var e,t,r=null===(e=this.underlyingSocket)||void 0===e?void 0:e.readyState,i=arguments.length,o=new Array(i),a=0;a<i;a++)o[a]=arguments[a];return 1===r?(t=$(Y(n.prototype),"notify",this)).call.apply(t,[this].concat(o)):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+o[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+r+")"))}}]),n}();var tc=function(){function e(t){B(this,e),this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}return U(e,[{key:"isActive",value:function(){var e=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===e}}],[{key:"deserialize",value:function(e){var t=function(e,t){var n;try{n=e.layout.decode(t)}catch(e){throw new Error("invalid instruction; "+e)}if(n.typeIndex!==e.index)throw new Error("invalid account data; account type mismatch ".concat(n.typeIndex," != ").concat(e.index));return n}(nc,e),n=e.length-56;su(n>=0,"lookup table is invalid"),su(n%32==0,"lookup table is invalid");var r=n/32,i=Fi([Vi(tu(),r,"addresses")]).decode(e.slice(56)).addresses;return{deactivationSlot:t.deactivationSlot,lastExtendedSlot:t.lastExtendedSlot,lastExtendedSlotStartIndex:t.lastExtendedStartIndex,authority:0!==t.authority.length?new qs(t.authority[0]):void 0,addresses:i.map((function(e){return new qs(e)}))}}}]),e}(),nc={index:1,layout:Fi([Qi("typeIndex"),_u("deactivationSlot"),Wi("lastExtendedSlot"),Ri("lastExtendedStartIndex"),Ri(),Vi(tu(),Bi(Ri(),-1),"authority")])},rc=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i;var ic=xo(mo(qs),Ao(),(function(e){return new qs(e)})),oc=Io([Ao(),go("base64")]),ac=xo(mo(Ne),oc,(function(e){return Ne.from(e[0],"base64")}));function sc(e){var t,n;if("string"==typeof e)t=e;else if(e){t=e.commitment,n=q(e,Ds)}return{commitment:t,config:n}}function uc(e){return To([No({jsonrpc:go("2.0"),id:Ao(),result:e}),No({jsonrpc:go("2.0"),id:Ao(),error:No({code:Eo(),message:Ao(),data:bo(fo("any",(function(){return!0})))})})])}var cc=uc(Eo());function lc(e){return xo(uc(e),cc,(function(t){return"error"in t?t:C(C({},t),{},{result:co(t.result,e)})}))}function hc(e){return lc(No({context:No({slot:wo()}),value:e}))}function dc(e){return No({context:No({slot:wo()}),value:e})}function fc(e,t){return 0===e?new lu({header:t.header,staticAccountKeys:t.accountKeys.map((function(e){return new qs(e)})),recentBlockhash:t.recentBlockhash,compiledInstructions:t.instructions.map((function(e){return{programIdIndex:e.programIdIndex,accountKeyIndexes:e.accounts,data:dr.decode(e.data)}})),addressTableLookups:t.addressTableLookups}):new cu(t)}var pc=No({foundation:wo(),foundationTerm:wo(),initial:wo(),taper:wo(),terminal:wo()}),yc=lc(po(vo(No({epoch:wo(),effectiveSlot:wo(),amount:wo(),postBalance:wo(),commission:bo(vo(wo()))})))),mc=po(No({slot:wo(),prioritizationFee:wo()})),gc=No({total:wo(),validator:wo(),foundation:wo(),epoch:wo()}),vc=No({epoch:wo(),slotIndex:wo(),slotsInEpoch:wo(),absoluteSlot:wo(),blockHeight:bo(wo()),transactionCount:bo(wo())}),wc=No({slotsPerEpoch:wo(),leaderScheduleSlotOffset:wo(),warmup:yo(),firstNormalEpoch:wo(),firstNormalSlot:wo()}),bc=Mo(Ao(),po(wo())),Mc=vo(To([No({}),Ao()])),Ac=No({err:Mc}),Ic=go("receivedSignature"),Nc=No({"solana-core":Ao(),"feature-set":bo(wo())}),Tc=hc(No({err:vo(To([No({}),Ao()])),logs:vo(po(Ao())),accounts:bo(vo(po(vo(No({executable:yo(),owner:Ao(),lamports:wo(),data:po(Ao()),rentEpoch:bo(wo())}))))),unitsConsumed:bo(wo()),returnData:bo(vo(No({programId:Ao(),data:Io([Ao(),go("base64")])})))})),Ec=hc(No({byIdentity:Mo(Ao(),po(wo())),range:No({firstSlot:wo(),lastSlot:wo()})}));var xc=lc(pc),kc=lc(gc),Lc=lc(mc),Sc=lc(vc),jc=lc(wc),Dc=lc(bc),Cc=lc(wo()),Oc=hc(No({total:wo(),circulating:wo(),nonCirculating:wo(),nonCirculatingAccounts:po(ic)})),zc=No({amount:Ao(),uiAmount:vo(wo()),decimals:wo(),uiAmountString:bo(Ao())}),Pc=hc(po(No({address:ic,amount:Ao(),uiAmount:vo(wo()),decimals:wo(),uiAmountString:bo(Ao())}))),_c=hc(po(No({pubkey:ic,account:No({executable:yo(),owner:ic,lamports:wo(),data:ac,rentEpoch:wo()})}))),Bc=No({program:Ao(),parsed:Eo(),space:wo()}),Rc=hc(po(No({pubkey:ic,account:No({executable:yo(),owner:ic,lamports:wo(),data:Bc,rentEpoch:wo()})}))),Uc=hc(po(No({lamports:wo(),address:ic}))),Qc=No({executable:yo(),owner:ic,lamports:wo(),data:ac,rentEpoch:wo()}),Wc=No({pubkey:ic,account:Qc}),Yc=xo(To([mo(Ne),Bc]),To([oc,Bc]),(function(e){return Array.isArray(e)?co(e,ac):e})),Fc=No({executable:yo(),owner:ic,lamports:wo(),data:Yc,rentEpoch:wo()}),Vc=No({pubkey:ic,account:Fc}),Hc=No({state:To([go("active"),go("inactive"),go("activating"),go("deactivating")]),active:wo(),inactive:wo()}),Gc=lc(po(No({signature:Ao(),slot:wo(),err:Mc,memo:vo(Ao()),blockTime:bo(vo(wo()))}))),qc=lc(po(No({signature:Ao(),slot:wo(),err:Mc,memo:vo(Ao()),blockTime:bo(vo(wo()))}))),Zc=No({subscription:wo(),result:dc(Qc)}),Jc=No({pubkey:ic,account:Qc}),Xc=No({subscription:wo(),result:dc(Jc)}),Kc=No({parent:wo(),slot:wo(),root:wo()}),$c=No({subscription:wo(),result:Kc}),el=To([No({type:To([go("firstShredReceived"),go("completed"),go("optimisticConfirmation"),go("root")]),slot:wo(),timestamp:wo()}),No({type:go("createdBank"),parent:wo(),slot:wo(),timestamp:wo()}),No({type:go("frozen"),slot:wo(),timestamp:wo(),stats:No({numTransactionEntries:wo(),numSuccessfulTransactions:wo(),numFailedTransactions:wo(),maxTransactionsPerEntry:wo()})}),No({type:go("dead"),slot:wo(),timestamp:wo(),err:Ao()})]),tl=No({subscription:wo(),result:el}),nl=No({subscription:wo(),result:dc(To([Ac,Ic]))}),rl=No({subscription:wo(),result:wo()}),il=No({pubkey:Ao(),gossip:vo(Ao()),tpu:vo(Ao()),rpc:vo(Ao()),version:vo(Ao())}),ol=No({votePubkey:Ao(),nodePubkey:Ao(),activatedStake:wo(),epochVoteAccount:yo(),epochCredits:po(Io([wo(),wo(),wo()])),commission:wo(),lastVote:wo(),rootSlot:vo(wo())}),al=lc(No({current:po(ol),delinquent:po(ol)})),sl=To([go("processed"),go("confirmed"),go("finalized")]),ul=No({slot:wo(),confirmations:vo(wo()),err:Mc,confirmationStatus:bo(sl)}),cl=hc(po(vo(ul))),ll=lc(wo()),hl=No({accountKey:ic,writableIndexes:po(wo()),readonlyIndexes:po(wo())}),dl=No({signatures:po(Ao()),message:No({accountKeys:po(Ao()),header:No({numRequiredSignatures:wo(),numReadonlySignedAccounts:wo(),numReadonlyUnsignedAccounts:wo()}),instructions:po(No({accounts:po(wo()),data:Ao(),programIdIndex:wo()})),recentBlockhash:Ao(),addressTableLookups:bo(po(hl))})}),fl=No({pubkey:ic,signer:yo(),writable:yo(),source:bo(To([go("transaction"),go("lookupTable")]))}),pl=No({accountKeys:po(fl),signatures:po(Ao())}),yl=No({parsed:Eo(),program:Ao(),programId:ic}),ml=No({accounts:po(ic),data:Ao(),programId:ic}),gl=xo(To([ml,yl]),To([No({parsed:Eo(),program:Ao(),programId:Ao()}),No({accounts:po(Ao()),data:Ao(),programId:Ao()})]),(function(e){return co(e,"accounts"in e?ml:yl)})),vl=No({signatures:po(Ao()),message:No({accountKeys:po(fl),instructions:po(gl),recentBlockhash:Ao(),addressTableLookups:bo(vo(po(hl)))})}),wl=No({accountIndex:wo(),mint:Ao(),owner:bo(Ao()),uiTokenAmount:zc}),bl=No({writable:po(ic),readonly:po(ic)}),Ml=No({err:Mc,fee:wo(),innerInstructions:bo(vo(po(No({index:wo(),instructions:po(No({accounts:po(wo()),data:Ao(),programIdIndex:wo()}))})))),preBalances:po(wo()),postBalances:po(wo()),logMessages:bo(vo(po(Ao()))),preTokenBalances:bo(vo(po(wl))),postTokenBalances:bo(vo(po(wl))),loadedAddresses:bo(bl),computeUnitsConsumed:bo(wo())}),Al=No({err:Mc,fee:wo(),innerInstructions:bo(vo(po(No({index:wo(),instructions:po(gl)})))),preBalances:po(wo()),postBalances:po(wo()),logMessages:bo(vo(po(Ao()))),preTokenBalances:bo(vo(po(wl))),postTokenBalances:bo(vo(po(wl))),loadedAddresses:bo(bl),computeUnitsConsumed:bo(wo())}),Il=To([go(0),go("legacy")]),Nl=No({pubkey:Ao(),lamports:wo(),postBalance:vo(wo()),rewardType:vo(Ao()),commission:bo(vo(wo()))}),Tl=lc(vo(No({blockhash:Ao(),previousBlockhash:Ao(),parentSlot:wo(),transactions:po(No({transaction:dl,meta:vo(Ml),version:bo(Il)})),rewards:bo(po(Nl)),blockTime:vo(wo()),blockHeight:vo(wo())}))),El=lc(vo(No({blockhash:Ao(),previousBlockhash:Ao(),parentSlot:wo(),rewards:bo(po(Nl)),blockTime:vo(wo()),blockHeight:vo(wo())}))),xl=lc(vo(No({blockhash:Ao(),previousBlockhash:Ao(),parentSlot:wo(),transactions:po(No({transaction:pl,meta:vo(Ml),version:bo(Il)})),rewards:bo(po(Nl)),blockTime:vo(wo()),blockHeight:vo(wo())}))),kl=lc(vo(No({blockhash:Ao(),previousBlockhash:Ao(),parentSlot:wo(),transactions:po(No({transaction:vl,meta:vo(Al),version:bo(Il)})),rewards:bo(po(Nl)),blockTime:vo(wo()),blockHeight:vo(wo())}))),Ll=lc(vo(No({blockhash:Ao(),previousBlockhash:Ao(),parentSlot:wo(),transactions:po(No({transaction:pl,meta:vo(Al),version:bo(Il)})),rewards:bo(po(Nl)),blockTime:vo(wo()),blockHeight:vo(wo())}))),Sl=lc(vo(No({blockhash:Ao(),previousBlockhash:Ao(),parentSlot:wo(),rewards:bo(po(Nl)),blockTime:vo(wo()),blockHeight:vo(wo())}))),jl=lc(vo(No({blockhash:Ao(),previousBlockhash:Ao(),parentSlot:wo(),transactions:po(No({transaction:dl,meta:vo(Ml)})),rewards:bo(po(Nl)),blockTime:vo(wo())}))),Dl=lc(vo(No({blockhash:Ao(),previousBlockhash:Ao(),parentSlot:wo(),signatures:po(Ao()),blockTime:vo(wo())}))),Cl=lc(vo(No({slot:wo(),meta:vo(Ml),blockTime:bo(vo(wo())),transaction:dl,version:bo(Il)}))),Ol=lc(vo(No({slot:wo(),transaction:vl,meta:vo(Al),blockTime:bo(vo(wo())),version:bo(Il)}))),zl=hc(No({blockhash:Ao(),feeCalculator:No({lamportsPerSignature:wo()})})),Pl=hc(No({blockhash:Ao(),lastValidBlockHeight:wo()})),_l=hc(yo()),Bl=lc(po(No({slot:wo(),numTransactions:wo(),numSlots:wo(),samplePeriodSecs:wo()}))),Rl=hc(vo(No({feeCalculator:No({lamportsPerSignature:wo()})}))),Ul=lc(Ao()),Ql=lc(Ao()),Wl=No({err:Mc,logs:po(Ao()),signature:Ao()}),Yl=No({result:dc(Wl),subscription:wo()}),Fl={"solana-client":"js/".concat("0.0.0-development")},Vl=function(){function e(t,n){var r,i,o,a,s,u,c,l=this;B(this,e),this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(r={},function(){var e=_(O().mark((function e(t){var n,i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=sc(t),o=i.commitment,a=i.config,s=l._buildArgs([],o,void 0,a),u=qu(s),r[u]=null!==(n=r[u])&&void 0!==n?n:_(O().mark((function e(){var t,n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,l._rpcRequest("getBlockHeight",s);case 3:if(t=e.sent,!("error"in(n=co(t,lc(wo()))))){e.next=7;break}throw new Ku(n.error,"failed to get block height information");case 7:return e.abrupt("return",n.result);case 8:return e.prev=8,delete r[u],e.finish(8);case 11:case"end":return e.stop()}}),e,null,[[0,,8,11]])})))(),e.next=6,r[u];case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()),n&&"string"==typeof n?this._commitment=n:n&&(this._commitment=n.commitment,this._confirmTransactionInitialTimeout=n.confirmTransactionInitialTimeout,i=n.wsEndpoint,o=n.httpHeaders,a=n.fetch,s=n.fetchMiddleware,u=n.disableRetryOnRateLimit,c=n.httpAgent),this._rpcEndpoint=function(e){if(!1===/^https?:/.test(e))throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return e}(t),this._rpcWsEndpoint=i||function(e){var t=e.match(rc);if(null==t)throw TypeError("Failed to validate endpoint URL `".concat(e,"`"));var n=ee(t,4);n[0];var r=n[1],i=n[2],o=n[3],a=e.startsWith("https:")?"wss:":"ws:",s=null==i?null:parseInt(i.slice(1),10),u=null==s?"":":".concat(s+1);return"".concat(a,"//").concat(r).concat(u).concat(o)}(t),this._rpcClient=function(e,t,n,r,i,o){var a,s=n||$u;return null!=o&&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."),r&&(a=function(){var e=_(O().mark((function e(t,n){var i;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise((function(e,i){try{r(t,n,(function(t,n){return e([t,n])}))}catch(e){i(e)}}));case 2:return i=e.sent,e.next=5,s.apply(void 0,te(i));case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}}),e)})));return function(t,n){return e.apply(this,arguments)}}()),new aa(function(){var n=_(O().mark((function n(r,o){var u,c,l,h,d;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:u={method:"POST",body:r,agent:void 0,headers:Object.assign({"Content-Type":"application/json"},t||{},Fl)},n.prev=1,c=5,h=500;case 4:if(!a){n.next=10;break}return n.next=7,a(e,u);case 7:l=n.sent,n.next=13;break;case 10:return n.next=12,s(e,u);case 12:l=n.sent;case 13:if(429===l.status){n.next=15;break}return n.abrupt("break",26);case 15:if(!0!==i){n.next=17;break}return n.abrupt("break",26);case 17:if(0!=(c-=1)){n.next=20;break}return n.abrupt("break",26);case 20:return console.log("Server responded with ".concat(l.status," ").concat(l.statusText,". Retrying after ").concat(h,"ms delay...")),n.next=23,Lu(h);case 23:h*=2;case 24:n.next=4;break;case 26:return n.next=28,l.text();case 28:d=n.sent,l.ok?o(null,d):o(new Error("".concat(l.status," ").concat(l.statusText,": ").concat(d))),n.next=35;break;case 32:n.prev=32,n.t0=n.catch(1),n.t0 instanceof Error&&o(n.t0);case 35:case"end":return n.stop()}}),n,null,[[1,32]])})));return function(e,t){return n.apply(this,arguments)}}(),{})}(t,o,a,s,u,c),this._rpcRequest=function(e){return function(t,n){return new Promise((function(r,i){e.request(t,n,(function(e,t){e?i(e):r(t)}))}))}}(this._rpcClient),this._rpcBatchRequest=function(e){return function(t){return new Promise((function(n,r){0===t.length&&n([]);var i=t.map((function(t){return e.request(t.methodName,t.args)}));e.request(i,(function(e,t){e?r(e):n(t)}))}))}}(this._rpcClient),this._rpcWebSocket=new ec(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))}var t,n,r,i,o,a,s,u,c,l,h,d,f,p,y,m,g,v,w,b,M,A,I,N,T,E,x,k,L,S,j,D,P,R,Q,W,Y,F,V,H,G,Z,J,X,K,$,ne,re,ie,oe,ae,se,ue,ce,le,he,de,fe,pe,ye,me,ge,ve,we,be,Me,Ae,Ie,Te,Ee,xe,ke,Le,Se,je,De,Ce,Oe,ze,Pe,_e,Be,Re,Ue,Qe,We,Ye,Fe,Ve;return U(e,[{key:"commitment",get:function(){return this._commitment}},{key:"rpcEndpoint",get:function(){return this._rpcEndpoint}},{key:"getBalanceAndContext",value:(Ve=_(O().mark((function e(t,n){var r,i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=this._buildArgs([t.toBase58()],i,void 0,o),e.next=4,this._rpcRequest("getBalance",a);case 4:if(s=e.sent,!("error"in(u=co(s,hc(wo()))))){e.next=8;break}throw new Ku(u.error,"failed to get balance for ".concat(t.toBase58()));case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ve.apply(this,arguments)})},{key:"getBalance",value:(Fe=_(O().mark((function e(t,n){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getBalanceAndContext(t,n).then((function(e){return e.value})).catch((function(e){throw new Error("failed to get balance of account "+t.toBase58()+": "+e)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return Fe.apply(this,arguments)})},{key:"getBlockTime",value:(Ye=_(O().mark((function e(t){var n,r;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getBlockTime",[t]);case 2:if(n=e.sent,!("error"in(r=co(n,lc(vo(wo())))))){e.next=6;break}throw new Ku(r.error,"failed to get block time for slot ".concat(t));case 6:return e.abrupt("return",r.result);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return Ye.apply(this,arguments)})},{key:"getMinimumLedgerSlot",value:(We=_(O().mark((function e(){var t,n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("minimumLedgerSlot",[]);case 2:if(t=e.sent,!("error"in(n=co(t,lc(wo()))))){e.next=6;break}throw new Ku(n.error,"failed to get minimum ledger slot");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return We.apply(this,arguments)})},{key:"getFirstAvailableBlock",value:(Qe=_(O().mark((function e(){var t,n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getFirstAvailableBlock",[]);case 2:if(t=e.sent,!("error"in(n=co(t,Cc)))){e.next=6;break}throw new Ku(n.error,"failed to get first available block");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return Qe.apply(this,arguments)})},{key:"getSupply",value:(Ue=_(O().mark((function e(t){var n,r,i;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n={},n="string"==typeof t?{commitment:t}:t?C(C({},t),{},{commitment:t&&t.commitment||this.commitment}):{commitment:this.commitment},e.next=4,this._rpcRequest("getSupply",[n]);case 4:if(r=e.sent,!("error"in(i=co(r,Oc)))){e.next=8;break}throw new Ku(i.error,"failed to get supply");case 8:return e.abrupt("return",i.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return Ue.apply(this,arguments)})},{key:"getTokenSupply",value:(Re=_(O().mark((function e(t,n){var r,i,o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgs([t.toBase58()],n),e.next=3,this._rpcRequest("getTokenSupply",r);case 3:if(i=e.sent,!("error"in(o=co(i,hc(zc))))){e.next=7;break}throw new Ku(o.error,"failed to get token supply");case 7:return e.abrupt("return",o.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return Re.apply(this,arguments)})},{key:"getTokenAccountBalance",value:(Be=_(O().mark((function e(t,n){var r,i,o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgs([t.toBase58()],n),e.next=3,this._rpcRequest("getTokenAccountBalance",r);case 3:if(i=e.sent,!("error"in(o=co(i,hc(zc))))){e.next=7;break}throw new Ku(o.error,"failed to get token account balance");case 7:return e.abrupt("return",o.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return Be.apply(this,arguments)})},{key:"getTokenAccountsByOwner",value:(_e=_(O().mark((function e(t,n,r){var i,o,a,s,u,c,l;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=sc(r),o=i.commitment,a=i.config,s=[t.toBase58()],"mint"in n?s.push({mint:n.mint.toBase58()}):s.push({programId:n.programId.toBase58()}),u=this._buildArgs(s,o,"base64",a),e.next=6,this._rpcRequest("getTokenAccountsByOwner",u);case 6:if(c=e.sent,!("error"in(l=co(c,_c)))){e.next=10;break}throw new Ku(l.error,"failed to get token accounts owned by account ".concat(t.toBase58()));case 10:return e.abrupt("return",l.result);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return _e.apply(this,arguments)})},{key:"getParsedTokenAccountsByOwner",value:(Pe=_(O().mark((function e(t,n,r){var i,o,a,s;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=[t.toBase58()],"mint"in n?i.push({mint:n.mint.toBase58()}):i.push({programId:n.programId.toBase58()}),o=this._buildArgs(i,r,"jsonParsed"),e.next=5,this._rpcRequest("getTokenAccountsByOwner",o);case 5:if(a=e.sent,!("error"in(s=co(a,Rc)))){e.next=9;break}throw new Ku(s.error,"failed to get token accounts owned by account ".concat(t.toBase58()));case 9:return e.abrupt("return",s.result);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return Pe.apply(this,arguments)})},{key:"getLargestAccounts",value:(ze=_(O().mark((function e(t){var n,r,i,o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=C(C({},t),{},{commitment:t&&t.commitment||this.commitment}),r=n.filter||n.commitment?[n]:[],e.next=4,this._rpcRequest("getLargestAccounts",r);case 4:if(i=e.sent,!("error"in(o=co(i,Uc)))){e.next=8;break}throw new Ku(o.error,"failed to get largest accounts");case 8:return e.abrupt("return",o.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return ze.apply(this,arguments)})},{key:"getTokenLargestAccounts",value:(Oe=_(O().mark((function e(t,n){var r,i,o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgs([t.toBase58()],n),e.next=3,this._rpcRequest("getTokenLargestAccounts",r);case 3:if(i=e.sent,!("error"in(o=co(i,Pc)))){e.next=7;break}throw new Ku(o.error,"failed to get token largest accounts");case 7:return e.abrupt("return",o.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return Oe.apply(this,arguments)})},{key:"getAccountInfoAndContext",value:(Ce=_(O().mark((function e(t,n){var r,i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=this._buildArgs([t.toBase58()],i,"base64",o),e.next=4,this._rpcRequest("getAccountInfo",a);case 4:if(s=e.sent,!("error"in(u=co(s,hc(vo(Qc)))))){e.next=8;break}throw new Ku(u.error,"failed to get info about account ".concat(t.toBase58()));case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ce.apply(this,arguments)})},{key:"getParsedAccountInfo",value:(De=_(O().mark((function e(t,n){var r,i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=this._buildArgs([t.toBase58()],i,"jsonParsed",o),e.next=4,this._rpcRequest("getAccountInfo",a);case 4:if(s=e.sent,!("error"in(u=co(s,hc(vo(Fc)))))){e.next=8;break}throw new Ku(u.error,"failed to get info about account ".concat(t.toBase58()));case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return De.apply(this,arguments)})},{key:"getAccountInfo",value:(je=_(O().mark((function e(t,n){var r;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getAccountInfoAndContext(t,n);case 3:return r=e.sent,e.abrupt("return",r.value);case 7:throw e.prev=7,e.t0=e.catch(0),new Error("failed to get info about account "+t.toBase58()+": "+e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e,t){return je.apply(this,arguments)})},{key:"getMultipleParsedAccounts",value:(Se=_(O().mark((function e(t,n){var r,i,o,a,s,u,c;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=t.map((function(e){return e.toBase58()})),s=this._buildArgs([a],i,"jsonParsed",o),e.next=5,this._rpcRequest("getMultipleAccounts",s);case 5:if(u=e.sent,!("error"in(c=co(u,hc(po(vo(Fc))))))){e.next=9;break}throw new Ku(c.error,"failed to get info for accounts ".concat(a));case 9:return e.abrupt("return",c.result);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return Se.apply(this,arguments)})},{key:"getMultipleAccountsInfoAndContext",value:(Le=_(O().mark((function e(t,n){var r,i,o,a,s,u,c;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=t.map((function(e){return e.toBase58()})),s=this._buildArgs([a],i,"base64",o),e.next=5,this._rpcRequest("getMultipleAccounts",s);case 5:if(u=e.sent,!("error"in(c=co(u,hc(po(vo(Qc))))))){e.next=9;break}throw new Ku(c.error,"failed to get info for accounts ".concat(a));case 9:return e.abrupt("return",c.result);case 10:case"end":return e.stop()}}),e,this)}))),function(e,t){return Le.apply(this,arguments)})},{key:"getMultipleAccountsInfo",value:(ke=_(O().mark((function e(t,n){var r;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getMultipleAccountsInfoAndContext(t,n);case 2:return r=e.sent,e.abrupt("return",r.value);case 4:case"end":return e.stop()}}),e,this)}))),function(e,t){return ke.apply(this,arguments)})},{key:"getStakeActivation",value:(xe=_(O().mark((function e(t,n,r){var i,o,a,s,u,c;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=sc(n),o=i.commitment,a=i.config,s=this._buildArgs([t.toBase58()],o,void 0,C(C({},a),{},{epoch:null!=r?r:null==a?void 0:a.epoch})),e.next=4,this._rpcRequest("getStakeActivation",s);case 4:if(u=e.sent,!("error"in(c=co(u,lc(Hc))))){e.next=8;break}throw new Ku(c.error,"failed to get Stake Activation ".concat(t.toBase58()));case 8:return e.abrupt("return",c.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return xe.apply(this,arguments)})},{key:"getProgramAccounts",value:(Ee=_(O().mark((function e(t,n){var r,i,o,a,s,u,c,l,h,d;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,s=(a=o||{}).encoding,u=q(a,Cs),c=this._buildArgs([t.toBase58()],i,s||"base64",u),e.next=5,this._rpcRequest("getProgramAccounts",c);case 5:if(l=e.sent,h=po(Wc),!("error"in(d=!0===u.withContext?co(l,hc(h)):co(l,lc(h))))){e.next=10;break}throw new Ku(d.error,"failed to get accounts owned by program ".concat(t.toBase58()));case 10:return e.abrupt("return",d.result);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return Ee.apply(this,arguments)})},{key:"getParsedProgramAccounts",value:(Te=_(O().mark((function e(t,n){var r,i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=this._buildArgs([t.toBase58()],i,"jsonParsed",o),e.next=4,this._rpcRequest("getProgramAccounts",a);case 4:if(s=e.sent,!("error"in(u=co(s,lc(po(Vc)))))){e.next=8;break}throw new Ku(u.error,"failed to get accounts owned by program ".concat(t.toBase58()));case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return Te.apply(this,arguments)})},{key:"confirmTransaction",value:(Ie=_(O().mark((function e(t,n){var r,i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("string"!=typeof t){e.next=4;break}r=t,e.next=8;break;case 4:if(null===(i=(o=t).abortSignal)||void 0===i||!i.aborted){e.next=7;break}return e.abrupt("return",Promise.reject(o.abortSignal.reason));case 7:r=o.signature;case 8:e.prev=8,a=dr.decode(r),e.next=15;break;case 12:throw e.prev=12,e.t0=e.catch(8),new Error("signature must be base58 encoded: "+r);case 15:if(su(64===a.length,"signature has invalid length"),"string"!=typeof t){e.next=22;break}return e.next=19,this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:n||this.commitment,signature:r});case 19:return e.abrupt("return",e.sent);case 22:if(!("lastValidBlockHeight"in t)){e.next=28;break}return e.next=25,this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:n||this.commitment,strategy:t});case 25:return e.abrupt("return",e.sent);case 28:return e.next=30,this.confirmTransactionUsingDurableNonceStrategy({commitment:n||this.commitment,strategy:t});case 30:return e.abrupt("return",e.sent);case 31:case"end":return e.stop()}}),e,this,[[8,12]])}))),function(e,t){return Ie.apply(this,arguments)})},{key:"getCancellationPromise",value:function(e){return new Promise((function(t,n){null!=e&&(e.aborted?n(e.reason):e.addEventListener("abort",(function(){n(e.reason)})))}))}},{key:"getTransactionConfirmationPromise",value:function(e){var t,n,r=this,i=e.commitment,o=e.signature,a=!1;return{abortConfirmation:function(){n&&(n(),n=void 0),null!=t&&(r.removeSignatureListener(t),t=void 0)},confirmationPromise:new Promise((function(e,s){try{t=r.onSignature(o,(function(n,r){t=void 0;var i={context:r,value:n};e({__type:du.PROCESSED,response:i})}),i);var u=new Promise((function(e){null==t?e():n=r._onSubscriptionStateChange(t,(function(t){"subscribed"===t&&e()}))}));_(O().mark((function t(){var n,c,l;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,u;case 2:if(!a){t.next=4;break}return t.abrupt("return");case 4:return t.next=6,r.getSignatureStatus(o);case 6:if(n=t.sent,!a){t.next=9;break}return t.abrupt("return");case 9:if(null!=n){t.next=11;break}return t.abrupt("return");case 11:if(c=n.context,null!=(l=n.value)){t.next=14;break}return t.abrupt("return");case 14:if(null==l||!l.err){t.next=18;break}s(l.err),t.next=29;break;case 18:t.t0=i,t.next="confirmed"===t.t0||"single"===t.t0||"singleGossip"===t.t0?21:"finalized"===t.t0||"max"===t.t0||"root"===t.t0?24:("processed"===t.t0||t.t0,27);break;case 21:if("processed"!==l.confirmationStatus){t.next=23;break}return t.abrupt("return");case 23:return t.abrupt("break",27);case 24:if("processed"!==l.confirmationStatus&&"confirmed"!==l.confirmationStatus){t.next=26;break}return t.abrupt("return");case 26:return t.abrupt("break",27);case 27:a=!0,e({__type:du.PROCESSED,response:{context:c,value:l}});case 29:case"end":return t.stop()}}),t)})))()}catch(e){s(e)}}))}}},{key:"confirmTransactionUsingBlockHeightExceedanceStrategy",value:(Ae=_(O().mark((function e(t){var n,r,i,o,a,s,u,c,l,h,d,f,p,y=this;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.commitment,r=t.strategy,i=r.abortSignal,o=r.lastValidBlockHeight,a=r.signature,s=!1,u=new Promise((function(e){var t=function(){var e=_(O().mark((function e(){var t;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,y.getBlockHeight(n);case 3:return t=e.sent,e.abrupt("return",t);case 7:return e.prev=7,e.t0=e.catch(0),e.abrupt("return",-1);case 10:case"end":return e.stop()}}),e,null,[[0,7]])})));return function(){return e.apply(this,arguments)}}();_(O().mark((function n(){var r;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,t();case 2:if(r=n.sent,!s){n.next=5;break}return n.abrupt("return");case 5:if(!(r<=o)){n.next=17;break}return n.next=8,Lu(1e3);case 8:if(!s){n.next=10;break}return n.abrupt("return");case 10:return n.next=12,t();case 12:if(r=n.sent,!s){n.next=15;break}return n.abrupt("return");case 15:n.next=5;break;case 17:e({__type:du.BLOCKHEIGHT_EXCEEDED});case 18:case"end":return n.stop()}}),n)})))()})),c=this.getTransactionConfirmationPromise({commitment:n,signature:a}),l=c.abortConfirmation,h=c.confirmationPromise,d=this.getCancellationPromise(i),e.prev=5,e.next=8,Promise.race([d,h,u]);case 8:if((p=e.sent).__type!==du.PROCESSED){e.next=13;break}f=p.response,e.next=14;break;case 13:throw new Xs(a);case 14:return e.prev=14,s=!0,l(),e.finish(14);case 18:return e.abrupt("return",f);case 19:case"end":return e.stop()}}),e,this,[[5,,14,18]])}))),function(e){return Ae.apply(this,arguments)})},{key:"confirmTransactionUsingDurableNonceStrategy",value:(Me=_(O().mark((function e(t){var n,r,i,o,a,s,u,c,l,h,d,f,p,y,m,g,v,w,b,M,A,I=this;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.commitment,r=t.strategy,i=r.abortSignal,o=r.minContextSlot,a=r.nonceAccountPubkey,s=r.nonceValue,u=r.signature,c=!1,l=new Promise((function(e){var t=s,r=null,i=function(){var e=_(O().mark((function e(){var i,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,I.getNonceAndContext(a,{commitment:n,minContextSlot:o});case 3:return i=e.sent,s=i.context,u=i.value,r=s.slot,e.abrupt("return",null==u?void 0:u.nonce);case 10:return e.prev=10,e.t0=e.catch(0),e.abrupt("return",t);case 13:case"end":return e.stop()}}),e,null,[[0,10]])})));return function(){return e.apply(this,arguments)}}();_(O().mark((function n(){return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,i();case 2:if(t=n.sent,!c){n.next=5;break}return n.abrupt("return");case 5:if(s===t){n.next=9;break}return e({__type:du.NONCE_INVALID,slotInWhichNonceDidAdvance:r}),n.abrupt("return");case 9:return n.next=11,Lu(2e3);case 11:if(!c){n.next=13;break}return n.abrupt("return");case 13:return n.next=15,i();case 15:if(t=n.sent,!c){n.next=18;break}return n.abrupt("return");case 18:n.next=5;break;case 20:case"end":return n.stop()}}),n)})))()})),h=this.getTransactionConfirmationPromise({commitment:n,signature:u}),d=h.abortConfirmation,f=h.confirmationPromise,p=this.getCancellationPromise(i),e.prev=5,e.next=8,Promise.race([p,f,l]);case 8:if((m=e.sent).__type!==du.PROCESSED){e.next=13;break}y=m.response,e.next=47;break;case 13:return e.next=16,this.getSignatureStatus(u);case 16:if(null!=(b=e.sent)){e.next=19;break}return e.abrupt("break",27);case 19:if(!(b.context.slot<(null!==(w=m.slotInWhichNonceDidAdvance)&&void 0!==w?w:o))){e.next=23;break}return e.next=22,Lu(400);case 22:return e.abrupt("continue",13);case 23:return v=b,e.abrupt("break",27);case 27:if(null===(g=v)||void 0===g||!g.value){e.next=46;break}M=n||"finalized",A=v.value.confirmationStatus,e.t0=M,e.next="processed"===e.t0||"recent"===e.t0?33:"confirmed"===e.t0||"single"===e.t0||"singleGossip"===e.t0?36:"finalized"===e.t0||"max"===e.t0||"root"===e.t0?39:42;break;case 33:if("processed"===A||"confirmed"===A||"finalized"===A){e.next=35;break}throw new $s(u);case 35:return e.abrupt("break",43);case 36:if("confirmed"===A||"finalized"===A){e.next=38;break}throw new $s(u);case 38:return e.abrupt("break",43);case 39:if("finalized"===A){e.next=41;break}throw new $s(u);case 41:return e.abrupt("break",43);case 42:case 43:y={context:v.context,value:{err:v.value.err}},e.next=47;break;case 46:throw new $s(u);case 47:return e.prev=47,c=!0,d(),e.finish(47);case 51:return e.abrupt("return",y);case 52:case"end":return e.stop()}}),e,this,[[5,,47,51]])}))),function(e){return Me.apply(this,arguments)})},{key:"confirmTransactionUsingLegacyTimeoutStrategy",value:(be=_(O().mark((function e(t){var n,r,i,o,a,s,u,c,l,h=this;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.commitment,r=t.signature,o=new Promise((function(e){var t=h._confirmTransactionInitialTimeout||6e4;switch(n){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":t=h._confirmTransactionInitialTimeout||3e4}i=setTimeout((function(){return e({__type:du.TIMED_OUT,timeoutMs:t})}),t)})),a=this.getTransactionConfirmationPromise({commitment:n,signature:r}),s=a.abortConfirmation,u=a.confirmationPromise,e.prev=3,e.next=6,Promise.race([u,o]);case 6:if((l=e.sent).__type!==du.PROCESSED){e.next=11;break}c=l.response,e.next=12;break;case 11:throw new Ks(r,l.timeoutMs/1e3);case 12:return e.prev=12,clearTimeout(i),s(),e.finish(12);case 16:return e.abrupt("return",c);case 17:case"end":return e.stop()}}),e,this,[[3,,12,16]])}))),function(e){return be.apply(this,arguments)})},{key:"getClusterNodes",value:(we=_(O().mark((function e(){var t,n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getClusterNodes",[]);case 2:if(t=e.sent,!("error"in(n=co(t,lc(po(il)))))){e.next=6;break}throw new Ku(n.error,"failed to get cluster nodes");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return we.apply(this,arguments)})},{key:"getVoteAccounts",value:(ve=_(O().mark((function e(t){var n,r,i;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._buildArgs([],t),e.next=3,this._rpcRequest("getVoteAccounts",n);case 3:if(r=e.sent,!("error"in(i=co(r,al)))){e.next=7;break}throw new Ku(i.error,"failed to get vote accounts");case 7:return e.abrupt("return",i.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return ve.apply(this,arguments)})},{key:"getSlot",value:(ge=_(O().mark((function e(t){var n,r,i,o,a,s;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=sc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),e.next=4,this._rpcRequest("getSlot",o);case 4:if(a=e.sent,!("error"in(s=co(a,lc(wo()))))){e.next=8;break}throw new Ku(s.error,"failed to get slot");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return ge.apply(this,arguments)})},{key:"getSlotLeader",value:(me=_(O().mark((function e(t){var n,r,i,o,a,s;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=sc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),e.next=4,this._rpcRequest("getSlotLeader",o);case 4:if(a=e.sent,!("error"in(s=co(a,lc(Ao()))))){e.next=8;break}throw new Ku(s.error,"failed to get slot leader");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return me.apply(this,arguments)})},{key:"getSlotLeaders",value:(ye=_(O().mark((function e(t,n){var r,i,o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=[t,n],e.next=3,this._rpcRequest("getSlotLeaders",r);case 3:if(i=e.sent,!("error"in(o=co(i,lc(po(ic)))))){e.next=7;break}throw new Ku(o.error,"failed to get slot leaders");case 7:return e.abrupt("return",o.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return ye.apply(this,arguments)})},{key:"getSignatureStatus",value:(pe=_(O().mark((function e(t,n){var r,i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSignatureStatuses([t],n);case 2:return r=e.sent,i=r.context,su(1===(o=r.value).length),a=o[0],e.abrupt("return",{context:i,value:a});case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return pe.apply(this,arguments)})},{key:"getSignatureStatuses",value:(fe=_(O().mark((function e(t,n){var r,i,o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=[t],n&&r.push(n),e.next=4,this._rpcRequest("getSignatureStatuses",r);case 4:if(i=e.sent,!("error"in(o=co(i,cl)))){e.next=8;break}throw new Ku(o.error,"failed to get signature status");case 8:return e.abrupt("return",o.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return fe.apply(this,arguments)})},{key:"getTransactionCount",value:(de=_(O().mark((function e(t){var n,r,i,o,a,s;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=sc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),e.next=4,this._rpcRequest("getTransactionCount",o);case 4:if(a=e.sent,!("error"in(s=co(a,lc(wo()))))){e.next=8;break}throw new Ku(s.error,"failed to get transaction count");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return de.apply(this,arguments)})},{key:"getTotalSupply",value:(he=_(O().mark((function e(t){var n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0});case 2:return n=e.sent,e.abrupt("return",n.value.total);case 4:case"end":return e.stop()}}),e,this)}))),function(e){return he.apply(this,arguments)})},{key:"getInflationGovernor",value:(le=_(O().mark((function e(t){var n,r,i;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._buildArgs([],t),e.next=3,this._rpcRequest("getInflationGovernor",n);case 3:if(r=e.sent,!("error"in(i=co(r,xc)))){e.next=7;break}throw new Ku(i.error,"failed to get inflation");case 7:return e.abrupt("return",i.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return le.apply(this,arguments)})},{key:"getInflationReward",value:(ce=_(O().mark((function e(t,n,r){var i,o,a,s,u,c;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=sc(r),o=i.commitment,a=i.config,s=this._buildArgs([t.map((function(e){return e.toBase58()}))],o,void 0,C(C({},a),{},{epoch:null!=n?n:null==a?void 0:a.epoch})),e.next=4,this._rpcRequest("getInflationReward",s);case 4:if(u=e.sent,!("error"in(c=co(u,yc)))){e.next=8;break}throw new Ku(c.error,"failed to get inflation reward");case 8:return e.abrupt("return",c.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return ce.apply(this,arguments)})},{key:"getInflationRate",value:(ue=_(O().mark((function e(){var t,n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getInflationRate",[]);case 2:if(t=e.sent,!("error"in(n=co(t,kc)))){e.next=6;break}throw new Ku(n.error,"failed to get inflation rate");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return ue.apply(this,arguments)})},{key:"getEpochInfo",value:(se=_(O().mark((function e(t){var n,r,i,o,a,s;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=sc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),e.next=4,this._rpcRequest("getEpochInfo",o);case 4:if(a=e.sent,!("error"in(s=co(a,Sc)))){e.next=8;break}throw new Ku(s.error,"failed to get epoch info");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return se.apply(this,arguments)})},{key:"getEpochSchedule",value:(ae=_(O().mark((function e(){var t,n,r;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getEpochSchedule",[]);case 2:if(t=e.sent,!("error"in(n=co(t,jc)))){e.next=6;break}throw new Ku(n.error,"failed to get epoch schedule");case 6:return r=n.result,e.abrupt("return",new Ju(r.slotsPerEpoch,r.leaderScheduleSlotOffset,r.warmup,r.firstNormalEpoch,r.firstNormalSlot));case 8:case"end":return e.stop()}}),e,this)}))),function(){return ae.apply(this,arguments)})},{key:"getLeaderSchedule",value:(oe=_(O().mark((function e(){var t,n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getLeaderSchedule",[]);case 2:if(t=e.sent,!("error"in(n=co(t,Dc)))){e.next=6;break}throw new Ku(n.error,"failed to get leader schedule");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return oe.apply(this,arguments)})},{key:"getMinimumBalanceForRentExemption",value:(ie=_(O().mark((function e(t,n){var r,i,o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgs([t],n),e.next=3,this._rpcRequest("getMinimumBalanceForRentExemption",r);case 3:if(i=e.sent,!("error"in(o=co(i,ll)))){e.next=8;break}return console.warn("Unable to fetch minimum balance for rent exemption"),e.abrupt("return",0);case 8:return e.abrupt("return",o.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return ie.apply(this,arguments)})},{key:"getRecentBlockhashAndContext",value:(re=_(O().mark((function e(t){var n,r,i;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=this._buildArgs([],t),e.next=3,this._rpcRequest("getRecentBlockhash",n);case 3:if(r=e.sent,!("error"in(i=co(r,zl)))){e.next=7;break}throw new Ku(i.error,"failed to get recent blockhash");case 7:return e.abrupt("return",i.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e){return re.apply(this,arguments)})},{key:"getRecentPerformanceSamples",value:(ne=_(O().mark((function e(t){var n,r;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]);case 2:if(n=e.sent,!("error"in(r=co(n,Bl)))){e.next=6;break}throw new Ku(r.error,"failed to get recent performance samples");case 6:return e.abrupt("return",r.result);case 7:case"end":return e.stop()}}),e,this)}))),function(e){return ne.apply(this,arguments)})},{key:"getFeeCalculatorForBlockhash",value:($=_(O().mark((function e(t,n){var r,i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgs([t],n),e.next=3,this._rpcRequest("getFeeCalculatorForBlockhash",r);case 3:if(i=e.sent,!("error"in(o=co(i,Rl)))){e.next=7;break}throw new Ku(o.error,"failed to get fee calculator");case 7:return a=o.result,s=a.context,u=a.value,e.abrupt("return",{context:s,value:null!==u?u.feeCalculator:null});case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return $.apply(this,arguments)})},{key:"getFeeForMessage",value:(K=_(O().mark((function e(t,n){var r,i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Ys(t.serialize()).toString("base64"),i=this._buildArgs([r],n),e.next=4,this._rpcRequest("getFeeForMessage",i);case 4:if(o=e.sent,!("error"in(a=co(o,hc(vo(wo())))))){e.next=8;break}throw new Ku(a.error,"failed to get fee for message");case 8:if(null!==a.result){e.next=10;break}throw new Error("invalid blockhash");case 10:return e.abrupt("return",a.result);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return K.apply(this,arguments)})},{key:"getRecentPrioritizationFees",value:(X=_(O().mark((function e(t){var n,r,i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=null==t||null===(n=t.lockedWritableAccounts)||void 0===n?void 0:n.map((function(e){return e.toBase58()})),i=null!=r&&r.length?[r]:[],e.next=4,this._rpcRequest("getRecentPrioritizationFees",i);case 4:if(o=e.sent,!("error"in(a=co(o,Lc)))){e.next=8;break}throw new Ku(a.error,"failed to get recent prioritization fees");case 8:return e.abrupt("return",a.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return X.apply(this,arguments)})},{key:"getRecentBlockhash",value:(J=_(O().mark((function e(t){var n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getRecentBlockhashAndContext(t);case 3:return n=e.sent,e.abrupt("return",n.value);case 7:throw e.prev=7,e.t0=e.catch(0),new Error("failed to get recent blockhash: "+e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e){return J.apply(this,arguments)})},{key:"getLatestBlockhash",value:(Z=_(O().mark((function e(t){var n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getLatestBlockhashAndContext(t);case 3:return n=e.sent,e.abrupt("return",n.value);case 7:throw e.prev=7,e.t0=e.catch(0),new Error("failed to get recent blockhash: "+e.t0);case 10:case"end":return e.stop()}}),e,this,[[0,7]])}))),function(e){return Z.apply(this,arguments)})},{key:"getLatestBlockhashAndContext",value:(G=_(O().mark((function e(t){var n,r,i,o,a,s;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=sc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,void 0,i),e.next=4,this._rpcRequest("getLatestBlockhash",o);case 4:if(a=e.sent,!("error"in(s=co(a,Pl)))){e.next=8;break}throw new Ku(s.error,"failed to get latest blockhash");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return G.apply(this,arguments)})},{key:"isBlockhashValid",value:(H=_(O().mark((function e(t,n){var r,i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=this._buildArgs([t],i,void 0,o),e.next=4,this._rpcRequest("isBlockhashValid",a);case 4:if(s=e.sent,!("error"in(u=co(s,_l)))){e.next=8;break}throw new Ku(u.error,"failed to determine if the blockhash `"+t+"`is valid");case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return H.apply(this,arguments)})},{key:"getVersion",value:(V=_(O().mark((function e(){var t,n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getVersion",[]);case 2:if(t=e.sent,!("error"in(n=co(t,lc(Nc))))){e.next=6;break}throw new Ku(n.error,"failed to get version");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return V.apply(this,arguments)})},{key:"getGenesisHash",value:(F=_(O().mark((function e(){var t,n;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("getGenesisHash",[]);case 2:if(t=e.sent,!("error"in(n=co(t,lc(Ao()))))){e.next=6;break}throw new Ku(n.error,"failed to get genesis hash");case 6:return e.abrupt("return",n.result);case 7:case"end":return e.stop()}}),e,this)}))),function(){return F.apply(this,arguments)})},{key:"getBlock",value:(Y=_(O().mark((function e(t,n){var r,i,o,a,s,u,c,l,h;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([t],i,void 0,o),e.next=4,this._rpcRequest("getBlock",a);case 4:s=e.sent,e.prev=5,e.t0=null==o?void 0:o.transactionDetails,e.next="accounts"===e.t0?9:"none"===e.t0?13:17;break;case 9:if(!("error"in(u=co(s,xl)))){e.next=12;break}throw u.error;case 12:return e.abrupt("return",u.result);case 13:if(!("error"in(c=co(s,El)))){e.next=16;break}throw c.error;case 16:return e.abrupt("return",c.result);case 17:if(!("error"in(l=co(s,Tl)))){e.next=20;break}throw l.error;case 20:return h=l.result,e.abrupt("return",h?C(C({},h),{},{transactions:h.transactions.map((function(e){var t=e.transaction,n=e.meta,r=e.version;return{meta:n,transaction:C(C({},t),{},{message:fc(r,t.message)}),version:r}}))}):null);case 22:e.next=27;break;case 24:throw e.prev=24,e.t1=e.catch(5),new Ku(e.t1,"failed to get confirmed block");case 27:case"end":return e.stop()}}),e,this,[[5,24]])}))),function(e,t){return Y.apply(this,arguments)})},{key:"getParsedBlock",value:(W=_(O().mark((function e(t,n){var r,i,o,a,s,u,c,l;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([t],i,"jsonParsed",o),e.next=4,this._rpcRequest("getBlock",a);case 4:s=e.sent,e.prev=5,e.t0=null==o?void 0:o.transactionDetails,e.next="accounts"===e.t0?9:"none"===e.t0?13:17;break;case 9:if(!("error"in(u=co(s,Ll)))){e.next=12;break}throw u.error;case 12:return e.abrupt("return",u.result);case 13:if(!("error"in(c=co(s,Sl)))){e.next=16;break}throw c.error;case 16:return e.abrupt("return",c.result);case 17:if(!("error"in(l=co(s,kl)))){e.next=20;break}throw l.error;case 20:return e.abrupt("return",l.result);case 21:e.next=26;break;case 23:throw e.prev=23,e.t1=e.catch(5),new Ku(e.t1,"failed to get block");case 26:case"end":return e.stop()}}),e,this,[[5,23]])}))),function(e,t){return W.apply(this,arguments)})},{key:"getBlockProduction",value:(Q=_(O().mark((function e(t){var n,r,i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return"string"==typeof t?r=t:t&&(i=t.commitment,o=q(t,Os),r=i,n=o),a=this._buildArgs([],r,"base64",n),e.next=4,this._rpcRequest("getBlockProduction",a);case 4:if(s=e.sent,!("error"in(u=co(s,Ec)))){e.next=8;break}throw new Ku(u.error,"failed to get block production information");case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return Q.apply(this,arguments)})},{key:"getTransaction",value:(R=_(O().mark((function e(t,n){var r,i,o,a,s,u,c;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([t],i,void 0,o),e.next=4,this._rpcRequest("getTransaction",a);case 4:if(s=e.sent,!("error"in(u=co(s,Cl)))){e.next=8;break}throw new Ku(u.error,"failed to get transaction");case 8:if(c=u.result){e.next=11;break}return e.abrupt("return",c);case 11:return e.abrupt("return",C(C({},c),{},{transaction:C(C({},c.transaction),{},{message:fc(c.version,c.transaction.message)})}));case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return R.apply(this,arguments)})},{key:"getParsedTransaction",value:(P=_(O().mark((function e(t,n){var r,i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=this._buildArgsAtLeastConfirmed([t],i,"jsonParsed",o),e.next=4,this._rpcRequest("getTransaction",a);case 4:if(s=e.sent,!("error"in(u=co(s,Ol)))){e.next=8;break}throw new Ku(u.error,"failed to get transaction");case 8:return e.abrupt("return",u.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e,t){return P.apply(this,arguments)})},{key:"getParsedTransactions",value:(D=_(O().mark((function e(t,n){var r,i,o,a,s,u,c=this;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=t.map((function(e){return{methodName:"getTransaction",args:c._buildArgsAtLeastConfirmed([e],i,"jsonParsed",o)}})),e.next=4,this._rpcBatchRequest(a);case 4:return s=e.sent,u=s.map((function(e){var t=co(e,Ol);if("error"in t)throw new Ku(t.error,"failed to get transactions");return t.result})),e.abrupt("return",u);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return D.apply(this,arguments)})},{key:"getTransactions",value:(j=_(O().mark((function e(t,n){var r,i,o,a,s,u,c=this;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=sc(n),i=r.commitment,o=r.config,a=t.map((function(e){return{methodName:"getTransaction",args:c._buildArgsAtLeastConfirmed([e],i,void 0,o)}})),e.next=4,this._rpcBatchRequest(a);case 4:return s=e.sent,u=s.map((function(e){var t=co(e,Cl);if("error"in t)throw new Ku(t.error,"failed to get transactions");var n=t.result;return n?C(C({},n),{},{transaction:C(C({},n.transaction),{},{message:fc(n.version,n.transaction.message)})}):n})),e.abrupt("return",u);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return j.apply(this,arguments)})},{key:"getConfirmedBlock",value:(S=_(O().mark((function e(t,n){var r,i,o,a,s;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgsAtLeastConfirmed([t],n),e.next=3,this._rpcRequest("getConfirmedBlock",r);case 3:if(i=e.sent,!("error"in(o=co(i,jl)))){e.next=7;break}throw new Ku(o.error,"failed to get confirmed block");case 7:if(a=o.result){e.next=10;break}throw new Error("Confirmed block "+t+" not found");case 10:return s=C(C({},a),{},{transactions:a.transactions.map((function(e){var t=e.transaction,n=e.meta,r=new cu(t.message);return{meta:n,transaction:C(C({},t),{},{message:r})}}))}),e.abrupt("return",C(C({},s),{},{transactions:s.transactions.map((function(e){var t=e.transaction;return{meta:e.meta,transaction:yu.populate(t.message,t.signatures)}}))}));case 12:case"end":return e.stop()}}),e,this)}))),function(e,t){return S.apply(this,arguments)})},{key:"getBlocks",value:(L=_(O().mark((function e(t,n,r){var i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this._buildArgsAtLeastConfirmed(void 0!==n?[t,n]:[t],r),e.next=3,this._rpcRequest("getBlocks",i);case 3:if(o=e.sent,!("error"in(a=co(o,lc(po(wo())))))){e.next=7;break}throw new Ku(a.error,"failed to get blocks");case 7:return e.abrupt("return",a.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return L.apply(this,arguments)})},{key:"getBlockSignatures",value:(k=_(O().mark((function e(t,n){var r,i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgsAtLeastConfirmed([t],n,void 0,{transactionDetails:"signatures",rewards:!1}),e.next=3,this._rpcRequest("getBlock",r);case 3:if(i=e.sent,!("error"in(o=co(i,Dl)))){e.next=7;break}throw new Ku(o.error,"failed to get block");case 7:if(a=o.result){e.next=10;break}throw new Error("Block "+t+" not found");case 10:return e.abrupt("return",a);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return k.apply(this,arguments)})},{key:"getConfirmedBlockSignatures",value:(x=_(O().mark((function e(t,n){var r,i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgsAtLeastConfirmed([t],n,void 0,{transactionDetails:"signatures",rewards:!1}),e.next=3,this._rpcRequest("getConfirmedBlock",r);case 3:if(i=e.sent,!("error"in(o=co(i,Dl)))){e.next=7;break}throw new Ku(o.error,"failed to get confirmed block");case 7:if(a=o.result){e.next=10;break}throw new Error("Confirmed block "+t+" not found");case 10:return e.abrupt("return",a);case 11:case"end":return e.stop()}}),e,this)}))),function(e,t){return x.apply(this,arguments)})},{key:"getConfirmedTransaction",value:(E=_(O().mark((function e(t,n){var r,i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgsAtLeastConfirmed([t],n),e.next=3,this._rpcRequest("getConfirmedTransaction",r);case 3:if(i=e.sent,!("error"in(o=co(i,Cl)))){e.next=7;break}throw new Ku(o.error,"failed to get transaction");case 7:if(a=o.result){e.next=10;break}return e.abrupt("return",a);case 10:return s=new cu(a.transaction.message),u=a.transaction.signatures,e.abrupt("return",C(C({},a),{},{transaction:yu.populate(s,u)}));case 13:case"end":return e.stop()}}),e,this)}))),function(e,t){return E.apply(this,arguments)})},{key:"getParsedConfirmedTransaction",value:(T=_(O().mark((function e(t,n){var r,i,o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed"),e.next=3,this._rpcRequest("getConfirmedTransaction",r);case 3:if(i=e.sent,!("error"in(o=co(i,Ol)))){e.next=7;break}throw new Ku(o.error,"failed to get confirmed transaction");case 7:return e.abrupt("return",o.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return T.apply(this,arguments)})},{key:"getParsedConfirmedTransactions",value:(N=_(O().mark((function e(t,n){var r,i,o,a=this;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.map((function(e){return{methodName:"getConfirmedTransaction",args:a._buildArgsAtLeastConfirmed([e],n,"jsonParsed")}})),e.next=3,this._rpcBatchRequest(r);case 3:return i=e.sent,o=i.map((function(e){var t=co(e,Ol);if("error"in t)throw new Ku(t.error,"failed to get confirmed transactions");return t.result})),e.abrupt("return",o);case 6:case"end":return e.stop()}}),e,this)}))),function(e,t){return N.apply(this,arguments)})},{key:"getConfirmedSignaturesForAddress",value:(I=_(O().mark((function e(t,n,r){var i,o,a,s,u,c;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i={},e.next=3,this.getFirstAvailableBlock();case 3:o=e.sent;case 4:if("until"in i){e.next=24;break}if(!(--n<=0||n<o)){e.next=8;break}return e.abrupt("break",24);case 8:return e.prev=8,e.next=11,this.getConfirmedBlockSignatures(n,"finalized");case 11:(a=e.sent).signatures.length>0&&(i.until=a.signatures[a.signatures.length-1].toString()),e.next=22;break;case 15:if(e.prev=15,e.t0=e.catch(8),!(e.t0 instanceof Error&&e.t0.message.includes("skipped"))){e.next=21;break}return e.abrupt("continue",4);case 21:throw e.t0;case 22:e.next=4;break;case 24:return e.next=26,this.getSlot("finalized");case 26:s=e.sent;case 27:if("before"in i){e.next=47;break}if(!(++r>s)){e.next=31;break}return e.abrupt("break",47);case 31:return e.prev=31,e.next=34,this.getConfirmedBlockSignatures(r);case 34:(u=e.sent).signatures.length>0&&(i.before=u.signatures[u.signatures.length-1].toString()),e.next=45;break;case 38:if(e.prev=38,e.t1=e.catch(31),!(e.t1 instanceof Error&&e.t1.message.includes("skipped"))){e.next=44;break}return e.abrupt("continue",27);case 44:throw e.t1;case 45:e.next=27;break;case 47:return e.next=49,this.getConfirmedSignaturesForAddress2(t,i);case 49:return c=e.sent,e.abrupt("return",c.map((function(e){return e.signature})));case 51:case"end":return e.stop()}}),e,this,[[8,15],[31,38]])}))),function(e,t,n){return I.apply(this,arguments)})},{key:"getConfirmedSignaturesForAddress2",value:(A=_(O().mark((function e(t,n,r){var i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this._buildArgsAtLeastConfirmed([t.toBase58()],r,void 0,n),e.next=3,this._rpcRequest("getConfirmedSignaturesForAddress2",i);case 3:if(o=e.sent,!("error"in(a=co(o,Gc)))){e.next=7;break}throw new Ku(a.error,"failed to get confirmed signatures for address");case 7:return e.abrupt("return",a.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return A.apply(this,arguments)})},{key:"getSignaturesForAddress",value:(M=_(O().mark((function e(t,n,r){var i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=this._buildArgsAtLeastConfirmed([t.toBase58()],r,void 0,n),e.next=3,this._rpcRequest("getSignaturesForAddress",i);case 3:if(o=e.sent,!("error"in(a=co(o,qc)))){e.next=7;break}throw new Ku(a.error,"failed to get signatures for address");case 7:return e.abrupt("return",a.result);case 8:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return M.apply(this,arguments)})},{key:"getAddressLookupTable",value:(b=_(O().mark((function e(t,n){var r,i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getAccountInfoAndContext(t,n);case 2:return r=e.sent,i=r.context,o=r.value,a=null,null!==o&&(a=new tc({key:t,state:tc.deserialize(o.data)})),e.abrupt("return",{context:i,value:a});case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return b.apply(this,arguments)})},{key:"getNonceAndContext",value:(w=_(O().mark((function e(t,n){var r,i,o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getAccountInfoAndContext(t,n);case 2:return r=e.sent,i=r.context,o=r.value,a=null,null!==o&&(a=Pu.fromAccountData(o.data)),e.abrupt("return",{context:i,value:a});case 8:case"end":return e.stop()}}),e,this)}))),function(e,t){return w.apply(this,arguments)})},{key:"getNonce",value:(v=_(O().mark((function e(t,n){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getNonceAndContext(t,n).then((function(e){return e.value})).catch((function(e){throw new Error("failed to get nonce for account "+t.toBase58()+": "+e)}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)}))),function(e,t){return v.apply(this,arguments)})},{key:"requestAirdrop",value:(g=_(O().mark((function e(t,n){var r,i;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._rpcRequest("requestAirdrop",[t.toBase58(),n]);case 2:if(r=e.sent,!("error"in(i=co(r,Ul)))){e.next=6;break}throw new Ku(i.error,"airdrop to ".concat(t.toBase58()," failed"));case 6:return e.abrupt("return",i.result);case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return g.apply(this,arguments)})},{key:"_blockhashWithExpiryBlockHeight",value:(m=_(O().mark((function e(t){var n,r;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=10;break}case 1:if(!this._pollingBlockhash){e.next=6;break}return e.next=4,Lu(100);case 4:e.next=1;break;case 6:if(n=Date.now()-this._blockhashInfo.lastFetch,r=n>=3e4,null===this._blockhashInfo.latestBlockhash||r){e.next=10;break}return e.abrupt("return",this._blockhashInfo.latestBlockhash);case 10:return e.next=12,this._pollNewBlockhash();case 12:return e.abrupt("return",e.sent);case 13:case"end":return e.stop()}}),e,this)}))),function(e){return m.apply(this,arguments)})},{key:"_pollNewBlockhash",value:(y=_(O().mark((function e(){var t,n,r,i,o;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:this._pollingBlockhash=!0,e.prev=1,t=Date.now(),n=this._blockhashInfo.latestBlockhash,r=n?n.blockhash:null,i=0;case 6:if(!(i<50)){e.next=18;break}return e.next=9,this.getLatestBlockhash("finalized");case 9:if(o=e.sent,r===o.blockhash){e.next=13;break}return this._blockhashInfo={latestBlockhash:o,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},e.abrupt("return",o);case 13:return e.next=15,Lu(200);case 15:i++,e.next=6;break;case 18:throw new Error("Unable to obtain a new blockhash after ".concat(Date.now()-t,"ms"));case 19:return e.prev=19,this._pollingBlockhash=!1,e.finish(19);case 22:case"end":return e.stop()}}),e,this,[[1,,19,22]])}))),function(){return y.apply(this,arguments)})},{key:"getStakeMinimumDelegation",value:(p=_(O().mark((function e(t){var n,r,i,o,a,s;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=sc(t),r=n.commitment,i=n.config,o=this._buildArgs([],r,"base64",i),e.next=4,this._rpcRequest("getStakeMinimumDelegation",o);case 4:if(a=e.sent,!("error"in(s=co(a,hc(wo()))))){e.next=8;break}throw new Ku(s.error,"failed to get stake minimum delegation");case 8:return e.abrupt("return",s.result);case 9:case"end":return e.stop()}}),e,this)}))),function(e){return p.apply(this,arguments)})},{key:"simulateTransaction",value:(f=_(O().mark((function e(t,n,r){var i,o,a,s,u,c,l,h,d,f,p,y,m,g,v,w,b,M,A,I,N,T,E,x,k,L;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!("message"in t)){e.next=17;break}if(i=t.serialize(),o=Ne.from(i).toString("base64"),!Array.isArray(n)&&void 0===r){e.next=6;break}throw new Error("Invalid arguments");case 6:return(a=n||{}).encoding="base64","commitment"in a||(a.commitment=this.commitment),s=[o,a],e.next=12,this._rpcRequest("simulateTransaction",s);case 12:if(u=e.sent,!("error"in(c=co(u,Tc)))){e.next=16;break}throw new Error("failed to simulate transaction: "+c.error.message);case 16:return e.abrupt("return",c.result);case 17:if(t instanceof yu?(h=t,(l=new yu).feePayer=h.feePayer,l.instructions=t.instructions,l.nonceInfo=h.nonceInfo,l.signatures=h.signatures):(l=yu.populate(t))._message=l._json=void 0,void 0===n||Array.isArray(n)){e.next=20;break}throw new Error("Invalid arguments");case 20:if(d=n,!l.nonceInfo||!d){e.next=25;break}(f=l).sign.apply(f,te(d)),e.next=45;break;case 25:p=this._disableBlockhashCaching;case 26:return e.next=28,this._blockhashWithExpiryBlockHeight(p);case 28:if(m=e.sent,l.lastValidBlockHeight=m.lastValidBlockHeight,l.recentBlockhash=m.blockhash,d){e.next=33;break}return e.abrupt("break",45);case 33:if((y=l).sign.apply(y,te(d)),l.signature){e.next=36;break}throw new Error("!signature");case 36:if(g=l.signature.toString("base64"),this._blockhashInfo.simulatedSignatures.includes(g)||this._blockhashInfo.transactionSignatures.includes(g)){e.next=42;break}return this._blockhashInfo.simulatedSignatures.push(g),e.abrupt("break",45);case 42:p=!0;case 43:e.next=26;break;case 45:return v=l._compile(),w=v.serialize(),b=l._serialize(w),M=b.toString("base64"),A={encoding:"base64",commitment:this.commitment},r&&(I=(Array.isArray(r)?r:v.nonProgramIds()).map((function(e){return e.toBase58()})),A.accounts={encoding:"base64",addresses:I}),d&&(A.sigVerify=!0),N=[M,A],e.next=55,this._rpcRequest("simulateTransaction",N);case 55:if(T=e.sent,!("error"in(E=co(T,Tc)))){e.next=60;break}throw"data"in E.error&&(x=E.error.data.logs)&&Array.isArray(x)&&(L=(k="\n ")+x.join(k),console.error(E.error.message,L)),new Xu("failed to simulate transaction: "+E.error.message,x);case 60:return e.abrupt("return",E.result);case 61:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return f.apply(this,arguments)})},{key:"sendTransaction",value:(d=_(O().mark((function e(t,n,r){var i,o,a,s,u,c;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!("version"in t)){e.next=7;break}if(!n||!Array.isArray(n)){e.next=3;break}throw new Error("Invalid arguments");case 3:return i=t.serialize(),e.next=6,this.sendRawTransaction(i,n);case 6:return e.abrupt("return",e.sent);case 7:if(void 0!==n&&Array.isArray(n)){e.next=9;break}throw new Error("Invalid arguments");case 9:if(o=n,!t.nonceInfo){e.next=14;break}t.sign.apply(t,te(o)),e.next=32;break;case 14:a=this._disableBlockhashCaching;case 15:return e.next=17,this._blockhashWithExpiryBlockHeight(a);case 17:if(s=e.sent,t.lastValidBlockHeight=s.lastValidBlockHeight,t.recentBlockhash=s.blockhash,t.sign.apply(t,te(o)),t.signature){e.next=23;break}throw new Error("!signature");case 23:if(u=t.signature.toString("base64"),this._blockhashInfo.transactionSignatures.includes(u)){e.next=29;break}return this._blockhashInfo.transactionSignatures.push(u),e.abrupt("break",32);case 29:a=!0;case 30:e.next=15;break;case 32:return c=t.serialize(),e.next=35,this.sendRawTransaction(c,r);case 35:return e.abrupt("return",e.sent);case 36:case"end":return e.stop()}}),e,this)}))),function(e,t,n){return d.apply(this,arguments)})},{key:"sendRawTransaction",value:(h=_(O().mark((function e(t,n){var r,i;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=Ys(t).toString("base64"),e.next=3,this.sendEncodedTransaction(r,n);case 3:return i=e.sent,e.abrupt("return",i);case 5:case"end":return e.stop()}}),e,this)}))),function(e,t){return h.apply(this,arguments)})},{key:"sendEncodedTransaction",value:(l=_(O().mark((function e(t,n){var r,i,o,a,s,u,c;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r={encoding:"base64"},i=n&&n.skipPreflight,o=n&&n.preflightCommitment||this.commitment,n&&null!=n.maxRetries&&(r.maxRetries=n.maxRetries),n&&null!=n.minContextSlot&&(r.minContextSlot=n.minContextSlot),i&&(r.skipPreflight=i),o&&(r.preflightCommitment=o),a=[t,r],e.next=10,this._rpcRequest("sendTransaction",a);case 10:if(s=e.sent,!("error"in(u=co(s,Ql)))){e.next=15;break}throw"data"in u.error&&(c=u.error.data.logs),new Xu("failed to send transaction: "+u.error.message,c);case 15:return e.abrupt("return",u.result);case 16:case"end":return e.stop()}}),e,this)}))),function(e,t){return l.apply(this,arguments)})},{key:"_wsOnOpen",value:function(){var e=this;this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval((function(){_(O().mark((function t(){return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,t.next=3,e._rpcWebSocket.notify("ping");case 3:t.next=7;break;case 5:t.prev=5,t.t0=t.catch(0);case 7:case"end":return t.stop()}}),t,null,[[0,5]])})))()}),5e3),this._updateSubscriptions()}},{key:"_wsOnError",value:function(e){this._rpcWebSocketConnected=!1,console.error("ws error:",e.message)}},{key:"_wsOnClose",value:function(e){var t=this;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),1e3!==e?(this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach((function(e){var n=ee(e,2),r=n[0],i=n[1];t._setSubscription(r,C(C({},i),{},{state:"pending"}))}))):this._updateSubscriptions()}},{key:"_setSubscription",value:function(e,t){var n,r=null===(n=this._subscriptionsByHash[e])||void 0===n?void 0:n.state;if(this._subscriptionsByHash[e]=t,r!==t.state){var i=this._subscriptionStateChangeCallbacksByHash[e];i&&i.forEach((function(e){try{e(t.state)}catch(e){}}))}}},{key:"_onSubscriptionStateChange",value:function(e,t){var n,r=this,i=this._subscriptionHashByClientSubscriptionId[e];if(null==i)return function(){};var o=(n=this._subscriptionStateChangeCallbacksByHash)[i]||(n[i]=new Set);return o.add(t),function(){o.delete(t),0===o.size&&delete r._subscriptionStateChangeCallbacksByHash[i]}}},{key:"_updateSubscriptions",value:(c=_(O().mark((function e(){var t,n,r=this;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(0!==Object.keys(this._subscriptionsByHash).length){e.next=3;break}return this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout((function(){r._rpcWebSocketIdleTimeout=null;try{r._rpcWebSocket.close()}catch(e){e instanceof Error&&console.log("Error when closing socket connection: ".concat(e.message))}}),500)),e.abrupt("return");case 3:if(null!==this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),this._rpcWebSocketConnected){e.next=7;break}return this._rpcWebSocket.connect(),e.abrupt("return");case 7:return t=this._rpcWebSocketGeneration,n=function(){return t===r._rpcWebSocketGeneration},e.next=11,Promise.all(Object.keys(this._subscriptionsByHash).map(function(){var e=_(O().mark((function e(t){var i;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0!==(i=r._subscriptionsByHash[t])){e.next=3;break}return e.abrupt("return");case 3:e.t0=i.state,e.next="pending"===e.t0||"unsubscribed"===e.t0?6:"subscribed"===e.t0?15:19;break;case 6:if(0!==i.callbacks.size){e.next=12;break}return delete r._subscriptionsByHash[t],"unsubscribed"===i.state&&delete r._subscriptionCallbacksByServerSubscriptionId[i.serverSubscriptionId],e.next=11,r._updateSubscriptions();case 11:return e.abrupt("return");case 12:return e.next=14,_(O().mark((function e(){var o,a,s;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=i.args,a=i.method,e.prev=1,r._setSubscription(t,C(C({},i),{},{state:"subscribing"})),e.next=5,r._rpcWebSocket.call(a,o);case 5:return s=e.sent,r._setSubscription(t,C(C({},i),{},{serverSubscriptionId:s,state:"subscribed"})),r._subscriptionCallbacksByServerSubscriptionId[s]=i.callbacks,e.next=10,r._updateSubscriptions();case 10:e.next=20;break;case 12:if(e.prev=12,e.t0=e.catch(1),e.t0 instanceof Error&&console.error("".concat(a," error for argument"),o,e.t0.message),n()){e.next=17;break}return e.abrupt("return");case 17:return r._setSubscription(t,C(C({},i),{},{state:"pending"})),e.next=20,r._updateSubscriptions();case 20:case"end":return e.stop()}}),e,null,[[1,12]])})))();case 14:return e.abrupt("break",19);case 15:if(0!==i.callbacks.size){e.next=18;break}return e.next=18,_(O().mark((function e(){var o,a;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(o=i.serverSubscriptionId,a=i.unsubscribeMethod,!r._subscriptionsAutoDisposedByRpc.has(o)){e.next=5;break}r._subscriptionsAutoDisposedByRpc.delete(o),e.next=21;break;case 5:return r._setSubscription(t,C(C({},i),{},{state:"unsubscribing"})),r._setSubscription(t,C(C({},i),{},{state:"unsubscribing"})),e.prev=7,e.next=10,r._rpcWebSocket.call(a,[o]);case 10:e.next=21;break;case 12:if(e.prev=12,e.t0=e.catch(7),e.t0 instanceof Error&&console.error("".concat(a," error:"),e.t0.message),n()){e.next=17;break}return e.abrupt("return");case 17:return r._setSubscription(t,C(C({},i),{},{state:"subscribed"})),e.next=20,r._updateSubscriptions();case 20:return e.abrupt("return");case 21:return r._setSubscription(t,C(C({},i),{},{state:"unsubscribed"})),e.next=24,r._updateSubscriptions();case 24:case"end":return e.stop()}}),e,null,[[7,12]])})))();case 18:return e.abrupt("break",19);case 19:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()));case 11:case"end":return e.stop()}}),e,this)}))),function(){return c.apply(this,arguments)})},{key:"_handleServerNotification",value:function(e,t){var n=this._subscriptionCallbacksByServerSubscriptionId[e];void 0!==n&&n.forEach((function(e){try{e.apply(void 0,te(t))}catch(e){console.error(e)}}))}},{key:"_wsOnAccountNotification",value:function(e){var t=co(e,Zc),n=t.result,r=t.subscription;this._handleServerNotification(r,[n.value,n.context])}},{key:"_makeSubscription",value:function(e,t){var n=this,r=this._nextClientSubscriptionId++,i=qu([e.method,t],!0),o=this._subscriptionsByHash[i];return void 0===o?this._subscriptionsByHash[i]=C(C({},e),{},{args:t,callbacks:new Set([e.callback]),state:"pending"}):o.callbacks.add(e.callback),this._subscriptionHashByClientSubscriptionId[r]=i,this._subscriptionDisposeFunctionsByClientSubscriptionId[r]=_(O().mark((function t(){var o;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return delete n._subscriptionDisposeFunctionsByClientSubscriptionId[r],delete n._subscriptionHashByClientSubscriptionId[r],su(void 0!==(o=n._subscriptionsByHash[i]),"Could not find a `Subscription` when tearing down client subscription #".concat(r)),o.callbacks.delete(e.callback),t.next=7,n._updateSubscriptions();case 7:case"end":return t.stop()}}),t)}))),this._updateSubscriptions(),r}},{key:"onAccountChange",value:function(e,t,n){var r=this._buildArgs([e.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:t,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},r)}},{key:"removeAccountChangeListener",value:(u=_(O().mark((function e(t){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"account change");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return u.apply(this,arguments)})},{key:"_wsOnProgramAccountNotification",value:function(e){var t=co(e,Xc),n=t.result,r=t.subscription;this._handleServerNotification(r,[{accountId:n.value.pubkey,accountInfo:n.value.account},n.context])}},{key:"onProgramAccountChange",value:function(e,t,n,r){var i=this._buildArgs([e.toBase58()],n||this._commitment||"finalized","base64",r?{filters:r}:void 0);return this._makeSubscription({callback:t,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},i)}},{key:"removeProgramAccountChangeListener",value:(s=_(O().mark((function e(t){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"program account change");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return s.apply(this,arguments)})},{key:"onLogs",value:function(e,t,n){var r=this._buildArgs(["object"===z(e)?{mentions:[e.toString()]}:e],n||this._commitment||"finalized");return this._makeSubscription({callback:t,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},r)}},{key:"removeOnLogsListener",value:(a=_(O().mark((function e(t){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"logs");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return a.apply(this,arguments)})},{key:"_wsOnLogsNotification",value:function(e){var t=co(e,Yl),n=t.result,r=t.subscription;this._handleServerNotification(r,[n.value,n.context])}},{key:"_wsOnSlotNotification",value:function(e){var t=co(e,$c),n=t.result,r=t.subscription;this._handleServerNotification(r,[n])}},{key:"onSlotChange",value:function(e){return this._makeSubscription({callback:e,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}},{key:"removeSlotChangeListener",value:(o=_(O().mark((function e(t){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"slot change");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return o.apply(this,arguments)})},{key:"_wsOnSlotUpdatesNotification",value:function(e){var t=co(e,tl),n=t.result,r=t.subscription;this._handleServerNotification(r,[n])}},{key:"onSlotUpdate",value:function(e){return this._makeSubscription({callback:e,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}},{key:"removeSlotUpdateListener",value:(i=_(O().mark((function e(t){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"slot update");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return i.apply(this,arguments)})},{key:"_unsubscribeClientSubscription",value:(r=_(O().mark((function e(t,n){var r;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this._subscriptionDisposeFunctionsByClientSubscriptionId[t])){e.next=6;break}return e.next=4,r();case 4:e.next=7;break;case 6:console.warn("Ignored unsubscribe request because an active subscription with id "+"`".concat(t,"` for '").concat(n,"' events ")+"could not be found.");case 7:case"end":return e.stop()}}),e,this)}))),function(e,t){return r.apply(this,arguments)})},{key:"_buildArgs",value:function(e,t,n,r){var i=t||this._commitment;if(i||n||r){var o={};n&&(o.encoding=n),i&&(o.commitment=i),r&&(o=Object.assign(o,r)),e.push(o)}return e}},{key:"_buildArgsAtLeastConfirmed",value:function(e,t,n,r){var i=t||this._commitment;if(i&&!["confirmed","finalized"].includes(i))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(e,t,n,r)}},{key:"_wsOnSignatureNotification",value:function(e){var t=co(e,nl),n=t.result,r=t.subscription;"receivedSignature"!==n.value&&this._subscriptionsAutoDisposedByRpc.add(r),this._handleServerNotification(r,"receivedSignature"===n.value?[{type:"received"},n.context]:[{type:"status",result:n.value},n.context])}},{key:"onSignature",value:function(e,t,n){var r=this,i=this._buildArgs([e],n||this._commitment||"finalized"),o=this._makeSubscription({callback:function(e,n){if("status"===e.type){t(e.result,n);try{r.removeSignatureListener(o)}catch(e){}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return o}},{key:"onSignatureWithOptions",value:function(e,t,n){var r=this,i=C(C({},n),{},{commitment:n&&n.commitment||this._commitment||"finalized"}),o=i.commitment,a=q(i,zs),s=this._buildArgs([e],o,void 0,a),u=this._makeSubscription({callback:function(e,n){t(e,n);try{r.removeSignatureListener(u)}catch(e){}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},s);return u}},{key:"removeSignatureListener",value:(n=_(O().mark((function e(t){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"signature result");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return n.apply(this,arguments)})},{key:"_wsOnRootNotification",value:function(e){var t=co(e,rl),n=t.result,r=t.subscription;this._handleServerNotification(r,[n])}},{key:"onRootChange",value:function(e){return this._makeSubscription({callback:e,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}},{key:"removeRootChangeListener",value:(t=_(O().mark((function e(t){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._unsubscribeClientSubscription(t,"root change");case 2:case"end":return e.stop()}}),e,this)}))),function(e){return t.apply(this,arguments)})}]),e}(),Hl=function(){function e(t){B(this,e),this._keypair=void 0,this._keypair=null!=t?t:_s()}return U(e,[{key:"publicKey",get:function(){return new qs(this._keypair.publicKey)}},{key:"secretKey",get:function(){return new Uint8Array(this._keypair.secretKey)}}],[{key:"generate",value:function(){return new e(_s())}},{key:"fromSecretKey",value:function(t,n){if(64!==t.byteLength)throw new Error("bad secret key size");var r=t.slice(32,64);if(!n||!n.skipValidation)for(var i=t.slice(0,32),o=Bs(i),a=0;a<32;a++)if(r[a]!==o[a])throw new Error("provided secretKey is invalid");return new e({publicKey:r,secretKey:t})}},{key:"fromSeed",value:function(t){var n=Bs(t),r=new Uint8Array(64);return r.set(t),r.set(n,32),new e({publicKey:n,secretKey:r})}}]),e}(),Gl=Object.freeze({CreateLookupTable:{index:0,layout:Fi([Qi("instruction"),_u("recentSlot"),Ri("bumpSeed")])},FreezeLookupTable:{index:1,layout:Fi([Qi("instruction")])},ExtendLookupTable:{index:2,layout:Fi([Qi("instruction"),_u(),Vi(tu(),Bi(Qi(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Fi([Qi("instruction")])},CloseLookupTable:{index:4,layout:Fi([Qi("instruction")])}}),ql=function(){function e(){B(this,e)}return U(e,null,[{key:"decodeInstructionType",value:function(e){this.checkProgramId(e.programId);for(var t,n=Qi("instruction").decode(e.data),r=0,i=Object.entries(Gl);r<i.length;r++){var o=ee(i[r],2),a=o[0];if(o[1].index==n){t=a;break}}if(!t)throw new Error("Invalid Instruction. Should be a LookupTable Instruction");return t}},{key:"decodeCreateLookupTable",value:function(e){this.checkProgramId(e.programId),this.checkKeysLength(e.keys,4);var t=ju(Gl.CreateLookupTable,e.data).recentSlot;return{authority:e.keys[1].pubkey,payer:e.keys[2].pubkey,recentSlot:Number(t)}}},{key:"decodeExtendLookupTable",value:function(e){if(this.checkProgramId(e.programId),e.keys.length<2)throw new Error("invalid instruction; found ".concat(e.keys.length," keys, expected at least 2"));var t=ju(Gl.ExtendLookupTable,e.data).addresses;return{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey,payer:e.keys.length>2?e.keys[2].pubkey:void 0,addresses:t.map((function(e){return new qs(e)}))}}},{key:"decodeCloseLookupTable",value:function(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,3),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey,recipient:e.keys[2].pubkey}}},{key:"decodeFreezeLookupTable",value:function(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,2),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey}}},{key:"decodeDeactivateLookupTable",value:function(e){return this.checkProgramId(e.programId),this.checkKeysLength(e.keys,2),{lookupTable:e.keys[0].pubkey,authority:e.keys[1].pubkey}}},{key:"checkProgramId",value:function(e){if(!e.equals(Zl.programId))throw new Error("invalid instruction; programId is not AddressLookupTable Program")}},{key:"checkKeysLength",value:function(e,t){if(e.length<t)throw new Error("invalid instruction; found ".concat(e.length," keys, expected at least ").concat(t))}}]),e}(),Zl=function(){function e(){B(this,e)}return U(e,null,[{key:"createLookupTable",value:function(e){var t=ee(qs.findProgramAddressSync([e.authority.toBuffer(),Zi(BigInt(e.recentSlot),8)],this.programId),2),n=t[0],r=t[1],i=Su(Gl.CreateLookupTable,{recentSlot:BigInt(e.recentSlot),bumpSeed:r}),o=[{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:Uu.programId,isSigner:!1,isWritable:!1}];return[new pu({programId:this.programId,keys:o,data:i}),n]}},{key:"freezeLookupTable",value:function(e){var t=Su(Gl.FreezeLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new pu({programId:this.programId,keys:n,data:t})}},{key:"extendLookupTable",value:function(e){var t=Su(Gl.ExtendLookupTable,{addresses:e.addresses.map((function(e){return e.toBytes()}))}),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return e.payer&&n.push({pubkey:e.payer,isSigner:!0,isWritable:!0},{pubkey:Uu.programId,isSigner:!1,isWritable:!1}),new pu({programId:this.programId,keys:n,data:t})}},{key:"deactivateLookupTable",value:function(e){var t=Su(Gl.DeactivateLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1}];return new pu({programId:this.programId,keys:n,data:t})}},{key:"closeLookupTable",value:function(e){var t=Su(Gl.CloseLookupTable),n=[{pubkey:e.lookupTable,isSigner:!1,isWritable:!0},{pubkey:e.authority,isSigner:!0,isWritable:!1},{pubkey:e.recipient,isSigner:!1,isWritable:!0}];return new pu({programId:this.programId,keys:n,data:t})}}]),e}();Zl.programId=new qs("AddressLookupTab1e1111111111111111111111111");var Jl=function(){function e(){B(this,e)}return U(e,null,[{key:"decodeInstructionType",value:function(e){this.checkProgramId(e.programId);for(var t,n=Ri("instruction").decode(e.data),r=0,i=Object.entries(Xl);r<i.length;r++){var o=ee(i[r],2),a=o[0];if(o[1].index==n){t=a;break}}if(!t)throw new Error("Instruction type incorrect; not a ComputeBudgetInstruction");return t}},{key:"decodeRequestUnits",value:function(e){this.checkProgramId(e.programId);var t=ju(Xl.RequestUnits,e.data);return{units:t.units,additionalFee:t.additionalFee}}},{key:"decodeRequestHeapFrame",value:function(e){return this.checkProgramId(e.programId),{bytes:ju(Xl.RequestHeapFrame,e.data).bytes}}},{key:"decodeSetComputeUnitLimit",value:function(e){return this.checkProgramId(e.programId),{units:ju(Xl.SetComputeUnitLimit,e.data).units}}},{key:"decodeSetComputeUnitPrice",value:function(e){return this.checkProgramId(e.programId),{microLamports:ju(Xl.SetComputeUnitPrice,e.data).microLamports}}},{key:"checkProgramId",value:function(e){if(!e.equals(Kl.programId))throw new Error("invalid instruction; programId is not ComputeBudgetProgram")}}]),e}(),Xl=Object.freeze({RequestUnits:{index:0,layout:Fi([Ri("instruction"),Qi("units"),Qi("additionalFee")])},RequestHeapFrame:{index:1,layout:Fi([Ri("instruction"),Qi("bytes")])},SetComputeUnitLimit:{index:2,layout:Fi([Ri("instruction"),Qi("units")])},SetComputeUnitPrice:{index:3,layout:Fi([Ri("instruction"),_u("microLamports")])}}),Kl=function(){function e(){B(this,e)}return U(e,null,[{key:"requestUnits",value:function(e){var t=Su(Xl.RequestUnits,e);return new pu({keys:[],programId:this.programId,data:t})}},{key:"requestHeapFrame",value:function(e){var t=Su(Xl.RequestHeapFrame,e);return new pu({keys:[],programId:this.programId,data:t})}},{key:"setComputeUnitLimit",value:function(e){var t=Su(Xl.SetComputeUnitLimit,e);return new pu({keys:[],programId:this.programId,data:t})}},{key:"setComputeUnitPrice",value:function(e){var t=Su(Xl.SetComputeUnitPrice,{microLamports:BigInt(e.microLamports)});return new pu({keys:[],programId:this.programId,data:t})}}]),e}();Kl.programId=new qs("ComputeBudget111111111111111111111111111111");var $l=Fi([Ri("numSignatures"),Ri("padding"),Ui("signatureOffset"),Ui("signatureInstructionIndex"),Ui("publicKeyOffset"),Ui("publicKeyInstructionIndex"),Ui("messageDataOffset"),Ui("messageDataSize"),Ui("messageInstructionIndex")]),eh=function(){function e(){B(this,e)}return U(e,null,[{key:"createInstructionWithPublicKey",value:function(t){var n=t.publicKey,r=t.message,i=t.signature,o=t.instructionIndex;su(32===n.length,"Public Key must be ".concat(32," bytes but received ").concat(n.length," bytes")),su(64===i.length,"Signature must be ".concat(64," bytes but received ").concat(i.length," bytes"));var a=$l.span,s=a+n.length,u=s+i.length,c=Ne.alloc(u+r.length),l=null==o?65535:o;return $l.encode({numSignatures:1,padding:0,signatureOffset:s,signatureInstructionIndex:l,publicKeyOffset:a,publicKeyInstructionIndex:l,messageDataOffset:u,messageDataSize:r.length,messageInstructionIndex:l},c),c.fill(n,a),c.fill(i,s),c.fill(r,u),new pu({keys:[],programId:e.programId,data:c})}},{key:"createInstructionWithPrivateKey",value:function(e){var t=e.privateKey,n=e.message,r=e.instructionIndex;su(64===t.length,"Private key must be ".concat(64," bytes but received ").concat(t.length," bytes"));try{var i=Hl.fromSecretKey(t),o=i.publicKey.toBytes(),a=Qs(n,i.secretKey);return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:a,instructionIndex:r})}catch(e){throw new Error("Error creating instruction; ".concat(e))}}}]),e}();eh.programId=new qs("Ed25519SigVerify111111111111111111111111111");js.utils.isValidPrivateKey;var th,nh=js.getPublicKey,rh=Fi([Ri("numSignatures"),Ui("signatureOffset"),Ri("signatureInstructionIndex"),Ui("ethAddressOffset"),Ri("ethAddressInstructionIndex"),Ui("messageDataOffset"),Ui("messageDataSize"),Ri("messageInstructionIndex"),Hi(20,"ethAddress"),Hi(64,"signature"),Ri("recoveryId")]),ih=function(){function e(){B(this,e)}return U(e,null,[{key:"publicKeyToEthAddress",value:function(e){su(64===e.length,"Public key must be ".concat(64," bytes but received ").concat(e.length," bytes"));try{return Ne.from(ps(Ys(e))).slice(-20)}catch(e){throw new Error("Error constructing Ethereum address: ".concat(e))}}},{key:"createInstructionWithPublicKey",value:function(t){var n=t.publicKey,r=t.message,i=t.signature,o=t.recoveryId,a=t.instructionIndex;return e.createInstructionWithEthAddress({ethAddress:e.publicKeyToEthAddress(n),message:r,signature:i,recoveryId:o,instructionIndex:a})}},{key:"createInstructionWithEthAddress",value:function(t){var n,r=t.ethAddress,i=t.message,o=t.signature,a=t.recoveryId,s=t.instructionIndex,u=void 0===s?0:s;su(20===(n="string"==typeof r?r.startsWith("0x")?Ne.from(r.substr(2),"hex"):Ne.from(r,"hex"):r).length,"Address must be ".concat(20," bytes but received ").concat(n.length," bytes"));var c=12+n.length,l=c+o.length+1,h=Ne.alloc(rh.span+i.length);return rh.encode({numSignatures:1,signatureOffset:c,signatureInstructionIndex:u,ethAddressOffset:12,ethAddressInstructionIndex:u,messageDataOffset:l,messageDataSize:i.length,messageInstructionIndex:u,signature:Ys(o),ethAddress:Ys(n),recoveryId:a},h),h.fill(Ys(i),rh.span),new pu({keys:[],programId:e.programId,data:h})}},{key:"createInstructionWithPrivateKey",value:function(e){var t=e.privateKey,n=e.message,r=e.instructionIndex;su(32===t.length,"Private key must be ".concat(32," bytes but received ").concat(t.length," bytes"));try{var i=Ys(t),o=nh(i,!1).slice(1),a=ee(function(e,t){var n=js.sign(e,t);return[n.toCompactRawBytes(),n.recovery]}(Ne.from(ps(Ys(n))),i),2),s=a[0],u=a[1];return this.createInstructionWithPublicKey({publicKey:o,message:n,signature:s,recoveryId:u,instructionIndex:r})}catch(e){throw new Error("Error creating instruction; ".concat(e))}}}]),e}();ih.programId=new qs("KeccakSecp256k11111111111111111111111111111");var oh=new qs("StakeConfig11111111111111111111111111111111"),ah=U((function e(t,n){B(this,e),this.staker=void 0,this.withdrawer=void 0,this.staker=t,this.withdrawer=n})),sh=U((function e(t,n,r){B(this,e),this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=n,this.custodian=r}));th=sh,sh.default=new th(0,0,qs.default);var uh=function(){function e(){B(this,e)}return U(e,null,[{key:"decodeInstructionType",value:function(e){this.checkProgramId(e.programId);for(var t,n=Qi("instruction").decode(e.data),r=0,i=Object.entries(ch);r<i.length;r++){var o=ee(i[r],2),a=o[0];if(o[1].index==n){t=a;break}}if(!t)throw new Error("Instruction type incorrect; not a StakeInstruction");return t}},{key:"decodeInitialize",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=ju(ch.Initialize,e.data),n=t.authorized,r=t.lockup;return{stakePubkey:e.keys[0].pubkey,authorized:new ah(new qs(n.staker),new qs(n.withdrawer)),lockup:new sh(r.unixTimestamp,r.epoch,new qs(r.custodian))}}},{key:"decodeDelegate",value:function(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,6),ju(ch.Delegate,e.data),{stakePubkey:e.keys[0].pubkey,votePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[5].pubkey}}},{key:"decodeAuthorize",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=ju(ch.Authorize,e.data),n=t.newAuthorized,r=t.stakeAuthorizationType,i={stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new qs(n),stakeAuthorizationType:{index:r}};return e.keys.length>3&&(i.custodianPubkey=e.keys[3].pubkey),i}},{key:"decodeAuthorizeWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,2);var t=ju(ch.AuthorizeWithSeed,e.data),n=t.newAuthorized,r=t.stakeAuthorizationType,i=t.authoritySeed,o=t.authorityOwner,a={stakePubkey:e.keys[0].pubkey,authorityBase:e.keys[1].pubkey,authoritySeed:i,authorityOwner:new qs(o),newAuthorizedPubkey:new qs(n),stakeAuthorizationType:{index:r}};return e.keys.length>3&&(a.custodianPubkey=e.keys[3].pubkey),a}},{key:"decodeSplit",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=ju(ch.Split,e.data).lamports;return{stakePubkey:e.keys[0].pubkey,splitStakePubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[2].pubkey,lamports:t}}},{key:"decodeMerge",value:function(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),ju(ch.Merge,e.data),{stakePubkey:e.keys[0].pubkey,sourceStakePubKey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey}}},{key:"decodeWithdraw",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,5);var t=ju(ch.Withdraw,e.data).lamports,n={stakePubkey:e.keys[0].pubkey,toPubkey:e.keys[1].pubkey,authorizedPubkey:e.keys[4].pubkey,lamports:t};return e.keys.length>5&&(n.custodianPubkey=e.keys[5].pubkey),n}},{key:"decodeDeactivate",value:function(e){return this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3),ju(ch.Deactivate,e.data),{stakePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey}}},{key:"checkProgramId",value:function(e){if(!e.equals(hh.programId))throw new Error("invalid instruction; programId is not StakeProgram")}},{key:"checkKeyLength",value:function(e,t){if(e.length<t)throw new Error("invalid instruction; found ".concat(e.length," keys, expected at least ").concat(t))}}]),e}(),ch=Object.freeze({Initialize:{index:0,layout:Fi([Qi("instruction"),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"authorized";return Fi([tu("staker"),tu("withdrawer")],e)}(),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"lockup";return Fi([Yi("unixTimestamp"),Yi("epoch"),tu("custodian")],e)}()])},Authorize:{index:1,layout:Fi([Qi("instruction"),tu("newAuthorized"),Qi("stakeAuthorizationType")])},Delegate:{index:2,layout:Fi([Qi("instruction")])},Split:{index:3,layout:Fi([Qi("instruction"),Yi("lamports")])},Withdraw:{index:4,layout:Fi([Qi("instruction"),Yi("lamports")])},Deactivate:{index:5,layout:Fi([Qi("instruction")])},Merge:{index:7,layout:Fi([Qi("instruction")])},AuthorizeWithSeed:{index:8,layout:Fi([Qi("instruction"),tu("newAuthorized"),Qi("stakeAuthorizationType"),ru("authoritySeed"),tu("authorityOwner")])}}),lh=Object.freeze({Staker:{index:0},Withdrawer:{index:1}}),hh=function(){function e(){B(this,e)}return U(e,null,[{key:"initialize",value:function(e){var t=e.stakePubkey,n=e.authorized,r=e.lockup||sh.default,i=Su(ch.Initialize,{authorized:{staker:Ys(n.staker.toBuffer()),withdrawer:Ys(n.withdrawer.toBuffer())},lockup:{unixTimestamp:r.unixTimestamp,epoch:r.epoch,custodian:Ys(r.custodian.toBuffer())}}),o={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Au,isSigner:!1,isWritable:!1}],programId:this.programId,data:i};return new pu(o)}},{key:"createAccountWithSeed",value:function(e){var t=new yu;t.add(Uu.createAccountWithSeed({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,basePubkey:e.basePubkey,seed:e.seed,lamports:e.lamports,space:this.space,programId:this.programId}));var n=e.stakePubkey,r=e.authorized,i=e.lockup;return t.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}},{key:"createAccount",value:function(e){var t=new yu;t.add(Uu.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.stakePubkey,lamports:e.lamports,space:this.space,programId:this.programId}));var n=e.stakePubkey,r=e.authorized,i=e.lockup;return t.add(this.initialize({stakePubkey:n,authorized:r,lockup:i}))}},{key:"delegate",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=e.votePubkey,i=Su(ch.Delegate);return(new yu).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!1},{pubkey:vu,isSigner:!1,isWritable:!1},{pubkey:Eu,isSigner:!1,isWritable:!1},{pubkey:oh,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}},{key:"authorize",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=e.newAuthorizedPubkey,i=e.stakeAuthorizationType,o=e.custodianPubkey,a=Su(ch.Authorize,{newAuthorized:Ys(r.toBuffer()),stakeAuthorizationType:i.index}),s=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:vu,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new yu).add({keys:s,programId:this.programId,data:a})}},{key:"authorizeWithSeed",value:function(e){var t=e.stakePubkey,n=e.authorityBase,r=e.authoritySeed,i=e.authorityOwner,o=e.newAuthorizedPubkey,a=e.stakeAuthorizationType,s=e.custodianPubkey,u=Su(ch.AuthorizeWithSeed,{newAuthorized:Ys(o.toBuffer()),stakeAuthorizationType:a.index,authoritySeed:r,authorityOwner:Ys(i.toBuffer())}),c=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1},{pubkey:vu,isSigner:!1,isWritable:!1}];return s&&c.push({pubkey:s,isSigner:!1,isWritable:!1}),(new yu).add({keys:c,programId:this.programId,data:u})}},{key:"splitInstruction",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=e.splitStakePubkey,i=e.lamports,o=Su(ch.Split,{lamports:i});return new pu({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:o})}},{key:"split",value:function(e){var t=new yu;return t.add(Uu.createAccount({fromPubkey:e.authorizedPubkey,newAccountPubkey:e.splitStakePubkey,lamports:0,space:this.space,programId:this.programId})),t.add(this.splitInstruction(e))}},{key:"splitWithSeed",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=e.splitStakePubkey,i=e.basePubkey,o=e.seed,a=e.lamports,s=new yu;return s.add(Uu.allocate({accountPubkey:r,basePubkey:i,seed:o,space:this.space,programId:this.programId})),s.add(this.splitInstruction({stakePubkey:t,authorizedPubkey:n,splitStakePubkey:r,lamports:a}))}},{key:"merge",value:function(e){var t=e.stakePubkey,n=e.sourceStakePubKey,r=e.authorizedPubkey,i=Su(ch.Merge);return(new yu).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!1,isWritable:!0},{pubkey:vu,isSigner:!1,isWritable:!1},{pubkey:Eu,isSigner:!1,isWritable:!1},{pubkey:r,isSigner:!0,isWritable:!1}],programId:this.programId,data:i})}},{key:"withdraw",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=e.toPubkey,i=e.lamports,o=e.custodianPubkey,a=Su(ch.Withdraw,{lamports:i}),s=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:r,isSigner:!1,isWritable:!0},{pubkey:vu,isSigner:!1,isWritable:!1},{pubkey:Eu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return o&&s.push({pubkey:o,isSigner:!1,isWritable:!1}),(new yu).add({keys:s,programId:this.programId,data:a})}},{key:"deactivate",value:function(e){var t=e.stakePubkey,n=e.authorizedPubkey,r=Su(ch.Deactivate);return(new yu).add({keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:vu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:r})}}]),e}();hh.programId=new qs("Stake11111111111111111111111111111111111111"),hh.space=200;var dh=U((function e(t,n,r,i){B(this,e),this.nodePubkey=void 0,this.authorizedVoter=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.nodePubkey=t,this.authorizedVoter=n,this.authorizedWithdrawer=r,this.commission=i})),fh=function(){function e(){B(this,e)}return U(e,null,[{key:"decodeInstructionType",value:function(e){this.checkProgramId(e.programId);for(var t,n=Qi("instruction").decode(e.data),r=0,i=Object.entries(ph);r<i.length;r++){var o=ee(i[r],2),a=o[0];if(o[1].index==n){t=a;break}}if(!t)throw new Error("Instruction type incorrect; not a VoteInstruction");return t}},{key:"decodeInitializeAccount",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,4);var t=ju(ph.InitializeAccount,e.data).voteInit;return{votePubkey:e.keys[0].pubkey,nodePubkey:e.keys[3].pubkey,voteInit:new dh(new qs(t.nodePubkey),new qs(t.authorizedVoter),new qs(t.authorizedWithdrawer),t.commission)}}},{key:"decodeAuthorize",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=ju(ph.Authorize,e.data),n=t.newAuthorized,r=t.voteAuthorizationType;return{votePubkey:e.keys[0].pubkey,authorizedPubkey:e.keys[2].pubkey,newAuthorizedPubkey:new qs(n),voteAuthorizationType:{index:r}}}},{key:"decodeAuthorizeWithSeed",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=ju(ph.AuthorizeWithSeed,e.data).voteAuthorizeWithSeedArgs,n=t.currentAuthorityDerivedKeyOwnerPubkey,r=t.currentAuthorityDerivedKeySeed,i=t.newAuthorized,o=t.voteAuthorizationType;return{currentAuthorityDerivedKeyBasePubkey:e.keys[2].pubkey,currentAuthorityDerivedKeyOwnerPubkey:new qs(n),currentAuthorityDerivedKeySeed:r,newAuthorizedPubkey:new qs(i),voteAuthorizationType:{index:o},votePubkey:e.keys[0].pubkey}}},{key:"decodeWithdraw",value:function(e){this.checkProgramId(e.programId),this.checkKeyLength(e.keys,3);var t=ju(ph.Withdraw,e.data).lamports;return{votePubkey:e.keys[0].pubkey,authorizedWithdrawerPubkey:e.keys[2].pubkey,lamports:t,toPubkey:e.keys[1].pubkey}}},{key:"checkProgramId",value:function(e){if(!e.equals(mh.programId))throw new Error("invalid instruction; programId is not VoteProgram")}},{key:"checkKeyLength",value:function(e,t){if(e.length<t)throw new Error("invalid instruction; found ".concat(e.length," keys, expected at least ").concat(t))}}]),e}(),ph=Object.freeze({InitializeAccount:{index:0,layout:Fi([Qi("instruction"),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteInit";return Fi([tu("nodePubkey"),tu("authorizedVoter"),tu("authorizedWithdrawer"),Ri("commission")],e)}()])},Authorize:{index:1,layout:Fi([Qi("instruction"),tu("newAuthorized"),Qi("voteAuthorizationType")])},Withdraw:{index:3,layout:Fi([Qi("instruction"),Yi("lamports")])},AuthorizeWithSeed:{index:10,layout:Fi([Qi("instruction"),function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"voteAuthorizeWithSeedArgs";return Fi([Qi("voteAuthorizationType"),tu("currentAuthorityDerivedKeyOwnerPubkey"),ru("currentAuthorityDerivedKeySeed"),tu("newAuthorized")],e)}()])}}),yh=Object.freeze({Voter:{index:0},Withdrawer:{index:1}}),mh=function(){function e(){B(this,e)}return U(e,null,[{key:"initializeAccount",value:function(e){var t=e.votePubkey,n=e.nodePubkey,r=e.voteInit,i=Su(ph.InitializeAccount,{voteInit:{nodePubkey:Ys(r.nodePubkey.toBuffer()),authorizedVoter:Ys(r.authorizedVoter.toBuffer()),authorizedWithdrawer:Ys(r.authorizedWithdrawer.toBuffer()),commission:r.commission}}),o={keys:[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:Au,isSigner:!1,isWritable:!1},{pubkey:vu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}],programId:this.programId,data:i};return new pu(o)}},{key:"createAccount",value:function(e){var t=new yu;return t.add(Uu.createAccount({fromPubkey:e.fromPubkey,newAccountPubkey:e.votePubkey,lamports:e.lamports,space:this.space,programId:this.programId})),t.add(this.initializeAccount({votePubkey:e.votePubkey,nodePubkey:e.voteInit.nodePubkey,voteInit:e.voteInit}))}},{key:"authorize",value:function(e){var t=e.votePubkey,n=e.authorizedPubkey,r=e.newAuthorizedPubkey,i=e.voteAuthorizationType,o=Su(ph.Authorize,{newAuthorized:Ys(r.toBuffer()),voteAuthorizationType:i.index}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:vu,isSigner:!1,isWritable:!1},{pubkey:n,isSigner:!0,isWritable:!1}];return(new yu).add({keys:a,programId:this.programId,data:o})}},{key:"authorizeWithSeed",value:function(e){var t=e.currentAuthorityDerivedKeyBasePubkey,n=e.currentAuthorityDerivedKeyOwnerPubkey,r=e.currentAuthorityDerivedKeySeed,i=e.newAuthorizedPubkey,o=e.voteAuthorizationType,a=e.votePubkey,s=Su(ph.AuthorizeWithSeed,{voteAuthorizeWithSeedArgs:{currentAuthorityDerivedKeyOwnerPubkey:Ys(n.toBuffer()),currentAuthorityDerivedKeySeed:r,newAuthorized:Ys(i.toBuffer()),voteAuthorizationType:o.index}}),u=[{pubkey:a,isSigner:!1,isWritable:!0},{pubkey:vu,isSigner:!1,isWritable:!1},{pubkey:t,isSigner:!0,isWritable:!1}];return(new yu).add({keys:u,programId:this.programId,data:s})}},{key:"withdraw",value:function(e){var t=e.votePubkey,n=e.authorizedWithdrawerPubkey,r=e.lamports,i=e.toPubkey,o=Su(ph.Withdraw,{lamports:r}),a=[{pubkey:t,isSigner:!1,isWritable:!0},{pubkey:i,isSigner:!1,isWritable:!0},{pubkey:n,isSigner:!0,isWritable:!1}];return(new yu).add({keys:a,programId:this.programId,data:o})}},{key:"safeWithdraw",value:function(t,n,r){if(t.lamports>n-r)throw new Error("Withdraw will leave vote account with insuffcient funds.");return e.withdraw(t)}}]),e}();mh.programId=new qs("Vote111111111111111111111111111111111111111"),mh.space=3731;var gh=new qs("Va1idator1nfo111111111111111111111111111111"),vh=No({name:Ao(),website:bo(Ao()),details:bo(Ao()),keybaseUsername:bo(Ao())}),wh=function(){function e(t,n){B(this,e),this.key=void 0,this.info=void 0,this.key=t,this.info=n}return U(e,null,[{key:"fromConfigData",value:function(t){var n=te(t);if(2!==ou(n))return null;for(var r=[],i=0;i<2;i++){var o=new qs(n.slice(0,32)),a=1===(n=n.slice(32)).slice(0,1)[0];n=n.slice(1),r.push({publicKey:o,isSigner:a})}if(r[0].publicKey.equals(gh)&&r[1].isSigner){var s=ru().decode(Ne.from(n)),u=JSON.parse(s);return uo(u,vh),new e(r[1].publicKey,u)}return null}}]),e}(),bh=new qs("Vote111111111111111111111111111111111111111"),Mh=Fi([tu("nodePubkey"),tu("authorizedWithdrawer"),Ri("commission"),Wi(),Vi(Fi([Wi("slot"),Qi("confirmationCount")]),Bi(Qi(),-8),"votes"),Ri("rootSlotValid"),Wi("rootSlot"),Wi(),Vi(Fi([Wi("epoch"),tu("authorizedVoter")]),Bi(Qi(),-8),"authorizedVoters"),Fi([Vi(Fi([tu("authorizedPubkey"),Wi("epochOfLastAuthorizedSwitch"),Wi("targetEpoch")]),32,"buf"),Wi("idx"),Ri("isEmpty")],"priorVoters"),Wi(),Vi(Fi([Wi("epoch"),Wi("credits"),Wi("prevCredits")]),Bi(Qi(),-8),"epochCredits"),Fi([Wi("slot"),Wi("timestamp")],"lastTimestamp")]),Ah=function(){function e(t){B(this,e),this.nodePubkey=void 0,this.authorizedWithdrawer=void 0,this.commission=void 0,this.rootSlot=void 0,this.votes=void 0,this.authorizedVoters=void 0,this.priorVoters=void 0,this.epochCredits=void 0,this.lastTimestamp=void 0,this.nodePubkey=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}return U(e,null,[{key:"fromAccountData",value:function(t){var n=Mh.decode(Ys(t),4),r=n.rootSlot;return n.rootSlotValid||(r=null),new e({nodePubkey:new qs(n.nodePubkey),authorizedWithdrawer:new qs(n.authorizedWithdrawer),commission:n.commission,votes:n.votes,rootSlot:r,authorizedVoters:n.authorizedVoters.map(Ih),priorVoters:Th(n.priorVoters),epochCredits:n.epochCredits,lastTimestamp:n.lastTimestamp})}}]),e}();function Ih(e){var t=e.authorizedVoter;return{epoch:e.epoch,authorizedVoter:new qs(t)}}function Nh(e){var t=e.authorizedPubkey,n=e.epochOfLastAuthorizedSwitch,r=e.targetEpoch;return{authorizedPubkey:new qs(t),epochOfLastAuthorizedSwitch:n,targetEpoch:r}}function Th(e){var t=e.buf,n=e.idx;return e.isEmpty?[]:[].concat(te(t.slice(n+1).map(Nh)),te(t.slice(0,n).map(Nh)))}var Eh={http:{devnet:"http://api.devnet.solana.com",testnet:"http://api.testnet.solana.com","mainnet-beta":"http://api.mainnet-beta.solana.com/"},https:{devnet:"https://api.devnet.solana.com",testnet:"https://api.testnet.solana.com","mainnet-beta":"https://api.mainnet-beta.solana.com/"}};function xh(){return(xh=_(O().mark((function e(t,n,r,i){var o,a,s,u,c,l,h;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r&&Object.prototype.hasOwnProperty.call(r,"lastValidBlockHeight")||r&&Object.prototype.hasOwnProperty.call(r,"nonceValue")?(o=r,a=i):a=r,s=a&&{skipPreflight:a.skipPreflight,preflightCommitment:a.preflightCommitment||a.commitment,minContextSlot:a.minContextSlot},e.next=4,t.sendRawTransaction(n,s);case 4:return u=e.sent,c=a&&a.commitment,l=o?t.confirmTransaction(o,c):t.confirmTransaction(u,c),e.next=9,l;case 9:if(!(h=e.sent.value).err){e.next=12;break}throw new Error("Raw transaction ".concat(u," failed (").concat(JSON.stringify(h),")"));case 12:return e.abrupt("return",u);case 13:case"end":return e.stop()}}),e)})))).apply(this,arguments)}var kh=j(Object.freeze({__proto__:null,Account:Zs,AddressLookupTableAccount:tc,AddressLookupTableInstruction:ql,AddressLookupTableProgram:Zl,Authorized:ah,BLOCKHASH_CACHE_TIMEOUT_MS:3e4,BPF_LOADER_DEPRECATED_PROGRAM_ID:Js,BPF_LOADER_PROGRAM_ID:Wu,BpfLoader:Yu,COMPUTE_BUDGET_INSTRUCTION_LAYOUTS:Xl,ComputeBudgetInstruction:Jl,ComputeBudgetProgram:Kl,Connection:Vl,Ed25519Program:eh,Enum:Vs,EpochSchedule:Ju,FeeCalculatorLayout:Cu,Keypair:Hl,LAMPORTS_PER_SOL:1e9,LOOKUP_TABLE_INSTRUCTION_LAYOUTS:Gl,Loader:Qu,Lockup:sh,MAX_SEED_LENGTH:32,Message:cu,MessageAccountKeys:eu,MessageV0:lu,NONCE_ACCOUNT_LENGTH:zu,NonceAccount:Pu,PACKET_DATA_SIZE:1232,PUBLIC_KEY_LENGTH:32,PublicKey:qs,SIGNATURE_LENGTH_IN_BYTES:64,SOLANA_SCHEMA:Hs,STAKE_CONFIG_ID:oh,STAKE_INSTRUCTION_LAYOUTS:ch,SYSTEM_INSTRUCTION_LAYOUTS:Ru,SYSVAR_CLOCK_PUBKEY:vu,SYSVAR_EPOCH_SCHEDULE_PUBKEY:wu,SYSVAR_INSTRUCTIONS_PUBKEY:bu,SYSVAR_RECENT_BLOCKHASHES_PUBKEY:Mu,SYSVAR_RENT_PUBKEY:Au,SYSVAR_REWARDS_PUBKEY:Iu,SYSVAR_SLOT_HASHES_PUBKEY:Nu,SYSVAR_SLOT_HISTORY_PUBKEY:Tu,SYSVAR_STAKE_HISTORY_PUBKEY:Eu,Secp256k1Program:ih,SendTransactionError:Xu,SolanaJSONRPCError:Ku,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:lh,StakeInstruction:uh,StakeProgram:hh,Struct:Fs,SystemInstruction:Bu,SystemProgram:Uu,Transaction:yu,TransactionExpiredBlockheightExceededError:Xs,TransactionExpiredNonceInvalidError:$s,TransactionExpiredTimeoutError:Ks,TransactionInstruction:pu,TransactionMessage:mu,TransactionStatus:du,VALIDATOR_INFO_KEY:gh,VERSION_PREFIX_MASK:127,VOTE_PROGRAM_ID:bh,ValidatorInfo:wh,VersionedMessage:hu,VersionedTransaction:gu,VoteAccount:Ah,VoteAuthorizationLayout:yh,VoteInit:dh,VoteInstruction:fh,VoteProgram:mh,clusterApiUrl:function(e,t){var n=!1===t?"http":"https";if(!e)return Eh[n].devnet;var r=Eh[n][e];if(!r)throw new Error("Unknown ".concat(n," cluster: ").concat(e));return r},sendAndConfirmRawTransaction:function(e,t,n,r){return xh.apply(this,arguments)},sendAndConfirmTransaction:xu})),Lh={};Object.defineProperty(Lh,"__esModule",{value:!0});var Sh={ERROR_ASSOCIATION_PORT_OUT_OF_RANGE:"ERROR_ASSOCIATION_PORT_OUT_OF_RANGE",ERROR_FORBIDDEN_WALLET_BASE_URL:"ERROR_FORBIDDEN_WALLET_BASE_URL",ERROR_SECURE_CONTEXT_REQUIRED:"ERROR_SECURE_CONTEXT_REQUIRED",ERROR_SESSION_CLOSED:"ERROR_SESSION_CLOSED",ERROR_SESSION_TIMEOUT:"ERROR_SESSION_TIMEOUT",ERROR_WALLET_NOT_FOUND:"ERROR_WALLET_NOT_FOUND"},jh=function(e){W(n,G(Error));var t=X(n);function n(){var e;B(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var a=i[0],s=i[1],u=i[2];return(e=t.call(this,s)).code=a,e.data=u,e.name="SolanaMobileWalletAdapterError",e}return U(n)}(),Dh=function(e){W(n,G(Error));var t=X(n);function n(){var e;B(this,n);for(var r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];var a=i[0],s=i[1],u=i[2],c=i[3];return(e=t.call(this,u)).code=s,e.data=c,e.jsonRpcMessageId=a,e.name="SolanaMobileWalletAdapterProtocolError",e}return U(n)}();function Ch(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function Oh(e,t){return Ch(this,void 0,void 0,O().mark((function n(){var r,i,o;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,crypto.subtle.exportKey("raw",e);case 2:return r=n.sent,n.next=5,crypto.subtle.sign({hash:"SHA-256",name:"ECDSA"},t,r);case 5:return i=n.sent,(o=new Uint8Array(r.byteLength+i.byteLength)).set(new Uint8Array(r),0),o.set(new Uint8Array(i),r.byteLength),n.abrupt("return",o);case 10:case"end":return n.stop()}}),n)})))}function zh(e){if(e>=4294967296)throw new Error("Outbound sequence number overflow. The maximum sequence number is 32-bytes.");var t=new ArrayBuffer(4);return new DataView(t).setUint32(0,e,!1),new Uint8Array(t)}function Ph(){return Ch(this,void 0,void 0,O().mark((function e(){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,crypto.subtle.generateKey({name:"ECDSA",namedCurve:"P-256"},!1,["sign"]);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))}function _h(){return Ch(this,void 0,void 0,O().mark((function e(){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!1,["deriveKey","deriveBits"]);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)})))}var Bh;function Rh(e,t){return Ch(this,void 0,void 0,O().mark((function n(){var r,i,o,a,s;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=JSON.stringify(e),i=zh(e.id),o=new Uint8Array(12),crypto.getRandomValues(o),n.next=6,crypto.subtle.encrypt(Qh(i,o),t,(new TextEncoder).encode(r));case 6:return a=n.sent,(s=new Uint8Array(i.byteLength+o.byteLength+a.byteLength)).set(new Uint8Array(i),0),s.set(new Uint8Array(o),i.byteLength),s.set(new Uint8Array(a),i.byteLength+o.byteLength),n.abrupt("return",s);case 12:case"end":return n.stop()}}),n)})))}function Uh(e,t){return Ch(this,void 0,void 0,O().mark((function n(){var r,i,o,a,s,u;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=e.slice(0,4),i=e.slice(4,16),o=e.slice(16),n.next=5,crypto.subtle.decrypt(Qh(r,i),t,o);case 5:if(a=n.sent,s=Wh().decode(a),u=JSON.parse(s),!Object.hasOwnProperty.call(u,"error")){n.next=10;break}throw new Dh(u.id,u.error.code,u.error.message);case 10:return n.abrupt("return",u);case 11:case"end":return n.stop()}}),n)})))}function Qh(e,t){return{additionalData:e,iv:t,name:"AES-GCM",tagLength:128}}function Wh(){return void 0===Bh&&(Bh=new TextDecoder("utf-8")),Bh}function Yh(e,t,n){return Ch(this,void 0,void 0,O().mark((function r(){var i,o,a,s,u,c,l;return O().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,Promise.all([crypto.subtle.exportKey("raw",t),crypto.subtle.importKey("raw",e,{name:"ECDH",namedCurve:"P-256"},!1,[])]);case 2:return i=r.sent,o=ee(i,2),a=o[0],s=o[1],r.next=8,crypto.subtle.deriveBits({name:"ECDH",public:s},n,256);case 8:return u=r.sent,r.next=11,crypto.subtle.importKey("raw",u,"HKDF",!1,["deriveKey"]);case 11:return c=r.sent,r.next=14,crypto.subtle.deriveKey({name:"HKDF",hash:"SHA-256",salt:new Uint8Array(a),info:new Uint8Array},c,{name:"AES-GCM",length:128},!1,["encrypt","decrypt"]);case 14:return l=r.sent,r.abrupt("return",l);case 16:case"end":return r.stop()}}),r)})))}function Fh(e){if(e<49152||e>65535)throw new jh(Sh.ERROR_ASSOCIATION_PORT_OUT_OF_RANGE,"Association port number must be between 49152 and 65535. ".concat(e," given."),{port:e});return e}function Vh(e){for(var t="",n=new Uint8Array(e),r=n.byteLength,i=0;i<r;i++)t+=String.fromCharCode(n[i]);return window.btoa(t)}function Hh(e){return e.replace(/(^\/+|\/+$)/g,"").split("/")}function Gh(e,t){var n=null;if(t){try{n=new URL(t)}catch(e){}if("https:"!==(null==n?void 0:n.protocol))throw new jh(Sh.ERROR_FORBIDDEN_WALLET_BASE_URL,"Base URLs supplied by wallets must be valid `https` URLs")}n||(n=new URL("".concat("solana-wallet",":/")));var r=e.startsWith("/")?e:[].concat(te(Hh(n.pathname)),te(Hh(e))).join("/");return new URL(r,n)}function qh(e,t,n){return Ch(this,void 0,void 0,O().mark((function r(){var i,o,a,s;return O().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=Fh(t),r.next=3,crypto.subtle.exportKey("raw",e);case 3:return o=r.sent,a=Vh(o),(s=Gh("v1/associate/local",n)).searchParams.set("association",a.replace(/[/+=]/g,(function(e){return{"/":"_","+":"-","=":"."}[e]}))),s.searchParams.set("port","".concat(i)),r.abrupt("return",s);case 9:case"end":return r.stop()}}),r)})))}var Zh=0,Jh=1;var Xh=null;function Kh(e,t){return Ch(this,void 0,void 0,O().mark((function n(){var r,i,o,a;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=Fh(49152+Math.floor(16384*Math.random())),n.next=3,qh(e,r,t);case 3:if("https:"!==(i=n.sent).protocol){n.next=8;break}window.location.assign(i),n.next=26;break;case 8:n.prev=8,o=-1!==navigator.userAgent.indexOf("Firefox/")?Zh:Jh,n.t0=o,n.next=n.t0===Zh?13:n.t0===Jh?15:20;break;case 13:return s=i,null==Xh&&((Xh=document.createElement("iframe")).style.display="none",document.body.appendChild(Xh)),Xh.contentWindow.location.href=s.toString(),n.abrupt("break",21);case 15:return a=new Promise((function(e,t){function n(){clearTimeout(i),window.removeEventListener("blur",r)}function r(){n(),e()}window.addEventListener("blur",r);var i=setTimeout((function(){n(),t()}),2e3)})),window.location.assign(i),n.next=19,a;case 19:return n.abrupt("break",21);case 20:case 21:n.next=26;break;case 23:throw n.prev=23,n.t1=n.catch(8),new jh(Sh.ERROR_WALLET_NOT_FOUND,"Found no installed wallet that supports the mobile wallet protocol.");case 26:return n.abrupt("return",r);case 27:case"end":return n.stop()}var s}),n,null,[[8,23]])})))}var $h=[150,150,200,500,500,750,750,1e3],ed=3e4;function td(){if("undefined"==typeof window||!0!==window.isSecureContext)throw new jh(Sh.ERROR_SECURE_CONTEXT_REQUIRED,"The mobile wallet adapter protocol must be used in a secure context (`https`).")}function nd(e){var t;try{t=new URL(e)}catch(e){throw new jh(Sh.ERROR_FORBIDDEN_WALLET_BASE_URL,"Invalid base URL supplied by wallet")}if("https:"!==t.protocol)throw new jh(Sh.ERROR_FORBIDDEN_WALLET_BASE_URL,"Base URLs supplied by wallets must be valid `https` URLs")}Lh.SolanaMobileWalletAdapterError=jh,Lh.SolanaMobileWalletAdapterErrorCode=Sh,Lh.SolanaMobileWalletAdapterProtocolError=Dh,Lh.SolanaMobileWalletAdapterProtocolErrorCode={ERROR_AUTHORIZATION_FAILED:-1,ERROR_INVALID_PAYLOADS:-2,ERROR_NOT_SIGNED:-3,ERROR_NOT_SUBMITTED:-4,ERROR_TOO_MANY_PAYLOADS:-5,ERROR_ATTEST_ORIGIN_ANDROID:-100},Lh.transact=function(e,t){return Ch(this,void 0,void 0,O().mark((function n(){var r,i,o,a,s,u,c,l,h=this;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return td(),n.next=3,Ph();case 3:return r=n.sent,n.next=6,Kh(r.publicKey,null==t?void 0:t.baseUri);case 6:return i=n.sent,o="ws://localhost:".concat(i,"/solana-wallet"),s=function(){var e=te($h);return function(){return e.length>1?e.shift():e[0]}}(),u=1,c=0,l={__type:"disconnected"},n.abrupt("return",new Promise((function(t,n){var d,f,p,y={},m=function e(){return Ch(h,void 0,void 0,O().mark((function t(){var n,r;return O().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("connecting"===l.__type){t.next=3;break}return console.warn("Expected adapter state to be `connecting` at the moment the websocket opens. "+"Got `".concat(l.__type,"`.")),t.abrupt("return");case 3:return n=l.associationKeypair,d.removeEventListener("open",e),t.next=7,_h();case 7:return r=t.sent,t.t0=d,t.next=11,Oh(r.publicKey,n.privateKey);case 11:t.t1=t.sent,t.t0.send.call(t.t0,t.t1),l={__type:"hello_req_sent",associationPublicKey:n.publicKey,ecdhPrivateKey:r.privateKey};case 14:case"end":return t.stop()}}),t)})))},g=function(e){e.wasClean?l={__type:"disconnected"}:n(new jh(Sh.ERROR_SESSION_CLOSED,"The wallet session dropped unexpectedly (".concat(e.code,": ").concat(e.reason,")."),{closeEvent:e})),f()},v=function(e){return Ch(h,void 0,void 0,O().mark((function e(){return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(f(),!(Date.now()-a>=ed)){e.next=5;break}n(new jh(Sh.ERROR_SESSION_TIMEOUT,"Failed to connect to the wallet websocket on port ".concat(i,"."))),e.next=8;break;case 5:return e.next=7,new Promise((function(e){var t=s();p=window.setTimeout(e,t)}));case 7:b();case 8:case"end":return e.stop()}}),e)})))},w=function(r){return Ch(h,void 0,void 0,O().mark((function i(){var o,a,s,h,p,m,g,v;return O().wrap((function(i){for(;;)switch(i.prev=i.next){case 0:return i.next=2,r.data.arrayBuffer();case 2:o=i.sent,i.t0=l.__type,i.next="connected"===i.t0?6:"hello_req_sent"===i.t0?30:51;break;case 6:if(i.prev=6,a=o.slice(0,4),(s=new DataView(a).getUint32(0,!1))===c+1){i.next=11;break}throw new Error("Encrypted message has invalid sequence number");case 11:return c=s,i.next=14,Uh(o,l.sharedSecret);case 14:h=i.sent,p=y[h.id],delete y[h.id],p.resolve(h.result),i.next=29;break;case 20:if(i.prev=20,i.t1=i.catch(6),!(i.t1 instanceof Dh)){i.next=28;break}m=y[i.t1.jsonRpcMessageId],delete y[i.t1.jsonRpcMessageId],m.reject(i.t1),i.next=29;break;case 28:throw i.t1;case 29:return i.abrupt("break",51);case 30:return i.next=32,Yh(o,l.associationPublicKey,l.ecdhPrivateKey);case 32:return g=i.sent,l={__type:"connected",sharedSecret:g},v=new Proxy({},{get:function(e,t){if(null==e[t]){var n=t.toString().replace(/[A-Z]/g,(function(e){return"_".concat(e.toLowerCase())})).toLowerCase();e[t]=function(e){return Ch(this,void 0,void 0,O().mark((function r(){var i;return O().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=u++,r.t0=d,r.next=4,Rh({id:i,jsonrpc:"2.0",method:n,params:null!=e?e:{}},g);case 4:return r.t1=r.sent,r.t0.send.call(r.t0,r.t1),r.abrupt("return",new Promise((function(e,n){y[i]={resolve:function(r){switch(t){case"authorize":case"reauthorize":var i=r.wallet_uri_base;if(null!=i)try{nd(i)}catch(e){return void n(e)}}e(r)},reject:n}})));case 7:case"end":return r.stop()}}),r)})))}}return e[t]},defineProperty:function(){return!1},deleteProperty:function(){return!1}}),i.prev=35,i.t2=t,i.next=39,e(v);case 39:i.t3=i.sent,(0,i.t2)(i.t3),i.next=46;break;case 43:i.prev=43,i.t4=i.catch(35),n(i.t4);case 46:return i.prev=46,f(),d.close(),i.finish(46);case 50:return i.abrupt("break",51);case 51:case"end":return i.stop()}}),i,null,[[6,20],[35,43,46,50]])})))},b=function(){f&&f(),l={__type:"connecting",associationKeypair:r},void 0===a&&(a=Date.now()),(d=new WebSocket(o,["com.solana.mobilewalletadapter.v1"])).addEventListener("open",m),d.addEventListener("close",g),d.addEventListener("error",v),d.addEventListener("message",w),f=function(){window.clearTimeout(p),d.removeEventListener("open",m),d.removeEventListener("close",g),d.removeEventListener("error",v),d.removeEventListener("message",w)}};b()})));case 13:case"end":return n.stop()}}),n)})))};var rd=function(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),n=0;n<t.length;n++)t[n]=255;for(var r=0;r<e.length;r++){var i=e.charAt(r),o=i.charCodeAt(0);if(255!==t[o])throw new TypeError(i+" is ambiguous");t[o]=r}var a=e.length,s=e.charAt(0),u=Math.log(a)/Math.log(256),c=Math.log(256)/Math.log(a);function l(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;for(var n=0,r=0,i=0;e[n]===s;)r++,n++;for(var o=(e.length-n)*u+1>>>0,c=new Uint8Array(o);e[n];){var l=t[e.charCodeAt(n)];if(255===l)return;for(var h=0,d=o-1;(0!==l||h<i)&&-1!==d;d--,h++)l+=a*c[d]>>>0,c[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=h,n++}for(var f=o-i;f!==o&&0===c[f];)f++;for(var p=new Uint8Array(r+(o-f)),y=r;f!==o;)p[y++]=c[f++];return p}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var u=(o-i)*c+1>>>0,l=new Uint8Array(u);i!==o;){for(var h=t[i],d=0,f=u-1;(0!==h||d<r)&&-1!==f;f--,d++)h+=256*l[f]>>>0,l[f]=h%a>>>0,h=h/a>>>0;if(0!==h)throw new Error("Non-zero carry");r=d,i++}for(var p=u-r;p!==u&&0===l[p];)p++;for(var y=s.repeat(n);p<u;++p)y+=e.charAt(l[p]);return y},decodeUnsafe:l,decode:function(e){var t=l(e);if(t)return t;throw new Error("Non-base"+a+" character")}}}("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");Object.defineProperty(ue,"__esModule",{value:!0});var id=kh,od=Lh;function ad(e){return e&&"object"===z(e)&&"default"in e?e:{default:e}}var sd=ad(rd);function ud(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function cd(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))}function ld(e){var t;return window.btoa((t=String.fromCharCode).call.apply(t,[null].concat(te(e))))}function hd(e){return new Uint8Array(window.atob(e).split("").map((function(e){return e.charCodeAt(0)})))}function dd(e){return ld("version"in e?e.serialize():e.serialize({requireAllSignatures:!1,verifySignatures:!1}))}function fd(e){var t=e[0]*id.SIGNATURE_LENGTH_IN_BYTES+1;return"legacy"===id.VersionedMessage.deserializeMessageVersion(e.slice(t,e.length))?id.Transaction.from(e):id.VersionedTransaction.deserialize(e)}ue.transact=function(e,t){return cd(this,void 0,void 0,O().mark((function n(){var r;return O().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=function(t){var n=new Proxy({},{get:function(e,n){if(null==e[n])switch(n){case"signAndSendTransactions":e[n]=function(e){var n=e.minContextSlot,r=e.transactions,i=ud(e,["minContextSlot","transactions"]);return cd(this,void 0,void 0,O().mark((function e(){var o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=r.map(dd),e.next=3,t.signAndSendTransactions(Object.assign(Object.assign(Object.assign({},i),null!=n?{options:{min_context_slot:n}}:null),{payloads:o}));case 3:return a=e.sent,s=a.signatures,u=s.map(hd).map(sd.default.encode),e.abrupt("return",u);case 7:case"end":return e.stop()}}),e)})))};break;case"signMessages":e[n]=function(e){var n=e.payloads,r=ud(e,["payloads"]);return cd(this,void 0,void 0,O().mark((function e(){var i,o,a,s;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.map(ld),e.next=3,t.signMessages(Object.assign(Object.assign({},r),{payloads:i}));case 3:return o=e.sent,a=o.signed_payloads,s=a.map(hd),e.abrupt("return",s);case 7:case"end":return e.stop()}}),e)})))};break;case"signTransactions":e[n]=function(e){var n=e.transactions,r=ud(e,["transactions"]);return cd(this,void 0,void 0,O().mark((function e(){var i,o,a,s,u;return O().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return i=n.map(dd),e.next=3,t.signTransactions(Object.assign(Object.assign({},r),{payloads:i}));case 3:return o=e.sent,a=o.signed_payloads,s=a.map(hd),u=s.map(fd),e.abrupt("return",u);case 8:case"end":return e.stop()}}),e)})))};break;default:e[n]=t[n]}return e[n]},defineProperty:function(){return!1},deleteProperty:function(){return!1}});return e(n)},n.next=3,od.transact(r,t);case 3:return n.abrupt("return",n.sent);case 4:case"end":return n.stop()}}),n)})))};var pd={},yd=function(){function e(t,n){if(B(this,e),!Number.isInteger(t))throw new TypeError("span must be an integer");this.span=t,this.property=n}return U(e,[{key:"makeDestinationObject",value:function(){return{}}},{key:"decode",value:function(e,t){throw new Error("Layout is abstract")}},{key:"encode",value:function(e,t,n){throw new Error("Layout is abstract")}},{key:"getSpan",value:function(e,t){if(0>this.span)throw new RangeError("indeterminate span");return this.span}},{key:"replicate",value:function(e){var t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}},{key:"fromArray",value:function(e){}}]),e}();function md(e,t){return t.property?e+"["+t.property+"]":e}pd.Layout=yd,pd.nameWithProperty=md,pd.bindConstructorLayout=function(e,t){if("function"!=typeof e)throw new TypeError("Class must be constructor");if(e.hasOwnProperty("layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof yd))throw new TypeError("layout must be a Layout");if(t.hasOwnProperty("boundConstructor_"))throw new Error("layout is already bound to a constructor");e.layout_=t,t.boundConstructor_=e,t.makeDestinationObject=function(){return new e},Object.defineProperty(e.prototype,"encode",{value:function(e,n){return t.encode(this,e,n)},writable:!0}),Object.defineProperty(e,"decode",{value:function(e,n){return t.decode(e,n)},writable:!0})};var gd=function(e){W(n,yd);var t=X(n);function n(){return B(this,n),t.apply(this,arguments)}return U(n,[{key:"isCount",value:function(){throw new Error("ExternalLayout is abstract")}}]),n}(),vd=function(e){W(n,gd);var t=X(n);function n(e,r){var i;if(B(this,n),void 0===e&&(e=1),!Number.isInteger(e)||0>=e)throw new TypeError("elementSpan must be a (positive) integer");return(i=t.call(this,-1,r)).elementSpan=e,i}return U(n,[{key:"isCount",value:function(){return!0}},{key:"decode",value:function(e,t){void 0===t&&(t=0);var n=e.length-t;return Math.floor(n/this.elementSpan)}},{key:"encode",value:function(e,t,n){return 0}}]),n}(),wd=function(e){W(n,gd);var t=X(n);function n(e,r,i){var o;if(B(this,n),!(e instanceof yd))throw new TypeError("layout must be a Layout");if(void 0===r)r=0;else if(!Number.isInteger(r))throw new TypeError("offset must be integer or undefined");return(o=t.call(this,e.span,i||e.property)).layout=e,o.offset=r,o}return U(n,[{key:"isCount",value:function(){return this.layout instanceof bd||this.layout instanceof Md}},{key:"decode",value:function(e,t){return void 0===t&&(t=0),this.layout.decode(e,t+this.offset)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),this.layout.encode(e,t,n+this.offset)}}]),n}(),bd=function(e){W(n,yd);var t=X(n);function n(e,r){var i;if(B(this,n),6<(i=t.call(this,e,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readUIntLE(t,this.span)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeUIntLE(e,n,this.span),this.span}}]),n}(),Md=function(e){W(n,yd);var t=X(n);function n(e,r){var i;if(B(this,n),6<(i=t.call(this,e,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readUIntBE(t,this.span)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeUIntBE(e,n,this.span),this.span}}]),n}(),Ad=function(e){W(n,yd);var t=X(n);function n(e,r){var i;if(B(this,n),6<(i=t.call(this,e,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readIntLE(t,this.span)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeIntLE(e,n,this.span),this.span}}]),n}(),Id=function(e){W(n,yd);var t=X(n);function n(e,r){var i;if(B(this,n),6<(i=t.call(this,e,r)).span)throw new RangeError("span must not exceed 6 bytes");return i}return U(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readIntBE(t,this.span)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeIntBE(e,n,this.span),this.span}}]),n}(),Nd=Math.pow(2,32);function Td(e){var t=Math.floor(e/Nd);return{hi32:t,lo32:e-t*Nd}}function Ed(e,t){return e*Nd+t}var xd=function(e){W(n,yd);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return U(n,[{key:"decode",value:function(e,t){void 0===t&&(t=0);var n=e.readUInt32LE(t);return Ed(e.readUInt32LE(t+4),n)}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=Td(e);return t.writeUInt32LE(r.lo32,n),t.writeUInt32LE(r.hi32,n+4),8}}]),n}(),kd=function(e){W(n,yd);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return U(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),Ed(e.readUInt32BE(t),e.readUInt32BE(t+4))}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=Td(e);return t.writeUInt32BE(r.hi32,n),t.writeUInt32BE(r.lo32,n+4),8}}]),n}(),Ld=function(e){W(n,yd);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return U(n,[{key:"decode",value:function(e,t){void 0===t&&(t=0);var n=e.readUInt32LE(t);return Ed(e.readInt32LE(t+4),n)}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=Td(e);return t.writeUInt32LE(r.lo32,n),t.writeInt32LE(r.hi32,n+4),8}}]),n}(),Sd=function(e){W(n,yd);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return U(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),Ed(e.readInt32BE(t),e.readUInt32BE(t+4))}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=Td(e);return t.writeInt32BE(r.hi32,n),t.writeUInt32BE(r.lo32,n+4),8}}]),n}(),jd=function(e){W(n,yd);var t=X(n);function n(e){return B(this,n),t.call(this,4,e)}return U(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readFloatLE(t)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeFloatLE(e,n),4}}]),n}(),Dd=function(e){W(n,yd);var t=X(n);function n(e){return B(this,n),t.call(this,4,e)}return U(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readFloatBE(t)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeFloatBE(e,n),4}}]),n}(),Cd=function(e){W(n,yd);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return U(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readDoubleLE(t)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeDoubleLE(e,n),8}}]),n}(),Od=function(e){W(n,yd);var t=X(n);function n(e){return B(this,n),t.call(this,8,e)}return U(n,[{key:"decode",value:function(e,t){return void 0===t&&(t=0),e.readDoubleBE(t)}},{key:"encode",value:function(e,t,n){return void 0===n&&(n=0),t.writeDoubleBE(e,n),8}}]),n}(),zd=function(e){W(n,yd);var t=X(n);function n(e,r,i){var o;if(B(this,n),!(e instanceof yd))throw new TypeError("elementLayout must be a Layout");if(!(r instanceof gd&&r.isCount()||Number.isInteger(r)&&0<=r))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");var a=-1;return!(r instanceof gd)&&0<e.span&&(a=r*e.span),(o=t.call(this,a,i)).elementLayout=e,o.count=r,o}return U(n,[{key:"getSpan",value:function(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);var n=0,r=this.count;if(r instanceof gd&&(r=r.decode(e,t)),0<this.elementLayout.span)n=r*this.elementLayout.span;else for(var i=0;i<r;)n+=this.elementLayout.getSpan(e,t+n),++i;return n}},{key:"decode",value:function(e,t){void 0===t&&(t=0);var n=[],r=0,i=this.count;for(i instanceof gd&&(i=i.decode(e,t));r<i;)n.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),r+=1;return n}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=this.elementLayout,i=e.reduce((function(e,i){return e+r.encode(i,t,n+e)}),0);return this.count instanceof gd&&this.count.encode(e.length,t,n),i}}]),n}(),Pd=function(e){W(n,yd);var t=X(n);function n(e,r,i){var o;if(B(this,n),!Array.isArray(e)||!e.reduce((function(e,t){return e&&t instanceof yd}),!0))throw new TypeError("fields must be array of Layout instances");"boolean"==typeof r&&void 0===i&&(i=r,r=void 0);var a,s=se(e);try{for(s.s();!(a=s.n()).done;){var u=a.value;if(0>u.span&&void 0===u.property)throw new Error("fields cannot contain unnamed variable-length layout")}}catch(e){s.e(e)}finally{s.f()}var c=-1;try{c=e.reduce((function(e,t){return e+t.getSpan()}),0)}catch(e){}return(o=t.call(this,c,r)).fields=e,o.decodePrefixes=!!i,o}return U(n,[{key:"getSpan",value:function(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);var n=0;try{n=this.fields.reduce((function(n,r){var i=r.getSpan(e,t);return t+=i,n+i}),0)}catch(e){throw new RangeError("indeterminate span")}return n}},{key:"decode",value:function(e,t){void 0===t&&(t=0);var n,r=this.makeDestinationObject(),i=se(this.fields);try{for(i.s();!(n=i.n()).done;){var o=n.value;if(void 0!==o.property&&(r[o.property]=o.decode(e,t)),t+=o.getSpan(e,t),this.decodePrefixes&&e.length===t)break}}catch(e){i.e(e)}finally{i.f()}return r}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r,i=n,o=0,a=0,s=se(this.fields);try{for(s.s();!(r=s.n()).done;){var u=r.value,c=u.span;if(a=0<c?c:0,void 0!==u.property){var l=e[u.property];void 0!==l&&(a=u.encode(l,t,n),0>c&&(c=u.getSpan(t,n)))}o=n,n+=c}}catch(e){s.e(e)}finally{s.f()}return o+a-i}},{key:"fromArray",value:function(e){var t,n=this.makeDestinationObject(),r=se(this.fields);try{for(r.s();!(t=r.n()).done;){var i=t.value;void 0!==i.property&&0<e.length&&(n[i.property]=e.shift())}}catch(e){r.e(e)}finally{r.f()}return n}},{key:"layoutFor",value:function(e){if("string"!=typeof e)throw new TypeError("property must be string");var t,n=se(this.fields);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.property===e)return r}}catch(e){n.e(e)}finally{n.f()}}},{key:"offsetOf",value:function(e){if("string"!=typeof e)throw new TypeError("property must be string");var t,n=0,r=se(this.fields);try{for(r.s();!(t=r.n()).done;){var i=t.value;if(i.property===e)return n;0>i.span?n=-1:0<=n&&(n+=i.span)}}catch(e){r.e(e)}finally{r.f()}}}]),n}(),_d=function(){function e(t){B(this,e),this.property=t}return U(e,[{key:"decode",value:function(){throw new Error("UnionDiscriminator is abstract")}},{key:"encode",value:function(){throw new Error("UnionDiscriminator is abstract")}}]),e}(),Bd=function(e){W(n,_d);var t=X(n);function n(e,r){var i;if(B(this,n),!(e instanceof gd&&e.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");return(i=t.call(this,r||e.property||"variant")).layout=e,i}return U(n,[{key:"decode",value:function(e,t){return this.layout.decode(e,t)}},{key:"encode",value:function(e,t,n){return this.layout.encode(e,t,n)}}]),n}(),Rd=function(e){W(n,yd);var t=X(n);function n(e,r,i){var o;B(this,n);var a=e instanceof bd||e instanceof Md;if(a)e=new Bd(new wd(e));else if(e instanceof gd&&e.isCount())e=new Bd(e);else if(!(e instanceof _d))throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===r&&(r=null),!(null===r||r instanceof yd))throw new TypeError("defaultLayout must be null or a Layout");if(null!==r){if(0>r.span)throw new Error("defaultLayout must have constant span");void 0===r.property&&(r=r.replicate("content"))}var s=-1;r&&0<=(s=r.span)&&a&&(s+=e.layout.span),(o=t.call(this,s,i)).discriminator=e,o.usesPrefixDiscriminator=a,o.defaultLayout=r,o.registry={};var u=o.defaultGetSourceVariant.bind(Z(o));return o.getSourceVariant=function(e){return u(e)},o.configGetSourceVariant=function(e){u=e.bind(this)},o}return U(n,[{key:"getSpan",value:function(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);var n=this.getVariant(e,t);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(e,t)}},{key:"defaultGetSourceVariant",value:function(e){if(e.hasOwnProperty(this.discriminator.property)){if(this.defaultLayout&&e.hasOwnProperty(this.defaultLayout.property))return;var t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||e.hasOwnProperty(t.property)))return t}else for(var n in this.registry){var r=this.registry[n];if(e.hasOwnProperty(r.property))return r}throw new Error("unable to infer src variant")}},{key:"decode",value:function(e,t){var n;void 0===t&&(t=0);var r=this.discriminator,i=r.decode(e,t),o=this.registry[i];if(void 0===o){var a=0;o=this.defaultLayout,this.usesPrefixDiscriminator&&(a=r.layout.span),(n=this.makeDestinationObject())[r.property]=i,n[o.property]=this.defaultLayout.decode(e,t+a)}else n=o.decode(e,t);return n}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=this.getSourceVariant(e);if(void 0===r){var i=this.discriminator,o=this.defaultLayout,a=0;return this.usesPrefixDiscriminator&&(a=i.layout.span),i.encode(e[i.property],t,n),a+o.encode(e[o.property],t,n+a)}return r.encode(e,t,n)}},{key:"addVariant",value:function(e,t,n){var r=new Ud(this,e,t,n);return this.registry[e]=r,r}},{key:"getVariant",value:function(e,t){var n=e;return Ne.isBuffer(e)&&(void 0===t&&(t=0),n=this.discriminator.decode(e,t)),this.registry[n]}}]),n}(),Ud=function(e){W(n,yd);var t=X(n);function n(e,r,i,o){var a;if(B(this,n),!(e instanceof Rd))throw new TypeError("union must be a Union");if(!Number.isInteger(r)||0>r)throw new TypeError("variant must be a (non-negative) integer");if("string"==typeof i&&void 0===o&&(o=i,i=null),i){if(!(i instanceof yd))throw new TypeError("layout must be a Layout");if(null!==e.defaultLayout&&0<=i.span&&i.span>e.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if("string"!=typeof o)throw new TypeError("variant must have a String property")}var s=e.span;return 0>e.span&&0<=(s=i?i.span:0)&&e.usesPrefixDiscriminator&&(s+=e.discriminator.layout.span),(a=t.call(this,s,o)).union=e,a.variant=r,a.layout=i||null,a}return U(n,[{key:"getSpan",value:function(e,t){if(0<=this.span)return this.span;void 0===t&&(t=0);var n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),n+this.layout.getSpan(e,t+n)}},{key:"decode",value:function(e,t){var n=this.makeDestinationObject();if(void 0===t&&(t=0),this!==this.union.getVariant(e,t))throw new Error("variant mismatch");var r=0;return this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(e,t+r):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=0;if(this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span),this.layout&&!e.hasOwnProperty(this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,n);var i=r;if(this.layout&&(this.layout.encode(e[this.property],t,n+r),i+=this.layout.getSpan(t,n+r),0<=this.union.span&&i>this.union.span))throw new Error("encoded variant overruns containing union");return i}},{key:"fromArray",value:function(e){if(this.layout)return this.layout.fromArray(e)}}]),n}();function Qd(e){return 0>e&&(e+=4294967296),e}var Wd=function(e){W(n,yd);var t=X(n);function n(e,r,i){var o;if(B(this,n),!(e instanceof bd||e instanceof Md))throw new TypeError("word must be a UInt or UIntBE layout");if("string"==typeof r&&void 0===i&&(i=r,r=void 0),4<e.span)throw new RangeError("word cannot exceed 32 bits");(o=t.call(this,e.span,i)).word=e,o.msb=!!r,o.fields=[];var a=0;return o._packedSetValue=function(e){return a=Qd(e),this},o._packedGetValue=function(){return a},o}return U(n,[{key:"decode",value:function(e,t){var n=this.makeDestinationObject();void 0===t&&(t=0);var r=this.word.decode(e,t);this._packedSetValue(r);var i,o=se(this.fields);try{for(o.s();!(i=o.n()).done;){var a=i.value;void 0!==a.property&&(n[a.property]=a.decode(r))}}catch(e){o.e(e)}finally{o.f()}return n}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0);var r=this.word.decode(t,n);this._packedSetValue(r);var i,o=se(this.fields);try{for(o.s();!(i=o.n()).done;){var a=i.value;if(void 0!==a.property){var s=e[a.property];void 0!==s&&a.encode(s)}}}catch(e){o.e(e)}finally{o.f()}return this.word.encode(this._packedGetValue(),t,n)}},{key:"addField",value:function(e,t){var n=new Yd(this,e,t);return this.fields.push(n),n}},{key:"addBoolean",value:function(e){var t=new Fd(this,e);return this.fields.push(t),t}},{key:"fieldFor",value:function(e){if("string"!=typeof e)throw new TypeError("property must be string");var t,n=se(this.fields);try{for(n.s();!(t=n.n()).done;){var r=t.value;if(r.property===e)return r}}catch(e){n.e(e)}finally{n.f()}}}]),n}(),Yd=function(){function e(t,n,r){if(B(this,e),!(t instanceof Wd))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(n)||0>=n)throw new TypeError("bits must be positive integer");var i=8*t.span,o=t.fields.reduce((function(e,t){return e+t.bits}),0);if(n+o>i)throw new Error("bits too long for span remainder ("+(i-o)+" of "+i+" remain)");this.container=t,this.bits=n,this.valueMask=(1<<n)-1,32===n&&(this.valueMask=4294967295),this.start=o,this.container.msb&&(this.start=i-o-n),this.wordMask=Qd(this.valueMask<<this.start),this.property=r}return U(e,[{key:"decode",value:function(){return Qd(this.container._packedGetValue()&this.wordMask)>>>this.start}},{key:"encode",value:function(e){if(!Number.isInteger(e)||e!==Qd(e&this.valueMask))throw new TypeError(md("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);var t=this.container._packedGetValue(),n=Qd(e<<this.start);this.container._packedSetValue(Qd(t&~this.wordMask)|n)}}]),e}(),Fd=function(e){W(n,Yd);var t=X(n);function n(e,r){return B(this,n),t.call(this,e,1,r)}return U(n,[{key:"decode",value:function(e,t){return!!Yd.prototype.decode.call(this,e,t)}},{key:"encode",value:function(e){return"boolean"==typeof e&&(e=+e),Yd.prototype.encode.call(this,e)}}]),n}(),Vd=function(e){W(n,yd);var t=X(n);function n(e,r){var i;if(B(this,n),!(e instanceof gd&&e.isCount()||Number.isInteger(e)&&0<=e))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");var o=-1;return e instanceof gd||(o=e),(i=t.call(this,o,r)).length=e,i}return U(n,[{key:"getSpan",value:function(e,t){var n=this.span;return 0>n&&(n=this.length.decode(e,t)),n}},{key:"decode",value:function(e,t){void 0===t&&(t=0);var n=this.span;return 0>n&&(n=this.length.decode(e,t)),e.slice(t,t+n)}},{key:"encode",value:function(e,t,n){var r=this.length;if(this.length instanceof gd&&(r=e.length),!Ne.isBuffer(e)||r!==e.length)throw new TypeError(md("Blob.encode",this)+" requires (length "+r+") Buffer as src");if(n+r>t.length)throw new RangeError("encoding overruns Buffer");return t.write(e.toString("hex"),n,r,"hex"),this.length instanceof gd&&this.length.encode(r,t,n),r}}]),n}(),Hd=function(e){W(n,yd);var t=X(n);function n(e){return B(this,n),t.call(this,-1,e)}return U(n,[{key:"getSpan",value:function(e,t){if(!Ne.isBuffer(e))throw new TypeError("b must be a Buffer");void 0===t&&(t=0);for(var n=t;n<e.length&&0!==e[n];)n+=1;return 1+n-t}},{key:"decode",value:function(e,t,n){void 0===t&&(t=0);var r=this.getSpan(e,t);return e.slice(t,t+r-1).toString("utf-8")}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0),"string"!=typeof e&&(e=e.toString());var r=new Ne(e,"utf8"),i=r.length;if(n+i>t.length)throw new RangeError("encoding overruns Buffer");return r.copy(t,n),t[n+i]=0,i+1}}]),n}(),Gd=function(e){W(n,yd);var t=X(n);function n(e,r){var i;if(B(this,n),"string"==typeof e&&void 0===r&&(r=e,e=void 0),void 0===e)e=-1;else if(!Number.isInteger(e))throw new TypeError("maxSpan must be an integer");return(i=t.call(this,-1,r)).maxSpan=e,i}return U(n,[{key:"getSpan",value:function(e,t){if(!Ne.isBuffer(e))throw new TypeError("b must be a Buffer");return void 0===t&&(t=0),e.length-t}},{key:"decode",value:function(e,t,n){void 0===t&&(t=0);var r=this.getSpan(e,t);if(0<=this.maxSpan&&this.maxSpan<r)throw new RangeError("text length exceeds maxSpan");return e.slice(t,t+r).toString("utf-8")}},{key:"encode",value:function(e,t,n){void 0===n&&(n=0),"string"!=typeof e&&(e=e.toString());var r=new Ne(e,"utf8"),i=r.length;if(0<=this.maxSpan&&this.maxSpan<i)throw new RangeError("text length exceeds maxSpan");if(n+i>t.length)throw new RangeError("encoding overruns Buffer");return r.copy(t,n),i}}]),n}(),qd=function(e){W(n,yd);var t=X(n);function n(e,r){var i;return B(this,n),(i=t.call(this,0,r)).value=e,i}return U(n,[{key:"decode",value:function(e,t,n){return this.value}},{key:"encode",value:function(e,t,n){return 0}}]),n}();pd.ExternalLayout=gd,pd.GreedyCount=vd,pd.OffsetLayout=wd,pd.UInt=bd,pd.UIntBE=Md,pd.Int=Ad,pd.IntBE=Id,pd.Float=jd,pd.FloatBE=Dd,pd.Double=Cd,pd.DoubleBE=Od,pd.Sequence=zd,pd.Structure=Pd,pd.UnionDiscriminator=_d,pd.UnionLayoutDiscriminator=Bd,pd.Union=Rd,pd.VariantLayout=Ud,pd.BitStructure=Wd,pd.BitField=Yd,pd.Boolean=Fd,pd.Blob=Vd,pd.CString=Hd,pd.UTF8=Gd,pd.Constant=qd,pd.greedy=function(e,t){return new vd(e,t)},pd.offset=function(e,t,n){return new wd(e,t,n)},pd.u8=function(e){return new bd(1,e)},pd.u16=function(e){return new bd(2,e)},pd.u24=function(e){return new bd(3,e)},pd.u32=function(e){return new bd(4,e)},pd.u40=function(e){return new bd(5,e)},pd.u48=function(e){return new bd(6,e)},pd.nu64=function(e){return new xd(e)},pd.u16be=function(e){return new Md(2,e)},pd.u24be=function(e){return new Md(3,e)},pd.u32be=function(e){return new Md(4,e)},pd.u40be=function(e){return new Md(5,e)},pd.u48be=function(e){return new Md(6,e)},pd.nu64be=function(e){return new kd(e)},pd.s8=function(e){return new Ad(1,e)},pd.s16=function(e){return new Ad(2,e)},pd.s24=function(e){return new Ad(3,e)},pd.s32=function(e){return new Ad(4,e)},pd.s40=function(e){return new Ad(5,e)},pd.s48=function(e){return new Ad(6,e)},pd.ns64=function(e){return new Ld(e)},pd.s16be=function(e){return new Id(2,e)},pd.s24be=function(e){return new Id(3,e)},pd.s32be=function(e){return new Id(4,e)},pd.s40be=function(e){return new Id(5,e)},pd.s48be=function(e){return new Id(6,e)},pd.ns64be=function(e){return new Sd(e)},pd.f32=function(e){return new jd(e)},pd.f32be=function(e){return new Dd(e)},pd.f64=function(e){return new Cd(e)},pd.f64be=function(e){return new Od(e)},pd.struct=function(e,t,n){return new Pd(e,t,n)},pd.bits=function(e,t,n){return new Wd(e,t,n)};var Zd=pd.seq=function(e,t,n){return new zd(e,t,n)};pd.union=function(e,t,n){return new Rd(e,t,n)},pd.unionLayoutDiscriminator=function(e,t){return new Bd(e,t)},pd.blob=function(e,t){return new Vd(e,t)},pd.cstr=function(e){return new Hd(e)},pd.utf8=function(e,t){return new Gd(e,t)},pd.const=function(e,t){return new qd(e,t)};var Jd={},Xd={exports:{}};!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var o;"object"===z(e)?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:ur.Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function s(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,r,i){for(var o=0,a=0,s=Math.min(e.length,r),u=t;u<s;u++){var c=e.charCodeAt(u)-48;o*=i,a=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a<i,"Invalid character"),o+=a}return o}function c(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.isBN=function(e){return e instanceof i||null!==e&&"object"===z(e)&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"===z(e))return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<e.length;i+=3)a=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=e.length-1;r>=t;r-=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(e,l,l+r,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(e,l,e.length,t),l=0;l<a;l++)h*=t;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){c(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(e){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","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"],d=[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],f=[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 p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=67108863&u,d=Math.min(c,t.length-1),f=Math.max(0,c-e.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|e.words[p])*(o=0|t.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=d[e],l=f[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(e);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n++]=255&a,n<e.length&&(e[n++]=a>>8&255),n<e.length&&(e[n++]=a>>16&255),6===o?(n<e.length&&(e[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n--]=255&a,n>=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return n(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a<r.length;a++)o=(t=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<n.length;a++)o=(t=(0|n.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var y=function(e,t,n){var r,i,o,a=e.words,s=t.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],I=8191&A,N=A>>>13,T=0|a[5],E=8191&T,x=T>>>13,k=0|a[6],L=8191&k,S=k>>>13,j=0|a[7],D=8191&j,C=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,W=U>>>13,Y=0|s[1],F=8191&Y,V=Y>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,ee=K>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,le=0|s[8],he=8191&le,de=le>>>13,fe=0|s[9],pe=8191&fe,ye=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,W))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,W))+Math.imul(y,Q)|0,o=Math.imul(y,W);var ge=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,W))+Math.imul(v,Q)|0,o=Math.imul(v,W),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var ve=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,W))+Math.imul(M,Q)|0,o=Math.imul(M,W),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var we=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(I,Q),i=(i=Math.imul(I,W))+Math.imul(N,Q)|0,o=Math.imul(N,W),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var be=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,Q),i=(i=Math.imul(E,W))+Math.imul(x,Q)|0,o=Math.imul(x,W),r=r+Math.imul(I,F)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0;var Me=(c+(r=r+Math.imul(h,ne)|0)|0)+((8191&(i=(i=i+Math.imul(h,re)|0)+Math.imul(d,ne)|0))<<13)|0;c=((o=o+Math.imul(d,re)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,W))+Math.imul(S,Q)|0,o=Math.imul(S,W),r=r+Math.imul(E,F)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(x,F)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(I,G)|0,i=(i=i+Math.imul(I,q)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0;var Ae=(c+(r=r+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ae)|0)+Math.imul(d,oe)|0))<<13)|0;c=((o=o+Math.imul(d,ae)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(D,Q),i=(i=Math.imul(D,W))+Math.imul(C,Q)|0,o=Math.imul(C,W),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(E,G)|0,i=(i=i+Math.imul(E,q)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,q)|0,r=r+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(g,ne)|0,i=(i=i+Math.imul(g,re)|0)+Math.imul(v,ne)|0,o=o+Math.imul(v,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0;var Ie=(c+(r=r+Math.imul(h,ue)|0)|0)+((8191&(i=(i=i+Math.imul(h,ce)|0)+Math.imul(d,ue)|0))<<13)|0;c=((o=o+Math.imul(d,ce)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,W))+Math.imul(P,Q)|0,o=Math.imul(P,W),r=r+Math.imul(D,F)|0,i=(i=i+Math.imul(D,V)|0)+Math.imul(C,F)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0,r=r+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,ce)|0;var Ne=(c+(r=r+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;c=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,W))+Math.imul(R,Q)|0,o=Math.imul(R,W),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(D,G)|0,i=(i=i+Math.imul(D,q)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,r=r+Math.imul(g,ue)|0,i=(i=i+Math.imul(g,ce)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,ce)|0,r=r+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(y,he)|0,o=o+Math.imul(y,de)|0;var Te=(c+(r=r+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ye)|0)+Math.imul(d,pe)|0))<<13)|0;c=((o=o+Math.imul(d,ye)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(D,J)|0,i=(i=i+Math.imul(D,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,ee)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,ae)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,ae)|0,r=r+Math.imul(b,ue)|0,i=(i=i+Math.imul(b,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,r=r+Math.imul(g,he)|0,i=(i=i+Math.imul(g,de)|0)+Math.imul(v,he)|0,o=o+Math.imul(v,de)|0;var Ee=(c+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ye)|0)+Math.imul(y,pe)|0))<<13)|0;c=((o=o+Math.imul(y,ye)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(D,$)|0,i=(i=i+Math.imul(D,ee)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(L,ne)|0,i=(i=i+Math.imul(L,re)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,ae)|0,r=r+Math.imul(I,ue)|0,i=(i=i+Math.imul(I,ce)|0)+Math.imul(N,ue)|0,o=o+Math.imul(N,ce)|0,r=r+Math.imul(b,he)|0,i=(i=i+Math.imul(b,de)|0)+Math.imul(M,he)|0,o=o+Math.imul(M,de)|0;var xe=(c+(r=r+Math.imul(g,pe)|0)|0)+((8191&(i=(i=i+Math.imul(g,ye)|0)+Math.imul(v,pe)|0))<<13)|0;c=((o=o+Math.imul(v,ye)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,ee)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,ee)|0,r=r+Math.imul(D,ne)|0,i=(i=i+Math.imul(D,re)|0)+Math.imul(C,ne)|0,o=o+Math.imul(C,re)|0,r=r+Math.imul(L,oe)|0,i=(i=i+Math.imul(L,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,ce)|0)+Math.imul(x,ue)|0,o=o+Math.imul(x,ce)|0,r=r+Math.imul(I,he)|0,i=(i=i+Math.imul(I,de)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,de)|0;var ke=(c+(r=r+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ye)|0)+Math.imul(M,pe)|0))<<13)|0;c=((o=o+Math.imul(M,ye)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,ee))+Math.imul(R,$)|0,o=Math.imul(R,ee),r=r+Math.imul(z,ne)|0,i=(i=i+Math.imul(z,re)|0)+Math.imul(P,ne)|0,o=o+Math.imul(P,re)|0,r=r+Math.imul(D,oe)|0,i=(i=i+Math.imul(D,ae)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,ae)|0,r=r+Math.imul(L,ue)|0,i=(i=i+Math.imul(L,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,r=r+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(x,he)|0,o=o+Math.imul(x,de)|0;var Le=(c+(r=r+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,ye)|0)+Math.imul(N,pe)|0))<<13)|0;c=((o=o+Math.imul(N,ye)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,r=Math.imul(B,ne),i=(i=Math.imul(B,re))+Math.imul(R,ne)|0,o=Math.imul(R,re),r=r+Math.imul(z,oe)|0,i=(i=i+Math.imul(z,ae)|0)+Math.imul(P,oe)|0,o=o+Math.imul(P,ae)|0,r=r+Math.imul(D,ue)|0,i=(i=i+Math.imul(D,ce)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,ce)|0,r=r+Math.imul(L,he)|0,i=(i=i+Math.imul(L,de)|0)+Math.imul(S,he)|0,o=o+Math.imul(S,de)|0;var Se=(c+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,ye)|0)+Math.imul(x,pe)|0))<<13)|0;c=((o=o+Math.imul(x,ye)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(B,oe),i=(i=Math.imul(B,ae))+Math.imul(R,oe)|0,o=Math.imul(R,ae),r=r+Math.imul(z,ue)|0,i=(i=i+Math.imul(z,ce)|0)+Math.imul(P,ue)|0,o=o+Math.imul(P,ce)|0,r=r+Math.imul(D,he)|0,i=(i=i+Math.imul(D,de)|0)+Math.imul(C,he)|0,o=o+Math.imul(C,de)|0;var je=(c+(r=r+Math.imul(L,pe)|0)|0)+((8191&(i=(i=i+Math.imul(L,ye)|0)+Math.imul(S,pe)|0))<<13)|0;c=((o=o+Math.imul(S,ye)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,r=Math.imul(B,ue),i=(i=Math.imul(B,ce))+Math.imul(R,ue)|0,o=Math.imul(R,ce),r=r+Math.imul(z,he)|0,i=(i=i+Math.imul(z,de)|0)+Math.imul(P,he)|0,o=o+Math.imul(P,de)|0;var De=(c+(r=r+Math.imul(D,pe)|0)|0)+((8191&(i=(i=i+Math.imul(D,ye)|0)+Math.imul(C,pe)|0))<<13)|0;c=((o=o+Math.imul(C,ye)|0)+(i>>>13)|0)+(De>>>26)|0,De&=67108863,r=Math.imul(B,he),i=(i=Math.imul(B,de))+Math.imul(R,he)|0,o=Math.imul(R,de);var Ce=(c+(r=r+Math.imul(z,pe)|0)|0)+((8191&(i=(i=i+Math.imul(z,ye)|0)+Math.imul(P,pe)|0))<<13)|0;c=((o=o+Math.imul(P,ye)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863;var Oe=(c+(r=Math.imul(B,pe))|0)+((8191&(i=(i=Math.imul(B,ye))+Math.imul(R,pe)|0))<<13)|0;return c=((o=Math.imul(R,ye))+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,u[0]=me,u[1]=ge,u[2]=ve,u[3]=we,u[4]=be,u[5]=Me,u[6]=Ae,u[7]=Ie,u[8]=Ne,u[9]=Te,u[10]=Ee,u[11]=xe,u[12]=ke,u[13]=Le,u[14]=Se,u[15]=je,u[16]=De,u[17]=Ce,u[18]=Oe,0!==c&&(u[19]=c,n.length++),n};function m(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var l=o-c,h=(0|e.words[l])*(0|t.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(e,t,n){return m(e,t,n)}Math.imul||(y=p),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?y(this,e,t):n<63?p(this,e,t):n<1024?m(this,e,t):g(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*e,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var o=n.sqr();r<t.length;r++,o=o.sqr())0!==t[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r||!(this.words[r]&i))},i.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,r){var i,o,a=e.length+r;this._expand(a);var s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+r])+s;var u=(0|e.words[i])*t;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==t){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(o,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var o,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=t.clone();!t.isZero();){for(var d=0,f=1;0==(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(u)):(r.isub(t),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(t.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new N(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},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(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function I(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function N(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function T(e){N.call(this,e),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)}w.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},r(b,w),b.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(M,w),r(A,w),r(I,w),I.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(v[e])return v[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new M;else if("p192"===e)t=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new I}return v[e]=t,t},N.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},N.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},N.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(c(e,e.umod(this.m)._forceRed(this)),e)},N.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},N.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},N.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},N.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},N.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},N.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},N.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},N.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},N.prototype.isqr=function(e){return this.imul(e,e.clone())},N.prototype.sqr=function(e){return this.mul(e,e)},N.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),d=this.pow(e,o.addn(1).iushrn(1)),f=this.pow(e,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m<p);var g=this.pow(h,new i(1).iushln(p-m-1));d=d.redMul(g),h=g.redSqr(),f=f.redMul(h),p=m}return d},N.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},N.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var o=n[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var c=t.words[r],l=u-1;l>=0;l--){var h=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},N.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},N.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new T(e)},r(T,N),T.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},T.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},T.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},T.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(Xd,L),function(e){var t=L&&L.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,"__esModule",{value:!0}),e.map=e.array=e.rustEnum=e.str=e.vecU8=e.tagged=e.vec=e.bool=e.option=e.publicKey=e.i128=e.u128=e.i64=e.u64=e.struct=e.f64=e.f32=e.i32=e.u32=e.i16=e.u16=e.i8=e.u8=void 0;var n=pd,r=kh,i=t(Xd.exports),o=pd;Object.defineProperty(e,"u8",{enumerable:!0,get:function(){return o.u8}}),Object.defineProperty(e,"i8",{enumerable:!0,get:function(){return o.s8}}),Object.defineProperty(e,"u16",{enumerable:!0,get:function(){return o.u16}}),Object.defineProperty(e,"i16",{enumerable:!0,get:function(){return o.s16}}),Object.defineProperty(e,"u32",{enumerable:!0,get:function(){return o.u32}}),Object.defineProperty(e,"i32",{enumerable:!0,get:function(){return o.s32}}),Object.defineProperty(e,"f32",{enumerable:!0,get:function(){return o.f32}}),Object.defineProperty(e,"f64",{enumerable:!0,get:function(){return o.f64}}),Object.defineProperty(e,"struct",{enumerable:!0,get:function(){return o.struct}});var a=function(e){W(r,e);var t=X(r);function r(e,i,o){var a;return B(this,r),(a=t.call(this,e,o)).blob=n.blob(e),a.signed=i,a}return U(r,[{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=new i.default(this.blob.decode(e,t),10,"le");return this.signed?n.fromTwos(8*this.span).clone():n}},{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return this.signed&&(e=e.toTwos(8*this.span)),this.blob.encode(e.toArrayLike(Ne,"le",this.span),t,n)}}]),r}(n.Layout);function s(e){return new a(8,!1,e)}e.u64=s,e.i64=function(e){return new a(8,!0,e)},e.u128=function(e){return new a(16,!1,e)},e.i128=function(e){return new a(16,!0,e)};var u=function(e){W(n,e);var t=X(n);function n(e,r,i,o){var a;return B(this,n),(a=t.call(this,e.span,o)).layout=e,a.decoder=r,a.encoder=i,a}return U(n,[{key:"decode",value:function(e,t){return this.decoder(this.layout.decode(e,t))}},{key:"encode",value:function(e,t,n){return this.layout.encode(this.encoder(e),t,n)}},{key:"getSpan",value:function(e,t){return this.layout.getSpan(e,t)}}]),n}(n.Layout);e.publicKey=function(e){return new u(n.blob(32),(function(e){return new r.PublicKey(e)}),(function(e){return e.toBuffer()}),e)};var c=function(e){W(r,e);var t=X(r);function r(e,i){var o;return B(this,r),(o=t.call(this,-1,i)).layout=e,o.discriminator=n.u8(),o}return U(r,[{key:"encode",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return null==e?this.discriminator.encode(0,t,n):(this.discriminator.encode(1,t,n),this.layout.encode(e,t,n+1)+1)}},{key:"decode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator.decode(e,t);if(0===n)return null;if(1===n)return this.layout.decode(e,t+1);throw new Error("Invalid option "+this.property)}},{key:"getSpan",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=this.discriminator.decode(e,t);if(0===n)return 1;if(1===n)return this.layout.getSpan(e,t+1)+1;throw new Error("Invalid option "+this.property)}}]),r}(n.Layout);function l(e){if(0===e)return!1;if(1===e)return!0;throw new Error("Invalid bool: "+e)}function h(e){return e?1:0}function d(e){var t=n.u32("length"),r=n.struct([t,n.blob(n.offset(t,-t.span),"data")]);return new u(r,(function(e){return e.data}),(function(e){return{data:e}}),e)}e.option=function(e,t){return new c(e,t)},e.bool=function(e){return new u(n.u8(),l,h,e)},e.vec=function(e,t){var r=n.u32("length"),i=n.struct([r,n.seq(e,n.offset(r,-r.span),"values")]);return new u(i,(function(e){return e.values}),(function(e){return{values:e}}),t)},e.tagged=function(e,t,r){var i=n.struct([s("tag"),t.replicate("data")]);return new u(i,(function(t){var n=t.tag,r=t.data;if(!n.eq(e))throw new Error("Invalid tag, expected: "+e.toString("hex")+", got: "+n.toString("hex"));return r}),(function(t){return{tag:e,data:t}}),r)},e.vecU8=d,e.str=function(e){return new u(d(),(function(e){return e.toString("utf-8")}),(function(e){return Ne.from(e,"utf-8")}),e)},e.rustEnum=function(e,t,r){var i=n.union(null!=r?r:n.u8(),t);return e.forEach((function(e,t){return i.addVariant(t,e,e.property)})),i},e.array=function(e,t,r){var i=n.struct([n.seq(e,t,"values")]);return new u(i,(function(e){return e.values}),(function(e){return{values:e}}),r)};var f=function(e){W(n,e);var t=X(n);function n(e,r,i){var o;return B(this,n),(o=t.call(this,e.span+r.span,i)).keyLayout=e,o.valueLayout=r,o}return U(n,[{key:"decode",value:function(e,t){return t=t||0,[this.keyLayout.decode(e,t),this.valueLayout.decode(e,t+this.keyLayout.getSpan(e,t))]}},{key:"encode",value:function(e,t,n){n=n||0;var r=this.keyLayout.encode(e[0],t,n);return r+this.valueLayout.encode(e[1],t,n+r)}},{key:"getSpan",value:function(e,t){return this.keyLayout.getSpan(e,t)+this.valueLayout.getSpan(e,t)}}]),n}(n.Layout);e.map=function(e,t,r){var i=n.u32("length"),o=n.struct([i,n.seq(new f(e,t),n.offset(i,-i.span),"values")]);return new u(o,(function(e){var t=e.values;return new Map(t)}),(function(e){return{values:Array.from(e.entries())}}),r)}}(Jd),ue.Web3MobileWallet;var Kd=ue.transact,$d=ur.Buffer,ef=br.exports,tf=Jd.struct([Jd.publicKey("mint"),Jd.publicKey("owner"),Jd.u64("amount"),Jd.u32("delegateOption"),Jd.publicKey("delegate"),Jd.u8("state"),Jd.u32("isNativeOption"),Jd.u64("isNative"),Jd.u64("delegatedAmount"),Jd.u32("closeAuthorityOption"),Jd.publicKey("closeAuthority")]);Jd.array;var nf=Jd.bool,rf=Jd.i128;Jd.i16;var of=Jd.i32,af=Jd.i64;Jd.i8,Jd.map;var sf=Jd.option,uf=Jd.publicKey,cf=Jd.rustEnum,lf=Jd.str,hf=Jd.struct;Jd.tagged;var df=Jd.u128,ff=Jd.u16,pf=Jd.u32,yf=Jd.u64,mf=Jd.u8,gf=Jd.vec;Jd.vecU8;const vf="data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0yOTkuMyAyMzcuNSA1MDAgMTIybDIwMC43IDExNS41LTczLjUgNDIuNkw1MDAgMjA4LjJsLTEyNy4xIDcxLjktNzMuNi00Mi42em00MDEuNCAxNDYtNzMuNS00Mi42LTEyNy4xIDczTDM3MyAzNDAuNGwtNzMuNSA0My4xdjg1LjdsMTI3LjEgNzN2MTQ1LjRsNzMuNSA0My4xIDczLjUtNDMuMVY1NDIuMWwxMjcuMS03M3YtODUuNnptMCAyMzIuMXYtODUuN2wtNzMuNSA0Mi42djg1LjdjLS4xLS42IDczLjUtNDIuNiA3My41LTQyLjZ6bTUxLjkgMjkuMy0xMjcuMSA3M3Y4NS43TDgyNi4xIDY4OFY0NTYuNGwtNzMuNSA0My4xdjE0NS40em0tNzMuNS0zMzQuNCA3My41IDQzLjF2ODUuN2w3My41LTQzLjF2LTg1LjdsLTczLjUtNDMuMS03My41IDQzLjF6TTQyNi41IDc0OS40djg1LjdsNzMuNSA0My4xIDczLjUtNDMuMXYtODUuN2wtNzMuNSA0Mi03My41LTQyek0yOTkuMyA2MTUuNmw3My41IDQzLjF2LTg2LjJMMjk5LjMgNTMwdjg1LjZ6bTEyNy4yLTMwNS4xIDczLjUgNDMuMSA3My41LTQzLjEtNzMuNS00Mi42YzAtLjUtNzMuNSA0Mi42LTczLjUgNDIuNnptLTE3OS4xIDQzLjEgNzMuNS00My4xLTczLjUtNDMuMS03My41IDQzLjF2ODUuN2w3My41IDQzLjF2LTg1Ljd6bTAgMTQ1LjQtNzMuNS00Mi42VjY4OGwyMDAuNyAxMTUuNXYtODUuN2wtMTI3LjEtNzNjLS4xLjEtLjEtMTQ1LjgtLjEtMTQ1Ljh6IiBmaWxsPSIjZjBiOTBiIi8+PC9zdmc+",wf="https://assets.trustwalletapp.com/blockchains/smartchain/info/logo.png";var bf={name:"bsc",id:"0x38",networkId:"56",namespace:"eip155",platform:"evm",label:"BNB Smart Chain",fullName:"BNB Smart Chain Mainnet",logo:vf,logoBackgroundColor:"#000000",logoWhiteBackground:vf,currency:{name:"BNB",symbol:"BNB",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:wf},wrapped:{address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/logo.png"},stables:{usd:["0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d","0x55d398326f99059fF775485246999027B3197955"]},explorer:"https://bscscan.com",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://bscscan.com/tx/${e.id||e}`:t?`https://bscscan.com/token/${t}`:n?`https://bscscan.com/address/${n}`:void 0,endpoints:["https://binance.llamarpc.com","https://bsc-rpc.publicnode.com","https://bsc.rpc.blxrbdn.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"BNB",name:"Binance Coin",decimals:18,logo:wf,type:"NATIVE"},{address:"0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c",symbol:"WBNB",name:"Wrapped BNB",decimals:18,logo:"https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/smartchain/assets/0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c/logo.png",type:"20"},{address:"0x55d398326f99059fF775485246999027B3197955",symbol:"USDT",name:"Tether USD",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x55d398326f99059fF775485246999027B3197955/logo.png",type:"20"},{address:"0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d",symbol:"USDC",name:"USD Coin",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d/logo.png",type:"20"},{address:"0x2170Ed0880ac9A755fd29B2688956BD959F933F8",symbol:"ETH",name:"Ethereum Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x2170Ed0880ac9A755fd29B2688956BD959F933F8/logo.png",type:"20"},{address:"0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82",symbol:"Cake",name:"PancakeSwap Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x0E09FaBB73Bd3Ade0a17ECC321fD13a19e81cE82/logo.png",type:"20"},{address:"0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c",symbol:"BTCB",name:"BTCB Token",decimals:18,logo:"https://assets.trustwalletapp.com/blockchains/smartchain/assets/0x7130d2A12B9BCbFAe4f2634d864A1Ee1Ce3Ead9c/logo.png",type:"20"},{address:"0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",blockTime:3e3};const Mf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IB2cksfwAAAAlwSFlzAAALEwAACxMBAJqcGAAADxdJREFUeJztXVtzFMcVplwuP8VVeYmf7HJ+RKqSl/AQP6X8H+yqXUEIjhMnQY5jO9oVCIzA5mowdzAYG4xAGAyWLC5G3IyDL8gOASUYKrarYGZWC7qi23b6692VV6uZ7e6ZnT3di07VV6JUaLfnnG+6z+lz+vScOXUoL6SzP52/2PtlQ9p7piHlLU2k3P2JJqcjkXLO8589/OdN/tPjvx8VEP8Wv+sp/J8O/A3+Fp+Bz8JnUj/XrPjIwjT7ybxm57fJlLsy2eR2cwPe4QZksYB/Nr4D34XvxHdTP/8DJ+k0e4S/lb9Jpr2WZJNzgRtjPDaDS4DvFmPgY8GYMDZq/dStNKQzv0qmnA1c6RkqgysQIoMxYqzU+qoLWZDO/jyZdl7lir1ObdwQZLiOseMZqPVonSTS7i+4AtsTTW6O2pDR4ebEs/Bnotar8dKw2Pk1n0I76Y0W16zgdOIZqfVsnCSbvaeEB2+AkWpCBEQS/Jmp9U4u3Fl6nIdWB6gNQgb+7NABtR1qLjxcejiZdhfxKXGA3AjUswHXAXQBnVDbpSbCPeO5fAr8hlrxpgE6gW6o7ROb5N96Z3l9ePZxgUcMXEd1NxssbMk8kWxyztEr2A5AV3XjGySb3acTSLYYoFjL4EF31PYLLXwaeyiZcltnp/woEJtIrdAltT21BEkR7tnuo1dgfQC6tCbRlGh1H02k3C5qpalg/bt3WdOGDPk4lACdct1S27eiLEgPPMbDmcvkylLAgiUOc/sm2LHuITavmX48KoBun1828DNqO/tKsiX7JF+zeqmVpIqPzg2xyckc++Sfw2ImoB6POtxe6Jra3tMEb75Nxv/Hmxk2MZGbIsCpz4bZn1d45OPSIQF0Tm13IViXbJn2i+i9NcYgRQIA+zsGyMelA6Fzap8AnqktDl8RO9r7WVFKCQAs3dJHPj4tcN2TRQcizrcs1Hv+NZf1D04GEqDj/JBwDqnHqYNCiFj7fYL8Jg+9AnTQfXmYlUo5AYAtbffIx6lNAm6L2hpfbO/atcO3dGsfy+VyUgIAL66yySEE3FzNto2R2ElYtrffkHbYd7fHWbkEEeDQyUHk6cnHrQkPtonV+CKla2FWDx6+nwQRAFi5K0s+bl3ANrGmkvP5fPoH1cFfX/fYyP2cNgG6Lg6z55a55OPXJgG3UVzGn2vbug98fvW+r/FlBADePtJPPn59iKKS6lYW5ad++8q4Vu+5G2h8FQIAr663JFlUAtiqqksBZ1Uj9UPp4neLHeb0TUQmwNEzg2xemv559OE2VsX4KE2ysXoXhpOJCgGAdXttShblAZtVpayMe5Zt1A+ji5fXZdj4uL/jF4YApy4NsxdaLXQIue2iGb/Ze4r6IcLg6rejUuPrEAB47yO7kkVTJIhyAsnG41rYylUVHQIAizdZlixqyh9DC2V8HGKkHrwuELffHZiUWz4kAVBEAueS+jl1EepAqo2ndLFW64guAYBNB2xMFjmdWsbHWXbqQesC0zMMGjcBgEVv2JYs4tDpT5BvzmDAoBWBxM2tH8a0jB+FAAe77EsWwaZKxkdLE9u2fPce65dbu4oEAFp32JYscnNK7WrQ14Z+sOpAMefwiLrjVy0CdF0cYguX2rU3ANtKCWBTdS9wqWcklPGjEgDYcdiuZBEaV1U0PtqbUQ9SB6/vyoY2fjUIALy81q5kUcUWduhxRz1AVcxvdthtb2aVT60JcOT0oKg4otaHKmBjX+OLA50GN2Esx+FT8mRPLQgAIO1MrQ91ArgZ31JytDqlHpwqXlrjsbExvZg/TgKcvDTM/rjcHocQtp45/ae9FuqBqeLr/6gle2pFAAChKLVeVAFbzyRAk3OBemAq2LhfPdlTSwIA6Y12JItg62nGR9tzyq7bqljY4rK+e5WrfCgJcPzskHBOqfUkJQC39bRW9+h9Tz0oFXx8Yahqxo+DAMCGfXY4hLB5SfjnrqQekAypjRntZA8FAU5/NixK0an1JQNsXrL+m1/4ceM7/WRPJcExsas3Rtn7nQNVJ8GBj82vHppWKBLrNStVAOrzqyWjPHzEWQGEbjBW81t9bPn2LNt9tF/UE1SLBMu2Ge4QcpsL4+MyJPLBVADi68HhcMmeUrnbP8kufDUyw8ggQBHoD7Dt4D3WyX2NqASAv/L7Fnr9VYK4CAs3YlEPpBLOfxk+2QP5wRlnZy7ztTnAUKUEKGLJpj72JnfmUFoehQTbDpldPQTb8/Xfe5Z6IEHA1BxWem+N8rdd/ib7EaAUq/dkxZoelgTYtaTWYxBwJR7y/8uoB+IHnMbB26sjY+M59uU1vr5/qj6FywhQxIodWfbOh/2ioZQOAZCzMLV6CLafU7hUkXww5Wjr8j/S7Sdo+3LxyojSGx+WAFN+wtY+tp1P7V0afsIbbxtaPcRtb2T1b+Mqj90flcf8t91x1v158PoeBwGKWLy5j23kfsIxBT/h5KfDoj8RtV7LIaqFTcwBfHUt+Eg35L//G2WnqxSyhSVAKdZwP+FgV2U/Yc9R85JFIieQwH25BgymCHTt9JPxiRy7ch3xe/QQrdoEKGLlzqzICgb5CQb2Je6ZU7g0mXogAmjR5mWnJ3uwB3Dp65nxu4kEKGIZ9xN2tN9jJy5OJ6txfYm57TEDGNPwCdm0otzJTLCzX+T31uMwfJwEmNpP2NLHNu2/y453/0gEw/oSe3MK16dTD2Sqf+/N78diN3qtCDDlMG7qY2v33mWHTg6Y1ZeY294YAhw7Ozi1P19L1IIA0/yEXdxpfMeQWUAQwJAlAClUtHOrdwL8fW3GpBPGnlFOIIDp8lh3dT19EwiAJe4PprWdKziBRoWBALaB1/JpEhsothMAdYJY8w3dDhZh4HkDBuIL7J7t+qDfWgKg57BRYV85uO0xA3SQD0SCl9ZkRP9eWwjwyrqM8bUABXQYkwySpU0xhb62Lcs6z5u7E4idPpUDIn8ypeOYSAYZkg5esTPLPr0yIu2+gd1CnA3QTcvGSYA0B6IY2TpfXNLQxo5a30BDyluKI2HPUA+kCHj/qNlDDl0WKsGxevd49LAxqvGxPM2XjBV+AJpNYp/DpJ1AURBiUkkYvP9i9S9yAnjTZX+DaffoJ+H9g7CGR1j3nEKDCIS12OLGd6HGwaRoQJSEmVYU+rfVHhu+/2MR6LWbo+JMQGUmO6Lo4kSIsDFMWKfSNRRLWWnJOdrPm3aAVBSFmlgWXt7sEQc4kB+QKRBv5Pb2e7ERAIUqssbROL629eDMMSzZbFiZeLEs3NSDISjhLpeh4Umx7ssaMiD+bpMUaOgQAE6b7DYxjAkdS7ouzoxScFUdtT7LMe1giIlHw/AmORn/g6AoFlWps0OdP7p7hiUA/AuVUi74A+gU4vf5KC2XOYkkBCg9Gmbq4VBMm0gRBwkqgGX7B1A+PO+ggpKgsO4vK+VhHXwBVAAFkQuhqqk3kE07HGry8XDU5FcStIWHl40Zo9LnwH9AXZ6MAHBCZUe8EaLiFLBsL2LVbjOrgWccDze5QQTeQpX27zj6tV3hJM4r6zPsg5Lpemr7lv9eRiIA5V4dCruR+wxuLz+jQYTpLWIwHQ8MqZ0P/Pb7MdYiuQMYpMLOI87vIcRU2ZrFUnPwhNp+A7arTb5xzLdFjOlNorCTpio4+o0zhSBOpc+EZy+LKJDD33lYLyNpYPXvNPg2ibKhTRzqA3QE9wUiHAzTtgXx/po9+jUJpreTD2wTlw8HzW4UCY/e7wpYmSCc1NmDRxQQpioJOQzTbxgLbBSZXwbMbxWLmDtsj8B/3RiteA8gMnr7QtYlItEjW3JMQMVWsflZwL1OPUgZEM6FFWwrI2dQWp+H4o3NB/S2kMuBo+zUepFB2ixaEMCSdvFf/Lvy+UGZIKpAW5hiNBDF+Cae+/MlgEq7eFsujMAWbdSegdXoEoZNKFmewAwoXhhRWAasuDIGTRuitI57kNrFK18ZA7Hp0qgPz4RvHhmVACZV90ihc2lUfhYwr3GEHxrS4XsIRiEAchQmVfdUgva1cRCbLo58sayKKG4CIOdvWnVPxZckzMWRYhYwsFAkCDpXxkYlgHHVPRUQ+upYQQDLLo/W7SkYhgAoOaN+Ti0CRLk8GpJIOQeoH0IVSOfeCagiqgYBUH1sYnVPILjtIhkf0pDOPM6diAHyh1EEpufxClVEYQmA4o9Gi66Mhc1gu8gEgCTT7iLqB9KBrIooDAGM7fUXRABus6oYH5JOs4e5M/EN9UNpsF+0gq8WAd4zuLrH9/m5rWCzqhEAkkw7c23YIi4CmTl0EI1KAFHdY9UVsW4Otqqq8UtIsJz+AdWBJhNRCYD0M/Vz6AA2isX4kPxS4JyjfkgdVKoikhHgrfctC/m4bao+9ZfLwpbMEwlDGkupoFIVUSUCtJ80v7qnDB5sE6vxi5Jsdp+2yR9AFdCoTxVREAEwaxjTy08JfN3nNqmJ8adIkHJb6R9cHbt9qoiCCIBOJNTj1QFsUVPjQ/ha8xCPNfdRP7wOcFmUjAC7j9hR3TNlfG4D2KLmBCiQ4JFEyu2iVoIqyquIyglgT3VPAVz3gSXetZJEq/tossm9TK4MRbSWVBGVEwDtXqjHpwqhc657UuMXZUF64DHuiPRSK0UVOLJdTgCcPKIelzrcXuic2u7TJNmSfdIWEhSriIoEsKm6BzqGrqnt7StgpS3LAc7to+MIqntMvM/HD9CtcW9+uWBdssUxxDk+dPGiHocSoFNT1nyZiIOmloWIJqMQ6tF6+7oi9gnEZpE9O4bmwc1Bh2RxfjUkv21sT+7AIHg1396NS5CksC2LSAnoqmaJnVqJSCWLeoLZJSEYophjeewpXUpBtYpN5WW1AnQSWyWPaQKGc7Y32lRtHJvhhQ7cxrp+64NElJw3OW3URqB76522qpVu2yw4vWLTMbTohne7I5/YqUfBIUZbTiWHMjx/ttAHNR8kwVn2fJOKeogYxGZOu/b5/FnJt6vJ9yyyI8tYZvhejF25LcusVBa0N0OPO5ObWWJsGKO0FdushBckRdDqFP1u0fSYsss5vluMgY8FY7IuYVMPgrbn6H2PCxBEJBHn9Tf8s4UHz78L3zmj5fqsmCG4DAk3YiWbvGfFvYgpdz888EJL/J7Chdkerk8XEP8Wv+vJzyo8EsHf8L/FZ+Czpi5YqjP5P2ey0rAsl+yGAAAAAElFTkSuQmCC",Af="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png";var If={name:"ethereum",id:"0x1",networkId:"1",namespace:"eip155",platform:"evm",label:"Ethereum",fullName:"Ethereum Mainnet",logo:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbC1vcGFjaXR5Oi42MDJ9LnN0MCwuc3Qxe2ZpbGw6I2ZmZn08L3N0eWxlPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Ik01MTEuNCA3My4zdjMxNS41TDc3OCA1MDggNTExLjQgNzMuM3oiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJNNTExLjQgNzMuMyAyNDQuNyA1MDhsMjY2LjYtMTE5LjJWNzMuM3oiLz48cGF0aCBjbGFzcz0ic3QwIiBkPSJNNTExLjQgNzEyLjN2MjE0LjVsMjY2LjgtMzY5LjEtMjY2LjggMTU0LjZ6Ii8+PHBhdGggY2xhc3M9InN0MSIgZD0iTTUxMS40IDkyNi43VjcxMi4zTDI0NC43IDU1Ny42bDI2Ni43IDM2OS4xeiIvPjxwYXRoIGQ9Ik01MTEuNCA2NjIuNyA3NzggNTA4IDUxMS40IDM4OC44djI3My45eiIgZmlsbD0iI2ZmZiIgZmlsbC1vcGFjaXR5PSIuMiIvPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Im0yNDQuNyA1MDggMjY2LjYgMTU0LjdWMzg4LjhMMjQ0LjcgNTA4eiIvPjwvc3ZnPgo=",logoBackgroundColor:"#5683ec",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIGltYWdlLXJlbmRlcmluZz0ib3B0aW1pemVRdWFsaXR5IiBzaGFwZS1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiIgdGV4dC1yZW5kZXJpbmc9Imdlb21ldHJpY1ByZWNpc2lvbiIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4PSIwIiB5PSIwIiB2aWV3Qm94PSIwIDAgMTAwMCAxMDAwIiB4bWw6c3BhY2U9InByZXNlcnZlIj48c3R5bGU+LnN0MXtmaWxsOiM4YzhjOGN9PC9zdHlsZT48cGF0aCBkPSJtNDk5LjggNzcuNS01LjUgMTl2NTU5LjFsNS41IDUuNSAyNTkuNy0xNTMuNUw0OTkuOCA3Ny41eiIgZmlsbD0iIzM0MzQzNCIvPjxwYXRoIGNsYXNzPSJzdDEiIGQ9Im00OTkuOCA3Ny41LTI1OS4zIDQzMEw0OTkuOCA2NjFWNzcuNXoiLz48cGF0aCBkPSJtNDk5LjggNzEwLjMtMi45IDR2MTk5LjFsMi45IDkuMSAyNTkuNy0zNjUuOC0yNTkuNyAxNTMuNnoiIGZpbGw9IiMzYzNjM2IiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJNNDk5LjggOTIyLjVWNzEwLjNMMjQwLjUgNTU2LjdsMjU5LjMgMzY1Ljh6Ii8+PHBhdGggZD0ibTQ5OS44IDY2MSAyNTkuNy0xNTMuNS0yNTkuNy0xMTcuOFY2NjF6IiBmaWxsPSIjMTQxNDE0Ii8+PHBhdGggZD0iTTI0MC41IDUwNy41IDQ5OS44IDY2MVYzODkuN0wyNDAuNSA1MDcuNXoiIGZpbGw9IiMzOTM5MzkiLz48L3N2Zz4K",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Mf},wrapped:{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",logo:Af,logoBackgroundColor:"#FFFFFF"},stables:{usd:["0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","0xdAC17F958D2ee523a2206206994597C13D831ec7"]},explorer:"https://etherscan.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://etherscan.io/tx/${e.id||e}`:t?`https://etherscan.io/token/${t}`:n?`https://etherscan.io/address/${n}`:void 0,endpoints:["https://eth.llamarpc.com","https://ethereum.publicnode.com","https://eth.rpc.blxrbdn.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:Mf,type:"NATIVE"},{address:"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:Af,type:"20"},{address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",symbol:"EUROC",name:"EURO Coin",decimals:6,logo:"https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/ethereum/assets/0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c/logo.png",type:"20"},{address:"0xdAC17F958D2ee523a2206206994597C13D831ec7",symbol:"USDT",name:"Tether USD",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0x6B175474E89094C44Da98b954EedeAC495271d0F",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x853d955aCEf822Db058eb8505911ED77F175b99e",symbol:"FRAX",name:"Frax",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x853d955aCEf822Db058eb8505911ED77F175b99e/logo.png",type:"20"},{address:"0x956F47F50A910163D8BF957Cf5846D573E7f87CA",symbol:"FEI",name:"Fei USD",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x956F47F50A910163D8BF957Cf5846D573E7f87CA/logo.png",type:"20"},{address:"0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599",symbol:"WBTC",name:"Wrapped BTC",decimals:8,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",type:"20"},{address:"0xa0bEd124a09ac2Bd941b10349d8d224fe3c955eb",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",blockTime:12e3};const Nf="https://assets.trustwalletapp.com/blockchains/fantom/info/logo.png",Tf="https://assets.trustwalletapp.com/blockchains/fantom/assets/0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83/logo.png";var Ef={name:"fantom",id:"0xfa",networkId:"250",namespace:"eip155",label:"Fantom",fullName:"Fantom Opera",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00NjcgMTM1LjVjMTgtOS4zIDQ1LjEtOS4zIDYzIDBsMTgzLjQgOTdjMTAuNyA2LjEgMTYuNiAxNCAxOCAyMy4zdjQ4Ni42YzAgOS4zLTYuMSAxOS4yLTE4IDI1LjJsLTE4My4yIDk3Yy0xOCA5LjMtNDUuMSA5LjMtNjMgMGwtMTgzLjMtOTdjLTExLjktNi4xLTE3LjItMTUuOS0xOC0yNS4yVjI1NS43Yy43LTguNyA2LjctMTcuMiAxNy4yLTIzLjNMNDY3IDEzNS41em0yMzUuOCAzODkuNy0xNzIuNiA5MC45Yy0xOCA5LjMtNDUuMSA5LjMtNjMgMGwtMTcxLjktOTAuM3YyMTQuNGwxNzEuOSA5MC4zYzEwIDUuMyAyMC42IDEwLjcgMzEuMiAxMS4zaC43YzEwIDAgMjAtNS4zIDMwLjUtMTBsMTc0LTkyLjMtLjgtMjE0LjN6TTIzNy4zIDczMS4xYzAgMTguNiAyIDMxLjIgNi43IDM5LjggMy4zIDcuMyA4LjcgMTIuNiAxOC42IDE5LjJsLjcuN2MyIDEuNCA0LjcgMi42IDcuMyA0LjdsMy4zIDIgMTAuNyA2LjEtMTQuNiAyNC42LTExLjMtNy4zLTItMS40Yy0zLjMtMi02LjEtNC04LjctNS4zLTI3LjktMTguNi0zNy44LTM5LjItMzcuOC04MS42di0xLjRoMjcuMXpNNDg1IDM5Ni40Yy0xLjQuNy0yLjYuNy00IDEuNGwtMTgzLjIgOTYuOWgtLjcuN2wxODMuMyA5N2MxLjQuNyAyLjYgMS40IDQgMS40bC0uMS0xOTYuN3ptMjkuMyAwdjE5Ny44YzEuNC0uNyAyLjYtLjcgNC0xLjRsMTgzLjMtOTdoLjctLjdsLTE4My4zLTk4LjJjLTEuNC0uNS0yLjgtMS4yLTQtMS4yem0xODguNS0xMDctMTY0LjcgODYuMyAxNjQuNyA4Ni40VjI4OS40em0tNDA3LjcgMHYxNzMuM2wxNjQuNy04Ni4zLTE2NC43LTg3em0yMjIuNS0xMjhjLTkuMy01LjMtMjYuNS01LjMtMzYuNiAwbC0xODMuMiA5N2gtLjcuN2wxODMuMyA5N2M5LjMgNS4zIDI2LjUgNS4zIDM2LjYgMGwxODMuMy05N2guNy0uN2wtMTgzLjQtOTd6bTIxMi41IDkuMyAxMS4zIDcuMyAyIDEuNGMzLjMgMiA2LjEgNCA4LjcgNS4zIDI3LjkgMTguNiAzNy44IDM5LjIgMzcuOCA4MS42djEuNGgtMjguN2MwLTE4LjYtMi0zMS4yLTYuNy0zOS44LTMuMy03LjMtOC43LTEyLjYtMTguNi0xOS4ybC0uNy0uN2MtMi0xLjQtNC43LTIuNi03LjMtNC43bC0zLjMtMi0xMC43LTYuMSAxNi4yLTI0LjV6IiBmaWxsPSIjZmZmIi8+PC9zdmc+",logoBackgroundColor:"#226efb",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxjaXJjbGUgY3g9IjUwMCIgY3k9IjUwMCIgcj0iNDI1IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iIzE5NjlmZiIvPjxwYXRoIGQ9Ik00NzQuMSAyMTAuM2MxNC4zLTcuNCAzNS45LTcuNCA1MC4yIDBsMTQ1LjkgNzcuMmM4LjUgNC44IDEzLjIgMTEuMSAxNC4zIDE4LjV2Mzg3LjVjMCA3LjQtNC44IDE1LjMtMTQuMyAyMC4xbC0xNDUuOSA3Ny4yYy0xNC4zIDcuNC0zNS45IDcuNC01MC4yIDBsLTE0NS45LTc3LjJjLTkuNS00LjgtMTMuNy0xMi43LTE0LjMtMjAuMVYzMDZjLjUtNi45IDUuMy0xMy43IDEzLjctMTguNS4xIDAgMTQ2LjUtNzcuMiAxNDYuNS03Ny4yem0xODcuNyAzMTAuM0w1MjQuMyA1OTNjLTE0LjMgNy40LTM1LjkgNy40LTUwLjIgMGwtMTM2LjktNzEuOXYxNzAuN2wxMzYuOSA3MS45YzcuOSA0LjIgMTYuNCA4LjUgMjQuOCA5aC41YzcuOSAwIDE1LjktNC4yIDI0LjMtNy45bDEzOC41LTczLjVWNTIwLjZoLS40ek0yOTEuMiA2ODQuNWMwIDE0LjggMS42IDI0LjggNS4zIDMxLjcgMi42IDUuOCA2LjkgMTAgMTQuOCAxNS4zbC41LjVjMS42IDEuMSAzLjcgMi4xIDUuOCAzLjdsMi42IDEuNiA4LjUgNC44LTExLjYgMTkuNi05LTUuOC0xLjYtMS4xYy0yLjYtMS42LTQuOC0zLjItNi45LTQuMi0yMi4yLTE0LjgtMzAuMS0zMS4yLTMwLjEtNjV2LTEuMWgyMS43em0xOTcuMi0yNjYuNGMtMS4xLjUtMi4xLjUtMy4yIDEuMWwtMTQ1LjkgNzcuMmgtLjUuNWwxNDUuOSA3Ny4yYzEuMS41IDIuMSAxLjEgMy4yIDEuMVY0MTguMXptMjMuMiAwdjE1Ny41YzEuMS0uNSAyLjEtLjUgMy4yLTEuMWwxNDUuOS03Ny4yaC41LS41bC0xNDUuOS03OC4yYy0xLjEtLjUtMi4xLTEtMy4yLTF6TTY2MS44IDMzM2wtMTMxLjEgNjguNyAxMzEuMSA2OC43VjMzM3ptLTMyNC42IDB2MTM4bDEzMS4xLTY4LjdjMC0uMS0xMzEuMS02OS4zLTEzMS4xLTY5LjN6bTE3Ny4xLTEwMi4xYy03LjQtNC4yLTIxLjEtNC4yLTI5LjEgMGwtMTQ1LjkgNzcuMmgtLjUuNWwxNDUuOSA3Ny4yYzcuNCA0LjIgMjEuMSA0LjIgMjkuMSAwbDE0NS45LTc3LjJoLjUtLjVsLTE0NS45LTc3LjJ6bTE2OS4xIDcuNCA5IDUuOCAxLjYgMS4xYzIuNiAxLjYgNC44IDMuMiA2LjkgNC4yIDIyLjIgMTQuOCAzMC4xIDMxLjIgMzAuMSA2NXYxLjFoLTIyLjdjMC0xNC44LTEuNi0yNC44LTUuMy0zMS43LTIuNi01LjgtNi45LTEwLTE0LjgtMTUuM2wtLjUtLjVjLTEuNi0xLjEtMy43LTIuMS01LjgtMy43bC0yLjYtMS42LTguNS00LjggMTIuNi0xOS42eiIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==",currency:{name:"Fantom",symbol:"FTM",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Nf},wrapped:{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",logo:Tf},stables:{usd:["0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf","0x1B6382DBDEa11d97f24495C9A90b7c88469134a4"]},explorer:"https://ftmscan.com",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://ftmscan.com/tx/${e.id||e}`:t?`https://ftmscan.com/token/${t}`:n?`https://ftmscan.com/address/${n}`:void 0,endpoints:["https://rpc.fantom.network","https://fantom.publicnode.com","https://rpc2.fantom.network"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"FTM",name:"Fantom",decimals:18,logo:Nf,type:"NATIVE"},{address:"0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83",symbol:"WFTM",name:"Wrapped Fantom",decimals:18,logo:Tf,type:"20"},{address:"0x28a92dde19D9989F39A49905d7C9C2FAc7799bDf",symbol:"lzUSDC",name:"LayerZero USDC",decimals:6,logo:"https://ftmscan.com/token/images/axlusdc_32.png",type:"20"},{address:"0x1B6382DBDEa11d97f24495C9A90b7c88469134a4",symbol:"axlUSDC",name:"Axelar Wrapped USDC",decimals:6,logo:"https://ftmscan.com/token/images/axlusdc_32.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",blockTime:1e3};const xf="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/polygon/info/logo.png",kf="https://raw.githubusercontent.com/Uniswap/assets/master/blockchains/polygon/assets/0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270/logo.png";var Lf={name:"polygon",id:"0x89",networkId:"137",namespace:"eip155",label:"Polygon (POS)",fullName:"Polygon (POS) Mainnet",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0xMzEuNSA0NTkuM2MtMTQuNCA5LjYtMjQgMjQtMjQgNDMuMnYxOTQuNGMwIDE5LjIgOS42IDM2IDI0IDQzLjJsMTY1LjYgOTZjMTQuNCA5LjYgMzMuNiA5LjYgNDggMGwxNjUuNi05NmMxNC40LTkuNiAyNC0yNCAyNC00My4ydi02OS42bC03Ni44LTQzLjJ2NjQuOGMwIDE5LjItOS42IDM2LTI0IDQzLjJsLTg2LjQgNTIuOGMtMTQuNCA5LjYtMzMuNiA5LjYtNDggMGwtODYuNC01MC40Yy0xNC40LTkuNi0yNC0yNC0yNC00My4yVjU1MC41YzAtMTkuMiA5LjYtMzYgMjQtNDMuMmw4OC44LTUwLjRjMTQuNC05LjYgMzMuNi05LjYgNDggMGwxMTIuOCA2NC44IDc2LjggNDUuNiAxMTIuOCA2NC44YzE0LjQgOS42IDMzLjYgOS42IDQ4IDBsMTY4LTk2YzE0LjQtOS42IDI0LTI0IDI0LTQzLjJ2LTE5MmMwLTE0LjQtOS42LTMxLjItMjQtNDAuOGwtMTY4LTk2Yy0xNC40LTkuNi0zMy42LTkuNi00OCAwbC0xNjUuNiA5NmMtMTQuNCA5LjYtMjQgMjQtMjQgNDMuMnY2OS42bDc2LjggNDUuNnYtNjkuNmMwLTE5LjIgOS42LTM2IDI0LTQzLjJsODguOC01Mi44YzE0LjQtOS42IDMzLjYtOS42IDQ4IDBsODguOCA1MC40YzE0LjQgOS42IDI0IDI0IDI0IDQzLjJ2MTAwLjhjMCAxOS4yLTEyIDM2LTI0IDQzLjJsLTg4LjggNTIuOGMtMTQuNCA5LjYtMzMuNiA5LjYtNDggMGwtMTEyLjgtNjkuNi03OS4yLTQzLjItMTE3LjYtNjkuNmMtMTQuNC05LjYtMzMuNi05LjYtNDggMCAwIDIuNC0xNjAuOCA5OC40LTE2My4yIDk4LjR6IiBmaWxsPSIjZmZmIi8+PC9zdmc+",logoBackgroundColor:"#824ee2",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0xMDkuNyA0NTljLTE2LjQgOS40LTI1LjggMjUuOC0yNS44IDQ2Ljl2MjA2LjNjMCAyMS4xIDkuNCAzNy41IDI1LjggNDYuOWwxNzUuOCAxMDMuMWMxNi40IDkuNCAzNS4yIDkuNCA1MS42IDBsMTc1LjgtMTAzLjFjMTYuNC05LjQgMjUuOC0yNS44IDI1LjgtNDYuOXYtNzIuN2wtODItNDYuOXY2OGMwIDIxLjEtOS40IDM3LjUtMjUuOCA0Ni45TDMzNyA3NjEuNGMtMTYuNCA5LjQtMzUuMiA5LjQtNTEuNiAwTDE5NCA3MDcuNWMtMTYuNC05LjQtMjUuOC0yNS44LTI1LjgtNDYuOVY1NTIuOGMwLTIxLjEgOS40LTM3LjUgMjUuOC00Ni45bDkzLjgtNTMuOWMxNC4xLTkuNCAzNS4yLTkuNCA1MS42IDBsMTE5LjUgNjggODIgNDkuMiAxMTkuNSA2OGMxNi40IDkuNCAzNS4yIDkuNCA1MS42IDBMODkwLjIgNTM0YzE2LjQtOS40IDI1LjgtMjUuOCAyNS44LTQ2LjlWMjgzLjJjMC0xNi40LTkuNC0zMi44LTI1LjgtNDIuMkw3MTIuMSAxMzcuOWMtMTYuNC05LjQtMzUuMi05LjQtNTEuNiAwTDQ4NC43IDI0MWMtMTYuNCA5LjQtMjUuOCAyNS44LTI1LjggNDYuOXY3NWw4MiA0OS4ydi03Mi43YzAtMjEuMSA5LjQtMzcuNSAyNS44LTQ2LjlsOTMuOC01Ni4zYzE2LjQtOS40IDM1LjItOS40IDUxLjYgMGw5My44IDUzLjljMTQuMSA5LjQgMjUuOCAyNS44IDI1LjggNDYuOXYxMDhjMCAyMS4xLTExLjcgMzcuNS0yNS44IDQ2LjlsLTkzLjggNTYuM2MtMTQuMSA5LjQtMzUuMiA5LjQtNTEuNiAwTDU0MSA0NzUuNGwtODItNDYuOS0xMjQuMi03Mi43Yy0xNC4xLTkuNC0zNS4yLTkuNC01MS42IDAtLjEuMS0xNzEuMiAxMDMuMi0xNzMuNSAxMDMuMnoiIGZpbGw9IiM4MjQ3ZTUiLz48L3N2Zz4=",currency:{name:"Polygon",symbol:"MATIC",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:xf},wrapped:{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",logo:kf},stables:{usd:["0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359","0xc2132D05D31c914a87C6611C10748AEb04B58e8F"]},explorer:"https://polygonscan.com",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://polygonscan.com/tx/${e.id||e}`:t?`https://polygonscan.com/token/${t}`:n?`https://polygonscan.com/address/${n}`:void 0,endpoints:["https://polygon-bor-rpc.publicnode.com","https://polygon.llamarpc.com","https://polygon-bor.publicnode.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"MATIC",name:"Polygon",decimals:18,logo:xf,type:"NATIVE"},{address:"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270",symbol:"WMATIC",name:"Wrapped Matic",decimals:18,logo:kf,type:"20"},{address:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",symbol:"USDT",name:"Tether USD",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png",type:"20"},{address:"0x1BFD67037B42Cf73acF2047067bd4F2C47D9BfD6",symbol:"WBTC",name:"Wrapped BTC",decimals:8,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png",type:"20"},{address:"0xf6261529C6C2fBEB313aB25cDEcD243613b40EB5",symbol:"DEPAY",name:"DePay",decimals:18,logo:"https://depay.com/favicon.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",blockTime:2e3};const Sf="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDF7ZmlsbDp1cmwoI1NWR0lEXzAwMDAwMDE5Njc2ODQzODE5NzI3MzAwODIwMDAwMDA1OTQ3NjMyODMzODYxMjM4OTE3Xyl9LnN0MntmaWxsOnVybCgjU1ZHSURfMDAwMDAwNjQzMjA1MjE4MTcxODM4NzM1NjAwMDAwMDMxNzkyNDIxNTkzMzkwODM5NjdfKX08L3N0eWxlPjxsaW5lYXJHcmFkaWVudCBpZD0iU1ZHSURfMV8iIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iODE1Ljg1NiIgeTE9IjcwLjgyNCIgeDI9IjM4OC4zMzYiIHkyPSItNzQ4LjA1MiIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDE5MS40MzUpIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiMwMGZmYTMiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNkYzFmZmYiLz48L2xpbmVhckdyYWRpZW50PjxwYXRoIGQ9Ik0yMzcuOSA2NTcuOWM0LjktNC45IDEyLjItNy4zIDE3LjEtNy4zaDYxOS43YzEyLjIgMCAxNy4xIDE0LjcgOS44IDIyTDc2Mi4xIDc5NS4xYy00LjkgNC45LTEyLjIgNy4zLTE3LjEgNy4zSDEyNS4zYy0xMi4yIDAtMTcuMS0xNC43LTkuOC0yNC41bDEyMi40LTEyMHoiIGZpbGw9InVybCgjU1ZHSURfMV8pIi8+PGxpbmVhckdyYWRpZW50IGlkPSJTVkdJRF8wMDAwMDE1MDgxNTQ0MzI2NzI2OTc2MDQ0MDAwMDAxMzQ2MDgyNDM3MDQwMzE3MjU0M18iIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIiB4MT0iNjI4LjQ4MSIgeTE9IjE2NC4xMzQiIHgyPSIyMDAuOTYyIiB5Mj0iLTY1NC43NCIgZ3JhZGllbnRUcmFuc2Zvcm09Im1hdHJpeCgxIDAgMCAtMSAwIDE5MS40MzUpIj48c3RvcCBvZmZzZXQ9IjAiIHN0b3AtY29sb3I9IiMwMGZmYTMiLz48c3RvcCBvZmZzZXQ9IjEiIHN0b3AtY29sb3I9IiNkYzFmZmYiLz48L2xpbmVhckdyYWRpZW50PjxwYXRoIGQ9Ik0yMzcuOSAyMDQuOGM0LjktNC45IDEyLjItNy4zIDE3LjEtNy4zaDYxOS43YzEyLjIgMCAxNy4xIDE0LjcgOS44IDIyTDc2Mi4xIDM0MmMtNC45IDQuOS0xMi4yIDcuMy0xNy4xIDcuM0gxMjUuM2MtMTIuMiAwLTE3LjEtMTQuNy05LjgtMjJsMTIyLjQtMTIyLjV6IiBmaWxsPSJ1cmwoI1NWR0lEXzAwMDAwMTUwODE1NDQzMjY3MjY5NzYwNDQwMDAwMDEzNDYwODI0MzcwNDAzMTcyNTQzXykiLz48bGluZWFyR3JhZGllbnQgaWQ9IlNWR0lEXzAwMDAwMDA3NDA5ODc3MzYzMTA0OTgxNjMwMDAwMDE1MTMzNzA1NTcwNjgwMDk3NzA5XyIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiIHgxPSI3MjAuOTIzIiB5MT0iMTE1Ljg3IiB4Mj0iMjkzLjQwNiIgeTI9Ii03MDMuMDAzIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIC0xIDAgMTkxLjQzNSkiPjxzdG9wIG9mZnNldD0iMCIgc3RvcC1jb2xvcj0iIzAwZmZhMyIvPjxzdG9wIG9mZnNldD0iMSIgc3RvcC1jb2xvcj0iI2RjMWZmZiIvPjwvbGluZWFyR3JhZGllbnQ+PHBhdGggZD0iTTc2Mi4xIDQzMC4xYy00LjktNC45LTEyLjItNy4zLTE3LjEtNy4zSDEyNS4zYy0xMi4yIDAtMTcuMSAxNC43LTkuOCAyMkwyMzggNTY3LjNjNC45IDQuOSAxMi4yIDcuMyAxNy4xIDcuM2g2MTkuN2MxMi4yIDAgMTcuMS0xNC43IDkuOC0yMkw3NjIuMSA0MzAuMXoiIGZpbGw9InVybCgjU1ZHSURfMDAwMDAwMDc0MDk4NzczNjMxMDQ5ODE2MzAwMDAwMTUxMzM3MDU1NzA2ODAwOTc3MDlfKSIvPjwvc3ZnPgo=",jf="https://img.raydium.io/icon/So11111111111111111111111111111111111111112.png";var Df={name:"solana",networkId:"solana",namespace:"solana",label:"Solana",fullName:"Solana Mainnet Beta",logo:Sf,logoBackgroundColor:"#000000",logoWhiteBackground:Sf,currency:{name:"Solana",symbol:"SOL",decimals:9,address:"11111111111111111111111111111111",logo:jf},wrapped:{address:"So11111111111111111111111111111111111111112",logo:jf},stables:{usd:["EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v","Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB"]},explorer:"https://solscan.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://solscan.io/tx/${e.id||e}`:t?`https://solscan.io/token/${t}`:n?`https://solscan.io/address/${n}`:void 0,endpoints:["https://solana-mainnet.g.alchemy.com/v2/demo","https://solana-rpc.publicnode.com","https://endpoints.omniatech.io/v1/sol/mainnet/public",String.fromCharCode(104,116,116,112,115,58,47,47,115,111,108,97,110,97,45,97,112,105,46,105,110,115,116,97,110,116,110,111,100,101,115,46,105,111,47,116,111,107,101,110,45,120,65,55,115,53,55,69,97,102,112,72,107,51,116,106,56,83,98,86,101,105,57,101,65,122,109,75,74,52,105,117,57)],sockets:["wss://solana.drpc.org","wss://mainnet-beta.solflare.network","wss://solana-rpc.publicnode.com"],tokens:[{address:"11111111111111111111111111111111",symbol:"SOL",name:"Solana",decimals:9,logo:jf,type:"NATIVE"},{address:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://img.raydium.io/icon/EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v.png",type:"SPL"},{address:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",symbol:"USDT",name:"USDT",decimals:6,logo:"https://img.raydium.io/icon/Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB.png",type:"SPL"},{address:"7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj",symbol:"stSOL",name:"Lido Staked SOL",decimals:9,logo:"https://img.raydium.io/icon/7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj.png",type:"SPL"},{address:"DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",symbol:"BONK",name:"BONK",decimals:5,logo:"https://img.raydium.io/icon/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263.png",type:"SPL"},{address:"7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU",symbol:"SAMO",name:"Samoyed Coin",decimals:9,logo:"https://img.raydium.io/icon/7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU.png",type:"SPL"},{address:"DePay1miDBPWXs6PVQrdC5Vch2jemgEPaiyXLNLLa2NF",symbol:"DEPAY",name:"DePay",decimals:9,logo:"https://depay.com/favicon.png",type:"SPL"}],zero:"0",maxInt:"340282366920938463463374607431768211455",permit2:void 0,blockTime:500};const Cf="data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDF7ZmlsbDojMjEzMTQ3fTwvc3R5bGU+PHBhdGggZD0iTTkyIDkyaDgxNnY4MTZIOTJWOTJ6IiBmaWxsPSJub25lIi8+PHBhdGggY2xhc3M9InN0MSIgZD0iTTE2NS44IDM0MC4xVjY2MGMwIDIwLjYgMTAuOCAzOS4yIDI4LjcgNDkuNmwyNzcuMSAxNTkuOWMxNy42IDEwLjEgMzkuNSAxMC4xIDU3LjEgMGwyNzcuMS0xNTkuOWMxNy42LTEwLjEgMjguNy0yOSAyOC43LTQ5LjZWMzQwLjFjMC0yMC42LTEwLjgtMzkuMi0yOC43LTQ5LjZsLTI3Ny4xLTE2MGMtMTcuNi0xMC4xLTM5LjUtMTAuMS01Ny4xIDBsLTI3Ny4xIDE2MGMtMTcuNiAxMC4xLTI4LjQgMjktMjguNCA0OS42aC0uM3oiLz48cGF0aCBkPSJtNTYwLjQgNTYyLTM5LjUgMTA4LjRjLTEgMi45LTEgNi4yIDAgOS41bDY3LjkgMTg2LjQgNzguNi00NS40LTk0LjMtMjU4LjhjLTIuMy02LTEwLjQtNi0xMi43LS4xem03OS4zLTE4Mi4xYy0yLjMtNS45LTEwLjQtNS45LTEyLjcgMGwtMzkuNSAxMDguNGMtMSAyLjktMSA2LjIgMCA5LjVMNjk4LjggODAzbDc4LjYtNDUuNC0xMzcuNy0zNzcuNHYtLjN6IiBmaWxsPSIjMTJhYWZmIi8+PHBhdGggZD0iTTUwMCAxNDIuNmMyIDAgMy45LjYgNS41IDEuNmwyOTkuNiAxNzNjMy42IDIgNS41IDUuOSA1LjUgOS44djM0NmMwIDMuOS0yLjMgNy44LTUuNSA5LjhsLTI5OS42IDE3M2MtMS42IDEtMy42IDEuNi01LjUgMS42cy0zLjktLjYtNS41LTEuNmwtMjk5LjYtMTczYy0zLjYtMi01LjUtNS45LTUuNS05LjhWMzI2LjdjMC0zLjkgMi4zLTcuOCA1LjUtOS44bDI5OS42LTE3M2MxLjYtMSAzLjYtMS42IDUuNS0xLjZ2LjN6bTAtNTAuNmMtMTAuOCAwLTIxLjIgMi42LTMxIDguMmwtMjk5LjYgMTczYy0xOS4yIDExLjEtMzEgMzEuMy0zMSA1My41djM0NmMwIDIyLjIgMTEuOCA0Mi40IDMxIDUzLjVsMjk5LjYgMTczYzkuNSA1LjUgMjAuMiA4LjIgMzEgOC4yczIxLjItMi42IDMxLTguMmwyOTkuNi0xNzNjMTkuMi0xMS4xIDMxLTMxLjMgMzEtNTMuNXYtMzQ2YzAtMjIuMi0xMS44LTQyLjQtMzEtNTMuNWwtMjk5LjktMTczYy05LjUtNS41LTIwLjItOC4yLTMxLTguMmguM3oiIGZpbGw9IiM5ZGNjZWQiLz48cGF0aCBjbGFzcz0ic3QxIiBkPSJtMzAxLjUgODAzLjIgMjcuOC03NS43IDU1LjUgNDYtNTEuOSA0Ny43LTMxLjQtMTh6Ii8+PHBhdGggZD0iTTQ3NC41IDMwMi4yaC03Ni4xYy01LjUgMC0xMC44IDMuNi0xMi43IDguOEwyMjIuOSA3NTcuNWw3OC42IDQ1LjRMNDgxLjEgMzExYzEuNi00LjYtMS42LTkuMS02LjItOS4xbC0uNC4zem0xMzMuMiAwaC03Ni4xYy01LjUgMC0xMC44IDMuNi0xMi43IDguOGwtMTg2IDUwOS44IDc4LjYgNDUuNEw2MTMuOSAzMTFjMS42LTQuNi0xLjYtOS4xLTYuMi05LjF2LjN6IiBmaWxsPSIjZmZmIi8+PC9zdmc+Cg==";var Of={name:"arbitrum",id:"0xa4b1",networkId:"42161",namespace:"eip155",platform:"evm",label:"Arbitrum",fullName:"Arbitrum One",logo:Cf,logoBackgroundColor:"#2b354d",logoWhiteBackground:Cf,currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:If.currency.logo},wrapped:{address:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",logo:If.wrapped.logo},stables:{usd:["0xaf88d065e77c8cC2239327C5EDb3A432268e5831","0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"]},explorer:"https://arbiscan.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://arbiscan.io/tx/${e.id||e}`:t?`https://arbiscan.io/token/${t}`:n?`https://arbiscan.io/address/${n}`:void 0,endpoints:["https://arbitrum.llamarpc.com","https://arbitrum-one.publicnode.com","https://arbitrum.rpc.thirdweb.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:If.currency.logo,type:"NATIVE"},{address:"0x82aF49447D8a07e3bd95BD0d56f35241523fBab1",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:If.wrapped.logo,type:"20"},{address:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xFF970A61A04b1cA14834A43f5dE4533eBDDB5CC8/logo.png",type:"20"},{address:"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9/logo.png",type:"20"},{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1/logo.png",type:"20"},{address:"0x912CE59144191C1204E64559FE8253a0e49E6548",symbol:"ARB",name:"Arbitrum",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/arbitrum/assets/0x912CE59144191C1204E64559FE8253a0e49E6548/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",blockTime:250};const zf="https://traderjoexyz.com/static/media/avalanche.7c81486190237e87e238c029fd746008.svg",Pf="https://raw.githubusercontent.com/traderjoe-xyz/joe-tokenlists/main/logos/0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7/logo.png";var _f={name:"avalanche",id:"0xa86a",networkId:"43114",namespace:"eip155",platform:"evm",label:"Avalanche",fullName:"Avalanche C-Chain",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0zNTkuMSA3NTEuMWgtOTUuM2MtMjAgMC0yOS45IDAtMzYtMy44LTYuNi00LjMtMTAuNC0xMS4zLTEwLjktMTguOS0uMy03LjEgNC42LTE1LjggMTQuNC0zM2wyMzUtNDE0LjNjMTAuMS0xNy42IDE1LjEtMjYuNCAyMS40LTI5LjYgNi45LTMuNSAxNS4xLTMuNSAyMS45IDAgNi40IDMuMyAxMS40IDEyIDIxLjQgMjkuNmw0OC40IDg0LjMuMi41YzEwLjggMTguOSAxNi4zIDI4LjUgMTguNiAzOC41IDIuNiAxMC45IDIuNiAyMi42IDAgMzMuNS0yLjQgMTAuMS03LjggMTkuOC0xOC44IDM4LjlMNDU2LjIgNjk0LjlsLS4zLjVjLTEwLjggMTktMTYuMyAyOC43LTI0LjEgMzYtOC4zIDgtMTguMyAxMy43LTI5LjMgMTYuOS05LjkgMi44LTIxLjEgMi44LTQzLjQgMi44em0yNDAuMyAwaDEzNi40YzIwLjIgMCAzMC4yIDAgMzYuMy00IDYuNi00LjMgMTAuNi0xMS4zIDEwLjktMTkuMS4zLTYuOS00LjUtMTUuMi0xMy45LTMxLjZsLTEtMS43TDY5OS44IDU3OGwtLjgtMS4yYy05LjYtMTYuMy0xNC40LTI0LjUtMjAuNy0yNy42LTYuOS0zLjYtMTUtMy42LTIxLjcgMC02LjIgMy4zLTExLjMgMTEuOC0yMS4zIDI5bC02OC4xIDExNi45LS4yLjNjLTEwLjEgMTcuMi0xNSAyNS44LTE0LjUgMzIuOC41IDcuNyA0LjUgMTQuOSAxMC45IDE5IDUuNyAzLjkgMTUuOCAzLjkgMzYgMy45eiIgZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",logoBackgroundColor:"#E84142",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik0yMzUuNiAyNTkuNWg1MjguOXY0ODFIMjM1LjZ2LTQ4MXoiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJNOTI4IDUwMGMwIDIzNi40LTE5MS42IDQyOC00MjggNDI4UzcyIDczNi40IDcyIDUwMCAyNjMuNiA3MiA1MDAgNzJzNDI4IDE5MS42IDQyOCA0Mjh6TTM3OC43IDY3MC4zaC04My4xYy0xNy41IDAtMjYuMSAwLTMxLjMtMy40LTUuNy0zLjctOS4xLTkuOC05LjYtMTYuNS0uMy02LjIgNC0xMy44IDEyLjYtMjguOUw0NzIuNSAyNjBjOC43LTE1LjQgMTMuMS0yMyAxOC43LTI1LjkgNi0zIDEzLjEtMyAxOS4xIDAgNS42IDIuOCAxMCAxMC41IDE4LjcgMjUuOWw0Mi4yIDczLjYuMi40YzkuNCAxNi41IDE0LjIgMjQuOCAxNi4zIDMzLjYgMi4zIDkuNiAyLjMgMTkuNiAwIDI5LjItMi4xIDguOC02LjggMTcuMi0xNi40IDM0TDQ2My42IDYyMS4ybC0uMy41Yy05LjUgMTYuNi0xNC4zIDI1LTIxIDMxLjQtNy4zIDYuOS0xNiAxMi0yNS41IDE0LjgtOC43IDIuNC0xOC41IDIuNC0zOC4xIDIuNHptMjA5LjggMGgxMTljMTcuNiAwIDI2LjQgMCAzMS43LTMuNSA1LjctMy43IDkuMi05LjkgOS42LTE2LjYuMy02LTMuOS0xMy4zLTEyLjItMjcuNWwtLjktMS41LTU5LjYtMTAyLS43LTEuMWMtOC40LTE0LjItMTIuNi0yMS4zLTE4LTI0LjEtNi0zLTEzLjEtMy0xOSAwLTUuNSAyLjgtOS45IDEwLjMtMTguNiAyNS4zbC01OS40IDEwMi0uMi40Yy04LjcgMTUtMTMgMjIuNS0xMi43IDI4LjcuNCA2LjcgMy45IDEyLjkgOS42IDE2LjYgNSAzLjMgMTMuOCAzLjMgMzEuNCAzLjN6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2U4NDE0MiIvPjwvc3ZnPg==",currency:{name:"Avalanche",symbol:"AVAX",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:zf},wrapped:{address:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",logo:Pf},stables:{usd:["0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7","0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"]},explorer:"https://snowtrace.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://snowtrace.io/tx/${e.id||e}`:t?`https://snowtrace.io/token/${t}`:n?`https://snowtrace.io/address/${n}`:void 0,endpoints:["https://avalanche-c-chain-rpc.publicnode.com","https://avalanche-c-chain.publicnode.com","https://avalanche-api.flare.network/ext/bc/C/rpc"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"AVAX",name:"Avalanche",decimals:18,logo:zf,type:"NATIVE"},{address:"0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7",symbol:"WAVAX",name:"Wrapped AVAX",decimals:18,logo:Pf,type:"20"},{address:"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7/logo.png",type:"20"},{address:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E/logo.png",type:"20"},{address:"0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xd586E7F844cEa2F87f50152665BCbc2C279D8d70/logo.png",type:"20"},{address:"0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD",symbol:"EUROC",name:"EURO Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/avalanchec/assets/0xC891EB4cbdEFf6e073e859e987815Ed1505c2ACD/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",blockTime:2e3};const Bf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALsAAAC7CAMAAAAKTh9YAAAAYFBMVEVHcEz////////////////////////////////////j++ma6qVj5nsl5lAK4zpA6mXO79aD8Zyr87uCvq0J2TkItEkOhl4EeVsKzSwLrxMNtQpjsZG42dEeuxyF2oU6wzjPwJjeAAAACnRSTlMAEUB9r9j/YO+Kf6/iMwAABD1JREFUeAHU1EESQjEMAlBIAq33v7ArV7+OLss7AZOB4IDVI/kW0nQRf+Ca7QvNwg/s7VtpGJP8oPFNybdT4aidoPHEcYZn6ymnEEOjH8KPk0zeTI+DLacpfMhpxKTGnFtDB9o8/Jisw8uxh1/OtGIrYw9Ah9pEOVWhnaoxTvWCnErR2Z3rzX59JMYOAkEYXr1gRJfIzP1PalbOpZm2aEf+tcKnCCz7bS37si/7si/7si/7si/7srvRHAE5kJHdbV4wkn076Q9RMMLu04fYnceT/An9JnhMkr19Ezwvvvee73ieOL1dfdN15yQlwas2S7vbgTn4iLfaDO0emIPPeLtgZt+AOfhcQHJGdieYg88VLG9k98AUfG7gBRu7YAo+9wpeNLEnYAY+915wkIndQ4Xn9IajgoV9hwbP6b3iqGRhF5zH537VHi3swGl87tft3tB+Ap/7Z9lFhef0z3hndmjwnP4Z32qEAs/po4//Rwao8JzeC3hiMyeACs/ppnMCUlThOf3wxjurObAKz+kHNz5arT0CNHhO5zde7NZ8UYXn9N4K2Utnt8NzOsFL+Kuz2+EJneA5nduN8bmTWsXzKqNzuyX+FZ3rL43Sud0Un/txtV7KqNY+6Hq7Kb71Gxt0W7seX5od/Z6a+8BuGASCMMwraRK4103A9z9leq+Q3zCYC+h7oy7tbr6d4zGd2zme04Ed4AEd2AEe0Kmd4wGd2jke0Kmd4wGd2jke0Kmd4wGd2jke0Kmd4wGd2Tl+B+jQzvH7j/ThnNub4Xd7Rud2gLc9pyM7wO9sz+nEDvA7e8G/0vX2IeTan/DXPdWL+cwD/hl/c3r2lT2u7XbWk31aYt9vesp9yD5Xn1ZPx7svtNtMYwfX9/hqjwAvuq8awIufZwzgxc+RZgAvfn43gBe/N5lxPLAD+sTs2HgnS53jnS51jHfC1CneKVOHeCdNneGdNnWEd+LUCd6pUwd4p04d4J06dYB3tekAL64nSAAvr+PgeGYHdI6ndkDneGoHdI4HdkAvxw/V7IsiegU8sIdSejk+VbIvyumveBY8twdQh51A8PL691x8PBf3HRD8oO33QPhR2mfD8EnZ3wTxXthXRvFe18+H8anbPsqkOVfnnJ6DF/RmPdE5vs69aQiYnoH3rXuzXukcP6jmE3C8734uxAgfgSvM4+D4RcV37SmgZ+BT6/kz0yd6KT5+kcex9bel+fDPupXP+MOs8byl6esGYfRxbDPnanG0OVf+8ODeH9Ks5f+mE50vJlp37d23EQQhFATRr6Yg/4RPuSe9o6tmIni7gN2222677bbbbrvttttuu5sw/7EP1j7kfhO6m5Wbak90Jw7d54NeGsV9jb0y1B+f+P5qpHB08XvD8M4zrq9N7pqje/L8jj/twXa8XOl4uSoe4/363RnvlyOo/LE1R8JnZfywrB7pGLY0Xa/gV5AhY9e5oJHCAAAAAElFTkSuQmCC",Rf="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAALsAAAC7CAYAAAA9kO9qAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAA0PSURBVHgB7d1LbFzVHcfx37l3/CDGxgkhxEnU2K1EgxoUN0kVUglhIhbdVAo7dpCiSl2BqbqphIRpuy5u95SwY1XSWlXVIhFXtGqjJsXQSJRCsXklaQiJ8zCxPTP3cv53cuOxZ8bjmbmP8z/n/5GMHcfjmPHXZ86ce++xQpJGxwdRwChCtQ9Q+nU4qt87CIVhCLGeEHP6v/NQag5h8DY8TKOEGcxMziMhCp2iwD0c1V/kE/QnUNxCJGdavxzHmRdfQYfajz2K3HsGKhyHBC7SN6dznUY5eEGP9nNoQ+uxS+Qib6GawL9++QJa1FrsB8fH9D/0sn5rGELka04PuMdwenJ6ozfwN/qB2D/+vP7ZOA4ZzYUZdIfqSQx9Fzj/979s5AbNR3aatvieHs3DoxDCSOqEnssfa7Zys37s0VKiOqmXhUYhhMlCvUwZhI+sF3zj2CV0wU2T4L2GN6Spi4QuOFG612jKXV/9J6j0ZFThRxCCnz2NnrTWTmMqy4snIQRnSk9n1ixL1k5jKuvoQvBGHdPzziqrY4/W0uWAkbDCMDw1Xv2OlWnM6PgwfDULIewxj3I4Eq/OrIzsvpqAEHYZrB7dq6cxD0MI2yg8E8/dK7HvH38SMlcXdqpcb4E49sqFF0LY6VbfqnKil7oCIewVPVH1omtGhbBbdG20hwBjEMJ2AcWuvH0QwnYK+zyE4TCEsF2oaGSXy+yEA3TntPQ4DCHsN+xBCEdI7MIZErtwhsQunCGxC2dI7MIZErtwhsQunCGxC2dI7MIZErtwhsQunCGxC2dI7MIZErtwRgEWU30loK9c+cOCj3DB6v/dtqltS7ffDi/2wFZWffcpbv/IJXh7r8Hfe70SexWKPZjdhPKpzdGLzd/Y9dD9Uzh0BR69VIUeo/somO1D6c0tCN6y50I2hQPPhmCORqauxz9D4cjnLd2u9MY9KL6605noC9+/EN1PaweB9dB9Q/cR3VfcsY+9nW/gWsWpIRRf+hpspUa+RM/T/4OnX7eLol987n7WAwPb2Cnurqdn9cPxZSTBhm9mPfRo1/XUxx0NBtWWX9qN0tR2cMRyNYa+cT2/eDex0KPPqadCvfpzqjpzWK4Kj51D99MfJhY66X7qo+jRlCOWsdNI1clDciM2Be8/9AW6n/gEaaDg6UkuN+xip1Gl1SeirbAheH/0Krp/OIc09fz0v4k+YmSBVewUYBYPoZyD976xgMLjn0INpBui0scv6BGWE1ax06qLl1GAHIOn0D09qvt7biAL9Airdic/nUwLq9iznidyCj4KXb/438l2q/2uR9ObUiaNTex+g6N9aeMQfBx69PaORWTJPyKxJ45iz4vJwVeHrrYupz5XX4vm7mpkARywiT3v0EwMvjr0SH8RefBHeMzb2cTuGXCHmhR8Tej0Pj2y54HLk3g+I7sha7omBF8v9EhPgDxI7BbLM/iGoedpyQcHbGIPDDtBK4/gm4a+lM+3M7zK47IINrGbeDZilsFvZEQPr3UhD3ShBwd8Yp/dBBNlEfxGpy7huV7kIfjkDnDAJvbSqc0wVZrBtzJHD68X9Oie7ZSCHnHz+iFrFZ85+9kBoy+YTiP4dp6MBu/diSwV/3gvuGC1GlOaMvuOTTL4dlddyu/chTDDJ6rlv20BF8xiHzJuVWatJILvaHlRhx68M4AsFF/dxeoyRlaxhws+ln/9dZiuk+CTWEePRveU5+7xrgOcsDuoRHN3DndyO8EndsBIj+6l3w2lNp2h5050cTo3LI+g0sOnbcEnfWSUVmZKJ5IPPg6d4y4MPnYcngBDNMIT2vnLZHQKLO2+RTuQocFqUmqnANz0EX5wZ3QSnUrgvJnwcjcWJ/YYe8yjGbaxExuCT/1cl2VPx9kXxa46OCuy/O8BLP38Pr2mzuMAUj2sYyecg8/spC4dPB3SD/7T33L0wWe9KP15G5Z/sxuY7wZnVuz1SLoe/zS6INt08c5jqr+U29mL9G+rHYt6erMQnRZMf7799ekfDFzqRqBfwvf6EdzwUT6tf0Cv898D15rYCZvg9dy3+Id7jQ8oLCprQidWnc/OZpVmyzK6jp4H+s3dZMi20Il1F2+wCV6HbmrwNoZOrLxSSYJvn62hE2svy5PgW2dz6MTqa1Al+I2zPXRi/QXXEnxzLoROnNhdQIJvzJXQiTNbaUjwtVwKnTi1b4wEv8K10IlzmyRJ8G6GTpzcEczl4F0NnTi7/R234NWmzi/idjl04vRej6yCf/R9qJ4OfmnvTc/p0InzG5tyCR67+tB94FRbwUvoFbKLL3gF3/PAmy0Ffzv0mzx22k2TxH4Lh+DDzVug+pY2HLyEvprEXsX44H0fwcBdUL1fNg1eQq8lsa9BwZemtsNYd1QueG4WvIReS2KvI9rWzdRNVLtXLnpuFHxAu+pK6DUk9jpom73gbD9MFPau3sqiXvDhZzy2kM6axN4ABc9FTfBlBVFLYm9Abcvn1yw2VS7Xffft4PuuAr35/NY800nsddDejP7eazBSg9hJHLw/fBGilsReh8l7z6jFm+v/faGI3u+9Dm/7FxCrSexr0EZLhSOfw1Tqxo3mH6OD3/SD30vwa0jsVTjsKKYWmscefVzvsgS/hsR+C4vQr1xed85e8/ES/CoSO/jsEen9/wJaJcGvcD52LqGrS/p5xHJ7y6ESfIXTsXMJnSL3znX2dUrwDsfOKXT/ww+QBNeDdzJ2dqEvJ3c01+XgnYvd5dBjrgbvVOwS+goXg3cmdgm9lmvBOxG7hN6YS8FbH7uE3pwrwVsdu4S+cS4Eb23sEnrrbA/eytgl9PbZHLx1sUvonbM1eKtiZ/Mbrq8pY0OP2Ri8NbGzCf1iDxZ/sg9Lf3oAprMteCtiZxX6c/dHr5dPHsTSyQMwnU3Bs4+dY+gxCT5brGPnHHpMgs8O29htCD0mwWeDZew2hR7jFrwavA5u2MVeOHTZutBjvIKf0q87/6VmWeIX+1Mfw3TthB7jErynR/auw2fBCavYaacub5vZo0knoce4BN99+B1Wozuv2A2fviQReoxD8DSd4TS6s4nd23vN6FE9ydBjHILv+vZ74IJN7IVDV2CqNEKPmR48zd25rMywiV2NtP/bndOUZugx04P3R86BAz6xGziFySL0mMnBezKyJ8u0+XqWocdMDd7r57EiI7v4tiGP0GNcliVNxCZ2U34vaZ6hx0wLPrie333RCj6xX+xG3kwIPWZS8MH8ZnDAJvbg7ADyZFLoMVOCD84PggM2sZdO5Td6mBh6LO/gg/l+BBfuBgd8pjGzfbnM200OPZZn8OXZIXDB6Amqj9LUvcgSh9BjeQW/pP9dLlgtPZamhjIb3TmFHss6+OJb9yHU0xguWMVOo3vx1R1IG8fQYxT84m/HkDaaq3Ma1Qm7g0o0upfeuAdp4Rx6rDjzzdSDX5p6mNWoTlgeQS2+tBvB7CYkzYbQY2kGv/j6gyi9vxPc+NhxeALcFD2U/7oVatdNeLsWkQT64Vn62R4rQo8FF7YivNIPf+Q8VGHjvxm7kXCxR4/oD6F46lvgSOHAsyEYS2KngdLUdv1cYKcxpyQkjc5KvOPYFLzN7Z+dGJy/Gzdfe4TNmno97GMndPovRV84cqml25X1UVmKPO+js1mhq4q6x860FD09EV1+cz+K/9wD7qyIPUbR0+V7/qEr8Pdeh+orrfp7GrlpulLWR2PLb2y1diRvxh8+F4VPmx35Q6s3PApLXQg+H0B5Ti8EvDuiX6e/+pUVq2Kv5/ZFH3rZ0tW4m4l2COitbJ/NbYWlFdZ/9216wpkWeuKJRfvvJ7l4QzhDYhfOkNiFMyR24QyJXThDYhfOkNiFMyR24QyJXThDYhfOkNiFMyR24QyJXThDYhfOkNiFMyj2OQhhvzkPIeYhhO105zr28G0IYTsVfuRBYQZC2C7EjKdn7RK7sJ+HaQ+lKHaZtwu7lWhkn5mk0GV0Fzabps4r6+xh+AqEsNdx+k8l9gAnIFMZYaNQH0c682I0mFdip6lMGP4KQthGhdPxmyunCwSYhIzuwjZlvBC/uRK7jO7CNkqHPjM5F/9x9YlgNLqHcq6MsAB1fPrFiep3rY6dRncvPAYhuKvTsV/zQef+MYedDyr9GDAGITii6cvpyeO1727kwI9f048FRyEEK+EJnJl8rN7fNL54oxwco5NnIAQX1GsZDafhat0bj44PwlMn9UeNQgiTUehB+Mit01/qWv+yPLohfQKoExDCWHrq0iR0sv7IXu3g+ARC9TyEMEn0ZHT1EmPjD23FwfExBOplfathCJEnWken5cXTk9MbvUlrscdklBd5oWumPX2kv6QPgDaZtqzVXuxkdHwYvtLR42EZ6UXqOog81n7s1faPP6k/0xNyIEokigJX4Yx+/Up0GnqbkceSiT1GS5UFvUwZYEx/5n36ixzW/8SgjPyiqeicrHC+sgGAmtGRvx1dMtph4NW+AiZycfiu2QTRAAAAAElFTkSuQmCC";var Uf={name:"gnosis",id:"0x64",networkId:"100",namespace:"eip155",label:"Gnosis",fullName:"Gnosis Chain",logo:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbDojZmZmfTwvc3R5bGU+PHBhdGggY2xhc3M9InN0MCIgZD0iTTMzMS45IDU1Ni41YzIzLjUgMCA0Ni40LTcuOCA2NS0yMi4yTDI0OCAzODUuNGMtMzUuOSA0Ni40LTI3LjQgMTEyLjkgMTguOSAxNDguOCAxOC42IDE0IDQxLjUgMjEuOSA2NSAyMS45di40em00NDIuMy0xMDYuMWMwLTIzLjUtNy44LTQ2LjQtMjIuMi02NUw2MDMuMiA1MzQuMmM0Ni40IDM1LjkgMTEyLjkgMjcuNCAxNDguOC0xOC45IDE0LjMtMTguNiAyMi4yLTQxLjQgMjIuMi02NC45eiIvPjxwYXRoIGNsYXNzPSJzdDAiIGQ9Im04NDkuMiAyODguNS02NS45IDY1LjljNTIuOSA2My42IDQ0LjcgMTU4LTE4LjkgMjExLjItNTUuNiA0Ni43LTEzNi42IDQ2LjctMTkyLjIgMEw1MDAgNjM3LjdsLTcyLjEtNzIuMWMtNjMuNiA1Mi45LTE1OCA0NC43LTIxMS4yLTE4LjktNDYuNy01NS42LTQ2LjctMTM2LjYgMC0xOTIuMmwtMzMuNi0zMy42LTMyLTMyLjNDMTEyLjMgMzUyLjIgOTIgNDI1LjMgOTIgNTAwYzAgMjI1LjIgMTgyLjggNDA4IDQwOCA0MDhzNDA4LTE4Mi44IDQwOC00MDhjLjMtNzQuNC0yMC42LTE0Ny44LTU4LjgtMjExLjV6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0iTTc5NS4xIDIxOC4zYy0xNTUuNC0xNjIuOC00MTMuNi0xNjktNTc2LjQtMTMuNy00LjkgNC42LTkuNSA5LjEtMTMuNyAxMy43LTEwLjEgMTAuOC0xOS42IDIxLjktMjguNyAzMy4zTDUwMCA1NzUuNGwzMjMuOC0zMjMuOGMtOC44LTExLjctMTguNi0yMi44LTI4LjctMzMuM3pNNTAwIDE0NS4yYzk1LjMgMCAxODQuMSAzNi45IDI1MSAxMDMuOEw1MDAgNTAwIDI0OSAyNDljNjYuNi02Ny4yIDE1NS43LTEwMy44IDI1MS0xMDMuOHoiLz48L3N2Zz4K",logoBackgroundColor:"#406958",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeD0iMCIgeT0iMCIgdmlld0JveD0iMCAwIDEwMDAgMTAwMCIgeG1sOnNwYWNlPSJwcmVzZXJ2ZSI+PHN0eWxlPi5zdDB7ZmlsbDojM2U2OTU3fTwvc3R5bGU+PHBhdGggY2xhc3M9InN0MCIgZD0iTTMyNC4yIDU1OS4xYzI0LjYgMCA0OC41LTguMiA2Ny45LTIzLjJMMjM2LjUgMzgwLjJjLTM3LjUgNDguNS0yOC43IDExOC4xIDE5LjggMTU1LjYgMTkuNSAxNC43IDQzLjMgMjIuOSA2Ny45IDIyLjl2LjR6TTc4Ni43IDQ0OC4xYzAtMjQuNi04LjItNDguNS0yMy4yLTY3LjlMNjA3LjkgNTM1LjhjNDguNSAzNy41IDExOC4xIDI4LjcgMTU1LjYtMTkuOCAxNS0xOS40IDIzLjItNDMuMyAyMy4yLTY3Ljl6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0ibTg2NS4yIDI3OC44LTY4LjkgNjguOWM1NS4zIDY2LjYgNDYuOCAxNjUuMi0xOS44IDIyMC44LTU4LjQgNDguOC0xNDIuNyA0OC44LTIwMSAwTDUwMCA2NDRsLTc1LjQtNzUuNGMtNjYuNiA1NS4zLTE2NS4yIDQ2LjgtMjIwLjgtMTkuOC00OC44LTU4LjQtNDguOC0xNDIuNyAwLTIwMWwtMzUuMi0zNS4yLTMzLjQtMzMuOGMtNDAuNiA2Ni42LTYxLjggMTQzLTYxLjggMjIxLjIgMCAyMzUuNSAxOTEuMSA0MjYuNiA0MjYuNiA0MjYuNlM5MjYuNiA3MzUuNSA5MjYuNiA1MDBjLjQtNzcuOC0yMS41LTE1NC42LTYxLjQtMjIxLjJ6Ii8+PHBhdGggY2xhc3M9InN0MCIgZD0iTTgwOC42IDIwNS41QzY0Ni4xIDM1LjEgMzc2LjEgMjguNyAyMDUuOCAxOTEuMWMtNS4xIDQuOC05LjkgOS42LTE0LjMgMTQuMy0xMC42IDExLjMtMjAuNSAyMi45LTMwIDM0LjhMNTAwIDU3OC44bDMzOC42LTMzOC42Yy05LjItMTIuMi0xOS41LTIzLjgtMzAtMzQuN3pNNTAwIDEyOWM5OS43IDAgMTkyLjUgMzguNiAyNjIuNSAxMDguNUw1MDAgNTAwIDIzNy41IDIzNy41QzMwNy4yIDE2Ny4yIDQwMC4zIDEyOSA1MDAgMTI5eiIvPjwvc3ZnPgo=",currency:{name:"xDAI",symbol:"xDAI",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:Bf},wrapped:{address:"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",logo:Rf},stables:{usd:["0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83"]},explorer:"https://gnosisscan.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://gnosisscan.io/tx/${e.id||e}`:t?`https://gnosisscan.io/token/${t}`:n?`https://gnosisscan.io/address/${n}`:void 0,endpoints:["https://rpc.gnosis.gateway.fm","https://rpc.gnosischain.com","https://gnosis-rpc.publicnode.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"xDAI",name:"xDAI",decimals:18,logo:Bf,type:"NATIVE"},{address:"0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d",symbol:"WXDAI",name:"Wrapped XDAI",decimals:18,logo:Rf,type:"20"},{address:"0x4ECaBa5870353805a9F068101A40E0f32ed605C6",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png",type:"20"},{address:"0xDDAfbb505ad214D7b80b1f830fcCc89B60fb7A83",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png",type:"20"},{address:"0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb",symbol:"GNO",name:"Gnosis",decimals:18,logo:"https://cdn.sushi.com/image/upload/f_auto,c_limit,w_16,q_auto/tokens/100/0x9C58BAcC331c9aa871AFD802DB6379a98e80CEdb.jpg",type:"20"},{address:"0xD057604A14982FE8D88c5fC25Aac3267eA142a08",symbol:"HOPR",name:"HOPR",decimals:18,logo:"https://hoprnet.org/assets/icons/hopr_icon.svg",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",blockTime:5e3};var Qf={name:"optimism",id:"0xa",networkId:"10",namespace:"eip155",label:"Optimism",fullName:"Optimism",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00ODcuMSAzOTUuN2MtNS4yLTE1LjgtMTMuMi0zMS43LTI2LjQtNDIuMi0xMy4yLTEwLjUtMjYuNC0yMS4yLTQ0LjktMjYuNC0xOC41LTUuMi0zNy04LTU4LjEtOC00Ny41IDAtODcuMSAxMC41LTExNi4xIDM0LjQtMjkgMjMuOC00Ny41IDU4LjEtNjAuNyAxMDIuOS0yLjYgMTUuOC04IDI5LTEwLjUgNDQuOS0yLjYgMTMuMi01LjIgMjktOCA0Mi4yLTIuNiAyMy44LTIuNiA0Mi4yIDIuNiA2MC43IDUuMiAxNS44IDEzLjIgMzEuNyAyNi40IDQyLjIgMTMuMiAxMC41IDI2LjQgMjEuMiA0NC45IDI2LjQgMTguNCA1LjIgMzcgOCA1OC4xIDggNDcuNSAwIDg3LjEtMTAuNSAxMTYuMS0zNC40czQ3LjUtNTguMSA2MC43LTEwMi45YzIuNi0xMy4yIDUuMi0yOSAxMC41LTQyLjIgMi42LTEzLjIgNS4yLTI5IDgtNDQuOSAyLjgtMjMuOCAyLjgtNDQuOC0yLjYtNjAuN3ptLTkyLjQgNjAuOGMtMi42IDEzLjItNS4yIDI2LjQtOCAzOS41LTIuNiAxMy4yLTUuMiAyNi40LTEwLjUgNDIuMi01LjIgMjMuOC0xNS44IDM5LjUtMjkgNTAuMi0xMy4yIDEwLjUtMjkgMTUuOC00Ny41IDE1LjgtMTguNCAwLTMxLjctNS4yLTM5LjUtMTUuOC04LTEwLjUtMTAuNS0yOS01LjItNTAuMiAyLjYtMTUuOCA1LjItMjkgOC00Mi4yIDIuNi0xMy4yIDUuMi0yNi40IDEwLjUtMzkuNSA1LjItMjMuOCAxNS44LTM5LjUgMjktNTAuMiAxMy4yLTEwLjUgMjktMTUuOCA0Ny41LTE1LjggMTguNCAwIDMxLjcgNS4yIDM5LjUgMTUuOCA3LjkgMTAuNiAxMC41IDI2LjMgNS4yIDUwLjJ6bTQ0MC45LTY4LjZjLTUuMi0xNS44LTEzLjItMjYuNC0yMy44LTM3cy0yMy44LTE1LjgtNDIuMi0yMS4yYy0xNS44LTUuMi0zNC40LTgtNTUuNC04SDU3OS43Yy0yLjYgMC01LjIgMC0xMC41IDIuNi0yLjYgMi42LTUuMiA1LjItNS4yIDhsLTY4LjYgMzI3LjRjMCAyLjYgMCA4IDIuNiA4IDIuNiAyLjYgNS4yIDIuNiA4IDIuNmg2OC42YzIuNiAwIDggMCAxMC41LTIuNnM1LjItNS4yIDUuMi04bDIzLjgtMTEwLjloNjguNmM0Mi4yIDAgNzYuNi04IDEwMi45LTI2LjQgMjYuNC0xOC40IDQyLjItNDcuNSA1MC4yLTg0LjYgNS4xLTE4LjQgNS4xLTM2LjctLjItNDkuOXpNNzQzLjEgNDM4Yy0yLjYgMTUuOC0xMC41IDI2LjQtMjEuMiAzNC40cy0yMy44IDEwLjUtMzcgMTAuNWgtNTguMWwxOC40LTg5LjdoNjAuN2MxMy4yIDAgMjEuMiAyLjYgMjYuNCA1LjIgNS4yIDUuMiAxMC41IDEwLjUgMTAuNSAxNS44IDMgNS4yIDMgMTMuMi4zIDIzLjh6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2ZmZiIvPjwvc3ZnPg==",logoBackgroundColor:"#FF0420",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxjaXJjbGUgY3g9IjUwMCIgY3k9IjUwMCIgcj0iMzk2LjYiIGZpbGw9IiNmZmYiLz48cGF0aCBkPSJNNTAwIDg5Ni42YzIxOS4xIDAgMzk2LjYtMTc3LjYgMzk2LjYtMzk2LjZTNzE5LjEgMTAzLjQgNTAwIDEwMy40IDEwMy40IDI4MC45IDEwMy40IDUwMCAyODAuOSA4OTYuNiA1MDAgODk2LjZ6TTM1MC43IDYwOWMxMC45IDMuNCAyMi42IDUuMSAzNS4zIDUuMSAyOS4xIDAgNTIuNC02LjcgNjkuNi0yMC4yIDE3LjMtMTMuNyAyOS4zLTM0LjMgMzYuMi02MS44IDItOC42IDMuOS0xNy4zIDUuNy0yNS45IDItOC42IDMuNy0xNy40IDUuMS0yNi4yIDIuNC0xMy43IDItMjUuNi0xLjItMzUuOS0zLTEwLjItOC4zLTE4LjktMTYtMjUuOS03LjQtNy0xNi42LTEyLjMtMjcuNC0xNS43LTEwLjctMy42LTIyLjMtNS40LTM1LTUuNC0yOS4zIDAtNTIuNyA3LTY5LjkgMjEuMXMtMjkuMiAzNC43LTM1LjkgNjEuOGMtMiA4LjgtNCAxNy42LTYgMjYuMi0xLjggOC42LTMuNSAxNy4zLTUuMSAyNS45LTIuMiAxMy43LTEuOCAyNS42IDEuMiAzNS45IDMuMiAxMC4yIDguNSAxOC44IDE2IDI1LjYgNy40IDYuOCAxNi42IDExLjkgMjcuNCAxNS40em02Ny44LTQ4Yy04LjIgNi40LTE3LjggOS42LTI4LjYgOS42LTExLjEgMC0xOS0zLjItMjMuOC05LjYtNC44LTYuNC02LTE2LjctMy42LTMwLjcgMS42LTguOCAzLjItMTcuMiA0LjgtMjUgMS44LTcuOCAzLjgtMTYgNi0yNC40IDMuNC0xNC4xIDkuMS0yNC4zIDE3LjItMzAuNyA4LjItNi40IDE3LjgtOS42IDI4LjYtOS42czE4LjggMy4yIDIzLjggOS42IDYuMiAxNi43IDMuNiAzMC43Yy0xLjQgOC40LTMgMTYuNi00LjggMjQuNC0xLjYgNy44LTMuNSAxNi4yLTUuNyAyNS0zLjQgMTQtOS4yIDI0LjMtMTcuNSAzMC43em05MS43IDQ4YzEuMiAxLjQgMi44IDIuMSA0LjggMi4xaDQxYzIuMiAwIDQuMS0uNyA1LjctMi4xIDEuOC0xLjQgMi45LTMuMiAzLjMtNS40bDEzLjktNjZoNDAuN2MyNS45IDAgNDYuNS01LjUgNjEuOC0xNi42IDE1LjUtMTEuMSAyNS43LTI4LjEgMzAuNy01MS4yIDIuNC0xMS43IDIuMy0yMS44LS4zLTMwLjQtMi42LTguOC03LjItMTYuMi0xMy45LTIyLTYuNi01LjgtMTUtMTAuMS0yNS0xMy05LjgtMi44LTIwLjktNC4yLTMzLjItNC4yaC04MC4yYy0yIDAtMy45LjctNS43IDIuMS0xLjggMS40LTIuOSAzLjItMy4zIDUuNEw1MDkgNjAzLjVjLS40IDIuMiAwIDQgMS4yIDUuNXptMTExLjItMTEzLjFoLTM0LjdsMTEuOC01NGgzNi4yYzcuMiAwIDEyLjYgMS4yIDE2IDMuNiAzLjYgMi40IDUuNyA1LjYgNi4zIDkuNi42IDQgLjQgOC42LS42IDEzLjktMiA5LTYuMyAxNS44LTEzIDIwLjItNi40IDQuNS0xMy44IDYuNy0yMiA2Ljd6IiBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZmlsbD0iI2ZmMDQyMCIvPjwvc3ZnPg==",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:If.currency.logo},wrapped:{address:"0x4200000000000000000000000000000000000006",logo:If.wrapped.logo},stables:{usd:["0x94b008aA00579c1307B0EF2c499aD98a8ce58e58","0x7F5c764cBc14f9669B88837ca1490cCa17c31607"]},explorer:"https://optimistic.etherscan.io",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://optimistic.etherscan.io/tx/${e.id||e}`:t?`https://optimistic.etherscan.io/token/${t}`:n?`https://optimistic.etherscan.io/address/${n}`:void 0,endpoints:["https://optimism.llamarpc.com","https://optimism.publicnode.com","https://optimism.rpc.thirdweb.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:If.currency.logo,type:"NATIVE"},{address:"0x4200000000000000000000000000000000000006",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:If.wrapped.logo,type:"20"},{address:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",symbol:"USDT",name:"Tether",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/assets/0x94b008aA00579c1307B0EF2c499aD98a8ce58e58/logo.png",type:"20"},{address:"0x7F5c764cBc14f9669B88837ca1490cCa17c31607",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/assets/0x7F5c764cBc14f9669B88837ca1490cCa17c31607/logo.png",type:"20"},{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"},{address:"0x4200000000000000000000000000000000000042",symbol:"OP",name:"Optimism",decimals:18,logo:"https://user-images.githubusercontent.com/1300064/219575413-d7990d69-1d21-44ef-a2b1-e9c682c79802.svg",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",blockTime:2e3};var Wf={name:"base",id:"0x2105",networkId:"8453",namespace:"eip155",label:"Base",fullName:"Base",logo:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00OTguNiA4NDJDNjg4IDg0MiA4NDIgNjg4LjkgODQyIDQ5OS41UzY4OCAxNTcgNDk4LjYgMTU3QzMxOSAxNTcgMTcxLjIgMjk1LjEgMTU3IDQ3MC4zaDQ1My4xdjU3LjVIMTU3QzE3MiA3MDMuOSAzMTkgODQyIDQ5OC42IDg0MnoiIGZpbGw9IiNmZmYiLz48L3N2Zz4=",logoBackgroundColor:"#0052FF",logoWhiteBackground:"data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxMDAwIDEwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxwYXRoIGQ9Ik00OTguOSA4NDVDNjkwLjEgODQ1IDg0NSA2OTAuMyA4NDUgNDk5LjVTNjkwLjEgMTU0IDQ5OC45IDE1NEMzMTcuNiAxNTQgMTY4LjggMjkzLjMgMTU0IDQ3MC41aDQ1Ny40djU4LjFIMTU0QzE2OC44IDcwNS44IDMxNy42IDg0NSA0OTguOSA4NDV6IiBmaWxsPSIjMDA1MmZmIi8+PC9zdmc+",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:If.currency.logo},wrapped:{address:"0x4200000000000000000000000000000000000006",logo:If.wrapped.logo},stables:{usd:["0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA"]},explorer:"https://basescan.org",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://basescan.org/tx/${e.id||e}`:t?`https://basescan.org/token/${t}`:n?`https://basescan.org/address/${n}`:void 0,endpoints:["https://base-rpc.publicnode.com","https://base.llamarpc.com","https://base.rpc.thirdweb.com"],tokens:[{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:If.currency.logo,type:"NATIVE"},{address:"0x4200000000000000000000000000000000000006",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:If.wrapped.logo,type:"20"},{address:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",symbol:"USDC",name:"USD Coin",decimals:6,logo:"https://ethereum-optimism.github.io/data/USDC/logo.png",type:"20"},{address:"0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA",symbol:"USDbC",name:"USD Base Coin",decimals:6,logo:"https://ethereum-optimism.github.io/data/USDC/logo.png",type:"20"},{address:"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",symbol:"DAI",name:"Dai Stablecoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x6B175474E89094C44Da98b954EedeAC495271d0F/logo.png",type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",blockTime:2e3};var Yf={name:"worldchain",id:"0x1e0",networkId:"480",namespace:"eip155",platform:"evm",label:"World Chain",fullName:"World Chain Mainnet",logo:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIj4KICA8Zz4KICAgIDxnPgogICAgICA8cGF0aCBmaWxsPSIjRkZGRkZGIiBkPSJNMjQuNSwxMi40Yy0uNS0xLjEtMS4xLTIuMS0yLTIuOS0uOS0uOS0xLjgtMS41LTIuOS0yLTEuMS0uNS0yLjMtLjctMy42LS43cy0yLjUuMi0zLjYuN2MtMS4xLjUtMi4xLDEuMS0yLjksMi0uOS45LTEuNSwxLjgtMiwyLjktLjUsMS4xLS43LDIuNC0uNywzLjZzLjIsMi40LjcsMy42Yy41LDEuMSwxLjEsMi4xLDIsMi45LjkuOSwxLjgsMS41LDIuOSwyLDEuMS41LDIuNC43LDMuNi43czIuNC0uMiwzLjYtLjdjMS4xLS41LDIuMS0xLjEsMi45LTIsLjktLjksMS41LTEuOCwyLTIuOS41LTEuMS43LTIuNC43LTMuNnMtLjItMi40LS43LTMuNlpNMTMsMTUuMWMuMy0xLjUsMS43LTIuNSwzLjMtMi41aDYuNGMuNC44LjcsMS43LjcsMi41aC0xMC41Wk0yMy40LDE2LjljLS4xLjktLjMsMS44LS43LDIuNWgtNi40Yy0xLjYsMC0yLjktMS4xLTMuMy0yLjUsMCwwLDEwLjUsMCwxMC41LDBaTTEwLjcsMTAuN2MxLjQtMS40LDMuMy0yLjIsNS4zLTIuMnMzLjkuNyw1LjMsMi4yaC4xYzAsLjEtNS4yLjEtNS4yLjEtMS40LDAtMi42LjUtMy42LDEuNS0uNy43LTEuMywxLjctMS40LDIuOGgtMi42Yy4yLTEuNy45LTMuMiwyLjEtNC40aDBaTTE2LDIzLjVjLTIsMC0zLjktLjctNS4zLTIuMi0xLjItMS4yLTItMi44LTIuMS00LjRoMi42Yy4yLDEsLjcsMiwxLjQsMi44LDEsMSwyLjIsMS41LDMuNiwxLjVoNS4yLS4xYy0xLjQsMS42LTMuMywyLjMtNS4zLDIuM2gwWiIvPgogICAgPC9nPgogIDwvZz4KPC9zdmc+Cg==",logoBackgroundColor:"#000000",logoWhiteBackground:"data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgdmlld0JveD0iMCAwIDMyIDMyIj4KICA8Zz4KICAgIDxnPgogICAgICA8cGF0aCBmaWxsPSIjMDAwMDAwIiBkPSJNMjQuNSwxMi40Yy0uNS0xLjEtMS4xLTIuMS0yLTIuOS0uOS0uOS0xLjgtMS41LTIuOS0yLTEuMS0uNS0yLjMtLjctMy42LS43cy0yLjUuMi0zLjYuN2MtMS4xLjUtMi4xLDEuMS0yLjksMi0uOS45LTEuNSwxLjgtMiwyLjktLjUsMS4xLS43LDIuNC0uNywzLjZzLjIsMi40LjcsMy42Yy41LDEuMSwxLjEsMi4xLDIsMi45LjkuOSwxLjgsMS41LDIuOSwyLDEuMS41LDIuNC43LDMuNi43czIuNC0uMiwzLjYtLjdjMS4xLS41LDIuMS0xLjEsMi45LTIsLjktLjksMS41LTEuOCwyLTIuOS41LTEuMS43LTIuNC43LTMuNnMtLjItMi40LS43LTMuNlpNMTMsMTUuMWMuMy0xLjUsMS43LTIuNSwzLjMtMi41aDYuNGMuNC44LjcsMS43LjcsMi41aC0xMC41Wk0yMy40LDE2LjljLS4xLjktLjMsMS44LS43LDIuNWgtNi40Yy0xLjYsMC0yLjktMS4xLTMuMy0yLjUsMCwwLDEwLjUsMCwxMC41LDBaTTEwLjcsMTAuN2MxLjQtMS40LDMuMy0yLjIsNS4zLTIuMnMzLjkuNyw1LjMsMi4yaC4xYzAsLjEtNS4yLjEtNS4yLjEtMS40LDAtMi42LjUtMy42LDEuNS0uNy43LTEuMywxLjctMS40LDIuOGgtMi42Yy4yLTEuNy45LTMuMiwyLjEtNC40aDBaTTE2LDIzLjVjLTIsMC0zLjktLjctNS4zLTIuMi0xLjItMS4yLTItMi44LTIuMS00LjRoMi42Yy4yLDEsLjcsMiwxLjQsMi44LDEsMSwyLjIsMS41LDMuNiwxLjVoNS4yLS4xYy0xLjQsMS42LTMuMywyLjMtNS4zLDIuM2gwWiIvPgogICAgPC9nPgogIDwvZz4KPC9zdmc+Cg==",currency:{name:"Ether",symbol:"ETH",decimals:18,address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",logo:If.currency.logo},wrapped:{address:"0x4200000000000000000000000000000000000006",logo:If.wrapped.logo},stables:{usd:["0x79A02482A880bCE3F13e09Da970dC34db4CD24d1"]},explorer:"https://worldchain-mainnet.explorer.alchemy.com",explorerUrlFor:({transaction:e,token:t,address:n})=>e?`https://worldchain-mainnet.explorer.alchemy.com/tx/${e.id||e}`:t?`https://worldchain-mainnet.explorer.alchemy.com/token/${t}`:n?`https://worldchain-mainnet.explorer.alchemy.com/address/${n}`:void 0,endpoints:["https://worldchain-mainnet.g.alchemy.com/public","https://480.rpc.thirdweb.com"],tokens:[{address:"0x2cFc85d8E48F8EAB294be644d9E25C3030863003",symbol:"WLD",name:"Worldcoin",decimals:18,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/assets/0xdC6fF44d5d932Cbd77B52E5612Ba0529DC6226F1/logo.png",type:"20"},{address:"0x79A02482A880bCE3F13e09Da970dC34db4CD24d1",symbol:"USDC.e",name:"Bridged USDC",decimals:6,logo:"https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/optimism/assets/0x7F5c764cBc14f9669B88837ca1490cCa17c31607/logo.png",type:"20"},{address:"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE",symbol:"ETH",name:"Ether",decimals:18,logo:If.currency.logo,type:"NATIVE"},{address:"0x4200000000000000000000000000000000000006",symbol:"WETH",name:"Wrapped Ether",decimals:18,logo:If.wrapped.logo,type:"20"}],zero:"0x0000000000000000000000000000000000000000",maxInt:"115792089237316195423570985008687907853269984665640564039457584007913129639935",permit2:"0x000000000022D473030F116dDEE9F6B43aC78BA3",blockTime:2e3};const Ff=[If,bf,Lf,Df,Ef,Of,_f,Uf,Qf,Wf,Yf];var Vf={ethereum:If,bsc:bf,polygon:Lf,solana:Df,fantom:Ef,arbitrum:Of,avalanche:_f,gnosis:Uf,optimism:Qf,base:Wf,worldchain:Yf,all:Ff,findById:function(e){let t=e;return t.match("0x0")&&(t=t.replace(/0x0+/,"0x")),Ff.find((e=>e.id&&e.id.toLowerCase()==t.toLowerCase()))},findByNetworkId:function(e){return e=e.toString(),Ff.find((t=>t.networkId==e))},findByName:function(e){return Ff.find((t=>t.name==e))}},Hf="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function Gf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function qf(e){var t={exports:{}};return e(t,t.exports),t.exports}for(var Zf=function(e){var t=ip(e),n=t[0],r=t[1];return 3*(n+r)/4-r},Jf=function(e){var t,n,r=ip(e),i=r[0],o=r[1],a=new ep(function(e,t,n){return 3*(t+n)/4-n}(0,i,o)),s=0,u=o>0?i-4:i;for(n=0;n<u;n+=4)t=$f[e.charCodeAt(n)]<<18|$f[e.charCodeAt(n+1)]<<12|$f[e.charCodeAt(n+2)]<<6|$f[e.charCodeAt(n+3)],a[s++]=t>>16&255,a[s++]=t>>8&255,a[s++]=255&t;2===o&&(t=$f[e.charCodeAt(n)]<<2|$f[e.charCodeAt(n+1)]>>4,a[s++]=255&t);1===o&&(t=$f[e.charCodeAt(n)]<<10|$f[e.charCodeAt(n+1)]<<4|$f[e.charCodeAt(n+2)]>>2,a[s++]=t>>8&255,a[s++]=255&t);return a},Xf=function(e){for(var t,n=e.length,r=n%3,i=[],o=16383,a=0,s=n-r;a<s;a+=o)i.push(op(e,a,a+o>s?s:a+o));1===r?(t=e[n-1],i.push(Kf[t>>2]+Kf[t<<4&63]+"==")):2===r&&(t=(e[n-2]<<8)+e[n-1],i.push(Kf[t>>10]+Kf[t>>4&63]+Kf[t<<2&63]+"="));return i.join("")},Kf=[],$f=[],ep="undefined"!=typeof Uint8Array?Uint8Array:Array,tp="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",np=0,rp=tp.length;np<rp;++np)Kf[np]=tp[np],$f[tp.charCodeAt(np)]=np;function ip(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=e.indexOf("=");return-1===n&&(n=t),[n,n===t?0:4-n%4]}function op(e,t,n){for(var r,i,o=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(255&e[a+2]),o.push(Kf[(i=r)>>18&63]+Kf[i>>12&63]+Kf[i>>6&63]+Kf[63&i]);return o.join("")}$f["-".charCodeAt(0)]=62,$f["_".charCodeAt(0)]=63;var ap={byteLength:Zf,toByteArray:Jf,fromByteArray:Xf},sp=function(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<<s)-1,c=u>>1,l=-7,h=n?i-1:0,d=n?-1:1,f=e[t+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+e[t+h],h+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+e[t+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)},up=function(e,t,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(t*u-1)*Math.pow(2,i),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;e[n+f]=255&a,f+=p,a/=256,c-=8);e[n+f-p]|=128*y},cp=qf((function(e,t){const n="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;t.Buffer=o,t.SlowBuffer=function(e){+e!=e&&(e=0);return o.alloc(+e)},t.INSPECT_MAX_BYTES=50;const r=2147483647;function i(e){if(e>r)throw new RangeError('The value "'+e+'" is invalid for option "size"');const t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,n){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return u(e)}return a(e,t,n)}function a(e,t,n){if("string"==typeof e)return function(e,t){"string"==typeof t&&""!==t||(t="utf8");if(!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);const n=0|d(e,t);let r=i(n);const a=r.write(e,t);a!==n&&(r=r.slice(0,a));return r}(e,t);if(ArrayBuffer.isView(e))return function(e){if(H(e,Uint8Array)){const t=new Uint8Array(e);return l(t.buffer,t.byteOffset,t.byteLength)}return c(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(H(e,ArrayBuffer)||e&&H(e.buffer,ArrayBuffer))return l(e,t,n);if("undefined"!=typeof SharedArrayBuffer&&(H(e,SharedArrayBuffer)||e&&H(e.buffer,SharedArrayBuffer)))return l(e,t,n);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');const r=e.valueOf&&e.valueOf();if(null!=r&&r!==e)return o.from(r,t,n);const a=function(e){if(o.isBuffer(e)){const t=0|h(e.length),n=i(t);return 0===n.length||e.copy(n,0,0,t),n}if(void 0!==e.length)return"number"!=typeof e.length||G(e.length)?i(0):c(e);if("Buffer"===e.type&&Array.isArray(e.data))return c(e.data)}(e);if(a)return a;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,n);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function s(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return s(e),i(e<0?0:0|h(e))}function c(e){const t=e.length<0?0:0|h(e.length),n=i(t);for(let r=0;r<t;r+=1)n[r]=255&e[r];return n}function l(e,t,n){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(n||0))throw new RangeError('"length" is outside of buffer bounds');let r;return r=void 0===t&&void 0===n?new Uint8Array(e):void 0===n?new Uint8Array(e,t):new Uint8Array(e,t,n),Object.setPrototypeOf(r,o.prototype),r}function h(e){if(e>=r)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+r.toString(16)+" bytes");return 0|e}function d(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||H(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);const n=e.length,r=arguments.length>2&&!0===arguments[2];if(!r&&0===n)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":return Y(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return F(e).length;default:if(i)return r?-1:Y(e).length;t=(""+t).toLowerCase(),i=!0}}function f(e,t,n){let r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,n);case"utf8":case"utf-8":return I(this,t,n);case"ascii":return T(this,t,n);case"latin1":case"binary":return E(this,t,n);case"base64":return A(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return k(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function p(e,t,n){const r=e[t];e[t]=e[n],e[n]=r}function y(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),G(n=+n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=o.from(t,r)),o.isBuffer(t))return 0===t.length?-1:m(e,t,n,r,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):m(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function m(e,t,n,r,i){let o,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){let r=-1;for(o=n;o<s;o++)if(c(e,o)===c(t,-1===r?0:o-r)){if(-1===r&&(r=o),o-r+1===u)return r*a}else-1!==r&&(o-=o-r),r=-1}else for(n+u>s&&(n=s-u),o=n;o>=0;o--){let n=!0;for(let r=0;r<u;r++)if(c(e,o+r)!==c(t,r)){n=!1;break}if(n)return o}return-1}function g(e,t,n,r){n=Number(n)||0;const i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;const o=t.length;let a;for(r>o/2&&(r=o/2),a=0;a<r;++a){const r=parseInt(t.substr(2*a,2),16);if(G(r))return a;e[n+a]=r}return a}function v(e,t,n,r){return V(Y(t,e.length-n),e,n,r)}function w(e,t,n,r){return V(function(e){const t=[];for(let n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function b(e,t,n,r){return V(F(t),e,n,r)}function M(e,t,n,r){return V(function(e,t){let n,r,i;const o=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)n=e.charCodeAt(a),r=n>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function A(e,t,n){return 0===t&&n===e.length?ap.fromByteArray(e):ap.fromByteArray(e.slice(t,n))}function I(e,t,n){n=Math.min(e.length,n);const r=[];let i=t;for(;i<n;){const t=e[i];let o=null,a=t>239?4:t>223?3:t>191?2:1;if(i+a<=n){let n,r,s,u;switch(a){case 1:t<128&&(o=t);break;case 2:n=e[i+1],128==(192&n)&&(u=(31&t)<<6|63&n,u>127&&(o=u));break;case 3:n=e[i+1],r=e[i+2],128==(192&n)&&128==(192&r)&&(u=(15&t)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(o=u));break;case 4:n=e[i+1],r=e[i+2],s=e[i+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(u=(15&t)<<18|(63&n)<<12|(63&r)<<6|63&s,u>65535&&u<1114112&&(o=u))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|1023&o),r.push(o),i+=a}return function(e){const t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=N));return n}(r)}t.kMaxLength=r,o.TYPED_ARRAY_SUPPORT=function(){try{const e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch(e){return!1}}(),o.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||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(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,n){return a(e,t,n)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,n){return function(e,t,n){return s(e),e<=0?i(e):void 0!==t?"string"==typeof n?i(e).fill(t,n):i(e).fill(t):i(e)}(e,t,n)},o.allocUnsafe=function(e){return u(e)},o.allocUnsafeSlow=function(e){return u(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(H(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),H(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,r=t.length;for(let i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},o.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);let n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;const r=o.allocUnsafe(t);let i=0;for(n=0;n<e.length;++n){let t=e[n];if(H(t,Uint8Array))i+t.length>r.length?(o.isBuffer(t)||(t=o.from(t)),t.copy(r,i)):Uint8Array.prototype.set.call(r,t,i);else{if(!o.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(r,i)}i+=t.length}return r},o.byteLength=d,o.prototype._isBuffer=!0,o.prototype.swap16=function(){const e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)p(this,t,t+1);return this},o.prototype.swap32=function(){const e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)p(this,t,t+3),p(this,t+1,t+2);return this},o.prototype.swap64=function(){const e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)p(this,t,t+7),p(this,t+1,t+6),p(this,t+2,t+5),p(this,t+3,t+4);return this},o.prototype.toString=function(){const e=this.length;return 0===e?"":0===arguments.length?I(this,0,e):f.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){let e="";const n=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,n).replace(/(.{2})/g,"$1 ").trim(),this.length>n&&(e+=" ... "),"<Buffer "+e+">"},n&&(o.prototype[n]=o.prototype.inspect),o.prototype.compare=function(e,t,n,r,i){if(H(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;let a=(i>>>=0)-(r>>>=0),s=(n>>>=0)-(t>>>=0);const u=Math.min(a,s),c=this.slice(r,i),l=e.slice(t,n);for(let e=0;e<u;++e)if(c[e]!==l[e]){a=c[e],s=l[e];break}return a<s?-1:s<a?1:0},o.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},o.prototype.indexOf=function(e,t,n){return y(this,e,t,n,!0)},o.prototype.lastIndexOf=function(e,t,n){return y(this,e,t,n,!1)},o.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(n)?(n>>>=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}const i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");let o=!1;for(;;)switch(r){case"hex":return g(this,e,t,n);case"utf8":case"utf-8":return v(this,e,t,n);case"ascii":case"latin1":case"binary":return w(this,e,t,n);case"base64":return b(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return M(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const N=4096;function T(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function E(e,t,n){let r="";n=Math.min(e.length,n);for(let i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function x(e,t,n){const r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);let i="";for(let r=t;r<n;++r)i+=q[e[r]];return i}function k(e,t,n){const r=e.slice(t,n);let i="";for(let e=0;e<r.length-1;e+=2)i+=String.fromCharCode(r[e]+256*r[e+1]);return i}function L(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function S(e,t,n,r,i,a){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function j(e,t,n,r,i){R(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o,o>>=8,e[n++]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,a>>=8,e[n++]=a,n}function D(e,t,n,r,i){R(t,r,i,e,n,7);let o=Number(t&BigInt(4294967295));e[n+7]=o,o>>=8,e[n+6]=o,o>>=8,e[n+5]=o,o>>=8,e[n+4]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[n+3]=a,a>>=8,e[n+2]=a,a>>=8,e[n+1]=a,a>>=8,e[n]=a,n+8}function C(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function O(e,t,n,r,i){return t=+t,n>>>=0,i||C(e,0,n,4),up(e,t,n,r,23,4),n+4}function z(e,t,n,r,i){return t=+t,n>>>=0,i||C(e,0,n,8),up(e,t,n,r,52,8),n+8}o.prototype.slice=function(e,t){const n=this.length;(e=~~e)<0?(e+=n)<0&&(e=0):e>n&&(e=n),(t=void 0===t?n:~~t)<0?(t+=n)<0&&(t=0):t>n&&(t=n),t<e&&(t=e);const r=this.subarray(e,t);return Object.setPrototypeOf(r,o.prototype),r},o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[e+o]*i;return r},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e+--t],i=1;for(;t>0&&(i*=256);)r+=this[e+--t]*i;return r},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||L(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=Z((function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Q(e,this.length-8);const r=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+n*2**24;return BigInt(r)+(BigInt(i)<<BigInt(32))})),o.prototype.readBigUInt64BE=Z((function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Q(e,this.length-8);const r=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+n;return(BigInt(r)<<BigInt(32))+BigInt(i)})),o.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=this[e],i=1,o=0;for(;++o<t&&(i*=256);)r+=this[e+o]*i;return i*=128,r>=i&&(r-=Math.pow(2,8*t)),r},o.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||L(e,t,this.length);let r=t,i=1,o=this[e+--r];for(;r>0&&(i*=256);)o+=this[e+--r]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return e>>>=0,t||L(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt16BE=function(e,t){e>>>=0,t||L(e,2,this.length);const n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||L(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=Z((function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Q(e,this.length-8);const r=this[e+4]+256*this[e+5]+65536*this[e+6]+(n<<24);return(BigInt(r)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),o.prototype.readBigInt64BE=Z((function(e){U(e>>>=0,"offset");const t=this[e],n=this[e+7];void 0!==t&&void 0!==n||Q(e,this.length-8);const r=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(r)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+n)})),o.prototype.readFloatLE=function(e,t){return e>>>=0,t||L(e,4,this.length),sp(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,t){return e>>>=0,t||L(e,4,this.length),sp(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,t){return e>>>=0,t||L(e,8,this.length),sp(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,t){return e>>>=0,t||L(e,8,this.length),sp(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){S(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){S(this,e,t,n,Math.pow(2,8*n)-1,0)}let i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigUInt64LE=Z((function(e,t=0){return j(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=Z((function(e,t=0){return D(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);S(this,e,t,n,r-1,-r)}let i=0,o=1,a=0;for(this[t]=255&e;++i<n&&(o*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+n},o.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){const r=Math.pow(2,8*n-1);S(this,e,t,n,r-1,-r)}let i=n-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o>>0)-a&255;return t+n},o.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||S(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigInt64LE=Z((function(e,t=0){return j(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=Z((function(e,t=0){return D(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(e,t,n){return O(this,e,t,!0,n)},o.prototype.writeFloatBE=function(e,t,n){return O(this,e,t,!1,n)},o.prototype.writeDoubleLE=function(e,t,n){return z(this,e,t,!0,n)},o.prototype.writeDoubleBE=function(e,t,n){return z(this,e,t,!1,n)},o.prototype.copy=function(e,t,n,r){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);const i=r-n;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},o.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!o.isEncoding(r))throw new TypeError("Unknown encoding: "+r);if(1===e.length){const t=e.charCodeAt(0);("utf8"===r&&t<128||"latin1"===r)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;let i;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(i=t;i<n;++i)this[i]=e;else{const a=o.isBuffer(e)?e:o.from(e,r),s=a.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<n-t;++i)this[i+t]=a[i%s]}return this};const P={};function _(e,t,n){P[e]=class extends n{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function B(e){let t="",n=e.length;const r="-"===e[0]?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function R(e,t,n,r,i,o){if(e>n||e<t){const r="bigint"==typeof t?"n":"";let i;throw i=o>3?0===t||t===BigInt(0)?`>= 0${r} and < 2${r} ** ${8*(o+1)}${r}`:`>= -(2${r} ** ${8*(o+1)-1}${r}) and < 2 ** ${8*(o+1)-1}${r}`:`>= ${t}${r} and <= ${n}${r}`,new P.ERR_OUT_OF_RANGE("value",i,e)}!function(e,t,n){U(t,"offset"),void 0!==e[t]&&void 0!==e[t+n]||Q(t,e.length-(n+1))}(r,i,o)}function U(e,t){if("number"!=typeof e)throw new P.ERR_INVALID_ARG_TYPE(t,"number",e)}function Q(e,t,n){if(Math.floor(e)!==e)throw U(e,n),new P.ERR_OUT_OF_RANGE(n||"offset","an integer",e);if(t<0)throw new P.ERR_BUFFER_OUT_OF_BOUNDS;throw new P.ERR_OUT_OF_RANGE(n||"offset",`>= ${n?1:0} and <= ${t}`,e)}_("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),_("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),_("ERR_OUT_OF_RANGE",(function(e,t,n){let r=`The value of "${e}" is out of range.`,i=n;return Number.isInteger(n)&&Math.abs(n)>2**32?i=B(String(n)):"bigint"==typeof n&&(i=String(n),(n>BigInt(2)**BigInt(32)||n<-(BigInt(2)**BigInt(32)))&&(i=B(i)),i+="n"),r+=` It must be ${t}. Received ${i}`,r}),RangeError);const W=/[^+/0-9A-Za-z-_]/g;function Y(e,t){let n;t=t||1/0;const r=e.length;let i=null;const o=[];for(let a=0;a<r;++a){if(n=e.charCodeAt(a),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function F(e){return ap.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(W,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function V(e,t,n,r){let i;for(i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function H(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function G(e){return e!=e}const q=function(){const e="0123456789abcdef",t=new Array(256);for(let n=0;n<16;++n){const r=16*n;for(let i=0;i<16;++i)t[r+i]=e[n]+e[i]}return t}();function Z(e){return"undefined"==typeof BigInt?J:e}function J(){throw new Error("BigInt not supported")}})),lp=qf((function(e){!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var o;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:cp.Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function s(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,r,i){for(var o=0,a=0,s=Math.min(e.length,r),u=t;u<s;u++){var c=e.charCodeAt(u)-48;o*=i,a=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a<i,"Invalid character"),o+=a}return o}function c(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<e.length;i+=3)a=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=e.length-1;r>=t;r-=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(e,l,l+r,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(e,l,e.length,t),l=0;l<a;l++)h*=t;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){c(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(e){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","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"],d=[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],f=[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(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=d[e],l=f[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(e);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=67108863&u,d=Math.min(c,t.length-1),f=Math.max(0,c-e.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|e.words[p])*(o=0|t.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n++]=255&a,n<e.length&&(e[n++]=a>>8&255),n<e.length&&(e[n++]=a>>16&255),6===o?(n<e.length&&(e[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n--]=255&a,n>=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return n(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a<r.length;a++)o=(t=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<n.length;a++)o=(t=(0|n.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var y=function(e,t,n){var r,i,o,a=e.words,s=t.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],I=8191&A,N=A>>>13,T=0|a[5],E=8191&T,x=T>>>13,k=0|a[6],L=8191&k,S=k>>>13,j=0|a[7],D=8191&j,C=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,W=U>>>13,Y=0|s[1],F=8191&Y,V=Y>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,ee=K>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,le=0|s[8],he=8191&le,de=le>>>13,fe=0|s[9],pe=8191&fe,ye=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,W))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,W))+Math.imul(y,Q)|0,o=Math.imul(y,W);var ge=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,W))+Math.imul(v,Q)|0,o=Math.imul(v,W),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var ve=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,W))+Math.imul(M,Q)|0,o=Math.imul(M,W),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var we=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(I,Q),i=(i=Math.imul(I,W))+Math.imul(N,Q)|0,o=Math.imul(N,W),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var be=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,Q),i=(i=Math.imul(E,W))+Math.imul(x,Q)|0,o=Math.imul(x,W),r=r+Math.imul(I,F)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0;var Me=(c+(r=r+Math.imul(h,ne)|0)|0)+((8191&(i=(i=i+Math.imul(h,re)|0)+Math.imul(d,ne)|0))<<13)|0;c=((o=o+Math.imul(d,re)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,W))+Math.imul(S,Q)|0,o=Math.imul(S,W),r=r+Math.imul(E,F)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(x,F)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(I,G)|0,i=(i=i+Math.imul(I,q)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0;var Ae=(c+(r=r+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ae)|0)+Math.imul(d,oe)|0))<<13)|0;c=((o=o+Math.imul(d,ae)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(D,Q),i=(i=Math.imul(D,W))+Math.imul(C,Q)|0,o=Math.imul(C,W),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(E,G)|0,i=(i=i+Math.imul(E,q)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,q)|0,r=r+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(g,ne)|0,i=(i=i+Math.imul(g,re)|0)+Math.imul(v,ne)|0,o=o+Math.imul(v,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0;var Ie=(c+(r=r+Math.imul(h,ue)|0)|0)+((8191&(i=(i=i+Math.imul(h,ce)|0)+Math.imul(d,ue)|0))<<13)|0;c=((o=o+Math.imul(d,ce)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,W))+Math.imul(P,Q)|0,o=Math.imul(P,W),r=r+Math.imul(D,F)|0,i=(i=i+Math.imul(D,V)|0)+Math.imul(C,F)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0,r=r+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,ce)|0;var Ne=(c+(r=r+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;c=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,W))+Math.imul(R,Q)|0,o=Math.imul(R,W),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(D,G)|0,i=(i=i+Math.imul(D,q)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,r=r+Math.imul(g,ue)|0,i=(i=i+Math.imul(g,ce)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,ce)|0,r=r+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(y,he)|0,o=o+Math.imul(y,de)|0;var Te=(c+(r=r+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ye)|0)+Math.imul(d,pe)|0))<<13)|0;c=((o=o+Math.imul(d,ye)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(D,J)|0,i=(i=i+Math.imul(D,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,ee)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,ae)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,ae)|0,r=r+Math.imul(b,ue)|0,i=(i=i+Math.imul(b,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,r=r+Math.imul(g,he)|0,i=(i=i+Math.imul(g,de)|0)+Math.imul(v,he)|0,o=o+Math.imul(v,de)|0;var Ee=(c+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ye)|0)+Math.imul(y,pe)|0))<<13)|0;c=((o=o+Math.imul(y,ye)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(D,$)|0,i=(i=i+Math.imul(D,ee)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(L,ne)|0,i=(i=i+Math.imul(L,re)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,ae)|0,r=r+Math.imul(I,ue)|0,i=(i=i+Math.imul(I,ce)|0)+Math.imul(N,ue)|0,o=o+Math.imul(N,ce)|0,r=r+Math.imul(b,he)|0,i=(i=i+Math.imul(b,de)|0)+Math.imul(M,he)|0,o=o+Math.imul(M,de)|0;var xe=(c+(r=r+Math.imul(g,pe)|0)|0)+((8191&(i=(i=i+Math.imul(g,ye)|0)+Math.imul(v,pe)|0))<<13)|0;c=((o=o+Math.imul(v,ye)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,ee)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,ee)|0,r=r+Math.imul(D,ne)|0,i=(i=i+Math.imul(D,re)|0)+Math.imul(C,ne)|0,o=o+Math.imul(C,re)|0,r=r+Math.imul(L,oe)|0,i=(i=i+Math.imul(L,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,ce)|0)+Math.imul(x,ue)|0,o=o+Math.imul(x,ce)|0,r=r+Math.imul(I,he)|0,i=(i=i+Math.imul(I,de)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,de)|0;var ke=(c+(r=r+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ye)|0)+Math.imul(M,pe)|0))<<13)|0;c=((o=o+Math.imul(M,ye)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,ee))+Math.imul(R,$)|0,o=Math.imul(R,ee),r=r+Math.imul(z,ne)|0,i=(i=i+Math.imul(z,re)|0)+Math.imul(P,ne)|0,o=o+Math.imul(P,re)|0,r=r+Math.imul(D,oe)|0,i=(i=i+Math.imul(D,ae)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,ae)|0,r=r+Math.imul(L,ue)|0,i=(i=i+Math.imul(L,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,r=r+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(x,he)|0,o=o+Math.imul(x,de)|0;var Le=(c+(r=r+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,ye)|0)+Math.imul(N,pe)|0))<<13)|0;c=((o=o+Math.imul(N,ye)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,r=Math.imul(B,ne),i=(i=Math.imul(B,re))+Math.imul(R,ne)|0,o=Math.imul(R,re),r=r+Math.imul(z,oe)|0,i=(i=i+Math.imul(z,ae)|0)+Math.imul(P,oe)|0,o=o+Math.imul(P,ae)|0,r=r+Math.imul(D,ue)|0,i=(i=i+Math.imul(D,ce)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,ce)|0,r=r+Math.imul(L,he)|0,i=(i=i+Math.imul(L,de)|0)+Math.imul(S,he)|0,o=o+Math.imul(S,de)|0;var Se=(c+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,ye)|0)+Math.imul(x,pe)|0))<<13)|0;c=((o=o+Math.imul(x,ye)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(B,oe),i=(i=Math.imul(B,ae))+Math.imul(R,oe)|0,o=Math.imul(R,ae),r=r+Math.imul(z,ue)|0,i=(i=i+Math.imul(z,ce)|0)+Math.imul(P,ue)|0,o=o+Math.imul(P,ce)|0,r=r+Math.imul(D,he)|0,i=(i=i+Math.imul(D,de)|0)+Math.imul(C,he)|0,o=o+Math.imul(C,de)|0;var je=(c+(r=r+Math.imul(L,pe)|0)|0)+((8191&(i=(i=i+Math.imul(L,ye)|0)+Math.imul(S,pe)|0))<<13)|0;c=((o=o+Math.imul(S,ye)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,r=Math.imul(B,ue),i=(i=Math.imul(B,ce))+Math.imul(R,ue)|0,o=Math.imul(R,ce),r=r+Math.imul(z,he)|0,i=(i=i+Math.imul(z,de)|0)+Math.imul(P,he)|0,o=o+Math.imul(P,de)|0;var De=(c+(r=r+Math.imul(D,pe)|0)|0)+((8191&(i=(i=i+Math.imul(D,ye)|0)+Math.imul(C,pe)|0))<<13)|0;c=((o=o+Math.imul(C,ye)|0)+(i>>>13)|0)+(De>>>26)|0,De&=67108863,r=Math.imul(B,he),i=(i=Math.imul(B,de))+Math.imul(R,he)|0,o=Math.imul(R,de);var Ce=(c+(r=r+Math.imul(z,pe)|0)|0)+((8191&(i=(i=i+Math.imul(z,ye)|0)+Math.imul(P,pe)|0))<<13)|0;c=((o=o+Math.imul(P,ye)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863;var Oe=(c+(r=Math.imul(B,pe))|0)+((8191&(i=(i=Math.imul(B,ye))+Math.imul(R,pe)|0))<<13)|0;return c=((o=Math.imul(R,ye))+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,u[0]=me,u[1]=ge,u[2]=ve,u[3]=we,u[4]=be,u[5]=Me,u[6]=Ae,u[7]=Ie,u[8]=Ne,u[9]=Te,u[10]=Ee,u[11]=xe,u[12]=ke,u[13]=Le,u[14]=Se,u[15]=je,u[16]=De,u[17]=Ce,u[18]=Oe,0!==c&&(u[19]=c,n.length++),n};function m(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var l=o-c,h=(0|e.words[l])*(0|t.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(e,t,n){return m(e,t,n)}Math.imul||(y=p),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?y(this,e,t):n<63?p(this,e,t):n<1024?m(this,e,t):g(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*e,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var o=n.sqr();r<t.length;r++,o=o.sqr())0!==t[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r)&&!!(this.words[r]&i)},i.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,r){var i,o,a=e.length+r;this._expand(a);var s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+r])+s;var u=(0|e.words[i])*t;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,a=0|o.words[o.length-1];0!==(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==t){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(o,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var o,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=t.clone();!t.isZero();){for(var d=0,f=1;0==(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(u)):(r.isub(t),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(t.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new N(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},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(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function I(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function N(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function T(e){N.call(this,e),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)}w.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},r(b,w),b.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(M,w),r(A,w),r(I,w),I.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(v[e])return v[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new M;else if("p192"===e)t=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new I}return v[e]=t,t},N.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},N.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},N.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(c(e,e.umod(this.m)._forceRed(this)),e)},N.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},N.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},N.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},N.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},N.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},N.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},N.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},N.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},N.prototype.isqr=function(e){return this.imul(e,e.clone())},N.prototype.sqr=function(e){return this.mul(e,e)},N.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),d=this.pow(e,o.addn(1).iushrn(1)),f=this.pow(e,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m<p);var g=this.pow(h,new i(1).iushln(p-m-1));d=d.redMul(g),h=g.redSqr(),f=f.redMul(h),p=m}return d},N.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},N.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var o=n[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var c=t.words[r],l=u-1;l>=0;l--){var h=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},N.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},N.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new T(e)},r(T,N),T.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},T.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},T.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},T.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,Hf)}));
11
11
  /*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */let hp=!1,dp=!1;const fp={debug:1,default:2,info:2,warning:3,error:4,off:5};let pp=fp.default,yp=null;const mp=function(){try{const e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((t=>{try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(n){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();var gp,vp;!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(gp||(gp={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(vp||(vp={}));const wp="0123456789abcdef";class bp{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,t){const n=e.toLowerCase();null==fp[n]&&this.throwArgumentError("invalid log level name","logLevel",e),pp>fp[n]||console.log.apply(console,t)}debug(...e){this._log(bp.levels.DEBUG,e)}info(...e){this._log(bp.levels.INFO,e)}warn(...e){this._log(bp.levels.WARNING,e)}makeError(e,t,n){if(dp)return this.makeError("censored error",t,{});t||(t=bp.errors.UNKNOWN_ERROR),n||(n={});const r=[];Object.keys(n).forEach((e=>{const t=n[e];try{if(t instanceof Uint8Array){let n="";for(let e=0;e<t.length;e++)n+=wp[t[e]>>4],n+=wp[15&t[e]];r.push(e+"=Uint8Array(0x"+n+")")}else r.push(e+"="+JSON.stringify(t))}catch(t){r.push(e+"="+JSON.stringify(n[e].toString()))}})),r.push(`code=${t}`),r.push(`version=${this.version}`);const i=e;let o="";switch(t){case vp.NUMERIC_FAULT:{o="NUMERIC_FAULT";const t=e;switch(t){case"overflow":case"underflow":case"division-by-zero":o+="-"+t;break;case"negative-power":case"negative-width":o+="-unsupported";break;case"unbound-bitwise-result":o+="-unbound-result"}break}case vp.CALL_EXCEPTION:case vp.INSUFFICIENT_FUNDS:case vp.MISSING_NEW:case vp.NONCE_EXPIRED:case vp.REPLACEMENT_UNDERPRICED:case vp.TRANSACTION_REPLACED:case vp.UNPREDICTABLE_GAS_LIMIT:o=t}o&&(e+=" [ See: https://links.ethers.org/v5-errors-"+o+" ]"),r.length&&(e+=" ("+r.join(", ")+")");const a=new Error(e);return a.reason=i,a.code=t,Object.keys(n).forEach((function(e){a[e]=n[e]})),a}throwError(e,t,n){throw this.makeError(e,t,n)}throwArgumentError(e,t,n){return this.throwError(e,bp.errors.INVALID_ARGUMENT,{argument:t,value:n})}assert(e,t,n,r){e||this.throwError(t,n,r)}assertArgument(e,t,n,r){e||this.throwArgumentError(t,n,r)}checkNormalize(e){mp&&this.throwError("platform missing String.prototype.normalize",bp.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:mp})}checkSafeUint53(e,t){"number"==typeof e&&(null==t&&(t="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(t,bp.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(t,bp.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,t,n){n=n?": "+n:"",e<t&&this.throwError("missing argument"+n,bp.errors.MISSING_ARGUMENT,{count:e,expectedCount:t}),e>t&&this.throwError("too many arguments"+n,bp.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:t})}checkNew(e,t){e!==Object&&null!=e||this.throwError("missing new",bp.errors.MISSING_NEW,{name:t.name})}checkAbstract(e,t){e===t?this.throwError("cannot instantiate abstract class "+JSON.stringify(t.name)+" directly; use a sub-class",bp.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):e!==Object&&null!=e||this.throwError("missing new",bp.errors.MISSING_NEW,{name:t.name})}static globalLogger(){return yp||(yp=new bp("logger/5.7.0")),yp}static setCensorship(e,t){if(!e&&t&&this.globalLogger().throwError("cannot permanently disable censorship",bp.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),hp){if(!e)return;this.globalLogger().throwError("error censorship permanent",bp.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}dp=!!e,hp=!!t}static setLogLevel(e){const t=fp[e.toLowerCase()];null!=t?pp=t:bp.globalLogger().warn("invalid log level - "+e)}static from(e){return new bp(e)}}bp.errors=vp,bp.levels=gp;const Mp=new bp("bytes/5.7.0");function Ap(e){return!!e.toHexString}function Ip(e){return e.slice||(e.slice=function(){const t=Array.prototype.slice.call(arguments);return Ip(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function Np(e){return jp(e)&&!(e.length%2)||Ep(e)}function Tp(e){return"number"==typeof e&&e==e&&e%1==0}function Ep(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e)return!1;if(!Tp(e.length)||e.length<0)return!1;for(let t=0;t<e.length;t++){const n=e[t];if(!Tp(n)||n<0||n>=256)return!1}return!0}function xp(e,t){if(t||(t={}),"number"==typeof e){Mp.checkSafeUint53(e,"invalid arrayify value");const t=[];for(;e;)t.unshift(255&e),e=parseInt(String(e/256));return 0===t.length&&t.push(0),Ip(new Uint8Array(t))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Ap(e)&&(e=e.toHexString()),jp(e)){let n=e.substring(2);n.length%2&&("left"===t.hexPad?n="0"+n:"right"===t.hexPad?n+="0":Mp.throwArgumentError("hex data is odd-length","value",e));const r=[];for(let e=0;e<n.length;e+=2)r.push(parseInt(n.substring(e,e+2),16));return Ip(new Uint8Array(r))}return Ep(e)?Ip(new Uint8Array(e)):Mp.throwArgumentError("invalid arrayify value","value",e)}function kp(e){const t=e.map((e=>xp(e))),n=t.reduce(((e,t)=>e+t.length),0),r=new Uint8Array(n);return t.reduce(((e,t)=>(r.set(t,e),e+t.length)),0),Ip(r)}function Lp(e){let t=xp(e);if(0===t.length)return t;let n=0;for(;n<t.length&&0===t[n];)n++;return n&&(t=t.slice(n)),t}function Sp(e,t){(e=xp(e)).length>t&&Mp.throwArgumentError("value out of range","value",arguments[0]);const n=new Uint8Array(t);return n.set(e,t-e.length),Ip(n)}function jp(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(!t||e.length===2+2*t)}function Dp(e,t){if(t||(t={}),"number"==typeof e){Mp.checkSafeUint53(e,"invalid hexlify value");let t="";for(;e;)t="0123456789abcdef"[15&e]+t,e=Math.floor(e/16);return t.length?(t.length%2&&(t="0"+t),"0x"+t):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Ap(e))return e.toHexString();if(jp(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":Mp.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(Ep(e)){let t="0x";for(let n=0;n<e.length;n++){let r=e[n];t+="0123456789abcdef"[(240&r)>>4]+"0123456789abcdef"[15&r]}return t}return Mp.throwArgumentError("invalid hexlify value","value",e)}function Cp(e){if("string"!=typeof e)e=Dp(e);else if(!jp(e)||e.length%2)return null;return(e.length-2)/2}function Op(e,t,n){return"string"!=typeof e?e=Dp(e):(!jp(e)||e.length%2)&&Mp.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=n?"0x"+e.substring(t,2+2*n):"0x"+e.substring(t)}function zp(e){let t="0x";return e.forEach((e=>{t+=Dp(e).substring(2)})),t}function Pp(e){const t=function(e){"string"!=typeof e&&(e=Dp(e));jp(e)||Mp.throwArgumentError("invalid hex string","value",e);e=e.substring(2);let t=0;for(;t<e.length&&"0"===e[t];)t++;return"0x"+e.substring(t)}(Dp(e,{hexPad:"left"}));return"0x"===t?"0x0":t}function _p(e,t){for("string"!=typeof e?e=Dp(e):jp(e)||Mp.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&Mp.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function Bp(e){const t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(Np(e)){let n=xp(e);64===n.length?(t.v=27+(n[32]>>7),n[32]&=127,t.r=Dp(n.slice(0,32)),t.s=Dp(n.slice(32,64))):65===n.length?(t.r=Dp(n.slice(0,32)),t.s=Dp(n.slice(32,64)),t.v=n[64]):Mp.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:Mp.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(n[32]|=128),t._vs=Dp(n.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){const n=Sp(xp(t._vs),32);t._vs=Dp(n);const r=n[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=r:t.recoveryParam!==r&&Mp.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),n[0]&=127;const i=Dp(n);null==t.s?t.s=i:t.s!==i&&Mp.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?Mp.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{const n=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==n&&Mp.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&jp(t.r)?t.r=_p(t.r,32):Mp.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&jp(t.s)?t.s=_p(t.s,32):Mp.throwArgumentError("signature missing or invalid s","signature",e);const n=xp(t.s);n[0]>=128&&Mp.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(n[0]|=128);const r=Dp(n);t._vs&&(jp(t._vs)||Mp.throwArgumentError("signature invalid _vs","signature",e),t._vs=_p(t._vs,32)),null==t._vs?t._vs=r:t._vs!==r&&Mp.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}var Rp=lp.BN;const Up=new bp("bignumber/5.7.0"),Qp={};let Wp=!1;class Yp{constructor(e,t){e!==Qp&&Up.throwError("cannot call constructor directly; use BigNumber.from",bp.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=t,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Vp(Hp(this).fromTwos(e))}toTwos(e){return Vp(Hp(this).toTwos(e))}abs(){return"-"===this._hex[0]?Yp.from(this._hex.substring(1)):this}add(e){return Vp(Hp(this).add(Hp(e)))}sub(e){return Vp(Hp(this).sub(Hp(e)))}div(e){return Yp.from(e).isZero()&&Gp("division-by-zero","div"),Vp(Hp(this).div(Hp(e)))}mul(e){return Vp(Hp(this).mul(Hp(e)))}mod(e){const t=Hp(e);return t.isNeg()&&Gp("division-by-zero","mod"),Vp(Hp(this).umod(t))}pow(e){const t=Hp(e);return t.isNeg()&&Gp("negative-power","pow"),Vp(Hp(this).pow(t))}and(e){const t=Hp(e);return(this.isNegative()||t.isNeg())&&Gp("unbound-bitwise-result","and"),Vp(Hp(this).and(t))}or(e){const t=Hp(e);return(this.isNegative()||t.isNeg())&&Gp("unbound-bitwise-result","or"),Vp(Hp(this).or(t))}xor(e){const t=Hp(e);return(this.isNegative()||t.isNeg())&&Gp("unbound-bitwise-result","xor"),Vp(Hp(this).xor(t))}mask(e){return(this.isNegative()||e<0)&&Gp("negative-width","mask"),Vp(Hp(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Gp("negative-width","shl"),Vp(Hp(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Gp("negative-width","shr"),Vp(Hp(this).shrn(e))}eq(e){return Hp(this).eq(Hp(e))}lt(e){return Hp(this).lt(Hp(e))}lte(e){return Hp(this).lte(Hp(e))}gt(e){return Hp(this).gt(Hp(e))}gte(e){return Hp(this).gte(Hp(e))}isNegative(){return"-"===this._hex[0]}isZero(){return Hp(this).isZero()}toNumber(){try{return Hp(this).toNumber()}catch(e){Gp("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch(e){}return Up.throwError("this platform does not support BigInt",bp.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(10===arguments[0]?Wp||(Wp=!0,Up.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?Up.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",bp.errors.UNEXPECTED_ARGUMENT,{}):Up.throwError("BigNumber.toString does not accept parameters",bp.errors.UNEXPECTED_ARGUMENT,{})),Hp(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof Yp)return e;if("string"==typeof e)return e.match(/^-?0x[0-9a-f]+$/i)?new Yp(Qp,Fp(e)):e.match(/^-?[0-9]+$/)?new Yp(Qp,Fp(new Rp(e))):Up.throwArgumentError("invalid BigNumber string","value",e);if("number"==typeof e)return e%1&&Gp("underflow","BigNumber.from",e),(e>=9007199254740991||e<=-9007199254740991)&&Gp("overflow","BigNumber.from",e),Yp.from(String(e));const t=e;if("bigint"==typeof t)return Yp.from(t.toString());if(Ep(t))return Yp.from(Dp(t));if(t)if(t.toHexString){const e=t.toHexString();if("string"==typeof e)return Yp.from(e)}else{let e=t._hex;if(null==e&&"BigNumber"===t.type&&(e=t.hex),"string"==typeof e&&(jp(e)||"-"===e[0]&&jp(e.substring(1))))return Yp.from(e)}return Up.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!(!e||!e._isBigNumber)}}function Fp(e){if("string"!=typeof e)return Fp(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&Up.throwArgumentError("invalid hex","value",e),"0x00"===(e=Fp(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function Vp(e){return Yp.from(Fp(e))}function Hp(e){const t=Yp.from(e).toHexString();return"-"===t[0]?new Rp("-"+t.substring(3),16):new Rp(t.substring(2),16)}function Gp(e,t,n){const r={fault:e,operation:t};return null!=n&&(r.value=n),Up.throwError(e,bp.errors.NUMERIC_FAULT,r)}const qp=new bp("bignumber/5.7.0"),Zp={},Jp=Yp.from(0),Xp=Yp.from(-1);function Kp(e,t,n,r){const i={fault:t,operation:n};return void 0!==r&&(i.value=r),qp.throwError(e,bp.errors.NUMERIC_FAULT,i)}let $p="0";for(;$p.length<256;)$p+=$p;function ey(e){if("number"!=typeof e)try{e=Yp.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+$p.substring(0,e):qp.throwArgumentError("invalid decimal size","decimals",e)}function ty(e,t){null==t&&(t=0);const n=ey(t),r=(e=Yp.from(e)).lt(Jp);r&&(e=e.mul(Xp));let i=e.mod(n).toString();for(;i.length<n.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];const o=e.div(n).toString();return e=1===n.length?o:o+"."+i,r&&(e="-"+e),e}function ny(e,t){null==t&&(t=0);const n=ey(t);"string"==typeof e&&e.match(/^-?[0-9.]+$/)||qp.throwArgumentError("invalid decimal value","value",e);const r="-"===e.substring(0,1);r&&(e=e.substring(1)),"."===e&&qp.throwArgumentError("missing value","value",e);const i=e.split(".");i.length>2&&qp.throwArgumentError("too many decimal points","value",e);let o=i[0],a=i[1];for(o||(o="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>n.length-1&&Kp("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.length<n.length-1;)a+="0";const s=Yp.from(o),u=Yp.from(a);let c=s.mul(n).add(u);return r&&(c=c.mul(Xp)),c}class ry{constructor(e,t,n,r){e!==Zp&&qp.throwError("cannot use FixedFormat constructor; use FixedFormat.from",bp.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=t,this.width=n,this.decimals=r,this.name=(t?"":"u")+"fixed"+String(n)+"x"+String(r),this._multiplier=ey(r),Object.freeze(this)}static from(e){if(e instanceof ry)return e;"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,n=128,r=18;if("string"==typeof e)if("fixed"===e);else if("ufixed"===e)t=!1;else{const i=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);i||qp.throwArgumentError("invalid fixed format","format",e),t="u"!==i[1],n=parseInt(i[2]),r=parseInt(i[3])}else if(e){const i=(t,n,r)=>null==e[t]?r:(typeof e[t]!==n&&qp.throwArgumentError("invalid fixed format ("+t+" not "+n+")","format."+t,e[t]),e[t]);t=i("signed","boolean",t),n=i("width","number",n),r=i("decimals","number",r)}return n%8&&qp.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",n),r>80&&qp.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",r),new ry(Zp,t,n,r)}}class iy{constructor(e,t,n,r){e!==Zp&&qp.throwError("cannot use FixedNumber constructor; use FixedNumber.from",bp.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=r,this._hex=t,this._value=n,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&qp.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const t=ny(this._value,this.format.decimals),n=ny(e._value,e.format.decimals);return iy.fromValue(t.add(n),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const t=ny(this._value,this.format.decimals),n=ny(e._value,e.format.decimals);return iy.fromValue(t.sub(n),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const t=ny(this._value,this.format.decimals),n=ny(e._value,e.format.decimals);return iy.fromValue(t.mul(n).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const t=ny(this._value,this.format.decimals),n=ny(e._value,e.format.decimals);return iy.fromValue(t.mul(this.format._multiplier).div(n),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=iy.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return this.isNegative()&&n&&(t=t.subUnsafe(oy.toFormat(t.format))),t}ceiling(){const e=this.toString().split(".");1===e.length&&e.push("0");let t=iy.from(e[0],this.format);const n=!e[1].match(/^(0*)$/);return!this.isNegative()&&n&&(t=t.addUnsafe(oy.toFormat(t.format))),t}round(e){null==e&&(e=0);const t=this.toString().split(".");if(1===t.length&&t.push("0"),(e<0||e>80||e%1)&&qp.throwArgumentError("invalid decimal count","decimals",e),t[1].length<=e)return this;const n=iy.from("1"+$p.substring(0,e),this.format),r=ay.toFormat(this.format);return this.mulUnsafe(n).addUnsafe(r).floor().divUnsafe(n)}isZero(){return"0.0"===this._value||"0"===this._value}isNegative(){return"-"===this._value[0]}toString(){return this._value}toHexString(e){if(null==e)return this._hex;e%8&&qp.throwArgumentError("invalid byte width","width",e);return _p(Yp.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return iy.fromString(this._value,e)}static fromValue(e,t,n){return null!=n||null==t||function(e){return null!=e&&(Yp.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||jp(e)||"bigint"==typeof e||Ep(e))}(t)||(n=t,t=null),null==t&&(t=0),null==n&&(n="fixed"),iy.fromString(ty(e,t),ry.from(n))}static fromString(e,t){null==t&&(t="fixed");const n=ry.from(t),r=ny(e,n.decimals);!n.signed&&r.lt(Jp)&&Kp("unsigned value cannot be negative","overflow","value",e);let i=null;n.signed?i=r.toTwos(n.width).toHexString():(i=r.toHexString(),i=_p(i,n.width/8));const o=ty(r,n.decimals);return new iy(Zp,i,o,n)}static fromBytes(e,t){null==t&&(t="fixed");const n=ry.from(t);if(xp(e).length>n.width/8)throw new Error("overflow");let r=Yp.from(e);n.signed&&(r=r.fromTwos(n.width));const i=r.toTwos((n.signed?0:1)+n.width).toHexString(),o=ty(r,n.decimals);return new iy(Zp,i,o,n)}static from(e,t){if("string"==typeof e)return iy.fromString(e,t);if(Ep(e))return iy.fromBytes(e,t);try{return iy.fromValue(e,0,t)}catch(e){if(e.code!==bp.errors.INVALID_ARGUMENT)throw e}return qp.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!(!e||!e._isFixedNumber)}}const oy=iy.from(1),ay=iy.from("0.5");var sy=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};const uy=new bp("properties/5.7.0");function cy(e,t,n){Object.defineProperty(e,t,{enumerable:!0,value:n,writable:!1})}function ly(e,t){for(let n=0;n<32;n++){if(e[t])return e[t];if(!e.prototype||"object"!=typeof e.prototype)break;e=Object.getPrototypeOf(e.prototype).constructor}return null}function hy(e){return sy(this,void 0,void 0,(function*(){const t=Object.keys(e).map((t=>{const n=e[t];return Promise.resolve(n).then((e=>({key:t,value:e})))}));return(yield Promise.all(t)).reduce(((e,t)=>(e[t.key]=t.value,e)),{})}))}function dy(e){const t={};for(const n in e)t[n]=e[n];return t}const fy={bigint:!0,boolean:!0,function:!0,number:!0,string:!0};function py(e){if(null==e||fy[typeof e])return!0;if(Array.isArray(e)||"object"==typeof e){if(!Object.isFrozen(e))return!1;const t=Object.keys(e);for(let n=0;n<t.length;n++){let r=null;try{r=e[t[n]]}catch(e){continue}if(!py(r))return!1}return!0}return uy.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function yy(e){if(py(e))return e;if(Array.isArray(e))return Object.freeze(e.map((e=>my(e))));if("object"==typeof e){const t={};for(const n in e){const r=e[n];void 0!==r&&cy(t,n,my(r))}return t}return uy.throwArgumentError("Cannot deepCopy "+typeof e,"object",e)}function my(e){return yy(e)}class gy{constructor(e){for(const t in e)this[t]=my(e[t])}}const vy=new bp("abi/5.7.0"),wy={};let by={calldata:!0,memory:!0,storage:!0},My={calldata:!0,memory:!0};function Ay(e,t){if("bytes"===e||"string"===e){if(by[t])return!0}else if("address"===e){if("payable"===t)return!0}else if((e.indexOf("[")>=0||"tuple"===e)&&My[t])return!0;return(by[t]||"payable"===t)&&vy.throwArgumentError("invalid modifier","name",t),!1}function Iy(e,t){for(let n in t)cy(e,n,t[n])}const Ny=Object.freeze({sighash:"sighash",minimal:"minimal",full:"full",json:"json"}),Ty=new RegExp(/^(.*)\[([0-9]*)\]$/);class Ey{constructor(e,t){e!==wy&&vy.throwError("use fromString",bp.errors.UNSUPPORTED_OPERATION,{operation:"new ParamType()"}),Iy(this,t);let n=this.type.match(Ty);Iy(this,n?{arrayLength:parseInt(n[2]||"-1"),arrayChildren:Ey.fromObject({type:n[1],components:this.components}),baseType:"array"}:{arrayLength:null,arrayChildren:null,baseType:null!=this.components?"tuple":this.type}),this._isParamType=!0,Object.freeze(this)}format(e){if(e||(e=Ny.sighash),Ny[e]||vy.throwArgumentError("invalid format type","format",e),e===Ny.json){let t={type:"tuple"===this.baseType?"tuple":this.type,name:this.name||void 0};return"boolean"==typeof this.indexed&&(t.indexed=this.indexed),this.components&&(t.components=this.components.map((t=>JSON.parse(t.format(e))))),JSON.stringify(t)}let t="";return"array"===this.baseType?(t+=this.arrayChildren.format(e),t+="["+(this.arrayLength<0?"":String(this.arrayLength))+"]"):"tuple"===this.baseType?(e!==Ny.sighash&&(t+=this.type),t+="("+this.components.map((t=>t.format(e))).join(e===Ny.full?", ":",")+")"):t+=this.type,e!==Ny.sighash&&(!0===this.indexed&&(t+=" indexed"),e===Ny.full&&this.name&&(t+=" "+this.name)),t}static from(e,t){return"string"==typeof e?Ey.fromString(e,t):Ey.fromObject(e)}static fromObject(e){return Ey.isParamType(e)?e:new Ey(wy,{name:e.name||null,type:_y(e.type),indexed:null==e.indexed?null:!!e.indexed,components:e.components?e.components.map(Ey.fromObject):null})}static fromString(e,t){return n=function(e,t){let n=e;function r(t){vy.throwArgumentError(`unexpected character at position ${t}`,"param",e)}function i(e){let n={type:"",name:"",parent:e,state:{allowType:!0}};return t&&(n.indexed=!1),n}e=e.replace(/\s/g," ");let o={type:"",name:"",state:{allowType:!0}},a=o;for(let n=0;n<e.length;n++){let o=e[n];switch(o){case"(":a.state.allowType&&""===a.type?a.type="tuple":a.state.allowParams||r(n),a.state.allowType=!1,a.type=_y(a.type),a.components=[i(a)],a=a.components[0];break;case")":delete a.state,"indexed"===a.name&&(t||r(n),a.indexed=!0,a.name=""),Ay(a.type,a.name)&&(a.name=""),a.type=_y(a.type);let e=a;a=a.parent,a||r(n),delete e.parent,a.state.allowParams=!1,a.state.allowName=!0,a.state.allowArray=!0;break;case",":delete a.state,"indexed"===a.name&&(t||r(n),a.indexed=!0,a.name=""),Ay(a.type,a.name)&&(a.name=""),a.type=_y(a.type);let s=i(a.parent);a.parent.components.push(s),delete a.parent,a=s;break;case" ":a.state.allowType&&""!==a.type&&(a.type=_y(a.type),delete a.state.allowType,a.state.allowName=!0,a.state.allowParams=!0),a.state.allowName&&""!==a.name&&("indexed"===a.name?(t||r(n),a.indexed&&r(n),a.indexed=!0,a.name=""):Ay(a.type,a.name)?a.name="":a.state.allowName=!1);break;case"[":a.state.allowArray||r(n),a.type+=o,a.state.allowArray=!1,a.state.allowName=!1,a.state.readArray=!0;break;case"]":a.state.readArray||r(n),a.type+=o,a.state.readArray=!1,a.state.allowArray=!0,a.state.allowName=!0;break;default:a.state.allowType?(a.type+=o,a.state.allowParams=!0,a.state.allowArray=!0):a.state.allowName?(a.name+=o,delete a.state.allowArray):a.state.readArray?a.type+=o:r(n)}}return a.parent&&vy.throwArgumentError("unexpected eof","param",e),delete o.state,"indexed"===a.name?(t||r(n.length-7),a.indexed&&r(n.length-7),a.indexed=!0,a.name=""):Ay(a.type,a.name)&&(a.name=""),o.type=_y(o.type),o}(e,!!t),Ey.fromObject({name:n.name,type:n.type,indexed:n.indexed,components:n.components});var n}static isParamType(e){return!(null==e||!e._isParamType)}}function xy(e,t){return function(e){e=e.trim();let t=[],n="",r=0;for(let i=0;i<e.length;i++){let o=e[i];","===o&&0===r?(t.push(n),n=""):(n+=o,"("===o?r++:")"===o&&(r--,-1===r&&vy.throwArgumentError("unbalanced parenthesis","value",e)))}n&&t.push(n);return t}(e).map((e=>Ey.fromString(e,t)))}class ky{constructor(e,t){e!==wy&&vy.throwError("use a static from method",bp.errors.UNSUPPORTED_OPERATION,{operation:"new Fragment()"}),Iy(this,t),this._isFragment=!0,Object.freeze(this)}static from(e){return ky.isFragment(e)?e:"string"==typeof e?ky.fromString(e):ky.fromObject(e)}static fromObject(e){if(ky.isFragment(e))return e;switch(e.type){case"function":return Oy.fromObject(e);case"event":return Ly.fromObject(e);case"constructor":return Cy.fromObject(e);case"error":return Py.fromObject(e);case"fallback":case"receive":return null}return vy.throwArgumentError("invalid fragment object","value",e)}static fromString(e){return"event"===(e=(e=(e=e.replace(/\s/g," ")).replace(/\(/g," (").replace(/\)/g,") ").replace(/\s+/g," ")).trim()).split(" ")[0]?Ly.fromString(e.substring(5).trim()):"function"===e.split(" ")[0]?Oy.fromString(e.substring(8).trim()):"constructor"===e.split("(")[0].trim()?Cy.fromString(e.trim()):"error"===e.split(" ")[0]?Py.fromString(e.substring(5).trim()):vy.throwArgumentError("unsupported fragment","value",e)}static isFragment(e){return!(!e||!e._isFragment)}}class Ly extends ky{format(e){if(e||(e=Ny.sighash),Ny[e]||vy.throwArgumentError("invalid format type","format",e),e===Ny.json)return JSON.stringify({type:"event",anonymous:this.anonymous,name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Ny.sighash&&(t+="event "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ny.full?", ":",")+") ",e!==Ny.sighash&&this.anonymous&&(t+="anonymous "),t.trim()}static from(e){return"string"==typeof e?Ly.fromString(e):Ly.fromObject(e)}static fromObject(e){if(Ly.isEventFragment(e))return e;"event"!==e.type&&vy.throwArgumentError("invalid event object","value",e);const t={name:Ry(e.name),anonymous:e.anonymous,inputs:e.inputs?e.inputs.map(Ey.fromObject):[],type:"event"};return new Ly(wy,t)}static fromString(e){let t=e.match(Uy);t||vy.throwArgumentError("invalid event string","value",e);let n=!1;return t[3].split(" ").forEach((e=>{switch(e.trim()){case"anonymous":n=!0;break;case"":break;default:vy.warn("unknown modifier: "+e)}})),Ly.fromObject({name:t[1].trim(),anonymous:n,inputs:xy(t[2],!0),type:"event"})}static isEventFragment(e){return e&&e._isFragment&&"event"===e.type}}function Sy(e,t){t.gas=null;let n=e.split("@");return 1!==n.length?(n.length>2&&vy.throwArgumentError("invalid human-readable ABI signature","value",e),n[1].match(/^[0-9]+$/)||vy.throwArgumentError("invalid human-readable ABI signature gas","value",e),t.gas=Yp.from(n[1]),n[0]):e}function jy(e,t){t.constant=!1,t.payable=!1,t.stateMutability="nonpayable",e.split(" ").forEach((e=>{switch(e.trim()){case"constant":t.constant=!0;break;case"payable":t.payable=!0,t.stateMutability="payable";break;case"nonpayable":t.payable=!1,t.stateMutability="nonpayable";break;case"pure":t.constant=!0,t.stateMutability="pure";break;case"view":t.constant=!0,t.stateMutability="view";break;case"external":case"public":case"":break;default:console.log("unknown modifier: "+e)}}))}function Dy(e){let t={constant:!1,payable:!0,stateMutability:"payable"};return null!=e.stateMutability?(t.stateMutability=e.stateMutability,t.constant="view"===t.stateMutability||"pure"===t.stateMutability,null!=e.constant&&!!e.constant!==t.constant&&vy.throwArgumentError("cannot have constant function with mutability "+t.stateMutability,"value",e),t.payable="payable"===t.stateMutability,null!=e.payable&&!!e.payable!==t.payable&&vy.throwArgumentError("cannot have payable function with mutability "+t.stateMutability,"value",e)):null!=e.payable?(t.payable=!!e.payable,null!=e.constant||t.payable||"constructor"===e.type||vy.throwArgumentError("unable to determine stateMutability","value",e),t.constant=!!e.constant,t.constant?t.stateMutability="view":t.stateMutability=t.payable?"payable":"nonpayable",t.payable&&t.constant&&vy.throwArgumentError("cannot have constant payable function","value",e)):null!=e.constant?(t.constant=!!e.constant,t.payable=!t.constant,t.stateMutability=t.constant?"view":"payable"):"constructor"!==e.type&&vy.throwArgumentError("unable to determine stateMutability","value",e),t}class Cy extends ky{format(e){if(e||(e=Ny.sighash),Ny[e]||vy.throwArgumentError("invalid format type","format",e),e===Ny.json)return JSON.stringify({type:"constructor",stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});e===Ny.sighash&&vy.throwError("cannot format a constructor for sighash",bp.errors.UNSUPPORTED_OPERATION,{operation:"format(sighash)"});let t="constructor("+this.inputs.map((t=>t.format(e))).join(e===Ny.full?", ":",")+") ";return this.stateMutability&&"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "),t.trim()}static from(e){return"string"==typeof e?Cy.fromString(e):Cy.fromObject(e)}static fromObject(e){if(Cy.isConstructorFragment(e))return e;"constructor"!==e.type&&vy.throwArgumentError("invalid constructor object","value",e);let t=Dy(e);t.constant&&vy.throwArgumentError("constructor cannot be constant","value",e);const n={name:null,type:e.type,inputs:e.inputs?e.inputs.map(Ey.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Yp.from(e.gas):null};return new Cy(wy,n)}static fromString(e){let t={type:"constructor"},n=(e=Sy(e,t)).match(Uy);return n&&"constructor"===n[1].trim()||vy.throwArgumentError("invalid constructor string","value",e),t.inputs=xy(n[2].trim(),!1),jy(n[3].trim(),t),Cy.fromObject(t)}static isConstructorFragment(e){return e&&e._isFragment&&"constructor"===e.type}}class Oy extends Cy{format(e){if(e||(e=Ny.sighash),Ny[e]||vy.throwArgumentError("invalid format type","format",e),e===Ny.json)return JSON.stringify({type:"function",name:this.name,constant:this.constant,stateMutability:"nonpayable"!==this.stateMutability?this.stateMutability:void 0,payable:this.payable,gas:this.gas?this.gas.toNumber():void 0,inputs:this.inputs.map((t=>JSON.parse(t.format(e)))),outputs:this.outputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Ny.sighash&&(t+="function "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ny.full?", ":",")+") ",e!==Ny.sighash&&(this.stateMutability?"nonpayable"!==this.stateMutability&&(t+=this.stateMutability+" "):this.constant&&(t+="view "),this.outputs&&this.outputs.length&&(t+="returns ("+this.outputs.map((t=>t.format(e))).join(", ")+") "),null!=this.gas&&(t+="@"+this.gas.toString()+" ")),t.trim()}static from(e){return"string"==typeof e?Oy.fromString(e):Oy.fromObject(e)}static fromObject(e){if(Oy.isFunctionFragment(e))return e;"function"!==e.type&&vy.throwArgumentError("invalid function object","value",e);let t=Dy(e);const n={type:e.type,name:Ry(e.name),constant:t.constant,inputs:e.inputs?e.inputs.map(Ey.fromObject):[],outputs:e.outputs?e.outputs.map(Ey.fromObject):[],payable:t.payable,stateMutability:t.stateMutability,gas:e.gas?Yp.from(e.gas):null};return new Oy(wy,n)}static fromString(e){let t={type:"function"},n=(e=Sy(e,t)).split(" returns ");n.length>2&&vy.throwArgumentError("invalid function string","value",e);let r=n[0].match(Uy);if(r||vy.throwArgumentError("invalid function signature","value",e),t.name=r[1].trim(),t.name&&Ry(t.name),t.inputs=xy(r[2],!1),jy(r[3].trim(),t),n.length>1){let r=n[1].match(Uy);""==r[1].trim()&&""==r[3].trim()||vy.throwArgumentError("unexpected tokens","value",e),t.outputs=xy(r[2],!1)}else t.outputs=[];return Oy.fromObject(t)}static isFunctionFragment(e){return e&&e._isFragment&&"function"===e.type}}function zy(e){const t=e.format();return"Error(string)"!==t&&"Panic(uint256)"!==t||vy.throwArgumentError(`cannot specify user defined ${t} error`,"fragment",e),e}class Py extends ky{format(e){if(e||(e=Ny.sighash),Ny[e]||vy.throwArgumentError("invalid format type","format",e),e===Ny.json)return JSON.stringify({type:"error",name:this.name,inputs:this.inputs.map((t=>JSON.parse(t.format(e))))});let t="";return e!==Ny.sighash&&(t+="error "),t+=this.name+"("+this.inputs.map((t=>t.format(e))).join(e===Ny.full?", ":",")+") ",t.trim()}static from(e){return"string"==typeof e?Py.fromString(e):Py.fromObject(e)}static fromObject(e){if(Py.isErrorFragment(e))return e;"error"!==e.type&&vy.throwArgumentError("invalid error object","value",e);const t={type:e.type,name:Ry(e.name),inputs:e.inputs?e.inputs.map(Ey.fromObject):[]};return zy(new Py(wy,t))}static fromString(e){let t={type:"error"},n=e.match(Uy);return n||vy.throwArgumentError("invalid error signature","value",e),t.name=n[1].trim(),t.name&&Ry(t.name),t.inputs=xy(n[2],!1),zy(Py.fromObject(t))}static isErrorFragment(e){return e&&e._isFragment&&"error"===e.type}}function _y(e){return e.match(/^uint($|[^1-9])/)?e="uint256"+e.substring(4):e.match(/^int($|[^1-9])/)&&(e="int256"+e.substring(3)),e}const By=new RegExp("^[a-zA-Z$_][a-zA-Z0-9$_]*$");function Ry(e){return e&&e.match(By)||vy.throwArgumentError(`invalid identifier "${e}"`,"value",e),e}const Uy=new RegExp("^([^)(]*)\\((.*)\\)([^)(]*)$");const Qy=new bp("abi/5.7.0");class Wy{constructor(e,t,n,r){this.name=e,this.type=t,this.localName=n,this.dynamic=r}_throwError(e,t){Qy.throwArgumentError(e,this.localName,t)}}class Yy{constructor(e){cy(this,"wordSize",e||32),this._data=[],this._dataLength=0,this._padding=new Uint8Array(e)}get data(){return zp(this._data)}get length(){return this._dataLength}_writeData(e){return this._data.push(e),this._dataLength+=e.length,e.length}appendWriter(e){return this._writeData(kp(e._data))}writeBytes(e){let t=xp(e);const n=t.length%this.wordSize;return n&&(t=kp([t,this._padding.slice(n)])),this._writeData(t)}_getValue(e){let t=xp(Yp.from(e));return t.length>this.wordSize&&Qy.throwError("value out-of-bounds",bp.errors.BUFFER_OVERRUN,{length:this.wordSize,offset:t.length}),t.length%this.wordSize&&(t=kp([this._padding.slice(t.length%this.wordSize),t])),t}writeValue(e){return this._writeData(this._getValue(e))}writeUpdatableValue(){const e=this._data.length;return this._data.push(this._padding),this._dataLength+=this.wordSize,t=>{this._data[e]=this._getValue(t)}}}class Fy{constructor(e,t,n,r){cy(this,"_data",xp(e)),cy(this,"wordSize",t||32),cy(this,"_coerceFunc",n),cy(this,"allowLoose",r),this._offset=0}get data(){return Dp(this._data)}get consumed(){return this._offset}static coerce(e,t){let n=e.match("^u?int([0-9]+)$");return n&&parseInt(n[1])<=48&&(t=t.toNumber()),t}coerce(e,t){return this._coerceFunc?this._coerceFunc(e,t):Fy.coerce(e,t)}_peekBytes(e,t,n){let r=Math.ceil(t/this.wordSize)*this.wordSize;return this._offset+r>this._data.length&&(this.allowLoose&&n&&this._offset+t<=this._data.length?r=t:Qy.throwError("data out-of-bounds",bp.errors.BUFFER_OVERRUN,{length:this._data.length,offset:this._offset+r})),this._data.slice(this._offset,this._offset+r)}subReader(e){return new Fy(this._data.slice(this._offset+e),this.wordSize,this._coerceFunc,this.allowLoose)}readBytes(e,t){let n=this._peekBytes(0,e,!!t);return this._offset+=n.length,n.slice(0,e)}readValue(){return Yp.from(this.readBytes(this.wordSize))}}var Vy=qf((function(e){!function(){var t="input is invalid type",n="object"==typeof window,r=n?window:{};r.JS_SHA3_NO_WINDOW&&(n=!1);var i=!n&&"object"==typeof self;!r.JS_SHA3_NO_NODE_JS&&"object"==typeof x&&x.versions&&x.versions.node?r=Hf:i&&(r=self);var o=!r.JS_SHA3_NO_COMMON_JS&&e.exports,a=!r.JS_SHA3_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,s="0123456789abcdef".split(""),u=[4,1024,262144,67108864],c=[0,8,16,24],l=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],h=[224,256,384,512],d=[128,256],f=["hex","buffer","arrayBuffer","array","digest"],p={128:168,256:136};!r.JS_SHA3_NO_NODE_JS&&Array.isArray||(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),!a||!r.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW&&ArrayBuffer.isView||(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var y=function(e,t,n){return function(r){return new j(e,t,e).update(r)[n]()}},m=function(e,t,n){return function(r,i){return new j(e,t,i).update(r)[n]()}},g=function(e,t,n){return function(t,r,i,o){return A["cshake"+e].update(t,r,i,o)[n]()}},v=function(e,t,n){return function(t,r,i,o){return A["kmac"+e].update(t,r,i,o)[n]()}},w=function(e,t,n,r){for(var i=0;i<f.length;++i){var o=f[i];e[o]=t(n,r,o)}return e},b=function(e,t){var n=y(e,t,"hex");return n.create=function(){return new j(e,t,e)},n.update=function(e){return n.create().update(e)},w(n,y,e,t)},M=[{name:"keccak",padding:[1,256,65536,16777216],bits:h,createMethod:b},{name:"sha3",padding:[6,1536,393216,100663296],bits:h,createMethod:b},{name:"shake",padding:[31,7936,2031616,520093696],bits:d,createMethod:function(e,t){var n=m(e,t,"hex");return n.create=function(n){return new j(e,t,n)},n.update=function(e,t){return n.create(t).update(e)},w(n,m,e,t)}},{name:"cshake",padding:u,bits:d,createMethod:function(e,t){var n=p[e],r=g(e,0,"hex");return r.create=function(r,i,o){return i||o?new j(e,t,r).bytepad([i,o],n):A["shake"+e].create(r)},r.update=function(e,t,n,i){return r.create(t,n,i).update(e)},w(r,g,e,t)}},{name:"kmac",padding:u,bits:d,createMethod:function(e,t){var n=p[e],r=v(e,0,"hex");return r.create=function(r,i,o){return new D(e,t,i).bytepad(["KMAC",o],n).bytepad([r],n)},r.update=function(e,t,n,i){return r.create(e,n,i).update(t)},w(r,v,e,t)}}],A={},I=[],N=0;N<M.length;++N)for(var T=M[N],E=T.bits,k=0;k<E.length;++k){var L=T.name+"_"+E[k];if(I.push(L),A[L]=T.createMethod(E[k],T.padding),"sha3"!==T.name){var S=T.name+E[k];I.push(S),A[S]=A[L]}}function j(e,t,n){this.blocks=[],this.s=[],this.padding=t,this.outputBits=n,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function D(e,t,n){j.call(this,e,t,n)}j.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var n,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}for(var i,o,s=this.blocks,u=this.byteCount,l=e.length,h=this.blockCount,d=0,f=this.s;d<l;){if(this.reset)for(this.reset=!1,s[0]=this.block,i=1;i<h+1;++i)s[i]=0;if(n)for(i=this.start;d<l&&i<u;++d)s[i>>2]|=e[d]<<c[3&i++];else for(i=this.start;d<l&&i<u;++d)(o=e.charCodeAt(d))<128?s[i>>2]|=o<<c[3&i++]:o<2048?(s[i>>2]|=(192|o>>6)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]):o<55296||o>=57344?(s[i>>2]|=(224|o>>12)<<c[3&i++],s[i>>2]|=(128|o>>6&63)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++d)),s[i>>2]|=(240|o>>18)<<c[3&i++],s[i>>2]|=(128|o>>12&63)<<c[3&i++],s[i>>2]|=(128|o>>6&63)<<c[3&i++],s[i>>2]|=(128|63&o)<<c[3&i++]);if(this.lastByteIndex=i,i>=u){for(this.start=i-u,this.block=s[h],i=0;i<h;++i)f[i]^=s[i];C(f),this.reset=!0}else this.start=i}return this},j.prototype.encode=function(e,t){var n=255&e,r=1,i=[n];for(n=255&(e>>=8);n>0;)i.unshift(n),n=255&(e>>=8),++r;return t?i.push(r):i.unshift(r),this.update(i),i.length},j.prototype.encodeString=function(e){var n,r=typeof e;if("string"!==r){if("object"!==r)throw new Error(t);if(null===e)throw new Error(t);if(a&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||a&&ArrayBuffer.isView(e)))throw new Error(t);n=!0}var i=0,o=e.length;if(n)i=o;else for(var s=0;s<e.length;++s){var u=e.charCodeAt(s);u<128?i+=1:u<2048?i+=2:u<55296||u>=57344?i+=3:(u=65536+((1023&u)<<10|1023&e.charCodeAt(++s)),i+=4)}return i+=this.encode(8*i),this.update(e),i},j.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r<e.length;++r)n+=this.encodeString(e[r]);var i=t-n%t,o=[];return o.length=i,this.update(o),this},j.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,n=this.blockCount,r=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t<n+1;++t)e[t]=0;for(e[n-1]|=2147483648,t=0;t<n;++t)r[t]^=e[t];C(r)}},j.prototype.toString=j.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,u="";a<r;){for(o=0;o<t&&a<r;++o,++a)e=n[o],u+=s[e>>4&15]+s[15&e]+s[e>>12&15]+s[e>>8&15]+s[e>>20&15]+s[e>>16&15]+s[e>>28&15]+s[e>>24&15];a%t==0&&(C(n),o=0)}return i&&(e=n[o],u+=s[e>>4&15]+s[15&e],i>1&&(u+=s[e>>12&15]+s[e>>8&15]),i>2&&(u+=s[e>>20&15]+s[e>>16&15])),u},j.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;e=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(e);a<r;){for(o=0;o<t&&a<r;++o,++a)u[a]=n[o];a%t==0&&C(n)}return i&&(u[o]=n[o],e=e.slice(0,s)),e},j.prototype.buffer=j.prototype.arrayBuffer,j.prototype.digest=j.prototype.array=function(){this.finalize();for(var e,t,n=this.blockCount,r=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,u=[];s<i;){for(a=0;a<n&&s<i;++a,++s)e=s<<2,t=r[a],u[e]=255&t,u[e+1]=t>>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;s%n==0&&C(r)}return o&&(e=s<<2,t=r[a],u[e]=255&t,o>1&&(u[e+1]=t>>8&255),o>2&&(u[e+2]=t>>16&255)),u},D.prototype=new j,D.prototype.finalize=function(){return this.encode(this.outputBits,!0),j.prototype.finalize.call(this)};var C=function(e){var t,n,r,i,o,a,s,u,c,h,d,f,p,y,m,g,v,w,b,M,A,I,N,T,E,x,k,L,S,j,D,C,O,z,P,_,B,R,U,Q,W,Y,F,V,H,G,q,Z,J,X,K,$,ee,te,ne,re,ie,oe,ae,se,ue,ce,le;for(r=0;r<48;r+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],h=e[6]^e[16]^e[26]^e[36]^e[46],d=e[7]^e[17]^e[27]^e[37]^e[47],t=(f=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),n=(p=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=i^(u<<1|c>>>31),n=o^(c<<1|u>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=a^(h<<1|d>>>31),n=s^(d<<1|h>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=u^(f<<1|p>>>31),n=c^(p<<1|f>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=h^(i<<1|o>>>31),n=d^(o<<1|i>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,y=e[0],m=e[1],G=e[11]<<4|e[10]>>>28,q=e[10]<<4|e[11]>>>28,L=e[20]<<3|e[21]>>>29,S=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ue=e[30]<<9|e[31]>>>23,Y=e[40]<<18|e[41]>>>14,F=e[41]<<18|e[40]>>>14,z=e[2]<<1|e[3]>>>31,P=e[3]<<1|e[2]>>>31,g=e[13]<<12|e[12]>>>20,v=e[12]<<12|e[13]>>>20,Z=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,j=e[33]<<13|e[32]>>>19,D=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,le=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,_=e[14]<<6|e[15]>>>26,B=e[15]<<6|e[14]>>>26,w=e[25]<<11|e[24]>>>21,b=e[24]<<11|e[25]>>>21,X=e[34]<<15|e[35]>>>17,K=e[35]<<15|e[34]>>>17,C=e[45]<<29|e[44]>>>3,O=e[44]<<29|e[45]>>>3,T=e[6]<<28|e[7]>>>4,E=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,R=e[26]<<25|e[27]>>>7,U=e[27]<<25|e[26]>>>7,M=e[36]<<21|e[37]>>>11,A=e[37]<<21|e[36]>>>11,$=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,V=e[8]<<27|e[9]>>>5,H=e[9]<<27|e[8]>>>5,x=e[18]<<20|e[19]>>>12,k=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,ae=e[28]<<7|e[29]>>>25,Q=e[38]<<8|e[39]>>>24,W=e[39]<<8|e[38]>>>24,I=e[48]<<14|e[49]>>>18,N=e[49]<<14|e[48]>>>18,e[0]=y^~g&w,e[1]=m^~v&b,e[10]=T^~x&L,e[11]=E^~k&S,e[20]=z^~_&R,e[21]=P^~B&U,e[30]=V^~G&Z,e[31]=H^~q&J,e[40]=te^~re&oe,e[41]=ne^~ie&ae,e[2]=g^~w&M,e[3]=v^~b&A,e[12]=x^~L&j,e[13]=k^~S&D,e[22]=_^~R&Q,e[23]=B^~U&W,e[32]=G^~Z&X,e[33]=q^~J&K,e[42]=re^~oe&se,e[43]=ie^~ae&ue,e[4]=w^~M&I,e[5]=b^~A&N,e[14]=L^~j&C,e[15]=S^~D&O,e[24]=R^~Q&Y,e[25]=U^~W&F,e[34]=Z^~X&$,e[35]=J^~K&ee,e[44]=oe^~se&ce,e[45]=ae^~ue&le,e[6]=M^~I&y,e[7]=A^~N&m,e[16]=j^~C&T,e[17]=D^~O&E,e[26]=Q^~Y&z,e[27]=W^~F&P,e[36]=X^~$&V,e[37]=K^~ee&H,e[46]=se^~ce&te,e[47]=ue^~le&ne,e[8]=I^~y&g,e[9]=N^~m&v,e[18]=C^~T&x,e[19]=O^~E&k,e[28]=Y^~z&_,e[29]=F^~P&B,e[38]=$^~V&G,e[39]=ee^~H&q,e[48]=ce^~te&re,e[49]=le^~ne&ie,e[0]^=l[r],e[1]^=l[r+1]};if(o)e.exports=A;else for(N=0;N<I.length;++N)r[I[N]]=A[I[N]]}()}));function Hy(e){return"0x"+Vy.keccak_256(xp(e))}const Gy=new bp("rlp/5.7.0");function qy(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function Zy(e,t,n){let r=0;for(let i=0;i<n;i++)r=256*r+e[t+i];return r}function Jy(e){if(Array.isArray(e)){let t=[];if(e.forEach((function(e){t=t.concat(Jy(e))})),t.length<=55)return t.unshift(192+t.length),t;const n=qy(t.length);return n.unshift(247+n.length),n.concat(t)}Np(e)||Gy.throwArgumentError("RLP object must be BytesLike","object",e);const t=Array.prototype.slice.call(xp(e));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const n=qy(t.length);return n.unshift(183+n.length),n.concat(t)}function Xy(e){return Dp(Jy(e))}function Ky(e,t,n,r){const i=[];for(;n<t+1+r;){const o=$y(e,n);i.push(o.result),(n+=o.consumed)>t+1+r&&Gy.throwError("child data too short",bp.errors.BUFFER_OVERRUN,{})}return{consumed:1+r,result:i}}function $y(e,t){if(0===e.length&&Gy.throwError("data too short",bp.errors.BUFFER_OVERRUN,{}),e[t]>=248){const n=e[t]-247;t+1+n>e.length&&Gy.throwError("data short segment too short",bp.errors.BUFFER_OVERRUN,{});const r=Zy(e,t+1,n);return t+1+n+r>e.length&&Gy.throwError("data long segment too short",bp.errors.BUFFER_OVERRUN,{}),Ky(e,t,t+1+n,n+r)}if(e[t]>=192){const n=e[t]-192;return t+1+n>e.length&&Gy.throwError("data array too short",bp.errors.BUFFER_OVERRUN,{}),Ky(e,t,t+1,n)}if(e[t]>=184){const n=e[t]-183;t+1+n>e.length&&Gy.throwError("data array too short",bp.errors.BUFFER_OVERRUN,{});const r=Zy(e,t+1,n);t+1+n+r>e.length&&Gy.throwError("data array too short",bp.errors.BUFFER_OVERRUN,{});return{consumed:1+n+r,result:Dp(e.slice(t+1+n,t+1+n+r))}}if(e[t]>=128){const n=e[t]-128;t+1+n>e.length&&Gy.throwError("data too short",bp.errors.BUFFER_OVERRUN,{});return{consumed:1+n,result:Dp(e.slice(t+1,t+1+n))}}return{consumed:1,result:Dp(e[t])}}function em(e){const t=xp(e),n=$y(t,0);return n.consumed!==t.length&&Gy.throwArgumentError("invalid rlp data","data",e),n.result}const tm=new bp("address/5.7.0");function nm(e){jp(e,20)||tm.throwArgumentError("invalid address","address",e);const t=(e=e.toLowerCase()).substring(2).split(""),n=new Uint8Array(40);for(let e=0;e<40;e++)n[e]=t[e].charCodeAt(0);const r=xp(Hy(n));for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&(t[e]=t[e].toUpperCase()),(15&r[e>>1])>=8&&(t[e+1]=t[e+1].toUpperCase());return"0x"+t.join("")}const rm={};for(let e=0;e<10;e++)rm[String(e)]=String(e);for(let e=0;e<26;e++)rm[String.fromCharCode(65+e)]=String(10+e);const im=Math.floor(function(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}(9007199254740991));function om(e){let t=null;if("string"!=typeof e&&tm.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=nm(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&tm.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==function(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((e=>rm[e])).join("");for(;t.length>=im;){let e=t.substring(0,im);t=parseInt(e,10)%97+t.substring(e.length)}let n=String(98-parseInt(t,10)%97);for(;n.length<2;)n="0"+n;return n}(e)&&tm.throwArgumentError("bad icap checksum","address",e),n=e.substring(4),t=new Rp(n,36).toString(16);t.length<40;)t="0"+t;t=nm("0x"+t)}else tm.throwArgumentError("invalid address","address",e);var n;return t}function am(e){let t=null;try{t=om(e.from)}catch(t){tm.throwArgumentError("missing from address","transaction",e)}return om(Op(Hy(Xy([t,Lp(xp(Yp.from(e.nonce).toHexString()))])),12))}class sm extends Wy{constructor(e){super("address","address",e,!1)}defaultValue(){return"0x0000000000000000000000000000000000000000"}encode(e,t){try{t=om(t)}catch(e){this._throwError(e.message,t)}return e.writeValue(t)}decode(e){return om(_p(e.readValue().toHexString(),20))}}class um extends Wy{constructor(e){super(e.name,e.type,void 0,e.dynamic),this.coder=e}defaultValue(){return this.coder.defaultValue()}encode(e,t){return this.coder.encode(e,t)}decode(e){return this.coder.decode(e)}}const cm=new bp("abi/5.7.0");function lm(e,t,n){let r=null;if(Array.isArray(n))r=n;else if(n&&"object"==typeof n){let e={};r=t.map((t=>{const r=t.localName;return r||cm.throwError("cannot encode object for signature with missing names",bp.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:n}),e[r]&&cm.throwError("cannot encode object for signature with duplicate names",bp.errors.INVALID_ARGUMENT,{argument:"values",coder:t,value:n}),e[r]=!0,n[r]}))}else cm.throwArgumentError("invalid tuple value","tuple",n);t.length!==r.length&&cm.throwArgumentError("types/value length mismatch","tuple",n);let i=new Yy(e.wordSize),o=new Yy(e.wordSize),a=[];t.forEach(((e,t)=>{let n=r[t];if(e.dynamic){let t=o.length;e.encode(o,n);let r=i.writeUpdatableValue();a.push((e=>{r(e+t)}))}else e.encode(i,n)})),a.forEach((e=>{e(i.length)}));let s=e.appendWriter(i);return s+=e.appendWriter(o),s}function hm(e,t){let n=[],r=e.subReader(0);t.forEach((t=>{let i=null;if(t.dynamic){let n=e.readValue(),o=r.subReader(n.toNumber());try{i=t.decode(o)}catch(e){if(e.code===bp.errors.BUFFER_OVERRUN)throw e;i=e,i.baseType=t.name,i.name=t.localName,i.type=t.type}}else try{i=t.decode(e)}catch(e){if(e.code===bp.errors.BUFFER_OVERRUN)throw e;i=e,i.baseType=t.name,i.name=t.localName,i.type=t.type}null!=i&&n.push(i)}));const i=t.reduce(((e,t)=>{const n=t.localName;return n&&(e[n]||(e[n]=0),e[n]++),e}),{});t.forEach(((e,t)=>{let r=e.localName;if(!r||1!==i[r])return;if("length"===r&&(r="_length"),null!=n[r])return;const o=n[t];o instanceof Error?Object.defineProperty(n,r,{enumerable:!0,get:()=>{throw o}}):n[r]=o}));for(let e=0;e<n.length;e++){const t=n[e];t instanceof Error&&Object.defineProperty(n,e,{enumerable:!0,get:()=>{throw t}})}return Object.freeze(n)}class dm extends Wy{constructor(e,t,n){super("array",e.type+"["+(t>=0?t:"")+"]",n,-1===t||e.dynamic),this.coder=e,this.length=t}defaultValue(){const e=this.coder.defaultValue(),t=[];for(let n=0;n<this.length;n++)t.push(e);return t}encode(e,t){Array.isArray(t)||this._throwError("expected array value",t);let n=this.length;-1===n&&(n=t.length,e.writeValue(t.length)),cm.checkArgumentCount(t.length,n,"coder array"+(this.localName?" "+this.localName:""));let r=[];for(let e=0;e<t.length;e++)r.push(this.coder);return lm(e,r,t)}decode(e){let t=this.length;-1===t&&(t=e.readValue().toNumber(),32*t>e._data.length&&cm.throwError("insufficient data length",bp.errors.BUFFER_OVERRUN,{length:e._data.length,count:t}));let n=[];for(let e=0;e<t;e++)n.push(new um(this.coder));return e.coerce(this.name,hm(e,n))}}class fm extends Wy{constructor(e){super("bool","bool",e,!1)}defaultValue(){return!1}encode(e,t){return e.writeValue(t?1:0)}decode(e){return e.coerce(this.type,!e.readValue().isZero())}}class pm extends Wy{constructor(e,t){super(e,e,t,!0)}defaultValue(){return"0x"}encode(e,t){t=xp(t);let n=e.writeValue(t.length);return n+=e.writeBytes(t),n}decode(e){return e.readBytes(e.readValue().toNumber(),!0)}}class ym extends pm{constructor(e){super("bytes",e)}decode(e){return e.coerce(this.name,Dp(super.decode(e)))}}class mm extends Wy{constructor(e,t){let n="bytes"+String(e);super(n,n,t,!1),this.size=e}defaultValue(){return"0x0000000000000000000000000000000000000000000000000000000000000000".substring(0,2+2*this.size)}encode(e,t){let n=xp(t);return n.length!==this.size&&this._throwError("incorrect data length",t),e.writeBytes(n)}decode(e){return e.coerce(this.name,Dp(e.readBytes(this.size)))}}class gm extends Wy{constructor(e){super("null","",e,!1)}defaultValue(){return null}encode(e,t){return null!=t&&this._throwError("not null",t),e.writeBytes([])}decode(e){return e.readBytes(0),e.coerce(this.name,null)}}const vm=Yp.from(-1),wm=Yp.from(0),bm=Yp.from(1),Mm=Yp.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");class Am extends Wy{constructor(e,t,n){const r=(t?"int":"uint")+8*e;super(r,r,n,!1),this.size=e,this.signed=t}defaultValue(){return 0}encode(e,t){let n=Yp.from(t),r=Mm.mask(8*e.wordSize);if(this.signed){let e=r.mask(8*this.size-1);(n.gt(e)||n.lt(e.add(bm).mul(vm)))&&this._throwError("value out-of-bounds",t)}else(n.lt(wm)||n.gt(r.mask(8*this.size)))&&this._throwError("value out-of-bounds",t);return n=n.toTwos(8*this.size).mask(8*this.size),this.signed&&(n=n.fromTwos(8*this.size).toTwos(8*e.wordSize)),e.writeValue(n)}decode(e){let t=e.readValue().mask(8*this.size);return this.signed&&(t=t.fromTwos(8*this.size)),e.coerce(this.name,t)}}const Im=new bp("strings/5.7.0");var Nm,Tm;function Em(e,t,n,r,i){if(e===Tm.BAD_PREFIX||e===Tm.UNEXPECTED_CONTINUE){let e=0;for(let r=t+1;r<n.length&&n[r]>>6==2;r++)e++;return e}return e===Tm.OVERRUN?n.length-t-1:0}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(Nm||(Nm={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(Tm||(Tm={}));const xm=Object.freeze({error:function(e,t,n,r,i){return Im.throwArgumentError(`invalid codepoint at offset ${t}; ${e}`,"bytes",n)},ignore:Em,replace:function(e,t,n,r,i){return e===Tm.OVERLONG?(r.push(i),0):(r.push(65533),Em(e,t,n))}});function km(e,t){null==t&&(t=xm.error),e=xp(e);const n=[];let r=0;for(;r<e.length;){const i=e[r++];if(i>>7==0){n.push(i);continue}let o=null,a=null;if(192==(224&i))o=1,a=127;else if(224==(240&i))o=2,a=2047;else{if(240!=(248&i)){r+=t(128==(192&i)?Tm.UNEXPECTED_CONTINUE:Tm.BAD_PREFIX,r-1,e,n);continue}o=3,a=65535}if(r-1+o>=e.length){r+=t(Tm.OVERRUN,r-1,e,n);continue}let s=i&(1<<8-o-1)-1;for(let i=0;i<o;i++){let i=e[r];if(128!=(192&i)){r+=t(Tm.MISSING_CONTINUE,r,e,n),s=null;break}s=s<<6|63&i,r++}null!==s&&(s>1114111?r+=t(Tm.OUT_OF_RANGE,r-1-o,e,n,s):s>=55296&&s<=57343?r+=t(Tm.UTF16_SURROGATE,r-1-o,e,n,s):s<=a?r+=t(Tm.OVERLONG,r-1-o,e,n,s):n.push(s))}return n}function Lm(e,t=Nm.current){t!=Nm.current&&(Im.checkNormalize(),e=e.normalize(t));let n=[];for(let t=0;t<e.length;t++){const r=e.charCodeAt(t);if(r<128)n.push(r);else if(r<2048)n.push(r>>6|192),n.push(63&r|128);else if(55296==(64512&r)){t++;const i=e.charCodeAt(t);if(t>=e.length||56320!=(64512&i))throw new Error("invalid utf-8 string");const o=65536+((1023&r)<<10)+(1023&i);n.push(o>>18|240),n.push(o>>12&63|128),n.push(o>>6&63|128),n.push(63&o|128)}else n.push(r>>12|224),n.push(r>>6&63|128),n.push(63&r|128)}return xp(n)}function Sm(e,t){return km(e,t).map((e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e))))).join("")}class jm extends pm{constructor(e){super("string",e)}defaultValue(){return""}encode(e,t){return super.encode(e,Lm(t))}decode(e){return Sm(super.decode(e))}}class Dm extends Wy{constructor(e,t){let n=!1;const r=[];e.forEach((e=>{e.dynamic&&(n=!0),r.push(e.type)}));super("tuple","tuple("+r.join(",")+")",t,n),this.coders=e}defaultValue(){const e=[];this.coders.forEach((t=>{e.push(t.defaultValue())}));const t=this.coders.reduce(((e,t)=>{const n=t.localName;return n&&(e[n]||(e[n]=0),e[n]++),e}),{});return this.coders.forEach(((n,r)=>{let i=n.localName;i&&1===t[i]&&("length"===i&&(i="_length"),null==e[i]&&(e[i]=e[r]))})),Object.freeze(e)}encode(e,t){return lm(e,this.coders,t)}decode(e){return e.coerce(this.name,hm(e,this.coders))}}const Cm=new bp("abi/5.7.0"),Om=new RegExp(/^bytes([0-9]*)$/),zm=new RegExp(/^(u?int)([0-9]*)$/);const Pm=new class{constructor(e){cy(this,"coerceFunc",e||null)}_getCoder(e){switch(e.baseType){case"address":return new sm(e.name);case"bool":return new fm(e.name);case"string":return new jm(e.name);case"bytes":return new ym(e.name);case"array":return new dm(this._getCoder(e.arrayChildren),e.arrayLength,e.name);case"tuple":return new Dm((e.components||[]).map((e=>this._getCoder(e))),e.name);case"":return new gm(e.name)}let t=e.type.match(zm);if(t){let n=parseInt(t[2]||"256");return(0===n||n>256||n%8!=0)&&Cm.throwArgumentError("invalid "+t[1]+" bit length","param",e),new Am(n/8,"int"===t[1],e.name)}if(t=e.type.match(Om),t){let n=parseInt(t[1]);return(0===n||n>32)&&Cm.throwArgumentError("invalid bytes length","param",e),new mm(n,e.name)}return Cm.throwArgumentError("invalid type","type",e.type)}_getWordSize(){return 32}_getReader(e,t){return new Fy(e,this._getWordSize(),this.coerceFunc,t)}_getWriter(){return new Yy(this._getWordSize())}getDefaultValue(e){const t=e.map((e=>this._getCoder(Ey.from(e))));return new Dm(t,"_").defaultValue()}encode(e,t){e.length!==t.length&&Cm.throwError("types/values length mismatch",bp.errors.INVALID_ARGUMENT,{count:{types:e.length,values:t.length},value:{types:e,values:t}});const n=e.map((e=>this._getCoder(Ey.from(e)))),r=new Dm(n,"_"),i=this._getWriter();return r.encode(i,t),i.data}decode(e,t,n){const r=e.map((e=>this._getCoder(Ey.from(e))));return new Dm(r,"_").decode(this._getReader(xp(t),n))}};function _m(e){return Hy(Lm(e))}function Bm(e){e=atob(e);const t=[];for(let n=0;n<e.length;n++)t.push(e.charCodeAt(n));return xp(t)}function Rm(e){e=xp(e);let t="";for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t)}function Um(e,t){null==t&&(t=1);const n=[],r=n.forEach,i=function(e,t){r.call(e,(function(e){t>0&&Array.isArray(e)?i(e,t-1):n.push(e)}))};return i(e,t),n}function Qm(e){return function(e){let t=0;return()=>e[t++]}(function(e){let t=0;function n(){return e[t++]<<8|e[t++]}let r=n(),i=1,o=[0,1];for(let e=1;e<r;e++)o.push(i+=n());let a=n(),s=t;t+=a;let u=0,c=0;function l(){return 0==u&&(c=c<<8|e[t++],u=8),c>>--u&1}const h=Math.pow(2,31),d=h>>>1,f=d>>1,p=h-1;let y=0;for(let e=0;e<31;e++)y=y<<1|l();let m=[],g=0,v=h;for(;;){let e=Math.floor(((y-g+1)*i-1)/v),t=0,n=r;for(;n-t>1;){let r=t+n>>>1;e<o[r]?n=r:t=r}if(0==t)break;m.push(t);let a=g+Math.floor(v*o[t]/i),s=g+Math.floor(v*o[t+1]/i)-1;for(;0==((a^s)&d);)y=y<<1&p|l(),a=a<<1&p,s=s<<1&p|1;for(;a&~s&f;)y=y&d|y<<1&p>>>1|l(),a=a<<1^d,s=(s^d)<<1|d|1;g=a,v=1+s-a}let w=r-4;return m.map((t=>{switch(t-w){case 3:return w+65792+(e[s++]<<16|e[s++]<<8|e[s++]);case 2:return w+256+(e[s++]<<8|e[s++]);case 1:return w+e[s++];default:return t-1}}))}(e))}function Wm(e){return 1&e?~e>>1:e>>1}function Ym(e,t){let n=Array(e);for(let r=0,i=-1;r<e;r++)n[r]=i+=1+t();return n}function Fm(e,t){let n=Array(e);for(let r=0,i=0;r<e;r++)n[r]=i+=Wm(t());return n}function Vm(e,t){let n=Ym(e(),e),r=e(),i=Ym(r,e),o=function(e,t){let n=Array(e);for(let r=0;r<e;r++)n[r]=1+t();return n}(r,e);for(let e=0;e<r;e++)for(let t=0;t<o[e];t++)n.push(i[e]+t);return t?n.map((e=>t[e])):n}function Hm(e,t,n){let r=Array(e).fill(void 0).map((()=>[]));for(let i=0;i<t;i++)Fm(e,n).forEach(((e,t)=>r[t].push(e)));return r}function Gm(e,t){let n=1+t(),r=t(),i=function(e){let t=[];for(;;){let n=e();if(0==n)break;t.push(n)}return t}(t);return Um(Hm(i.length,1+e,t).map(((e,t)=>{const o=e[0],a=e.slice(1);return Array(i[t]).fill(void 0).map(((e,t)=>{let i=t*r;return[o+t*n,a.map((e=>e+i))]}))})))}function qm(e,t){return Hm(1+t(),1+e,t).map((e=>[e[0],e.slice(1)]))}const Zm=Qm(Bm("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA==")),Jm=new Set(Vm(Zm)),Xm=new Set(Vm(Zm)),Km=function(e){let t=[];for(;;){let n=e();if(0==n)break;t.push(Gm(n,e))}for(;;){let n=e()-1;if(n<0)break;t.push(qm(n,e))}return function(e){const t={};for(let n=0;n<e.length;n++){const r=e[n];t[r[0]]=r[1]}return t}(Um(t))}(Zm),$m=function(e){let t=Vm(e).sort(((e,t)=>e-t));return function n(){let r=[];for(;;){let i=Vm(e,t);if(0==i.length)break;r.push({set:new Set(i),node:n()})}r.sort(((e,t)=>t.set.size-e.set.size));let i=e(),o=i%3;i=i/3|0;let a=!!(1&i);return i>>=1,{branches:r,valid:o,fe0f:a,save:1==i,check:2==i}}()}(Zm);function eg(e){return function(e,t=Nm.current){return km(Lm(e,t))}(e)}function tg(e){return e.filter((e=>65039!=e))}function ng(e){for(let t of e.split(".")){let e=eg(t);try{for(let t=e.lastIndexOf(95)-1;t>=0;t--)if(95!==e[t])throw new Error("underscore only allowed at start");if(e.length>=4&&e.every((e=>e<128))&&45===e[2]&&45===e[3])throw new Error("invalid label extension")}catch(e){throw new Error(`Invalid label "${t}": ${e.message}`)}}return e}function rg(e){return ng(function(e,t){let n=eg(e).reverse(),r=[];for(;n.length;){let e=ig(n);if(e){r.push(...t(e));continue}let i=n.pop();if(Jm.has(i)){r.push(i);continue}if(Xm.has(i))continue;let o=Km[i];if(!o)throw new Error(`Disallowed codepoint: 0x${i.toString(16).toUpperCase()}`);r.push(...o)}return ng(function(e){return e.normalize("NFC")}(String.fromCodePoint(...r)))}(e,tg))}function ig(e,t){var n;let r,i,o=$m,a=[],s=e.length;for(t&&(t.length=0);s;){let u=e[--s];if(o=null===(n=o.branches.find((e=>e.set.has(u))))||void 0===n?void 0:n.node,!o)break;if(o.save)i=u;else if(o.check&&u===i)break;a.push(u),o.fe0f&&(a.push(65039),s>0&&65039==e[s-1]&&s--),o.valid&&(r=a.slice(),2==o.valid&&r.splice(1,1),t&&t.push(...e.slice(s).reverse()),e.length=s)}return r}const og=new bp("hash/5.7.0"),ag=new Uint8Array(32);function sg(e){if(0===e.length)throw new Error("invalid ENS name; empty component");return e}function ug(e){const t=Lm(rg(e)),n=[];if(0===e.length)return n;let r=0;for(let e=0;e<t.length;e++){46===t[e]&&(n.push(sg(t.slice(r,e))),r=e+1)}if(r>=t.length)throw new Error("invalid ENS name; empty component");return n.push(sg(t.slice(r))),n}function cg(e){"string"!=typeof e&&og.throwArgumentError("invalid ENS name; not a string","name",e);let t=ag;const n=ug(e);for(;n.length;)t=Hy(kp([t,Hy(n.pop())]));return Dp(t)}ag.fill(0);var lg=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};const hg=new bp("hash/5.7.0"),dg=new Uint8Array(32);dg.fill(0);const fg=Yp.from(-1),pg=Yp.from(0),yg=Yp.from(1),mg=Yp.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const gg=_p(yg.toHexString(),32),vg=_p(pg.toHexString(),32),wg={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},bg=["name","version","chainId","verifyingContract","salt"];function Mg(e){return function(t){return"string"!=typeof t&&hg.throwArgumentError(`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const Ag={name:Mg("name"),version:Mg("version"),chainId:function(e){try{return Yp.from(e).toString()}catch(e){}return hg.throwArgumentError('invalid domain value for "chainId"',"domain.chainId",e)},verifyingContract:function(e){try{return om(e).toLowerCase()}catch(e){}return hg.throwArgumentError('invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){try{const t=xp(e);if(32!==t.length)throw new Error("bad length");return Dp(t)}catch(e){}return hg.throwArgumentError('invalid domain value "salt"',"domain.salt",e)}};function Ig(e){{const t=e.match(/^(u?)int(\d*)$/);if(t){const n=""===t[1],r=parseInt(t[2]||"256");(r%8!=0||r>256||t[2]&&t[2]!==String(r))&&hg.throwArgumentError("invalid numeric width","type",e);const i=mg.mask(n?r-1:r),o=n?i.add(yg).mul(fg):pg;return function(t){const n=Yp.from(t);return(n.lt(o)||n.gt(i))&&hg.throwArgumentError(`value out-of-bounds for ${e}`,"value",t),_p(n.toTwos(256).toHexString(),32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const n=parseInt(t[1]);return(0===n||n>32||t[1]!==String(n))&&hg.throwArgumentError("invalid bytes width","type",e),function(t){return xp(t).length!==n&&hg.throwArgumentError(`invalid length for ${e}`,"value",t),function(e){const t=xp(e),n=t.length%32;return n?zp([t,dg.slice(n)]):Dp(t)}(t)}}}switch(e){case"address":return function(e){return _p(om(e),32)};case"bool":return function(e){return e?gg:vg};case"bytes":return function(e){return Hy(e)};case"string":return function(e){return _m(e)}}return null}function Ng(e,t){return`${e}(${t.map((({name:e,type:t})=>t+" "+e)).join(",")})`}class Tg{constructor(e){cy(this,"types",Object.freeze(my(e))),cy(this,"_encoderCache",{}),cy(this,"_types",{});const t={},n={},r={};Object.keys(e).forEach((e=>{t[e]={},n[e]=[],r[e]={}}));for(const r in e){const i={};e[r].forEach((o=>{i[o.name]&&hg.throwArgumentError(`duplicate variable name ${JSON.stringify(o.name)} in ${JSON.stringify(r)}`,"types",e),i[o.name]=!0;const a=o.type.match(/^([^\x5b]*)(\x5b|$)/)[1];a===r&&hg.throwArgumentError(`circular type reference to ${JSON.stringify(a)}`,"types",e);Ig(a)||(n[a]||hg.throwArgumentError(`unknown type ${JSON.stringify(a)}`,"types",e),n[a].push(r),t[r][a]=!0)}))}const i=Object.keys(n).filter((e=>0===n[e].length));0===i.length?hg.throwArgumentError("missing primary type","types",e):i.length>1&&hg.throwArgumentError(`ambiguous primary types or unused types: ${i.map((e=>JSON.stringify(e))).join(", ")}`,"types",e),cy(this,"primaryType",i[0]),function i(o,a){a[o]&&hg.throwArgumentError(`circular type reference to ${JSON.stringify(o)}`,"types",e),a[o]=!0,Object.keys(t[o]).forEach((e=>{n[e]&&(i(e,a),Object.keys(a).forEach((t=>{r[t][e]=!0})))})),delete a[o]}(this.primaryType,{});for(const t in r){const n=Object.keys(r[t]);n.sort(),this._types[t]=Ng(t,e[t])+n.map((t=>Ng(t,e[t]))).join("")}}getEncoder(e){let t=this._encoderCache[e];return t||(t=this._encoderCache[e]=this._getEncoder(e)),t}_getEncoder(e){{const t=Ig(e);if(t)return t}const t=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(t){const e=t[1],n=this.getEncoder(e),r=parseInt(t[3]);return t=>{r>=0&&t.length!==r&&hg.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t);let i=t.map(n);return this._types[e]&&(i=i.map(Hy)),Hy(zp(i))}}const n=this.types[e];if(n){const t=_m(this._types[e]);return e=>{const r=n.map((({name:t,type:n})=>{const r=this.getEncoder(n)(e[t]);return this._types[n]?Hy(r):r}));return r.unshift(t),zp(r)}}return hg.throwArgumentError(`unknown type: ${e}`,"type",e)}encodeType(e){const t=this._types[e];return t||hg.throwArgumentError(`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return Hy(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,n){if(Ig(e))return n(e,t);const r=e.match(/^(.*)(\x5b(\d*)\x5d)$/);if(r){const e=r[1],i=parseInt(r[3]);return i>=0&&t.length!==i&&hg.throwArgumentError("array length mismatch; expected length ${ arrayLength }","value",t),t.map((t=>this._visit(e,t,n)))}const i=this.types[e];return i?i.reduce(((e,{name:r,type:i})=>(e[r]=this._visit(i,t[r],n),e)),{}):hg.throwArgumentError(`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new Tg(e)}static getPrimaryType(e){return Tg.from(e).primaryType}static hashStruct(e,t,n){return Tg.from(t).hashStruct(e,n)}static hashDomain(e){const t=[];for(const n in e){const r=wg[n];r||hg.throwArgumentError(`invalid typed-data domain key: ${JSON.stringify(n)}`,"domain",e),t.push({name:n,type:r})}return t.sort(((e,t)=>bg.indexOf(e.name)-bg.indexOf(t.name))),Tg.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,n){return zp(["0x1901",Tg.hashDomain(e),Tg.from(t).hash(n)])}static hash(e,t,n){return Hy(Tg.encode(e,t,n))}static resolveNames(e,t,n,r){return lg(this,void 0,void 0,(function*(){e=dy(e);const i={};e.verifyingContract&&!jp(e.verifyingContract,20)&&(i[e.verifyingContract]="0x");const o=Tg.from(t);o.visit(n,((e,t)=>("address"!==e||jp(t,20)||(i[t]="0x"),t)));for(const e in i)i[e]=yield r(e);return e.verifyingContract&&i[e.verifyingContract]&&(e.verifyingContract=i[e.verifyingContract]),n=o.visit(n,((e,t)=>"address"===e&&i[t]?i[t]:t)),{domain:e,value:n}}))}static getPayload(e,t,n){Tg.hashDomain(e);const r={},i=[];bg.forEach((t=>{const n=e[t];null!=n&&(r[t]=Ag[t](n),i.push({name:t,type:wg[t]}))}));const o=Tg.from(t),a=dy(t);return a.EIP712Domain?hg.throwArgumentError("types must not contain EIP712Domain type","types.EIP712Domain",t):a.EIP712Domain=i,o.encode(n),{types:a,domain:r,primaryType:o.primaryType,message:o.visit(n,((e,t)=>{if(e.match(/^bytes(\d*)/))return Dp(xp(t));if(e.match(/^u?int/))return Yp.from(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return"string"!=typeof t&&hg.throwArgumentError("invalid string","value",t),t}return hg.throwArgumentError("unsupported type","type",e)}))}}}const Eg=new bp("abi/5.7.0");class xg extends gy{}class kg extends gy{}class Lg extends gy{}class Sg extends gy{static isIndexed(e){return!(!e||!e._isIndexed)}}const jg={"0x08c379a0":{signature:"Error(string)",name:"Error",inputs:["string"],reason:!0},"0x4e487b71":{signature:"Panic(uint256)",name:"Panic",inputs:["uint256"]}};function Dg(e,t){const n=new Error(`deferred error during ABI decoding triggered accessing ${e}`);return n.error=t,n}class Cg{constructor(e){let t=[];t="string"==typeof e?JSON.parse(e):e,cy(this,"fragments",t.map((e=>ky.from(e))).filter((e=>null!=e))),cy(this,"_abiCoder",ly(new.target,"getAbiCoder")()),cy(this,"functions",{}),cy(this,"errors",{}),cy(this,"events",{}),cy(this,"structs",{}),this.fragments.forEach((e=>{let t=null;switch(e.type){case"constructor":return this.deploy?void Eg.warn("duplicate definition - constructor"):void cy(this,"deploy",e);case"function":t=this.functions;break;case"event":t=this.events;break;case"error":t=this.errors;break;default:return}let n=e.format();t[n]?Eg.warn("duplicate definition - "+n):t[n]=e})),this.deploy||cy(this,"deploy",Cy.from({payable:!1,type:"constructor"})),cy(this,"_isInterface",!0)}format(e){e||(e=Ny.full),e===Ny.sighash&&Eg.throwArgumentError("interface does not support formatting sighash","format",e);const t=this.fragments.map((t=>t.format(e)));return e===Ny.json?JSON.stringify(t.map((e=>JSON.parse(e)))):t}static getAbiCoder(){return Pm}static getAddress(e){return om(e)}static getSighash(e){return Op(_m(e.format()),0,4)}static getEventTopic(e){return _m(e.format())}getFunction(e){if(jp(e)){for(const t in this.functions)if(e===this.getSighash(t))return this.functions[t];Eg.throwArgumentError("no matching function","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),n=Object.keys(this.functions).filter((e=>e.split("(")[0]===t));return 0===n.length?Eg.throwArgumentError("no matching function","name",t):n.length>1&&Eg.throwArgumentError("multiple matching functions","name",t),this.functions[n[0]]}const t=this.functions[Oy.fromString(e).format()];return t||Eg.throwArgumentError("no matching function","signature",e),t}getEvent(e){if(jp(e)){const t=e.toLowerCase();for(const e in this.events)if(t===this.getEventTopic(e))return this.events[e];Eg.throwArgumentError("no matching event","topichash",t)}if(-1===e.indexOf("(")){const t=e.trim(),n=Object.keys(this.events).filter((e=>e.split("(")[0]===t));return 0===n.length?Eg.throwArgumentError("no matching event","name",t):n.length>1&&Eg.throwArgumentError("multiple matching events","name",t),this.events[n[0]]}const t=this.events[Ly.fromString(e).format()];return t||Eg.throwArgumentError("no matching event","signature",e),t}getError(e){if(jp(e)){const t=ly(this.constructor,"getSighash");for(const n in this.errors){if(e===t(this.errors[n]))return this.errors[n]}Eg.throwArgumentError("no matching error","sighash",e)}if(-1===e.indexOf("(")){const t=e.trim(),n=Object.keys(this.errors).filter((e=>e.split("(")[0]===t));return 0===n.length?Eg.throwArgumentError("no matching error","name",t):n.length>1&&Eg.throwArgumentError("multiple matching errors","name",t),this.errors[n[0]]}const t=this.errors[Oy.fromString(e).format()];return t||Eg.throwArgumentError("no matching error","signature",e),t}getSighash(e){if("string"==typeof e)try{e=this.getFunction(e)}catch(t){try{e=this.getError(e)}catch(e){throw t}}return ly(this.constructor,"getSighash")(e)}getEventTopic(e){return"string"==typeof e&&(e=this.getEvent(e)),ly(this.constructor,"getEventTopic")(e)}_decodeParams(e,t){return this._abiCoder.decode(e,t)}_encodeParams(e,t){return this._abiCoder.encode(e,t)}encodeDeploy(e){return this._encodeParams(this.deploy.inputs,e||[])}decodeErrorResult(e,t){"string"==typeof e&&(e=this.getError(e));const n=xp(t);return Dp(n.slice(0,4))!==this.getSighash(e)&&Eg.throwArgumentError(`data signature does not match error ${e.name}.`,"data",Dp(n)),this._decodeParams(e.inputs,n.slice(4))}encodeErrorResult(e,t){return"string"==typeof e&&(e=this.getError(e)),Dp(kp([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionData(e,t){"string"==typeof e&&(e=this.getFunction(e));const n=xp(t);return Dp(n.slice(0,4))!==this.getSighash(e)&&Eg.throwArgumentError(`data signature does not match function ${e.name}.`,"data",Dp(n)),this._decodeParams(e.inputs,n.slice(4))}encodeFunctionData(e,t){return"string"==typeof e&&(e=this.getFunction(e)),Dp(kp([this.getSighash(e),this._encodeParams(e.inputs,t||[])]))}decodeFunctionResult(e,t){"string"==typeof e&&(e=this.getFunction(e));let n=xp(t),r=null,i="",o=null,a=null,s=null;switch(n.length%this._abiCoder._getWordSize()){case 0:try{return this._abiCoder.decode(e.outputs,n)}catch(e){}break;case 4:{const e=Dp(n.slice(0,4)),t=jg[e];if(t)o=this._abiCoder.decode(t.inputs,n.slice(4)),a=t.name,s=t.signature,t.reason&&(r=o[0]),"Error"===a?i=`; VM Exception while processing transaction: reverted with reason string ${JSON.stringify(o[0])}`:"Panic"===a&&(i=`; VM Exception while processing transaction: reverted with panic code ${o[0]}`);else try{const t=this.getError(e);o=this._abiCoder.decode(t.inputs,n.slice(4)),a=t.name,s=t.format()}catch(e){}break}}return Eg.throwError("call revert exception"+i,bp.errors.CALL_EXCEPTION,{method:e.format(),data:Dp(t),errorArgs:o,errorName:a,errorSignature:s,reason:r})}encodeFunctionResult(e,t){return"string"==typeof e&&(e=this.getFunction(e)),Dp(this._abiCoder.encode(e.outputs,t||[]))}encodeFilterTopics(e,t){"string"==typeof e&&(e=this.getEvent(e)),t.length>e.inputs.length&&Eg.throwError("too many arguments for "+e.format(),bp.errors.UNEXPECTED_ARGUMENT,{argument:"values",value:t});let n=[];e.anonymous||n.push(this.getEventTopic(e));const r=(e,t)=>"string"===e.type?_m(t):"bytes"===e.type?Hy(Dp(t)):("bool"===e.type&&"boolean"==typeof t&&(t=t?"0x01":"0x00"),e.type.match(/^u?int/)&&(t=Yp.from(t).toHexString()),"address"===e.type&&this._abiCoder.encode(["address"],[t]),_p(Dp(t),32));for(t.forEach(((t,i)=>{let o=e.inputs[i];o.indexed?null==t?n.push(null):"array"===o.baseType||"tuple"===o.baseType?Eg.throwArgumentError("filtering with tuples or arrays not supported","contract."+o.name,t):Array.isArray(t)?n.push(t.map((e=>r(o,e)))):n.push(r(o,t)):null!=t&&Eg.throwArgumentError("cannot filter non-indexed parameters; must be null","contract."+o.name,t)}));n.length&&null===n[n.length-1];)n.pop();return n}encodeEventLog(e,t){"string"==typeof e&&(e=this.getEvent(e));const n=[],r=[],i=[];return e.anonymous||n.push(this.getEventTopic(e)),t.length!==e.inputs.length&&Eg.throwArgumentError("event arguments/values mismatch","values",t),e.inputs.forEach(((e,o)=>{const a=t[o];if(e.indexed)if("string"===e.type)n.push(_m(a));else if("bytes"===e.type)n.push(Hy(a));else{if("tuple"===e.baseType||"array"===e.baseType)throw new Error("not implemented");n.push(this._abiCoder.encode([e.type],[a]))}else r.push(e),i.push(a)})),{data:this._abiCoder.encode(r,i),topics:n}}decodeEventLog(e,t,n){if("string"==typeof e&&(e=this.getEvent(e)),null!=n&&!e.anonymous){let t=this.getEventTopic(e);jp(n[0],32)&&n[0].toLowerCase()===t||Eg.throwError("fragment/topic mismatch",bp.errors.INVALID_ARGUMENT,{argument:"topics[0]",expected:t,value:n[0]}),n=n.slice(1)}let r=[],i=[],o=[];e.inputs.forEach(((e,t)=>{e.indexed?"string"===e.type||"bytes"===e.type||"tuple"===e.baseType||"array"===e.baseType?(r.push(Ey.fromObject({type:"bytes32",name:e.name})),o.push(!0)):(r.push(e),o.push(!1)):(i.push(e),o.push(!1))}));let a=null!=n?this._abiCoder.decode(r,kp(n)):null,s=this._abiCoder.decode(i,t,!0),u=[],c=0,l=0;e.inputs.forEach(((e,t)=>{if(e.indexed)if(null==a)u[t]=new Sg({_isIndexed:!0,hash:null});else if(o[t])u[t]=new Sg({_isIndexed:!0,hash:a[l++]});else try{u[t]=a[l++]}catch(e){u[t]=e}else try{u[t]=s[c++]}catch(e){u[t]=e}if(e.name&&null==u[e.name]){const n=u[t];n instanceof Error?Object.defineProperty(u,e.name,{enumerable:!0,get:()=>{throw Dg(`property ${JSON.stringify(e.name)}`,n)}}):u[e.name]=n}}));for(let e=0;e<u.length;e++){const t=u[e];t instanceof Error&&Object.defineProperty(u,e,{enumerable:!0,get:()=>{throw Dg(`index ${e}`,t)}})}return Object.freeze(u)}parseTransaction(e){let t=this.getFunction(e.data.substring(0,10).toLowerCase());return t?new kg({args:this._abiCoder.decode(t.inputs,"0x"+e.data.substring(10)),functionFragment:t,name:t.name,signature:t.format(),sighash:this.getSighash(t),value:Yp.from(e.value||"0")}):null}parseLog(e){let t=this.getEvent(e.topics[0]);return!t||t.anonymous?null:new xg({eventFragment:t,name:t.name,signature:t.format(),topic:this.getEventTopic(t),args:this.decodeEventLog(t,e.data,e.topics)})}parseError(e){const t=Dp(e);let n=this.getError(t.substring(0,10).toLowerCase());return n?new Lg({args:this._abiCoder.decode(n.inputs,"0x"+t.substring(10)),errorFragment:n,name:n.name,signature:n.format(),sighash:this.getSighash(n)}):null}static isInterface(e){return!(!e||!e._isInterface)}}var Og=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};const zg=new bp("abstract-provider/5.7.0");class Pg extends gy{static isForkEvent(e){return!(!e||!e._isForkEvent)}}class _g{constructor(){zg.checkAbstract(new.target,_g),cy(this,"_isProvider",!0)}getFeeData(){return Og(this,void 0,void 0,(function*(){const{block:e,gasPrice:t}=yield hy({block:this.getBlock("latest"),gasPrice:this.getGasPrice().catch((e=>null))});let n=null,r=null,i=null;return e&&e.baseFeePerGas&&(n=e.baseFeePerGas,i=Yp.from("1500000000"),r=e.baseFeePerGas.mul(2).add(i)),{lastBaseFeePerGas:n,maxFeePerGas:r,maxPriorityFeePerGas:i,gasPrice:t}}))}addListener(e,t){return this.on(e,t)}removeListener(e,t){return this.off(e,t)}static isProvider(e){return!(!e||!e._isProvider)}}var Bg=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};const Rg=new bp("abstract-signer/5.7.0"),Ug=["accessList","ccipReadEnabled","chainId","customData","data","from","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","nonce","to","type","value"],Qg=[bp.errors.INSUFFICIENT_FUNDS,bp.errors.NONCE_EXPIRED,bp.errors.REPLACEMENT_UNDERPRICED];class Wg{constructor(){Rg.checkAbstract(new.target,Wg),cy(this,"_isSigner",!0)}getBalance(e){return Bg(this,void 0,void 0,(function*(){return this._checkProvider("getBalance"),yield this.provider.getBalance(this.getAddress(),e)}))}getTransactionCount(e){return Bg(this,void 0,void 0,(function*(){return this._checkProvider("getTransactionCount"),yield this.provider.getTransactionCount(this.getAddress(),e)}))}estimateGas(e){return Bg(this,void 0,void 0,(function*(){this._checkProvider("estimateGas");const t=yield hy(this.checkTransaction(e));return yield this.provider.estimateGas(t)}))}call(e,t){return Bg(this,void 0,void 0,(function*(){this._checkProvider("call");const n=yield hy(this.checkTransaction(e));return yield this.provider.call(n,t)}))}sendTransaction(e){return Bg(this,void 0,void 0,(function*(){this._checkProvider("sendTransaction");const t=yield this.populateTransaction(e),n=yield this.signTransaction(t);return yield this.provider.sendTransaction(n)}))}getChainId(){return Bg(this,void 0,void 0,(function*(){this._checkProvider("getChainId");return(yield this.provider.getNetwork()).chainId}))}getGasPrice(){return Bg(this,void 0,void 0,(function*(){return this._checkProvider("getGasPrice"),yield this.provider.getGasPrice()}))}getFeeData(){return Bg(this,void 0,void 0,(function*(){return this._checkProvider("getFeeData"),yield this.provider.getFeeData()}))}resolveName(e){return Bg(this,void 0,void 0,(function*(){return this._checkProvider("resolveName"),yield this.provider.resolveName(e)}))}checkTransaction(e){for(const t in e)-1===Ug.indexOf(t)&&Rg.throwArgumentError("invalid transaction key: "+t,"transaction",e);const t=dy(e);return null==t.from?t.from=this.getAddress():t.from=Promise.all([Promise.resolve(t.from),this.getAddress()]).then((t=>(t[0].toLowerCase()!==t[1].toLowerCase()&&Rg.throwArgumentError("from address mismatch","transaction",e),t[0]))),t}populateTransaction(e){return Bg(this,void 0,void 0,(function*(){const t=yield hy(this.checkTransaction(e));null!=t.to&&(t.to=Promise.resolve(t.to).then((e=>Bg(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.resolveName(e);return null==t&&Rg.throwArgumentError("provided ENS name resolves to null","tx.to",e),t})))),t.to.catch((e=>{})));const n=null!=t.maxFeePerGas||null!=t.maxPriorityFeePerGas;if(null==t.gasPrice||2!==t.type&&!n?0!==t.type&&1!==t.type||!n||Rg.throwArgumentError("pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","transaction",e):Rg.throwArgumentError("eip-1559 transaction do not support gasPrice","transaction",e),2!==t.type&&null!=t.type||null==t.maxFeePerGas||null==t.maxPriorityFeePerGas)if(0===t.type||1===t.type)null==t.gasPrice&&(t.gasPrice=this.getGasPrice());else{const e=yield this.getFeeData();if(null==t.type)if(null!=e.maxFeePerGas&&null!=e.maxPriorityFeePerGas)if(t.type=2,null!=t.gasPrice){const e=t.gasPrice;delete t.gasPrice,t.maxFeePerGas=e,t.maxPriorityFeePerGas=e}else null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas);else null!=e.gasPrice?(n&&Rg.throwError("network does not support EIP-1559",bp.errors.UNSUPPORTED_OPERATION,{operation:"populateTransaction"}),null==t.gasPrice&&(t.gasPrice=e.gasPrice),t.type=0):Rg.throwError("failed to get consistent fee data",bp.errors.UNSUPPORTED_OPERATION,{operation:"signer.getFeeData"});else 2===t.type&&(null==t.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null==t.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas))}else t.type=2;return null==t.nonce&&(t.nonce=this.getTransactionCount("pending")),null==t.gasLimit&&(t.gasLimit=this.estimateGas(t).catch((e=>{if(Qg.indexOf(e.code)>=0)throw e;return Rg.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",bp.errors.UNPREDICTABLE_GAS_LIMIT,{error:e,tx:t})}))),null==t.chainId?t.chainId=this.getChainId():t.chainId=Promise.all([Promise.resolve(t.chainId),this.getChainId()]).then((t=>(0!==t[1]&&t[0]!==t[1]&&Rg.throwArgumentError("chainId address mismatch","transaction",e),t[0]))),yield hy(t)}))}_checkProvider(e){this.provider||Rg.throwError("missing provider",bp.errors.UNSUPPORTED_OPERATION,{operation:e||"_checkProvider"})}static isSigner(e){return!(!e||!e._isSigner)}}class Yg extends Wg{constructor(e,t){super(),cy(this,"address",e),cy(this,"provider",t||null)}getAddress(){return Promise.resolve(this.address)}_fail(e,t){return Promise.resolve().then((()=>{Rg.throwError(e,bp.errors.UNSUPPORTED_OPERATION,{operation:t})}))}signMessage(e){return this._fail("VoidSigner cannot sign messages","signMessage")}signTransaction(e){return this._fail("VoidSigner cannot sign transactions","signTransaction")}_signTypedData(e,t,n){return this._fail("VoidSigner cannot sign typed data","signTypedData")}connect(e){return new Yg(this.address,e)}}var Fg=qf((function(e){!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&("le"!==t&&"be"!==t||(n=t,t=10),this._init(e||0,t||10,n||"be"))}var o;"object"==typeof e?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:cp.Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function s(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,r,i){for(var o=0,a=0,s=Math.min(e.length,r),u=t;u<s;u++){var c=e.charCodeAt(u)-48;o*=i,a=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a<i,"Invalid character"),o+=a}return o}function c(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.isBN=function(e){return e instanceof i||null!==e&&"object"==typeof e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<e.length;i+=3)a=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=e.length-1;r>=t;r-=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(e,l,l+r,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(e,l,e.length,t),l=0;l<a;l++)h*=t;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){c(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(e){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","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"],d=[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],f=[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(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=d[e],l=f[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(e);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)};function p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=67108863&u,d=Math.min(c,t.length-1),f=Math.max(0,c-e.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|e.words[p])*(o=0|t.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n++]=255&a,n<e.length&&(e[n++]=a>>8&255),n<e.length&&(e[n++]=a>>16&255),6===o?(n<e.length&&(e[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n--]=255&a,n>=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 0==(8191&t)&&(n+=13,t>>>=13),0==(127&t)&&(n+=7,t>>>=7),0==(15&t)&&(n+=4,t>>>=4),0==(3&t)&&(n+=2,t>>>=2),0==(1&t)&&n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return n(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a<r.length;a++)o=(t=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<n.length;a++)o=(t=(0|n.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var y=function(e,t,n){var r,i,o,a=e.words,s=t.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],I=8191&A,N=A>>>13,T=0|a[5],E=8191&T,x=T>>>13,k=0|a[6],L=8191&k,S=k>>>13,j=0|a[7],D=8191&j,C=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,W=U>>>13,Y=0|s[1],F=8191&Y,V=Y>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,ee=K>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,le=0|s[8],he=8191&le,de=le>>>13,fe=0|s[9],pe=8191&fe,ye=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,W))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,W))+Math.imul(y,Q)|0,o=Math.imul(y,W);var ge=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,W))+Math.imul(v,Q)|0,o=Math.imul(v,W),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var ve=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,W))+Math.imul(M,Q)|0,o=Math.imul(M,W),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var we=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(I,Q),i=(i=Math.imul(I,W))+Math.imul(N,Q)|0,o=Math.imul(N,W),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var be=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,Q),i=(i=Math.imul(E,W))+Math.imul(x,Q)|0,o=Math.imul(x,W),r=r+Math.imul(I,F)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0;var Me=(c+(r=r+Math.imul(h,ne)|0)|0)+((8191&(i=(i=i+Math.imul(h,re)|0)+Math.imul(d,ne)|0))<<13)|0;c=((o=o+Math.imul(d,re)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,W))+Math.imul(S,Q)|0,o=Math.imul(S,W),r=r+Math.imul(E,F)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(x,F)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(I,G)|0,i=(i=i+Math.imul(I,q)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0;var Ae=(c+(r=r+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ae)|0)+Math.imul(d,oe)|0))<<13)|0;c=((o=o+Math.imul(d,ae)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(D,Q),i=(i=Math.imul(D,W))+Math.imul(C,Q)|0,o=Math.imul(C,W),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(E,G)|0,i=(i=i+Math.imul(E,q)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,q)|0,r=r+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(g,ne)|0,i=(i=i+Math.imul(g,re)|0)+Math.imul(v,ne)|0,o=o+Math.imul(v,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0;var Ie=(c+(r=r+Math.imul(h,ue)|0)|0)+((8191&(i=(i=i+Math.imul(h,ce)|0)+Math.imul(d,ue)|0))<<13)|0;c=((o=o+Math.imul(d,ce)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,W))+Math.imul(P,Q)|0,o=Math.imul(P,W),r=r+Math.imul(D,F)|0,i=(i=i+Math.imul(D,V)|0)+Math.imul(C,F)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0,r=r+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,ce)|0;var Ne=(c+(r=r+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;c=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,W))+Math.imul(R,Q)|0,o=Math.imul(R,W),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(D,G)|0,i=(i=i+Math.imul(D,q)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,r=r+Math.imul(g,ue)|0,i=(i=i+Math.imul(g,ce)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,ce)|0,r=r+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(y,he)|0,o=o+Math.imul(y,de)|0;var Te=(c+(r=r+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ye)|0)+Math.imul(d,pe)|0))<<13)|0;c=((o=o+Math.imul(d,ye)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(D,J)|0,i=(i=i+Math.imul(D,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,ee)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,ae)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,ae)|0,r=r+Math.imul(b,ue)|0,i=(i=i+Math.imul(b,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,r=r+Math.imul(g,he)|0,i=(i=i+Math.imul(g,de)|0)+Math.imul(v,he)|0,o=o+Math.imul(v,de)|0;var Ee=(c+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ye)|0)+Math.imul(y,pe)|0))<<13)|0;c=((o=o+Math.imul(y,ye)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(D,$)|0,i=(i=i+Math.imul(D,ee)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(L,ne)|0,i=(i=i+Math.imul(L,re)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,ae)|0,r=r+Math.imul(I,ue)|0,i=(i=i+Math.imul(I,ce)|0)+Math.imul(N,ue)|0,o=o+Math.imul(N,ce)|0,r=r+Math.imul(b,he)|0,i=(i=i+Math.imul(b,de)|0)+Math.imul(M,he)|0,o=o+Math.imul(M,de)|0;var xe=(c+(r=r+Math.imul(g,pe)|0)|0)+((8191&(i=(i=i+Math.imul(g,ye)|0)+Math.imul(v,pe)|0))<<13)|0;c=((o=o+Math.imul(v,ye)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,ee)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,ee)|0,r=r+Math.imul(D,ne)|0,i=(i=i+Math.imul(D,re)|0)+Math.imul(C,ne)|0,o=o+Math.imul(C,re)|0,r=r+Math.imul(L,oe)|0,i=(i=i+Math.imul(L,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,ce)|0)+Math.imul(x,ue)|0,o=o+Math.imul(x,ce)|0,r=r+Math.imul(I,he)|0,i=(i=i+Math.imul(I,de)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,de)|0;var ke=(c+(r=r+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ye)|0)+Math.imul(M,pe)|0))<<13)|0;c=((o=o+Math.imul(M,ye)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,ee))+Math.imul(R,$)|0,o=Math.imul(R,ee),r=r+Math.imul(z,ne)|0,i=(i=i+Math.imul(z,re)|0)+Math.imul(P,ne)|0,o=o+Math.imul(P,re)|0,r=r+Math.imul(D,oe)|0,i=(i=i+Math.imul(D,ae)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,ae)|0,r=r+Math.imul(L,ue)|0,i=(i=i+Math.imul(L,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,r=r+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(x,he)|0,o=o+Math.imul(x,de)|0;var Le=(c+(r=r+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,ye)|0)+Math.imul(N,pe)|0))<<13)|0;c=((o=o+Math.imul(N,ye)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,r=Math.imul(B,ne),i=(i=Math.imul(B,re))+Math.imul(R,ne)|0,o=Math.imul(R,re),r=r+Math.imul(z,oe)|0,i=(i=i+Math.imul(z,ae)|0)+Math.imul(P,oe)|0,o=o+Math.imul(P,ae)|0,r=r+Math.imul(D,ue)|0,i=(i=i+Math.imul(D,ce)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,ce)|0,r=r+Math.imul(L,he)|0,i=(i=i+Math.imul(L,de)|0)+Math.imul(S,he)|0,o=o+Math.imul(S,de)|0;var Se=(c+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,ye)|0)+Math.imul(x,pe)|0))<<13)|0;c=((o=o+Math.imul(x,ye)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(B,oe),i=(i=Math.imul(B,ae))+Math.imul(R,oe)|0,o=Math.imul(R,ae),r=r+Math.imul(z,ue)|0,i=(i=i+Math.imul(z,ce)|0)+Math.imul(P,ue)|0,o=o+Math.imul(P,ce)|0,r=r+Math.imul(D,he)|0,i=(i=i+Math.imul(D,de)|0)+Math.imul(C,he)|0,o=o+Math.imul(C,de)|0;var je=(c+(r=r+Math.imul(L,pe)|0)|0)+((8191&(i=(i=i+Math.imul(L,ye)|0)+Math.imul(S,pe)|0))<<13)|0;c=((o=o+Math.imul(S,ye)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,r=Math.imul(B,ue),i=(i=Math.imul(B,ce))+Math.imul(R,ue)|0,o=Math.imul(R,ce),r=r+Math.imul(z,he)|0,i=(i=i+Math.imul(z,de)|0)+Math.imul(P,he)|0,o=o+Math.imul(P,de)|0;var De=(c+(r=r+Math.imul(D,pe)|0)|0)+((8191&(i=(i=i+Math.imul(D,ye)|0)+Math.imul(C,pe)|0))<<13)|0;c=((o=o+Math.imul(C,ye)|0)+(i>>>13)|0)+(De>>>26)|0,De&=67108863,r=Math.imul(B,he),i=(i=Math.imul(B,de))+Math.imul(R,he)|0,o=Math.imul(R,de);var Ce=(c+(r=r+Math.imul(z,pe)|0)|0)+((8191&(i=(i=i+Math.imul(z,ye)|0)+Math.imul(P,pe)|0))<<13)|0;c=((o=o+Math.imul(P,ye)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863;var Oe=(c+(r=Math.imul(B,pe))|0)+((8191&(i=(i=Math.imul(B,ye))+Math.imul(R,pe)|0))<<13)|0;return c=((o=Math.imul(R,ye))+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,u[0]=me,u[1]=ge,u[2]=ve,u[3]=we,u[4]=be,u[5]=Me,u[6]=Ae,u[7]=Ie,u[8]=Ne,u[9]=Te,u[10]=Ee,u[11]=xe,u[12]=ke,u[13]=Le,u[14]=Se,u[15]=je,u[16]=De,u[17]=Ce,u[18]=Oe,0!==c&&(u[19]=c,n.length++),n};function m(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var l=o-c,h=(0|e.words[l])*(0|t.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(e,t,n){return m(e,t,n)}Math.imul||(y=p),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?y(this,e,t):n<63?p(this,e,t):n<1024?m(this,e,t):g(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*e,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var o=n.sqr();r<t.length;r++,o=o.sqr())0!==t[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0===a);else if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r)&&!!(this.words[r]&i)},i.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,r){var i,o,a=e.length+r;this._expand(a);var s=0;for(i=0;i<e.length;i++){o=(0|this.words[i+r])+s;var u=(0|e.words[i])*t;s=((o-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&o}for(;i<this.length-r;i++)s=(o=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&o;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(o=-(0|this.words[i])+s)>>26,this.words[i]=67108863&o;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,a=0|o.words[o.length-1];0!==(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==t){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(o,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):0!=(this.negative&e.negative)?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var o,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=t.clone();!t.isZero();){for(var d=0,f=1;0==(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;0==(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(u)):(r.isub(t),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o,a=new i(1),s=new i(0),u=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;0==(t.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;0==(r.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(r.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s)):(r.isub(t),s.isub(a))}return(o=0===t.cmpn(1)?a:s).cmpn(0)<0&&o.iadd(e),o},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new N(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},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(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function I(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function N(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function T(e){N.call(this,e),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)}w.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},r(b,w),b.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(M,w),r(A,w),r(I,w),I.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(v[e])return v[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new M;else if("p192"===e)t=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new I}return v[e]=t,t},N.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},N.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},N.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(c(e,e.umod(this.m)._forceRed(this)),e)},N.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},N.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},N.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},N.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},N.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},N.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},N.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},N.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},N.prototype.isqr=function(e){return this.imul(e,e.clone())},N.prototype.sqr=function(e){return this.mul(e,e)},N.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),d=this.pow(e,o.addn(1).iushrn(1)),f=this.pow(e,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m<p);var g=this.pow(h,new i(1).iushln(p-m-1));d=d.redMul(g),h=g.redSqr(),f=f.redMul(h),p=m}return d},N.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},N.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var o=n[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var c=t.words[r],l=u-1;l>=0;l--){var h=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==a?(a<<=1,a|=h,(4===++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},N.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},N.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new T(e)},r(T,N),T.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},T.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},T.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},T.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},T.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,Hf)})),Vg=Hg;function Hg(e,t){if(!e)throw new Error(t||"Assertion failed")}Hg.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)};var Gg=[],qg=[],Zg="undefined"!=typeof Uint8Array?Uint8Array:Array,Jg=!1;function Xg(){Jg=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,n=e.length;t<n;++t)Gg[t]=e[t],qg[e.charCodeAt(t)]=t;qg["-".charCodeAt(0)]=62,qg["_".charCodeAt(0)]=63}function Kg(e,t,n){for(var r,i,o=[],a=t;a<n;a+=3)r=(e[a]<<16)+(e[a+1]<<8)+e[a+2],o.push(Gg[(i=r)>>18&63]+Gg[i>>12&63]+Gg[i>>6&63]+Gg[63&i]);return o.join("")}function $g(e){var t;Jg||Xg();for(var n=e.length,r=n%3,i="",o=[],a=16383,s=0,u=n-r;s<u;s+=a)o.push(Kg(e,s,s+a>u?u:s+a));return 1===r?(t=e[n-1],i+=Gg[t>>2],i+=Gg[t<<4&63],i+="=="):2===r&&(t=(e[n-2]<<8)+e[n-1],i+=Gg[t>>10],i+=Gg[t>>4&63],i+=Gg[t<<2&63],i+="="),o.push(i),o.join("")}function ev(e,t,n,r,i){var o,a,s=8*i-r-1,u=(1<<s)-1,c=u>>1,l=-7,h=n?i-1:0,d=n?-1:1,f=e[t+h];for(h+=d,o=f&(1<<-l)-1,f>>=-l,l+=s;l>0;o=256*o+e[t+h],h+=d,l-=8);for(a=o&(1<<-l)-1,o>>=-l,l+=r;l>0;a=256*a+e[t+h],h+=d,l-=8);if(0===o)o=1-c;else{if(o===u)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,r),o-=c}return(f?-1:1)*a*Math.pow(2,o-r)}function tv(e,t,n,r,i,o){var a,s,u,c=8*o-i-1,l=(1<<c)-1,h=l>>1,d=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=r?0:o-1,p=r?1:-1,y=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=l):(a=Math.floor(Math.log(t)/Math.LN2),t*(u=Math.pow(2,-a))<1&&(a--,u*=2),(t+=a+h>=1?d/u:d*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(s=0,a=l):a+h>=1?(s=(t*u-1)*Math.pow(2,i),a+=h):(s=t*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;e[n+f]=255&s,f+=p,s/=256,i-=8);for(a=a<<i|s,c+=i;c>0;e[n+f]=255&a,f+=p,a/=256,c-=8);e[n+f-p]|=128*y}var nv={}.toString,rv=Array.isArray||function(e){return"[object Array]"==nv.call(e)};function iv(){return av.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function ov(e,t){if(iv()<t)throw new RangeError("Invalid typed array length");return av.TYPED_ARRAY_SUPPORT?(e=new Uint8Array(t)).__proto__=av.prototype:(null===e&&(e=new av(t)),e.length=t),e}function av(e,t,n){if(!(av.TYPED_ARRAY_SUPPORT||this instanceof av))return new av(e,t,n);if("number"==typeof e){if("string"==typeof t)throw new Error("If encoding is specified then the first argument must be a string");return cv(this,e)}return sv(this,e,t,n)}function sv(e,t,n,r){if("number"==typeof t)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer?function(e,t,n,r){if(t.byteLength,n<0||t.byteLength<n)throw new RangeError("'offset' is out of bounds");if(t.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");t=void 0===n&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,n):new Uint8Array(t,n,r);av.TYPED_ARRAY_SUPPORT?(e=t).__proto__=av.prototype:e=lv(e,t);return e}(e,t,n,r):"string"==typeof t?function(e,t,n){"string"==typeof n&&""!==n||(n="utf8");if(!av.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|fv(t,n),i=(e=ov(e,r)).write(t,n);i!==r&&(e=e.slice(0,i));return e}(e,t,n):function(e,t){if(dv(t)){var n=0|hv(t.length);return 0===(e=ov(e,n)).length||t.copy(e,0,0,n),e}if(t){if("undefined"!=typeof ArrayBuffer&&t.buffer instanceof ArrayBuffer||"length"in t)return"number"!=typeof t.length||(r=t.length)!=r?ov(e,0):lv(e,t);if("Buffer"===t.type&&rv(t.data))return lv(e,t.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(e,t)}function uv(e){if("number"!=typeof e)throw new TypeError('"size" argument must be a number');if(e<0)throw new RangeError('"size" argument must not be negative')}function cv(e,t){if(uv(t),e=ov(e,t<0?0:0|hv(t)),!av.TYPED_ARRAY_SUPPORT)for(var n=0;n<t;++n)e[n]=0;return e}function lv(e,t){var n=t.length<0?0:0|hv(t.length);e=ov(e,n);for(var r=0;r<n;r+=1)e[r]=255&t[r];return e}function hv(e){if(e>=iv())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+iv().toString(16)+" bytes");return 0|e}function dv(e){return!(null==e||!e._isBuffer)}function fv(e,t){if(dv(e))return e.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(e)||e instanceof ArrayBuffer))return e.byteLength;"string"!=typeof e&&(e=""+e);var n=e.length;if(0===n)return 0;for(var r=!1;;)switch(t){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return Rv(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return Uv(e).length;default:if(r)return Rv(e).length;t=(""+t).toLowerCase(),r=!0}}function pv(e,t,n){var r=!1;if((void 0===t||t<0)&&(t=0),t>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return kv(this,t,n);case"utf8":case"utf-8":return Tv(this,t,n);case"ascii":return Ev(this,t,n);case"latin1":case"binary":return xv(this,t,n);case"base64":return Nv(this,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Lv(this,t,n);default:if(r)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),r=!0}}function yv(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}function mv(e,t,n,r,i){if(0===e.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof t&&(t=av.from(t,r)),dv(t))return 0===t.length?-1:gv(e,t,n,r,i);if("number"==typeof t)return t&=255,av.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):gv(e,[t],n,r,i);throw new TypeError("val must be string, number or Buffer")}function gv(e,t,n,r,i){var o,a=1,s=e.length,u=t.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(e.length<2||t.length<2)return-1;a=2,s/=2,u/=2,n/=2}function c(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){var l=-1;for(o=n;o<s;o++)if(c(e,o)===c(t,-1===l?0:o-l)){if(-1===l&&(l=o),o-l+1===u)return l*a}else-1!==l&&(o-=o-l),l=-1}else for(n+u>s&&(n=s-u),o=n;o>=0;o--){for(var h=!0,d=0;d<u;d++)if(c(e,o+d)!==c(t,d)){h=!1;break}if(h)return o}return-1}function vv(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r))>i&&(r=i):r=i;var o=t.length;if(o%2!=0)throw new TypeError("Invalid hex string");r>o/2&&(r=o/2);for(var a=0;a<r;++a){var s=parseInt(t.substr(2*a,2),16);if(isNaN(s))return a;e[n+a]=s}return a}function wv(e,t,n,r){return Qv(Rv(t,e.length-n),e,n,r)}function bv(e,t,n,r){return Qv(function(e){for(var t=[],n=0;n<e.length;++n)t.push(255&e.charCodeAt(n));return t}(t),e,n,r)}function Mv(e,t,n,r){return bv(e,t,n,r)}function Av(e,t,n,r){return Qv(Uv(t),e,n,r)}function Iv(e,t,n,r){return Qv(function(e,t){for(var n,r,i,o=[],a=0;a<e.length&&!((t-=2)<0);++a)r=(n=e.charCodeAt(a))>>8,i=n%256,o.push(i),o.push(r);return o}(t,e.length-n),e,n,r)}function Nv(e,t,n){return 0===t&&n===e.length?$g(e):$g(e.slice(t,n))}function Tv(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var o,a,s,u,c=e[i],l=null,h=c>239?4:c>223?3:c>191?2:1;if(i+h<=n)switch(h){case 1:c<128&&(l=c);break;case 2:128==(192&(o=e[i+1]))&&(u=(31&c)<<6|63&o)>127&&(l=u);break;case 3:o=e[i+1],a=e[i+2],128==(192&o)&&128==(192&a)&&(u=(15&c)<<12|(63&o)<<6|63&a)>2047&&(u<55296||u>57343)&&(l=u);break;case 4:o=e[i+1],a=e[i+2],s=e[i+3],128==(192&o)&&128==(192&a)&&128==(192&s)&&(u=(15&c)<<18|(63&o)<<12|(63&a)<<6|63&s)>65535&&u<1114112&&(l=u)}null===l?(l=65533,h=1):l>65535&&(l-=65536,r.push(l>>>10&1023|55296),l=56320|1023&l),r.push(l),i+=h}return function(e){var t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);var n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=4096));return n}(r)}av.TYPED_ARRAY_SUPPORT=void 0===r.TYPED_ARRAY_SUPPORT||r.TYPED_ARRAY_SUPPORT,av.poolSize=8192,av._augment=function(e){return e.__proto__=av.prototype,e},av.from=function(e,t,n){return sv(null,e,t,n)},av.TYPED_ARRAY_SUPPORT&&(av.prototype.__proto__=Uint8Array.prototype,av.__proto__=Uint8Array),av.alloc=function(e,t,n){return function(e,t,n,r){return uv(t),t<=0?ov(e,t):void 0!==n?"string"==typeof r?ov(e,t).fill(n,r):ov(e,t).fill(n):ov(e,t)}(null,e,t,n)},av.allocUnsafe=function(e){return cv(null,e)},av.allocUnsafeSlow=function(e){return cv(null,e)},av.isBuffer=function(e){return null!=e&&(!!e._isBuffer||Wv(e)||function(e){return"function"==typeof e.readFloatLE&&"function"==typeof e.slice&&Wv(e.slice(0,0))}(e))},av.compare=function(e,t){if(!dv(e)||!dv(t))throw new TypeError("Arguments must be Buffers");if(e===t)return 0;for(var n=e.length,r=t.length,i=0,o=Math.min(n,r);i<o;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},av.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},av.concat=function(e,t){if(!rv(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return av.alloc(0);var n;if(void 0===t)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=av.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var o=e[n];if(!dv(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(r,i),i+=o.length}return r},av.byteLength=fv,av.prototype._isBuffer=!0,av.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var t=0;t<e;t+=2)yv(this,t,t+1);return this},av.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var t=0;t<e;t+=4)yv(this,t,t+3),yv(this,t+1,t+2);return this},av.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var t=0;t<e;t+=8)yv(this,t,t+7),yv(this,t+1,t+6),yv(this,t+2,t+5),yv(this,t+3,t+4);return this},av.prototype.toString=function(){var e=0|this.length;return 0===e?"":0===arguments.length?Tv(this,0,e):pv.apply(this,arguments)},av.prototype.equals=function(e){if(!dv(e))throw new TypeError("Argument must be a Buffer");return this===e||0===av.compare(this,e)},av.prototype.inspect=function(){var e="";return this.length>0&&(e=this.toString("hex",0,50).match(/.{2}/g).join(" "),this.length>50&&(e+=" ... ")),"<Buffer "+e+">"},av.prototype.compare=function(e,t,n,r,i){if(!dv(e))throw new TypeError("Argument must be a Buffer");if(void 0===t&&(t=0),void 0===n&&(n=e?e.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(this===e)return 0;for(var o=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(t>>>=0),s=Math.min(o,a),u=this.slice(r,i),c=e.slice(t,n),l=0;l<s;++l)if(u[l]!==c[l]){o=u[l],a=c[l];break}return o<a?-1:a<o?1:0},av.prototype.includes=function(e,t,n){return-1!==this.indexOf(e,t,n)},av.prototype.indexOf=function(e,t,n){return mv(this,e,t,n,!0)},av.prototype.lastIndexOf=function(e,t,n){return mv(this,e,t,n,!1)},av.prototype.write=function(e,t,n,r){if(void 0===t)r="utf8",n=this.length,t=0;else if(void 0===n&&"string"==typeof t)r=t,n=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-t;if((void 0===n||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var o=!1;;)switch(r){case"hex":return vv(this,e,t,n);case"utf8":case"utf-8":return wv(this,e,t,n);case"ascii":return bv(this,e,t,n);case"latin1":case"binary":return Mv(this,e,t,n);case"base64":return Av(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Iv(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),o=!0}},av.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ev(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(127&e[i]);return r}function xv(e,t,n){var r="";n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function kv(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i="",o=t;o<n;++o)i+=Bv(e[o]);return i}function Lv(e,t,n){for(var r=e.slice(t,n),i="",o=0;o<r.length;o+=2)i+=String.fromCharCode(r[o]+256*r[o+1]);return i}function Sv(e,t,n){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>n)throw new RangeError("Trying to access beyond buffer length")}function jv(e,t,n,r,i,o){if(!dv(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<o)throw new RangeError('"value" argument is out of bounds');if(n+r>e.length)throw new RangeError("Index out of range")}function Dv(e,t,n,r){t<0&&(t=65535+t+1);for(var i=0,o=Math.min(e.length-n,2);i<o;++i)e[n+i]=(t&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function Cv(e,t,n,r){t<0&&(t=4294967295+t+1);for(var i=0,o=Math.min(e.length-n,4);i<o;++i)e[n+i]=t>>>8*(r?i:3-i)&255}function Ov(e,t,n,r,i,o){if(n+r>e.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function zv(e,t,n,r,i){return i||Ov(e,0,n,4),tv(e,t,n,r,23,4),n+4}function Pv(e,t,n,r,i){return i||Ov(e,0,n,8),tv(e,t,n,r,52,8),n+8}av.prototype.slice=function(e,t){var n,r=this.length;if((e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e),av.TYPED_ARRAY_SUPPORT)(n=this.subarray(e,t)).__proto__=av.prototype;else{var i=t-e;n=new av(i,void 0);for(var o=0;o<i;++o)n[o]=this[o+e]}return n},av.prototype.readUIntLE=function(e,t,n){e|=0,t|=0,n||Sv(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r},av.prototype.readUIntBE=function(e,t,n){e|=0,t|=0,n||Sv(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},av.prototype.readUInt8=function(e,t){return t||Sv(e,1,this.length),this[e]},av.prototype.readUInt16LE=function(e,t){return t||Sv(e,2,this.length),this[e]|this[e+1]<<8},av.prototype.readUInt16BE=function(e,t){return t||Sv(e,2,this.length),this[e]<<8|this[e+1]},av.prototype.readUInt32LE=function(e,t){return t||Sv(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},av.prototype.readUInt32BE=function(e,t){return t||Sv(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},av.prototype.readIntLE=function(e,t,n){e|=0,t|=0,n||Sv(e,t,this.length);for(var r=this[e],i=1,o=0;++o<t&&(i*=256);)r+=this[e+o]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*t)),r},av.prototype.readIntBE=function(e,t,n){e|=0,t|=0,n||Sv(e,t,this.length);for(var r=t,i=1,o=this[e+--r];r>0&&(i*=256);)o+=this[e+--r]*i;return o>=(i*=128)&&(o-=Math.pow(2,8*t)),o},av.prototype.readInt8=function(e,t){return t||Sv(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},av.prototype.readInt16LE=function(e,t){t||Sv(e,2,this.length);var n=this[e]|this[e+1]<<8;return 32768&n?4294901760|n:n},av.prototype.readInt16BE=function(e,t){t||Sv(e,2,this.length);var n=this[e+1]|this[e]<<8;return 32768&n?4294901760|n:n},av.prototype.readInt32LE=function(e,t){return t||Sv(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},av.prototype.readInt32BE=function(e,t){return t||Sv(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},av.prototype.readFloatLE=function(e,t){return t||Sv(e,4,this.length),ev(this,e,!0,23,4)},av.prototype.readFloatBE=function(e,t){return t||Sv(e,4,this.length),ev(this,e,!1,23,4)},av.prototype.readDoubleLE=function(e,t){return t||Sv(e,8,this.length),ev(this,e,!0,52,8)},av.prototype.readDoubleBE=function(e,t){return t||Sv(e,8,this.length),ev(this,e,!1,52,8)},av.prototype.writeUIntLE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||jv(this,e,t,n,Math.pow(2,8*n)-1,0);var i=1,o=0;for(this[t]=255&e;++o<n&&(i*=256);)this[t+o]=e/i&255;return t+n},av.prototype.writeUIntBE=function(e,t,n,r){(e=+e,t|=0,n|=0,r)||jv(this,e,t,n,Math.pow(2,8*n)-1,0);var i=n-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+n},av.prototype.writeUInt8=function(e,t,n){return e=+e,t|=0,n||jv(this,e,t,1,255,0),av.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),this[t]=255&e,t+1},av.prototype.writeUInt16LE=function(e,t,n){return e=+e,t|=0,n||jv(this,e,t,2,65535,0),av.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Dv(this,e,t,!0),t+2},av.prototype.writeUInt16BE=function(e,t,n){return e=+e,t|=0,n||jv(this,e,t,2,65535,0),av.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Dv(this,e,t,!1),t+2},av.prototype.writeUInt32LE=function(e,t,n){return e=+e,t|=0,n||jv(this,e,t,4,4294967295,0),av.TYPED_ARRAY_SUPPORT?(this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e):Cv(this,e,t,!0),t+4},av.prototype.writeUInt32BE=function(e,t,n){return e=+e,t|=0,n||jv(this,e,t,4,4294967295,0),av.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Cv(this,e,t,!1),t+4},av.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);jv(this,e,t,n,i-1,-i)}var o=0,a=1,s=0;for(this[t]=255&e;++o<n&&(a*=256);)e<0&&0===s&&0!==this[t+o-1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},av.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t|=0,!r){var i=Math.pow(2,8*n-1);jv(this,e,t,n,i-1,-i)}var o=n-1,a=1,s=0;for(this[t+o]=255&e;--o>=0&&(a*=256);)e<0&&0===s&&0!==this[t+o+1]&&(s=1),this[t+o]=(e/a>>0)-s&255;return t+n},av.prototype.writeInt8=function(e,t,n){return e=+e,t|=0,n||jv(this,e,t,1,127,-128),av.TYPED_ARRAY_SUPPORT||(e=Math.floor(e)),e<0&&(e=255+e+1),this[t]=255&e,t+1},av.prototype.writeInt16LE=function(e,t,n){return e=+e,t|=0,n||jv(this,e,t,2,32767,-32768),av.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8):Dv(this,e,t,!0),t+2},av.prototype.writeInt16BE=function(e,t,n){return e=+e,t|=0,n||jv(this,e,t,2,32767,-32768),av.TYPED_ARRAY_SUPPORT?(this[t]=e>>>8,this[t+1]=255&e):Dv(this,e,t,!1),t+2},av.prototype.writeInt32LE=function(e,t,n){return e=+e,t|=0,n||jv(this,e,t,4,2147483647,-2147483648),av.TYPED_ARRAY_SUPPORT?(this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24):Cv(this,e,t,!0),t+4},av.prototype.writeInt32BE=function(e,t,n){return e=+e,t|=0,n||jv(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),av.TYPED_ARRAY_SUPPORT?(this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e):Cv(this,e,t,!1),t+4},av.prototype.writeFloatLE=function(e,t,n){return zv(this,e,t,!0,n)},av.prototype.writeFloatBE=function(e,t,n){return zv(this,e,t,!1,n)},av.prototype.writeDoubleLE=function(e,t,n){return Pv(this,e,t,!0,n)},av.prototype.writeDoubleBE=function(e,t,n){return Pv(this,e,t,!1,n)},av.prototype.copy=function(e,t,n,r){if(n||(n=0),r||0===r||(r=this.length),t>=e.length&&(t=e.length),t||(t=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i,o=r-n;if(this===e&&n<t&&t<r)for(i=o-1;i>=0;--i)e[i+t]=this[i+n];else if(o<1e3||!av.TYPED_ARRAY_SUPPORT)for(i=0;i<o;++i)e[i+t]=this[i+n];else Uint8Array.prototype.set.call(e,this.subarray(n,n+o),t);return o},av.prototype.fill=function(e,t,n,r){if("string"==typeof e){if("string"==typeof t?(r=t,t=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===e.length){var i=e.charCodeAt(0);i<256&&(e=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!av.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof e&&(e&=255);if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;var o;if(t>>>=0,n=void 0===n?this.length:n>>>0,e||(e=0),"number"==typeof e)for(o=t;o<n;++o)this[o]=e;else{var a=dv(e)?e:Rv(new av(e,r).toString()),s=a.length;for(o=0;o<n-t;++o)this[o+t]=a[o%s]}return this};var _v=/[^+\/0-9A-Za-z-_]/g;function Bv(e){return e<16?"0"+e.toString(16):e.toString(16)}function Rv(e,t){var n;t=t||1/0;for(var r=e.length,i=null,o=[],a=0;a<r;++a){if((n=e.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===r){(t-=3)>-1&&o.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&o.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,n<128){if((t-=1)<0)break;o.push(n)}else if(n<2048){if((t-=2)<0)break;o.push(n>>6|192,63&n|128)}else if(n<65536){if((t-=3)<0)break;o.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return o}function Uv(e){return function(e){var t,n,r,i,o,a;Jg||Xg();var s=e.length;if(s%4>0)throw new Error("Invalid string. Length must be a multiple of 4");o="="===e[s-2]?2:"="===e[s-1]?1:0,a=new Zg(3*s/4-o),r=o>0?s-4:s;var u=0;for(t=0,n=0;t<r;t+=4,n+=3)i=qg[e.charCodeAt(t)]<<18|qg[e.charCodeAt(t+1)]<<12|qg[e.charCodeAt(t+2)]<<6|qg[e.charCodeAt(t+3)],a[u++]=i>>16&255,a[u++]=i>>8&255,a[u++]=255&i;return 2===o?(i=qg[e.charCodeAt(t)]<<2|qg[e.charCodeAt(t+1)]>>4,a[u++]=255&i):1===o&&(i=qg[e.charCodeAt(t)]<<10|qg[e.charCodeAt(t+1)]<<4|qg[e.charCodeAt(t+2)]>>2,a[u++]=i>>8&255,a[u++]=255&i),a}(function(e){if((e=function(e){return e.trim?e.trim():e.replace(/^\s+|\s+$/g,"")}(e).replace(_v,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function Qv(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function Wv(e){return!!e.constructor&&"function"==typeof e.constructor.isBuffer&&e.constructor.isBuffer(e)}var Yv=function(e){return e instanceof av},Fv=qf((function(e,t){var n=/%[sdj%]/g;t.format=function(e){if(!y(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(o(arguments[r]));return t.join(" ")}r=1;for(var i=arguments,a=i.length,s=String(e).replace(n,(function(e){if("%%"===e)return"%";if(r>=a)return e;switch(e){case"%s":return String(i[r++]);case"%d":return Number(i[r++]);case"%j":try{return JSON.stringify(i[r++])}catch(e){return"[Circular]"}default:return e}})),u=i[r];r<a;u=i[++r])f(u)||!v(u)?s+=" "+u:s+=" "+o(u);return s},t.deprecate=function(e,n){if(m(Hf.process))return function(){return t.deprecate(e,n).apply(this,arguments)};if(!0===x.noDeprecation)return e;var r=!1;return function(){if(!r){if(x.throwDeprecation)throw new Error(n);x.traceDeprecation?console.trace(n):console.error(n),r=!0}return e.apply(this,arguments)}};var r,i={};function o(e,n){var r={seen:[],stylize:s};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),d(n)?r.showHidden=n:n&&t._extend(r,n),m(r.showHidden)&&(r.showHidden=!1),m(r.depth)&&(r.depth=2),m(r.colors)&&(r.colors=!1),m(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=a),u(r,e,r.depth)}function a(e,t){var n=o.styles[t];return n?"["+o.colors[n][0]+"m"+e+"["+o.colors[n][1]+"m":e}function s(e,t){return e}function u(e,n,r){if(e.customInspect&&n&&M(n.inspect)&&n.inspect!==t.inspect&&(!n.constructor||n.constructor.prototype!==n)){var i=n.inspect(r,e);return y(i)||(i=u(e,i,r)),i}var o=function(e,t){if(m(t))return e.stylize("undefined","undefined");if(y(t)){var n="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(n,"string")}if(p(t))return e.stylize(""+t,"number");if(d(t))return e.stylize(""+t,"boolean");if(f(t))return e.stylize("null","null")}(e,n);if(o)return o;var a=Object.keys(n),s=function(e){var t={};return e.forEach((function(e,n){t[e]=!0})),t}(a);if(e.showHidden&&(a=Object.getOwnPropertyNames(n)),0===a.length){if(M(n)){var v=n.name?": "+n.name:"";return e.stylize("[Function"+v+"]","special")}if(g(n))return e.stylize(RegExp.prototype.toString.call(n),"regexp");if(w(n))return e.stylize(Date.prototype.toString.call(n),"date");if(b(n))return c(n)}var A,I="",N=!1,T=["{","}"];(h(n)&&(N=!0,T=["[","]"]),M(n))&&(I=" [Function"+(n.name?": "+n.name:"")+"]");return g(n)&&(I=" "+RegExp.prototype.toString.call(n)),w(n)&&(I=" "+Date.prototype.toUTCString.call(n)),b(n)&&(I=" "+c(n)),0!==a.length||N&&0!=n.length?r<0?g(n)?e.stylize(RegExp.prototype.toString.call(n),"regexp"):e.stylize("[Object]","special"):(e.seen.push(n),A=N?function(e,t,n,r,i){for(var o=[],a=0,s=t.length;a<s;++a)E(t,String(a))?o.push(l(e,t,n,r,String(a),!0)):o.push("");return i.forEach((function(i){i.match(/^\d+$/)||o.push(l(e,t,n,r,i,!0))})),o}(e,n,r,s,a):a.map((function(t){return l(e,n,r,s,t,N)})),e.seen.pop(),function(e,t,n){if(e.reduce((function(e,t){return t.indexOf("\n"),e+t.replace(/\u001b\[\d\d?m/g,"").length+1}),0)>60)return n[0]+(""===t?"":t+"\n ")+" "+e.join(",\n ")+" "+n[1];return n[0]+t+" "+e.join(", ")+" "+n[1]}(A,I,T)):T[0]+I+T[1]}function c(e){return"["+Error.prototype.toString.call(e)+"]"}function l(e,t,n,r,i,o){var a,s,c;if((c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]}).get?s=c.set?e.stylize("[Getter/Setter]","special"):e.stylize("[Getter]","special"):c.set&&(s=e.stylize("[Setter]","special")),E(r,i)||(a="["+i+"]"),s||(e.seen.indexOf(c.value)<0?(s=f(n)?u(e,c.value,null):u(e,c.value,n-1)).indexOf("\n")>-1&&(s=o?s.split("\n").map((function(e){return" "+e})).join("\n").substr(2):"\n"+s.split("\n").map((function(e){return" "+e})).join("\n")):s=e.stylize("[Circular]","special")),m(a)){if(o&&i.match(/^\d+$/))return s;(a=JSON.stringify(""+i)).match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(a=a.substr(1,a.length-2),a=e.stylize(a,"name")):(a=a.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),a=e.stylize(a,"string"))}return a+": "+s}function h(e){return Array.isArray(e)}function d(e){return"boolean"==typeof e}function f(e){return null===e}function p(e){return"number"==typeof e}function y(e){return"string"==typeof e}function m(e){return void 0===e}function g(e){return v(e)&&"[object RegExp]"===A(e)}function v(e){return"object"==typeof e&&null!==e}function w(e){return v(e)&&"[object Date]"===A(e)}function b(e){return v(e)&&("[object Error]"===A(e)||e instanceof Error)}function M(e){return"function"==typeof e}function A(e){return Object.prototype.toString.call(e)}function I(e){return e<10?"0"+e.toString(10):e.toString(10)}t.debuglog=function(e){if(m(r)&&(r=x.env.NODE_DEBUG||""),e=e.toUpperCase(),!i[e])if(new RegExp("\\b"+e+"\\b","i").test(r)){var n=x.pid;i[e]=function(){var r=t.format.apply(t,arguments);console.error("%s %d: %s",e,n,r)}}else i[e]=function(){};return i[e]},t.inspect=o,o.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]},o.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"},t.isArray=h,t.isBoolean=d,t.isNull=f,t.isNullOrUndefined=function(e){return null==e},t.isNumber=p,t.isString=y,t.isSymbol=function(e){return"symbol"==typeof e},t.isUndefined=m,t.isRegExp=g,t.isObject=v,t.isDate=w,t.isError=b,t.isFunction=M,t.isPrimitive=function(e){return null===e||"boolean"==typeof e||"number"==typeof e||"string"==typeof e||"symbol"==typeof e||void 0===e},t.isBuffer=Yv;var N=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function T(){var e=new Date,t=[I(e.getHours()),I(e.getMinutes()),I(e.getSeconds())].join(":");return[e.getDate(),N[e.getMonth()],t].join(" ")}function E(e,t){return Object.prototype.hasOwnProperty.call(e,t)}t.log=function(){console.log("%s - %s",T(),t.format.apply(t,arguments))},t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t._extend=function(e,t){if(!t||!v(t))return e;for(var n=Object.keys(t),r=n.length;r--;)e[n[r]]=t[n[r]];return e}})),Vv=qf((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}}));function Hv(e,t){return 55296==(64512&e.charCodeAt(t))&&(!(t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1)))}function Gv(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function qv(e){return 1===e.length?"0"+e:e}function Zv(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}var Jv={inherits:qf((function(e){try{var t=Fv;if("function"!=typeof t.inherits)throw"";e.exports=t.inherits}catch(t){e.exports=Vv}})),toArray:function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i<e.length;i+=2)n.push(parseInt(e[i]+e[i+1],16))}else for(var r=0,i=0;i<e.length;i++){var o=e.charCodeAt(i);o<128?n[r++]=o:o<2048?(n[r++]=o>>6|192,n[r++]=63&o|128):Hv(e,i)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i<e.length;i++)n[i]=0|e[i];return n},toHex:function(e){for(var t="",n=0;n<e.length;n++)t+=qv(e[n].toString(16));return t},htonl:Gv,toHex32:function(e,t){for(var n="",r=0;r<e.length;r++){var i=e[r];"little"===t&&(i=Gv(i)),n+=Zv(i.toString(16))}return n},zero2:qv,zero8:Zv,join32:function(e,t,n,r){var i=n-t;Vg(i%4==0);for(var o=new Array(i/4),a=0,s=t;a<o.length;a++,s+=4){var u;u="big"===r?e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3]:e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s],o[a]=u>>>0}return o},split32:function(e,t){for(var n=new Array(4*e.length),r=0,i=0;r<e.length;r++,i+=4){var o=e[r];"big"===t?(n[i]=o>>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},rotr32:function(e,t){return e>>>t|e<<32-t},rotl32:function(e,t){return e<<t|e>>>32-t},sum32:function(e,t){return e+t>>>0},sum32_3:function(e,t,n){return e+t+n>>>0},sum32_4:function(e,t,n,r){return e+t+n+r>>>0},sum32_5:function(e,t,n,r,i){return e+t+n+r+i>>>0},sum64:function(e,t,n,r){var i=e[t],o=r+e[t+1]>>>0,a=(o<r?1:0)+n+i;e[t]=a>>>0,e[t+1]=o},sum64_hi:function(e,t,n,r){return(t+r>>>0<t?1:0)+e+n>>>0},sum64_lo:function(e,t,n,r){return t+r>>>0},sum64_4_hi:function(e,t,n,r,i,o,a,s){var u=0,c=t;return u+=(c=c+r>>>0)<t?1:0,u+=(c=c+o>>>0)<o?1:0,e+n+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},sum64_4_lo:function(e,t,n,r,i,o,a,s){return t+r+o+s>>>0},sum64_5_hi:function(e,t,n,r,i,o,a,s,u,c){var l=0,h=t;return l+=(h=h+r>>>0)<t?1:0,l+=(h=h+o>>>0)<o?1:0,l+=(h=h+s>>>0)<s?1:0,e+n+i+a+u+(l+=(h=h+c>>>0)<c?1:0)>>>0},sum64_5_lo:function(e,t,n,r,i,o,a,s,u,c){return t+r+o+s+c>>>0},rotr64_hi:function(e,t,n){return(t<<32-n|e>>>n)>>>0},rotr64_lo:function(e,t,n){return(e<<32-n|t>>>n)>>>0},shr64_hi:function(e,t,n){return e>>>n},shr64_lo:function(e,t,n){return(e<<32-n|t>>>n)>>>0}};function Xv(){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}var Kv=Xv;Xv.prototype.update=function(e,t){if(e=Jv.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=Jv.join32(e,0,e.length-n,this.endian);for(var r=0;r<e.length;r+=this._delta32)this._update(e,r,r+this._delta32)}return this},Xv.prototype.digest=function(e){return this.update(this._pad()),Vg(null===this.pending),this._digest(e)},Xv.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(e<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=e>>>24&255,r[i++]=e>>>16&255,r[i++]=e>>>8&255,r[i++]=255&e}else for(r[i++]=255&e,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o<this.padLength;o++)r[i++]=0;return r};var $v={BlockHash:Kv},ew=Jv.rotr32;function tw(e,t,n){return e&t^~e&n}function nw(e,t,n){return e&t^e&n^t&n}function rw(e,t,n){return e^t^n}var iw={ft_1:function(e,t,n,r){return 0===e?tw(t,n,r):1===e||3===e?rw(t,n,r):2===e?nw(t,n,r):void 0},ch32:tw,maj32:nw,p32:rw,s0_256:function(e){return ew(e,2)^ew(e,13)^ew(e,22)},s1_256:function(e){return ew(e,6)^ew(e,11)^ew(e,25)},g0_256:function(e){return ew(e,7)^ew(e,18)^e>>>3},g1_256:function(e){return ew(e,17)^ew(e,19)^e>>>10}},ow=Jv.rotl32,aw=Jv.sum32,sw=Jv.sum32_5,uw=iw.ft_1,cw=$v.BlockHash,lw=[1518500249,1859775393,2400959708,3395469782];function hw(){if(!(this instanceof hw))return new hw;cw.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}Jv.inherits(hw,cw);var dw=hw;hw.blockSize=512,hw.outSize=160,hw.hmacStrength=80,hw.padLength=64,hw.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=ow(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4];for(r=0;r<n.length;r++){var c=~~(r/20),l=sw(ow(i,5),uw(c,o,a,s),u,n[r],lw[c]);u=s,s=a,a=ow(o,30),o=i,i=l}this.h[0]=aw(this.h[0],i),this.h[1]=aw(this.h[1],o),this.h[2]=aw(this.h[2],a),this.h[3]=aw(this.h[3],s),this.h[4]=aw(this.h[4],u)},hw.prototype._digest=function(e){return"hex"===e?Jv.toHex32(this.h,"big"):Jv.split32(this.h,"big")};var fw=Jv.sum32,pw=Jv.sum32_4,yw=Jv.sum32_5,mw=iw.ch32,gw=iw.maj32,vw=iw.s0_256,ww=iw.s1_256,bw=iw.g0_256,Mw=iw.g1_256,Aw=$v.BlockHash,Iw=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function Nw(){if(!(this instanceof Nw))return new Nw;Aw.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Iw,this.W=new Array(64)}Jv.inherits(Nw,Aw);var Tw=Nw;function Ew(){if(!(this instanceof Ew))return new Ew;Tw.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Nw.blockSize=512,Nw.outSize=256,Nw.hmacStrength=192,Nw.padLength=64,Nw.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=pw(Mw(n[r-2]),n[r-7],bw(n[r-15]),n[r-16]);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],l=this.h[6],h=this.h[7];for(Vg(this.k.length===n.length),r=0;r<n.length;r++){var d=yw(h,ww(u),mw(u,c,l),this.k[r],n[r]),f=fw(vw(i),gw(i,o,a));h=l,l=c,c=u,u=fw(s,d),s=a,a=o,o=i,i=fw(d,f)}this.h[0]=fw(this.h[0],i),this.h[1]=fw(this.h[1],o),this.h[2]=fw(this.h[2],a),this.h[3]=fw(this.h[3],s),this.h[4]=fw(this.h[4],u),this.h[5]=fw(this.h[5],c),this.h[6]=fw(this.h[6],l),this.h[7]=fw(this.h[7],h)},Nw.prototype._digest=function(e){return"hex"===e?Jv.toHex32(this.h,"big"):Jv.split32(this.h,"big")},Jv.inherits(Ew,Tw);var xw=Ew;Ew.blockSize=512,Ew.outSize=224,Ew.hmacStrength=192,Ew.padLength=64,Ew.prototype._digest=function(e){return"hex"===e?Jv.toHex32(this.h.slice(0,7),"big"):Jv.split32(this.h.slice(0,7),"big")};var kw=Jv.rotr64_hi,Lw=Jv.rotr64_lo,Sw=Jv.shr64_hi,jw=Jv.shr64_lo,Dw=Jv.sum64,Cw=Jv.sum64_hi,Ow=Jv.sum64_lo,zw=Jv.sum64_4_hi,Pw=Jv.sum64_4_lo,_w=Jv.sum64_5_hi,Bw=Jv.sum64_5_lo,Rw=$v.BlockHash,Uw=[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 Qw(){if(!(this instanceof Qw))return new Qw;Rw.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=Uw,this.W=new Array(160)}Jv.inherits(Qw,Rw);var Ww=Qw;function Yw(e,t,n,r,i){var o=e&n^~e&i;return o<0&&(o+=4294967296),o}function Fw(e,t,n,r,i,o){var a=t&r^~t&o;return a<0&&(a+=4294967296),a}function Vw(e,t,n,r,i){var o=e&n^e&i^n&i;return o<0&&(o+=4294967296),o}function Hw(e,t,n,r,i,o){var a=t&r^t&o^r&o;return a<0&&(a+=4294967296),a}function Gw(e,t){var n=kw(e,t,28)^kw(t,e,2)^kw(t,e,7);return n<0&&(n+=4294967296),n}function qw(e,t){var n=Lw(e,t,28)^Lw(t,e,2)^Lw(t,e,7);return n<0&&(n+=4294967296),n}function Zw(e,t){var n=kw(e,t,14)^kw(e,t,18)^kw(t,e,9);return n<0&&(n+=4294967296),n}function Jw(e,t){var n=Lw(e,t,14)^Lw(e,t,18)^Lw(t,e,9);return n<0&&(n+=4294967296),n}function Xw(e,t){var n=kw(e,t,1)^kw(e,t,8)^Sw(e,t,7);return n<0&&(n+=4294967296),n}function Kw(e,t){var n=Lw(e,t,1)^Lw(e,t,8)^jw(e,t,7);return n<0&&(n+=4294967296),n}function $w(e,t){var n=kw(e,t,19)^kw(t,e,29)^Sw(e,t,6);return n<0&&(n+=4294967296),n}function eb(e,t){var n=Lw(e,t,19)^Lw(t,e,29)^jw(e,t,6);return n<0&&(n+=4294967296),n}function tb(){if(!(this instanceof tb))return new tb;Ww.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}Qw.blockSize=1024,Qw.outSize=512,Qw.hmacStrength=192,Qw.padLength=128,Qw.prototype._prepareBlock=function(e,t){for(var n=this.W,r=0;r<32;r++)n[r]=e[t+r];for(;r<n.length;r+=2){var i=$w(n[r-4],n[r-3]),o=eb(n[r-4],n[r-3]),a=n[r-14],s=n[r-13],u=Xw(n[r-30],n[r-29]),c=Kw(n[r-30],n[r-29]),l=n[r-32],h=n[r-31];n[r]=zw(i,o,a,s,u,c,l,h),n[r+1]=Pw(i,o,a,s,u,c,l,h)}},Qw.prototype._update=function(e,t){this._prepareBlock(e,t);var n=this.W,r=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],s=this.h[4],u=this.h[5],c=this.h[6],l=this.h[7],h=this.h[8],d=this.h[9],f=this.h[10],p=this.h[11],y=this.h[12],m=this.h[13],g=this.h[14],v=this.h[15];Vg(this.k.length===n.length);for(var w=0;w<n.length;w+=2){var b=g,M=v,A=Zw(h,d),I=Jw(h,d),N=Yw(h,d,f,p,y),T=Fw(h,d,f,p,y,m),E=this.k[w],x=this.k[w+1],k=n[w],L=n[w+1],S=_w(b,M,A,I,N,T,E,x,k,L),j=Bw(b,M,A,I,N,T,E,x,k,L);b=Gw(r,i),M=qw(r,i),A=Vw(r,i,o,a,s),I=Hw(r,i,o,a,s,u);var D=Cw(b,M,A,I),C=Ow(b,M,A,I);g=y,v=m,y=f,m=p,f=h,p=d,h=Cw(c,l,S,j),d=Ow(l,l,S,j),c=s,l=u,s=o,u=a,o=r,a=i,r=Cw(S,j,D,C),i=Ow(S,j,D,C)}Dw(this.h,0,r,i),Dw(this.h,2,o,a),Dw(this.h,4,s,u),Dw(this.h,6,c,l),Dw(this.h,8,h,d),Dw(this.h,10,f,p),Dw(this.h,12,y,m),Dw(this.h,14,g,v)},Qw.prototype._digest=function(e){return"hex"===e?Jv.toHex32(this.h,"big"):Jv.split32(this.h,"big")},Jv.inherits(tb,Ww);var nb=tb;tb.blockSize=1024,tb.outSize=384,tb.hmacStrength=192,tb.padLength=128,tb.prototype._digest=function(e){return"hex"===e?Jv.toHex32(this.h.slice(0,12),"big"):Jv.split32(this.h.slice(0,12),"big")};var rb={sha1:dw,sha224:xw,sha256:Tw,sha384:nb,sha512:Ww},ib=Jv.rotl32,ob=Jv.sum32,ab=Jv.sum32_3,sb=Jv.sum32_4,ub=$v.BlockHash;function cb(){if(!(this instanceof cb))return new cb;ub.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}Jv.inherits(cb,ub);var lb=cb;function hb(e,t,n,r){return e<=15?t^n^r:e<=31?t&n|~t&r:e<=47?(t|~n)^r:e<=63?t&r|n&~r:t^(n|~r)}function db(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function fb(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}cb.blockSize=512,cb.outSize=160,cb.hmacStrength=192,cb.padLength=64,cb.prototype._update=function(e,t){for(var n=this.h[0],r=this.h[1],i=this.h[2],o=this.h[3],a=this.h[4],s=n,u=r,c=i,l=o,h=a,d=0;d<80;d++){var f=ob(ib(sb(n,hb(d,r,i,o),e[pb[d]+t],db(d)),mb[d]),a);n=a,a=o,o=ib(i,10),i=r,r=f,f=ob(ib(sb(s,hb(79-d,u,c,l),e[yb[d]+t],fb(d)),gb[d]),h),s=h,h=l,l=ib(c,10),c=u,u=f}f=ab(this.h[1],i,l),this.h[1]=ab(this.h[2],o,h),this.h[2]=ab(this.h[3],a,s),this.h[3]=ab(this.h[4],n,u),this.h[4]=ab(this.h[0],r,c),this.h[0]=f},cb.prototype._digest=function(e){return"hex"===e?Jv.toHex32(this.h,"little"):Jv.split32(this.h,"little")};var pb=[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],yb=[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],mb=[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],gb=[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],vb={ripemd160:lb};function wb(e,t,n){if(!(this instanceof wb))return new wb(e,t,n);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(Jv.toArray(t,n))}var bb=wb;wb.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),Vg(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},wb.prototype.update=function(e,t){return this.inner.update(e,t),this},wb.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)};var Mb=qf((function(e,t){var n=t;n.utils=Jv,n.common=$v,n.sha=rb,n.ripemd=vb,n.hmac=bb,n.sha1=n.sha.sha1,n.sha256=n.sha.sha256,n.sha224=n.sha.sha224,n.sha384=n.sha.sha384,n.sha512=n.sha.sha512,n.ripemd160=n.ripemd.ripemd160}));function Ab(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==t&&n.path)}},n.exports),n.exports}var Ib=Nb;function Nb(e,t){if(!e)throw new Error(t||"Assertion failed")}Nb.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)};var Tb=Ab((function(e,t){var n=t;function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",n=0;n<e.length;n++)t+=r(e[n].toString(16));return t}n.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"!=typeof e){for(var r=0;r<e.length;r++)n[r]=0|e[r];return n}if("hex"===t){(e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e);for(r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16))}else for(r=0;r<e.length;r++){var i=e.charCodeAt(r),o=i>>8,a=255&i;o?n.push(o,a):n.push(a)}return n},n.zero2=r,n.toHex=i,n.encode=function(e,t){return"hex"===t?i(e):e}})),Eb=Ab((function(e,t){var n=t;n.assert=Ib,n.toArray=Tb.toArray,n.zero2=Tb.zero2,n.toHex=Tb.toHex,n.encode=Tb.encode,n.getNAF=function(e,t,n){var r=new Array(Math.max(e.bitLength(),n)+1);r.fill(0);for(var i=1<<t+1,o=e.clone(),a=0;a<r.length;a++){var s,u=o.andln(i-1);o.isOdd()?(s=u>(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},n.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,u=e.andln(3)+i&3,c=t.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=0==(1&u)?0:3!==(r=e.andln(7)+i&7)&&5!==r||2!==c?u:-u,n[0].push(a),s=0==(1&c)?0:3!==(r=t.andln(7)+o&7)&&5!==r||2!==u?c:-c,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return n},n.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new Fg(e,"hex","le")}})),xb=Eb.getNAF,kb=Eb.getJSF,Lb=Eb.assert;function Sb(e,t){this.type=e,this.p=new Fg(t.p,16),this.red=t.prime?Fg.red(t.prime):Fg.mont(this.p),this.zero=new Fg(0).toRed(this.red),this.one=new Fg(1).toRed(this.red),this.two=new Fg(2).toRed(this.red),this.n=t.n&&new Fg(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 n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var jb=Sb;function Db(e,t){this.curve=e,this.type=t,this.precomputed=null}Sb.prototype.point=function(){throw new Error("Not implemented")},Sb.prototype.validate=function(){throw new Error("Not implemented")},Sb.prototype._fixedNafMul=function(e,t){Lb(e.precomputed);var n=e._getDoubles(),r=xb(t,1,this._bitLength),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;var o,a,s=[];for(o=0;o<r.length;o+=n.step){a=0;for(var u=o+n.step-1;u>=o;u--)a=(a<<1)+r[u];s.push(a)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=i;h>0;h--){for(o=0;o<s.length;o++)(a=s[o])===h?l=l.mixedAdd(n.points[o]):a===-h&&(l=l.mixedAdd(n.points[o].neg()));c=c.add(l)}return c.toP()},Sb.prototype._wnafMul=function(e,t){var n=4,r=e._getNAFPoints(n);n=r.wnd;for(var i=r.points,o=xb(t,n,this._bitLength),a=this.jpoint(null,null,null),s=o.length-1;s>=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var c=o[s];Lb(0!==c),a="affine"===e.type?c>0?a.mixedAdd(i[c-1>>1]):a.mixedAdd(i[-c-1>>1].neg()):c>0?a.add(i[c-1>>1]):a.add(i[-c-1>>1].neg())}return"affine"===e.type?a.toP():a},Sb.prototype._wnafMulAdd=function(e,t,n,r,i){var o,a,s,u=this._wnafT1,c=this._wnafT2,l=this._wnafT3,h=0;for(o=0;o<r;o++){var d=(s=t[o])._getNAFPoints(e);u[o]=d.wnd,c[o]=d.points}for(o=r-1;o>=1;o-=2){var f=o-1,p=o;if(1===u[f]&&1===u[p]){var y=[t[f],null,null,t[p]];0===t[f].y.cmp(t[p].y)?(y[1]=t[f].add(t[p]),y[2]=t[f].toJ().mixedAdd(t[p].neg())):0===t[f].y.cmp(t[p].y.redNeg())?(y[1]=t[f].toJ().mixedAdd(t[p]),y[2]=t[f].add(t[p].neg())):(y[1]=t[f].toJ().mixedAdd(t[p]),y[2]=t[f].toJ().mixedAdd(t[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],g=kb(n[f],n[p]);for(h=Math.max(g[0].length,h),l[f]=new Array(h),l[p]=new Array(h),a=0;a<h;a++){var v=0|g[0][a],w=0|g[1][a];l[f][a]=m[3*(v+1)+(w+1)],l[p][a]=0,c[f]=y}}else l[f]=xb(n[f],u[f],this._bitLength),l[p]=xb(n[p],u[p],this._bitLength),h=Math.max(l[f].length,h),h=Math.max(l[p].length,h)}var b=this.jpoint(null,null,null),M=this._wnafT4;for(o=h;o>=0;o--){for(var A=0;o>=0;){var I=!0;for(a=0;a<r;a++)M[a]=0|l[a][o],0!==M[a]&&(I=!1);if(!I)break;A++,o--}if(o>=0&&A++,b=b.dblp(A),o<0)break;for(a=0;a<r;a++){var N=M[a];0!==N&&(N>0?s=c[a][N-1>>1]:N<0&&(s=c[a][-N-1>>1].neg()),b="affine"===s.type?b.mixedAdd(s):b.add(s))}}for(o=0;o<r;o++)c[o]=null;return i?b:b.toP()},Sb.BasePoint=Db,Db.prototype.eq=function(){throw new Error("Not implemented")},Db.prototype.validate=function(){return this.curve.validate(this)},Sb.prototype.decodePoint=function(e,t){e=Eb.toArray(e,t);var n=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*n)return 6===e[0]?Lb(e[e.length-1]%2==0):7===e[0]&&Lb(e[e.length-1]%2==1),this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));if((2===e[0]||3===e[0])&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),3===e[0]);throw new Error("Unknown point format")},Db.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Db.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},Db.prototype.encode=function(e,t){return Eb.encode(this._encode(t),e)},Db.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Db.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},Db.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<t;i+=e){for(var o=0;o<e;o++)r=r.dbl();n.push(r)}return{step:e,points:n}},Db.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)t[i]=t[i-1].add(r);return{wnd:e,points:t}},Db.prototype._getBeta=function(){return null},Db.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t};var Cb=Ab((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}})),Ob=Eb.assert;function zb(e){jb.call(this,"short",e),this.a=new Fg(e.a,16).toRed(this.red),this.b=new Fg(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}Cb(zb,jb);var Pb=zb;function _b(e,t,n,r){jb.BasePoint.call(this,e,"affine"),null===t&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new Fg(t,16),this.y=new Fg(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function Bb(e,t,n,r){jb.BasePoint.call(this,e,"jacobian"),null===t&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Fg(0)):(this.x=new Fg(t,16),this.y=new Fg(n,16),this.z=new Fg(r,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}zb.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,n;if(e.beta)t=new Fg(e.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);t=(t=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new Fg(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?n=i[0]:(n=i[1],Ob(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map((function(e){return{a:new Fg(e.a,16),b:new Fg(e.b,16)}})):this._getEndoBasis(n)}}},zb.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:Fg.mont(e),n=new Fg(2).toRed(t).redInvm(),r=n.redNeg(),i=new Fg(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},zb.prototype._getEndoBasis=function(e){for(var t,n,r,i,o,a,s,u,c,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=e,d=this.n.clone(),f=new Fg(1),p=new Fg(0),y=new Fg(0),m=new Fg(1),g=0;0!==h.cmpn(0);){var v=d.div(h);u=d.sub(v.mul(h)),c=y.sub(v.mul(f));var w=m.sub(v.mul(p));if(!r&&u.cmp(l)<0)t=s.neg(),n=f,r=u.neg(),i=c;else if(r&&2==++g)break;s=u,d=h,h=u,y=f,f=c,m=p,p=w}o=u.neg(),a=c;var b=r.sqr().add(i.sqr());return o.sqr().add(a.sqr()).cmp(b)>=0&&(o=t,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},zb.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:e.sub(a).sub(s),k2:u.add(c).neg()}},zb.prototype.pointFromX=function(e,t){(e=new Fg(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(t&&!i||!t&&i)&&(r=r.redNeg()),this.point(e,r)},zb.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},zb.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o<e.length;o++){var a=this._endoSplit(t[o]),s=e[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),r[2*o]=s,r[2*o+1]=u,i[2*o]=a.k1,i[2*o+1]=a.k2}for(var c=this._wnafMulAdd(1,r,i,2*o,n),l=0;l<2*o;l++)r[l]=null,i[l]=null;return c},Cb(_b,jb.BasePoint),zb.prototype.point=function(e,t,n){return new _b(this,e,t,n)},zb.prototype.pointFromJSON=function(e,t){return _b.fromJSON(this,e,t)},_b.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,r=function(e){return n.point(e.x.redMul(n.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(r)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(r)}}}return t}},_b.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},_b.fromJSON=function(e,t,n){"string"==typeof t&&(t=JSON.parse(t));var r=e.point(t[0],t[1],n);if(!t[2])return r;function i(t){return e.point(t[0],t[1],n)}var o=t[2];return r.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[r].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[r].concat(o.naf.points.map(i))}},r},_b.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},_b.prototype.isInfinity=function(){return this.inf},_b.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},_b.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},_b.prototype.getX=function(){return this.x.fromRed()},_b.prototype.getY=function(){return this.y.fromRed()},_b.prototype.mul=function(e){return e=new Fg(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},_b.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},_b.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},_b.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},_b.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},_b.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},Cb(Bb,jb.BasePoint),zb.prototype.jpoint=function(e,t,n){return new Bb(this,e,t,n)},Bb.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},Bb.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Bb.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),h=r.redMul(c),d=u.redSqr().redIAdd(l).redISub(h).redISub(h),f=u.redMul(h.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(d,f,p)},Bb.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=n.redMul(u),h=s.redSqr().redIAdd(c).redISub(l).redISub(l),d=s.redMul(l.redISub(h)).redISub(i.redMul(c)),f=this.z.redMul(a);return this.curve.jpoint(h,d,f)},Bb.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t<e;t++)n=n.dbl();return n}var r=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),c=a.redAdd(a);for(t=0;t<e;t++){var l=o.redSqr(),h=c.redSqr(),d=h.redSqr(),f=l.redAdd(l).redIAdd(l).redIAdd(r.redMul(u)),p=o.redMul(h),y=f.redSqr().redISub(p.redAdd(p)),m=p.redISub(y),g=f.redMul(m);g=g.redIAdd(g).redISub(d);var v=c.redMul(s);t+1<e&&(u=u.redMul(d)),o=y,s=v,c=g}return this.curve.jpoint(o,c.redMul(i),s)},Bb.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},Bb.prototype._zeroDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r),u=s.redSqr().redISub(a).redISub(a),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=u,t=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),h=this.y.redSqr(),d=h.redSqr(),f=this.x.redAdd(h).redSqr().redISub(l).redISub(d);f=f.redIAdd(f);var p=l.redAdd(l).redIAdd(l),y=p.redSqr(),m=d.redIAdd(d);m=(m=m.redIAdd(m)).redIAdd(m),e=y.redISub(f).redISub(f),t=p.redMul(f.redISub(e)).redISub(m),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(e,t,n)},Bb.prototype._threeDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),u=s.redSqr().redISub(a).redISub(a);e=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),h=this.y.redSqr(),d=this.x.redMul(h),f=this.x.redSub(l).redMul(this.x.redAdd(l));f=f.redAdd(f).redIAdd(f);var p=d.redIAdd(d),y=(p=p.redIAdd(p)).redAdd(p);e=f.redSqr().redISub(y),n=this.y.redAdd(this.z).redSqr().redISub(h).redISub(l);var m=h.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),t=f.redMul(p.redISub(e)).redISub(m)}return this.curve.jpoint(e,t,n)},Bb.prototype._dbl=function(){var e=this.curve.a,t=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),o=t.redSqr(),a=n.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(i)),u=t.redAdd(t),c=(u=u.redIAdd(u)).redMul(a),l=s.redSqr().redISub(c.redAdd(c)),h=c.redISub(l),d=a.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=s.redMul(h).redISub(d),p=n.redAdd(n).redMul(r);return this.curve.jpoint(l,f,p)},Bb.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),r=t.redSqr(),i=e.redAdd(e).redIAdd(e),o=i.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).redISub(r),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),u=r.redIAdd(r);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=i.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(u),l=t.redMul(c);l=(l=l.redIAdd(l)).redIAdd(l);var h=this.x.redMul(s).redISub(l);h=(h=h.redIAdd(h)).redIAdd(h);var d=this.y.redMul(c.redMul(u.redISub(c)).redISub(a.redMul(s)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=this.z.redAdd(a).redSqr().redISub(n).redISub(s);return this.curve.jpoint(h,d,f)},Bb.prototype.mul=function(e,t){return e=new Fg(e,t),this.curve._wnafMul(this,e)},Bb.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(0!==this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0))return!1;var r=t.redMul(this.z),i=n.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(r)).cmpn(0)},Bb.prototype.eqXToP=function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(n))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(t);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},Bb.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},Bb.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var Rb=Ab((function(e,t){var n=t;n.base=jb,n.short=Pb,n.mont=null,n.edwards=null})),Ub=Ab((function(e,t){var n,r=t,i=Eb.assert;function o(e){"short"===e.type?this.curve=new Rb.short(e):"edwards"===e.type?this.curve=new Rb.edwards(e):this.curve=new Rb.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(e,t){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){var n=new o(t);return Object.defineProperty(r,e,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=o,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:Mb.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:Mb.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:Mb.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:Mb.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:Mb.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Mb.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:Mb.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=null.crash()}catch(e){n=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:Mb.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})}));function Qb(e){if(!(this instanceof Qb))return new Qb(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=Tb.toArray(e.entropy,e.entropyEnc||"hex"),n=Tb.toArray(e.nonce,e.nonceEnc||"hex"),r=Tb.toArray(e.pers,e.persEnc||"hex");Ib(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}var Wb=Qb;Qb.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},Qb.prototype._hmac=function(){return new Mb.hmac(this.hash,this.K)},Qb.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},Qb.prototype.reseed=function(e,t,n,r){"string"!=typeof t&&(r=n,n=t,t=null),e=Tb.toArray(e,t),n=Tb.toArray(n,r),Ib(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},Qb.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(r=n,n=t,t=null),n&&(n=Tb.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,e);return this._update(n),this._reseed++,Tb.encode(o,t)};var Yb=Eb.assert;function Fb(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var Vb=Fb;Fb.fromPublic=function(e,t,n){return t instanceof Fb?t:new Fb(e,{pub:t,pubEnc:n})},Fb.fromPrivate=function(e,t,n){return t instanceof Fb?t:new Fb(e,{priv:t,privEnc:n})},Fb.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},Fb.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},Fb.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},Fb.prototype._importPrivate=function(e,t){this.priv=new Fg(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},Fb.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?Yb(e.x,"Need x coordinate"):"short"!==this.ec.curve.type&&"edwards"!==this.ec.curve.type||Yb(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},Fb.prototype.derive=function(e){return e.validate()||Yb(e.validate(),"public point not validated"),e.mul(this.priv).getX()},Fb.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},Fb.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},Fb.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var Hb=Eb.assert;function Gb(e,t){if(e instanceof Gb)return e;this._importDER(e,t)||(Hb(e.r&&e.s,"Signature without r or s"),this.r=new Fg(e.r,16),this.s=new Fg(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var qb=Gb;function Zb(){this.place=0}function Jb(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=t.place;o<r;o++,a++)i<<=8,i|=e[a],i>>>=0;return!(i<=127)&&(t.place=a,i)}function Xb(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t<n;)t++;return 0===t?e:e.slice(t)}function Kb(e,t){if(t<128)e.push(t);else{var n=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}Gb.prototype._importDER=function(e,t){e=Eb.toArray(e,t);var n=new Zb;if(48!==e[n.place++])return!1;var r=Jb(e,n);if(!1===r)return!1;if(r+n.place!==e.length)return!1;if(2!==e[n.place++])return!1;var i=Jb(e,n);if(!1===i)return!1;var o=e.slice(n.place,i+n.place);if(n.place+=i,2!==e[n.place++])return!1;var a=Jb(e,n);if(!1===a)return!1;if(e.length!==a+n.place)return!1;var s=e.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new Fg(o),this.s=new Fg(s),this.recoveryParam=null,!0},Gb.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=Xb(t),n=Xb(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];Kb(r,t.length),(r=r.concat(t)).push(2),Kb(r,n.length);var i=r.concat(n),o=[48];return Kb(o,i.length),o=o.concat(i),Eb.encode(o,e)};var $b=function(){throw new Error("unsupported")},eM=Eb.assert;function tM(e){if(!(this instanceof tM))return new tM(e);"string"==typeof e&&(eM(Object.prototype.hasOwnProperty.call(Ub,e),"Unknown curve "+e),e=Ub[e]),e instanceof Ub.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var nM=tM;tM.prototype.keyPair=function(e){return new Vb(this,e)},tM.prototype.keyFromPrivate=function(e,t){return Vb.fromPrivate(this,e,t)},tM.prototype.keyFromPublic=function(e,t){return Vb.fromPublic(this,e,t)},tM.prototype.genKeyPair=function(e){e||(e={});for(var t=new Wb({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||$b(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new Fg(2));;){var i=new Fg(t.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},tM.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},tM.prototype.sign=function(e,t,n,r){"object"==typeof n&&(r=n,n=null),r||(r={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new Fg(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),a=e.toArray("be",i),s=new Wb({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),u=this.n.sub(new Fg(1)),c=0;;c++){var l=r.k?r.k(c):new Fg(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(u)>=0)){var h=this.g.mul(l);if(!h.isInfinity()){var d=h.getX(),f=d.umod(this.n);if(0!==f.cmpn(0)){var p=l.invm(this.n).mul(f.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var y=(h.getY().isOdd()?1:0)|(0!==d.cmp(f)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),y^=1),new qb({r:f,s:p,recoveryParam:y})}}}}}},tM.prototype.verify=function(e,t,n,r){e=this._truncateToN(new Fg(e,16)),n=this.keyFromPublic(n,r);var i=(t=new qb(t,"hex")).r,o=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0)return!1;if(o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),u=s.mul(e).umod(this.n),c=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),c)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(u,n.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},tM.prototype.recoverPubKey=function(e,t,n,r){eM((3&n)===n,"The recovery param is more than two bits"),t=new qb(t,r);var i=this.n,o=new Fg(e),a=t.r,s=t.s,u=1&n,c=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var l=t.r.invm(i),h=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(h,a,d)},tM.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new qb(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var rM=Ab((function(e,t){var n=t;n.version="6.5.4",n.utils=Eb,n.rand=function(){throw new Error("unsupported")},n.curve=Rb,n.curves=Ub,n.ec=nM,n.eddsa=null})).ec;const iM=new bp("signing-key/5.7.0");let oM=null;function aM(){return oM||(oM=new rM("secp256k1")),oM}class sM{constructor(e){cy(this,"curve","secp256k1"),cy(this,"privateKey",Dp(e)),32!==Cp(this.privateKey)&&iM.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const t=aM().keyFromPrivate(xp(this.privateKey));cy(this,"publicKey","0x"+t.getPublic(!1,"hex")),cy(this,"compressedPublicKey","0x"+t.getPublic(!0,"hex")),cy(this,"_isSigningKey",!0)}_addPoint(e){const t=aM().keyFromPublic(xp(this.publicKey)),n=aM().keyFromPublic(xp(e));return"0x"+t.pub.add(n.pub).encodeCompressed("hex")}signDigest(e){const t=aM().keyFromPrivate(xp(this.privateKey)),n=xp(e);32!==n.length&&iM.throwArgumentError("bad digest length","digest",e);const r=t.sign(n,{canonical:!0});return Bp({recoveryParam:r.recoveryParam,r:_p("0x"+r.r.toString(16),32),s:_p("0x"+r.s.toString(16),32)})}computeSharedSecret(e){const t=aM().keyFromPrivate(xp(this.privateKey)),n=aM().keyFromPublic(xp(uM(e)));return _p("0x"+t.derive(n.getPublic()).toString(16),32)}static isSigningKey(e){return!(!e||!e._isSigningKey)}}function uM(e,t){const n=xp(e);if(32===n.length){const e=new sM(n);return t?"0x"+aM().keyFromPrivate(n).getPublic(!0,"hex"):e.publicKey}return 33===n.length?t?Dp(n):"0x"+aM().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?t?"0x"+aM().keyFromPublic(n).getPublic(!0,"hex"):Dp(n):iM.throwArgumentError("invalid public or private key","key","[REDACTED]")}const cM=new bp("transactions/5.7.0");var lM;function hM(e){return"0x"===e?null:om(e)}function dM(e){return"0x"===e?wm:Yp.from(e)}function fM(e,t){return function(e){return om(Op(Hy(Op(uM(e),1)),12))}(function(e,t){const n=Bp(t),r={r:xp(n.r),s:xp(n.s)};return"0x"+aM().recoverPubKey(xp(e),r,n.recoveryParam).encode("hex",!1)}(xp(e),t))}function pM(e,t){const n=Lp(Yp.from(e).toHexString());return n.length>32&&cM.throwArgumentError("invalid length for "+t,"transaction:"+t,e),n}function yM(e,t){return{address:om(e),storageKeys:(t||[]).map(((t,n)=>(32!==Cp(t)&&cM.throwArgumentError("invalid access list storageKey",`accessList[${e}:${n}]`,t),t.toLowerCase())))}}function mM(e){if(Array.isArray(e))return e.map(((e,t)=>Array.isArray(e)?(e.length>2&&cM.throwArgumentError("access list expected to be [ address, storageKeys[] ]",`value[${t}]`,e),yM(e[0],e[1])):yM(e.address,e.storageKeys)));const t=Object.keys(e).map((t=>{const n=e[t].reduce(((e,t)=>(e[t]=!0,e)),{});return yM(t,Object.keys(n).sort())}));return t.sort(((e,t)=>e.address.localeCompare(t.address))),t}function gM(e){return mM(e).map((e=>[e.address,e.storageKeys]))}function vM(e,t){if(null!=e.gasPrice){const t=Yp.from(e.gasPrice),n=Yp.from(e.maxFeePerGas||0);t.eq(n)||cM.throwArgumentError("mismatch EIP-1559 gasPrice != maxFeePerGas","tx",{gasPrice:t,maxFeePerGas:n})}const n=[pM(e.chainId||0,"chainId"),pM(e.nonce||0,"nonce"),pM(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),pM(e.maxFeePerGas||0,"maxFeePerGas"),pM(e.gasLimit||0,"gasLimit"),null!=e.to?om(e.to):"0x",pM(e.value||0,"value"),e.data||"0x",gM(e.accessList||[])];if(t){const e=Bp(t);n.push(pM(e.recoveryParam,"recoveryParam")),n.push(Lp(e.r)),n.push(Lp(e.s))}return zp(["0x02",Xy(n)])}function wM(e,t){const n=[pM(e.chainId||0,"chainId"),pM(e.nonce||0,"nonce"),pM(e.gasPrice||0,"gasPrice"),pM(e.gasLimit||0,"gasLimit"),null!=e.to?om(e.to):"0x",pM(e.value||0,"value"),e.data||"0x",gM(e.accessList||[])];if(t){const e=Bp(t);n.push(pM(e.recoveryParam,"recoveryParam")),n.push(Lp(e.r)),n.push(Lp(e.s))}return zp(["0x01",Xy(n)])}function bM(e,t,n){try{const n=dM(t[0]).toNumber();if(0!==n&&1!==n)throw new Error("bad recid");e.v=n}catch(e){cM.throwArgumentError("invalid v for transaction type: 1","v",t[0])}e.r=_p(t[1],32),e.s=_p(t[2],32);try{const t=Hy(n(e));e.from=fM(t,{r:e.r,s:e.s,recoveryParam:e.v})}catch(e){}}function MM(e){const t=xp(e);if(t[0]>127)return function(e){const t=em(e);9!==t.length&&6!==t.length&&cM.throwArgumentError("invalid raw transaction","rawTransaction",e);const n={nonce:dM(t[0]).toNumber(),gasPrice:dM(t[1]),gasLimit:dM(t[2]),to:hM(t[3]),value:dM(t[4]),data:t[5],chainId:0};if(6===t.length)return n;try{n.v=Yp.from(t[6]).toNumber()}catch(e){return n}if(n.r=_p(t[7],32),n.s=_p(t[8],32),Yp.from(n.r).isZero()&&Yp.from(n.s).isZero())n.chainId=n.v,n.v=0;else{n.chainId=Math.floor((n.v-35)/2),n.chainId<0&&(n.chainId=0);let r=n.v-27;const i=t.slice(0,6);0!==n.chainId&&(i.push(Dp(n.chainId)),i.push("0x"),i.push("0x"),r-=2*n.chainId+8);const o=Hy(Xy(i));try{n.from=fM(o,{r:Dp(n.r),s:Dp(n.s),recoveryParam:r})}catch(e){}n.hash=Hy(e)}return n.type=null,n}(t);switch(t[0]){case 1:return function(e){const t=em(e.slice(1));8!==t.length&&11!==t.length&&cM.throwArgumentError("invalid component count for transaction type: 1","payload",Dp(e));const n={type:1,chainId:dM(t[0]).toNumber(),nonce:dM(t[1]).toNumber(),gasPrice:dM(t[2]),gasLimit:dM(t[3]),to:hM(t[4]),value:dM(t[5]),data:t[6],accessList:mM(t[7])};return 8===t.length||(n.hash=Hy(e),bM(n,t.slice(8),wM)),n}(t);case 2:return function(e){const t=em(e.slice(1));9!==t.length&&12!==t.length&&cM.throwArgumentError("invalid component count for transaction type: 2","payload",Dp(e));const n=dM(t[2]),r=dM(t[3]),i={type:2,chainId:dM(t[0]).toNumber(),nonce:dM(t[1]).toNumber(),maxPriorityFeePerGas:n,maxFeePerGas:r,gasPrice:null,gasLimit:dM(t[4]),to:hM(t[5]),value:dM(t[6]),data:t[7],accessList:mM(t[8])};return 9===t.length||(i.hash=Hy(e),bM(i,t.slice(9),vM)),i}(t)}return cM.throwError(`unsupported transaction type: ${t[0]}`,bp.errors.UNSUPPORTED_OPERATION,{operation:"parseTransaction",transactionType:t[0]})}!function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(lM||(lM={}));var AM=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};const IM=new bp("contracts/5.7.0");function NM(e,t){return AM(this,void 0,void 0,(function*(){const n=yield t;"string"!=typeof n&&IM.throwArgumentError("invalid address or ENS name","name",n);try{return om(n)}catch(e){}e||IM.throwError("a provider or signer is needed to resolve ENS names",bp.errors.UNSUPPORTED_OPERATION,{operation:"resolveName"});const r=yield e.resolveName(n);return null==r&&IM.throwArgumentError("resolver or addr is not configured for ENS name","name",n),r}))}function TM(e,t,n){return AM(this,void 0,void 0,(function*(){return Array.isArray(n)?yield Promise.all(n.map(((n,r)=>TM(e,Array.isArray(t)?t[r]:t[n.name],n)))):"address"===n.type?yield NM(e,t):"tuple"===n.type?yield TM(e,t,n.components):"array"===n.baseType?Array.isArray(t)?yield Promise.all(t.map((t=>TM(e,t,n.arrayChildren)))):Promise.reject(IM.makeError("invalid value for array",bp.errors.INVALID_ARGUMENT,{argument:"value",value:t})):t}))}function EM(e,t,n){return AM(this,void 0,void 0,(function*(){let r={};n.length===t.inputs.length+1&&"object"==typeof n[n.length-1]&&(r=dy(n.pop())),IM.checkArgumentCount(n.length,t.inputs.length,"passed to contract"),e.signer?r.from?r.from=hy({override:NM(e.signer,r.from),signer:e.signer.getAddress()}).then((e=>AM(this,void 0,void 0,(function*(){return om(e.signer)!==e.override&&IM.throwError("Contract with a Signer cannot override from",bp.errors.UNSUPPORTED_OPERATION,{operation:"overrides.from"}),e.override})))):r.from=e.signer.getAddress():r.from&&(r.from=NM(e.provider,r.from));const i=yield hy({args:TM(e.signer||e.provider,n,t.inputs),address:e.resolvedAddress,overrides:hy(r)||{}}),o=e.interface.encodeFunctionData(t,i.args),a={data:o,to:i.address},s=i.overrides;if(null!=s.nonce&&(a.nonce=Yp.from(s.nonce).toNumber()),null!=s.gasLimit&&(a.gasLimit=Yp.from(s.gasLimit)),null!=s.gasPrice&&(a.gasPrice=Yp.from(s.gasPrice)),null!=s.maxFeePerGas&&(a.maxFeePerGas=Yp.from(s.maxFeePerGas)),null!=s.maxPriorityFeePerGas&&(a.maxPriorityFeePerGas=Yp.from(s.maxPriorityFeePerGas)),null!=s.from&&(a.from=s.from),null!=s.type&&(a.type=s.type),null!=s.accessList&&(a.accessList=mM(s.accessList)),null==a.gasLimit&&null!=t.gas){let e=21e3;const n=xp(o);for(let t=0;t<n.length;t++)e+=4,n[t]&&(e+=64);a.gasLimit=Yp.from(t.gas).add(e)}if(s.value){const e=Yp.from(s.value);e.isZero()||t.payable||IM.throwError("non-payable method cannot override value",bp.errors.UNSUPPORTED_OPERATION,{operation:"overrides.value",value:r.value}),a.value=e}s.customData&&(a.customData=dy(s.customData)),s.ccipReadEnabled&&(a.ccipReadEnabled=!!s.ccipReadEnabled),delete r.nonce,delete r.gasLimit,delete r.gasPrice,delete r.from,delete r.value,delete r.type,delete r.accessList,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas,delete r.customData,delete r.ccipReadEnabled;const u=Object.keys(r).filter((e=>null!=r[e]));return u.length&&IM.throwError(`cannot override ${u.map((e=>JSON.stringify(e))).join(",")}`,bp.errors.UNSUPPORTED_OPERATION,{operation:"overrides",overrides:u}),a}))}function xM(e,t,n){const r=e.signer||e.provider;return function(...i){return AM(this,void 0,void 0,(function*(){let o;if(i.length===t.inputs.length+1&&"object"==typeof i[i.length-1]){const e=dy(i.pop());null!=e.blockTag&&(o=yield e.blockTag),delete e.blockTag,i.push(e)}null!=e.deployTransaction&&(yield e._deployed(o));const a=yield EM(e,t,i),s=yield r.call(a,o);try{let r=e.interface.decodeFunctionResult(t,s);return n&&1===t.outputs.length&&(r=r[0]),r}catch(t){throw t.code===bp.errors.CALL_EXCEPTION&&(t.address=e.address,t.args=i,t.transaction=a),t}}))}}function kM(e,t){return function(...n){return AM(this,void 0,void 0,(function*(){e.signer||IM.throwError("sending a transaction requires a signer",bp.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction"}),null!=e.deployTransaction&&(yield e._deployed());const r=yield EM(e,t,n),i=yield e.signer.sendTransaction(r);return function(e,t){const n=t.wait.bind(t);t.wait=t=>n(t).then((t=>(t.events=t.logs.map((n=>{let r=my(n),i=null;try{i=e.interface.parseLog(n)}catch(e){}return i&&(r.args=i.args,r.decode=(t,n)=>e.interface.decodeEventLog(i.eventFragment,t,n),r.event=i.name,r.eventSignature=i.signature),r.removeListener=()=>e.provider,r.getBlock=()=>e.provider.getBlock(t.blockHash),r.getTransaction=()=>e.provider.getTransaction(t.transactionHash),r.getTransactionReceipt=()=>Promise.resolve(t),r})),t)))}(e,i),i}))}}function LM(e,t,n){return t.constant?xM(e,t,n):kM(e,t)}function SM(e){return!e.address||null!=e.topics&&0!==e.topics.length?(e.address||"*")+"@"+(e.topics?e.topics.map((e=>Array.isArray(e)?e.join("|"):e)).join(":"):""):"*"}class jM{constructor(e,t){cy(this,"tag",e),cy(this,"filter",t),this._listeners=[]}addListener(e,t){this._listeners.push({listener:e,once:t})}removeListener(e){let t=!1;this._listeners=this._listeners.filter((n=>!(!t&&n.listener===e)||(t=!0,!1)))}removeAllListeners(){this._listeners=[]}listeners(){return this._listeners.map((e=>e.listener))}listenerCount(){return this._listeners.length}run(e){const t=this.listenerCount();return this._listeners=this._listeners.filter((t=>{const n=e.slice();return setTimeout((()=>{t.listener.apply(this,n)}),0),!t.once})),t}prepareEvent(e){}getEmit(e){return[e]}}class DM extends jM{constructor(){super("error",null)}}class CM extends jM{constructor(e,t,n,r){const i={address:e};let o=t.getEventTopic(n);r?(o!==r[0]&&IM.throwArgumentError("topic mismatch","topics",r),i.topics=r.slice()):i.topics=[o],super(SM(i),i),cy(this,"address",e),cy(this,"interface",t),cy(this,"fragment",n)}prepareEvent(e){super.prepareEvent(e),e.event=this.fragment.name,e.eventSignature=this.fragment.format(),e.decode=(e,t)=>this.interface.decodeEventLog(this.fragment,e,t);try{e.args=this.interface.decodeEventLog(this.fragment,e.data,e.topics)}catch(t){e.args=null,e.decodeError=t}}getEmit(e){const t=function(e){const t=[],n=function(e,r){if(Array.isArray(r))for(let i in r){const o=e.slice();o.push(i);try{n(o,r[i])}catch(e){t.push({path:o,error:e})}}};return n([],e),t}(e.args);if(t.length)throw t[0].error;const n=(e.args||[]).slice();return n.push(e),n}}class OM extends jM{constructor(e,t){super("*",{address:e}),cy(this,"address",e),cy(this,"interface",t)}prepareEvent(e){super.prepareEvent(e);try{const t=this.interface.parseLog(e);e.event=t.name,e.eventSignature=t.signature,e.decode=(e,n)=>this.interface.decodeEventLog(t.eventFragment,e,n),e.args=t.args}catch(e){}}}class zM extends class{constructor(e,t,n){cy(this,"interface",ly(new.target,"getInterface")(t)),null==n?(cy(this,"provider",null),cy(this,"signer",null)):Wg.isSigner(n)?(cy(this,"provider",n.provider||null),cy(this,"signer",n)):_g.isProvider(n)?(cy(this,"provider",n),cy(this,"signer",null)):IM.throwArgumentError("invalid signer or provider","signerOrProvider",n),cy(this,"callStatic",{}),cy(this,"estimateGas",{}),cy(this,"functions",{}),cy(this,"populateTransaction",{}),cy(this,"filters",{});{const e={};Object.keys(this.interface.events).forEach((t=>{const n=this.interface.events[t];cy(this.filters,t,((...e)=>({address:this.address,topics:this.interface.encodeFilterTopics(n,e)}))),e[n.name]||(e[n.name]=[]),e[n.name].push(t)})),Object.keys(e).forEach((t=>{const n=e[t];1===n.length?cy(this.filters,t,this.filters[n[0]]):IM.warn(`Duplicate definition of ${t} (${n.join(", ")})`)}))}if(cy(this,"_runningEvents",{}),cy(this,"_wrappedEmits",{}),null==e&&IM.throwArgumentError("invalid contract address or ENS name","addressOrName",e),cy(this,"address",e),this.provider)cy(this,"resolvedAddress",NM(this.provider,e));else try{cy(this,"resolvedAddress",Promise.resolve(om(e)))}catch(e){IM.throwError("provider is required to use ENS name as contract address",bp.errors.UNSUPPORTED_OPERATION,{operation:"new Contract"})}this.resolvedAddress.catch((e=>{}));const r={},i={};Object.keys(this.interface.functions).forEach((e=>{const t=this.interface.functions[e];if(i[e])IM.warn(`Duplicate ABI entry for ${JSON.stringify(e)}`);else{i[e]=!0;{const n=t.name;r[`%${n}`]||(r[`%${n}`]=[]),r[`%${n}`].push(e)}null==this[e]&&cy(this,e,LM(this,t,!0)),null==this.functions[e]&&cy(this.functions,e,LM(this,t,!1)),null==this.callStatic[e]&&cy(this.callStatic,e,xM(this,t,!0)),null==this.populateTransaction[e]&&cy(this.populateTransaction,e,function(e,t){return function(...n){return EM(e,t,n)}}(this,t)),null==this.estimateGas[e]&&cy(this.estimateGas,e,function(e,t){const n=e.signer||e.provider;return function(...r){return AM(this,void 0,void 0,(function*(){n||IM.throwError("estimate require a provider or signer",bp.errors.UNSUPPORTED_OPERATION,{operation:"estimateGas"});const i=yield EM(e,t,r);return yield n.estimateGas(i)}))}}(this,t))}})),Object.keys(r).forEach((e=>{const t=r[e];if(t.length>1)return;e=e.substring(1);const n=t[0];try{null==this[e]&&cy(this,e,this[n])}catch(e){}null==this.functions[e]&&cy(this.functions,e,this.functions[n]),null==this.callStatic[e]&&cy(this.callStatic,e,this.callStatic[n]),null==this.populateTransaction[e]&&cy(this.populateTransaction,e,this.populateTransaction[n]),null==this.estimateGas[e]&&cy(this.estimateGas,e,this.estimateGas[n])}))}static getContractAddress(e){return am(e)}static getInterface(e){return Cg.isInterface(e)?e:new Cg(e)}deployed(){return this._deployed()}_deployed(e){return this._deployedPromise||(this.deployTransaction?this._deployedPromise=this.deployTransaction.wait().then((()=>this)):this._deployedPromise=this.provider.getCode(this.address,e).then((e=>("0x"===e&&IM.throwError("contract not deployed",bp.errors.UNSUPPORTED_OPERATION,{contractAddress:this.address,operation:"getDeployed"}),this)))),this._deployedPromise}fallback(e){this.signer||IM.throwError("sending a transactions require a signer",bp.errors.UNSUPPORTED_OPERATION,{operation:"sendTransaction(fallback)"});const t=dy(e||{});return["from","to"].forEach((function(e){null!=t[e]&&IM.throwError("cannot override "+e,bp.errors.UNSUPPORTED_OPERATION,{operation:e})})),t.to=this.resolvedAddress,this.deployed().then((()=>this.signer.sendTransaction(t)))}connect(e){"string"==typeof e&&(e=new Yg(e,this.provider));const t=new this.constructor(this.address,this.interface,e);return this.deployTransaction&&cy(t,"deployTransaction",this.deployTransaction),t}attach(e){return new this.constructor(e,this.interface,this.signer||this.provider)}static isIndexed(e){return Sg.isIndexed(e)}_normalizeRunningEvent(e){return this._runningEvents[e.tag]?this._runningEvents[e.tag]:e}_getRunningEvent(e){if("string"==typeof e){if("error"===e)return this._normalizeRunningEvent(new DM);if("event"===e)return this._normalizeRunningEvent(new jM("event",null));if("*"===e)return this._normalizeRunningEvent(new OM(this.address,this.interface));const t=this.interface.getEvent(e);return this._normalizeRunningEvent(new CM(this.address,this.interface,t))}if(e.topics&&e.topics.length>0){try{const t=e.topics[0];if("string"!=typeof t)throw new Error("invalid topic");const n=this.interface.getEvent(t);return this._normalizeRunningEvent(new CM(this.address,this.interface,n,e.topics))}catch(e){}const t={address:this.address,topics:e.topics};return this._normalizeRunningEvent(new jM(SM(t),t))}return this._normalizeRunningEvent(new OM(this.address,this.interface))}_checkRunningEvents(e){if(0===e.listenerCount()){delete this._runningEvents[e.tag];const t=this._wrappedEmits[e.tag];t&&e.filter&&(this.provider.off(e.filter,t),delete this._wrappedEmits[e.tag])}}_wrapEvent(e,t,n){const r=my(t);return r.removeListener=()=>{n&&(e.removeListener(n),this._checkRunningEvents(e))},r.getBlock=()=>this.provider.getBlock(t.blockHash),r.getTransaction=()=>this.provider.getTransaction(t.transactionHash),r.getTransactionReceipt=()=>this.provider.getTransactionReceipt(t.transactionHash),e.prepareEvent(r),r}_addEventListener(e,t,n){if(this.provider||IM.throwError("events require a provider or a signer with a provider",bp.errors.UNSUPPORTED_OPERATION,{operation:"once"}),e.addListener(t,n),this._runningEvents[e.tag]=e,!this._wrappedEmits[e.tag]){const n=n=>{let r=this._wrapEvent(e,n,t);if(null==r.decodeError)try{const t=e.getEmit(r);this.emit(e.filter,...t)}catch(e){r.decodeError=e.error}null!=e.filter&&this.emit("event",r),null!=r.decodeError&&this.emit("error",r.decodeError,r)};this._wrappedEmits[e.tag]=n,null!=e.filter&&this.provider.on(e.filter,n)}}queryFilter(e,t,n){const r=this._getRunningEvent(e),i=dy(r.filter);return"string"==typeof t&&jp(t,32)?(null!=n&&IM.throwArgumentError("cannot specify toBlock with blockhash","toBlock",n),i.blockHash=t):(i.fromBlock=null!=t?t:0,i.toBlock=null!=n?n:"latest"),this.provider.getLogs(i).then((e=>e.map((e=>this._wrapEvent(r,e,null)))))}on(e,t){return this._addEventListener(this._getRunningEvent(e),t,!1),this}once(e,t){return this._addEventListener(this._getRunningEvent(e),t,!0),this}emit(e,...t){if(!this.provider)return!1;const n=this._getRunningEvent(e),r=n.run(t)>0;return this._checkRunningEvents(n),r}listenerCount(e){return this.provider?null==e?Object.keys(this._runningEvents).reduce(((e,t)=>e+this._runningEvents[t].listenerCount()),0):this._getRunningEvent(e).listenerCount():0}listeners(e){if(!this.provider)return[];if(null==e){const e=[];for(let t in this._runningEvents)this._runningEvents[t].listeners().forEach((t=>{e.push(t)}));return e}return this._getRunningEvent(e).listeners()}removeAllListeners(e){if(!this.provider)return this;if(null==e){for(const e in this._runningEvents){const t=this._runningEvents[e];t.removeAllListeners(),this._checkRunningEvents(t)}return this}const t=this._getRunningEvent(e);return t.removeAllListeners(),this._checkRunningEvents(t),this}off(e,t){if(!this.provider)return this;const n=this._getRunningEvent(e);return n.removeListener(t),this._checkRunningEvents(n),this}removeListener(e,t){return this.off(e,t)}}{}class PM{constructor(e){cy(this,"alphabet",e),cy(this,"base",e.length),cy(this,"_alphabetMap",{}),cy(this,"_leader",e.charAt(0));for(let t=0;t<e.length;t++)this._alphabetMap[e.charAt(t)]=t}encode(e){let t=xp(e);if(0===t.length)return"";let n=[0];for(let e=0;e<t.length;++e){let r=t[e];for(let e=0;e<n.length;++e)r+=n[e]<<8,n[e]=r%this.base,r=r/this.base|0;for(;r>0;)n.push(r%this.base),r=r/this.base|0}let r="";for(let e=0;0===t[e]&&e<t.length-1;++e)r+=this._leader;for(let e=n.length-1;e>=0;--e)r+=this.alphabet[n[e]];return r}decode(e){if("string"!=typeof e)throw new TypeError("Expected String");let t=[];if(0===e.length)return new Uint8Array(t);t.push(0);for(let n=0;n<e.length;n++){let r=this._alphabetMap[e[n]];if(void 0===r)throw new Error("Non-base"+this.base+" character");let i=r;for(let e=0;e<t.length;++e)i+=t[e]*this.base,t[e]=255&i,i>>=8;for(;i>0;)t.push(255&i),i>>=8}for(let n=0;e[n]===this._leader&&n<e.length-1;++n)t.push(0);return xp(new Uint8Array(t.reverse()))}}new PM("abcdefghijklmnopqrstuvwxyz234567");const _M=new PM("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function BM(e){return"0x"+Mb.sha256().update(xp(e)).digest("hex")}new bp("sha2/5.7.0");const RM=new bp("networks/5.7.1");function UM(e){const t=function(t,n){null==n&&(n={});const r=[];if(t.InfuraProvider&&"-"!==n.infura)try{r.push(new t.InfuraProvider(e,n.infura))}catch(e){}if(t.EtherscanProvider&&"-"!==n.etherscan)try{r.push(new t.EtherscanProvider(e,n.etherscan))}catch(e){}if(t.AlchemyProvider&&"-"!==n.alchemy)try{r.push(new t.AlchemyProvider(e,n.alchemy))}catch(e){}if(t.PocketProvider&&"-"!==n.pocket){const i=["goerli","ropsten","rinkeby","sepolia"];try{const o=new t.PocketProvider(e,n.pocket);o.network&&-1===i.indexOf(o.network.name)&&r.push(o)}catch(e){}}if(t.CloudflareProvider&&"-"!==n.cloudflare)try{r.push(new t.CloudflareProvider(e))}catch(e){}if(t.AnkrProvider&&"-"!==n.ankr)try{const i=["ropsten"],o=new t.AnkrProvider(e,n.ankr);o.network&&-1===i.indexOf(o.network.name)&&r.push(o)}catch(e){}if(0===r.length)return null;if(t.FallbackProvider){let i=1;return null!=n.quorum?i=n.quorum:"homestead"===e&&(i=2),new t.FallbackProvider(r,i)}return r[0]};return t.renetwork=function(e){return UM(e)},t}function QM(e,t){const n=function(n,r){return n.JsonRpcProvider?new n.JsonRpcProvider(e,t):null};return n.renetwork=function(t){return QM(e,t)},n}const WM={chainId:1,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"homestead",_defaultProvider:UM("homestead")},YM={chainId:3,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"ropsten",_defaultProvider:UM("ropsten")},FM={chainId:63,name:"classicMordor",_defaultProvider:QM("https://www.ethercluster.com/mordor","classicMordor")},VM={unspecified:{chainId:0,name:"unspecified"},homestead:WM,mainnet:WM,morden:{chainId:2,name:"morden"},ropsten:YM,testnet:YM,rinkeby:{chainId:4,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"rinkeby",_defaultProvider:UM("rinkeby")},kovan:{chainId:42,name:"kovan",_defaultProvider:UM("kovan")},goerli:{chainId:5,ensAddress:"0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e",name:"goerli",_defaultProvider:UM("goerli")},kintsugi:{chainId:1337702,name:"kintsugi"},sepolia:{chainId:11155111,name:"sepolia",_defaultProvider:UM("sepolia")},classic:{chainId:61,name:"classic",_defaultProvider:QM("https://www.ethercluster.com/etc","classic")},classicMorden:{chainId:62,name:"classicMorden"},classicMordor:FM,classicTestnet:FM,classicKotti:{chainId:6,name:"classicKotti",_defaultProvider:QM("https://www.ethercluster.com/kotti","classicKotti")},xdai:{chainId:100,name:"xdai"},matic:{chainId:137,name:"matic",_defaultProvider:UM("matic")},maticmum:{chainId:80001,name:"maticmum"},optimism:{chainId:10,name:"optimism",_defaultProvider:UM("optimism")},"optimism-kovan":{chainId:69,name:"optimism-kovan"},"optimism-goerli":{chainId:420,name:"optimism-goerli"},arbitrum:{chainId:42161,name:"arbitrum"},"arbitrum-rinkeby":{chainId:421611,name:"arbitrum-rinkeby"},"arbitrum-goerli":{chainId:421613,name:"arbitrum-goerli"},bnb:{chainId:56,name:"bnb"},bnbt:{chainId:97,name:"bnbt"}};var HM=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};function GM(e,t){return HM(this,void 0,void 0,(function*(){null==t&&(t={});const n={method:t.method||"GET",headers:t.headers||{},body:t.body||void 0};if(!0!==t.skipFetchSetup&&(n.mode="cors",n.cache="no-cache",n.credentials="same-origin",n.redirect="follow",n.referrer="client"),null!=t.fetchOptions){const e=t.fetchOptions;e.mode&&(n.mode=e.mode),e.cache&&(n.cache=e.cache),e.credentials&&(n.credentials=e.credentials),e.redirect&&(n.redirect=e.redirect),e.referrer&&(n.referrer=e.referrer)}const r=yield fetch(e,n),i=yield r.arrayBuffer(),o={};return r.headers.forEach?r.headers.forEach(((e,t)=>{o[t.toLowerCase()]=e})):r.headers.keys().forEach((e=>{o[e.toLowerCase()]=r.headers.get(e)})),{headers:o,statusCode:r.status,statusMessage:r.statusText,body:xp(new Uint8Array(i))}}))}var qM=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};const ZM=new bp("web/5.7.1");function JM(e){return new Promise((t=>{setTimeout(t,e)}))}function XM(e,t){if(null==e)return null;if("string"==typeof e)return e;if(Np(e)){if(t&&("text"===t.split("/")[0]||"application/json"===t.split(";")[0].trim()))try{return Sm(e)}catch(e){}return Dp(e)}return e}function KM(e,t,n){let r=null;if(null!=t){r=Lm(t);const n="string"==typeof e?{url:e}:dy(e);if(n.headers){0!==Object.keys(n.headers).filter((e=>"content-type"===e.toLowerCase())).length||(n.headers=dy(n.headers),n.headers["content-type"]="application/json")}else n.headers={"content-type":"application/json"};e=n}return function(e,t,n){const r="object"==typeof e&&null!=e.throttleLimit?e.throttleLimit:12;ZM.assertArgument(r>0&&r%1==0,"invalid connection throttle limit","connection.throttleLimit",r);const i="object"==typeof e?e.throttleCallback:null,o="object"==typeof e&&"number"==typeof e.throttleSlotInterval?e.throttleSlotInterval:100;ZM.assertArgument(o>0&&o%1==0,"invalid connection throttle slot interval","connection.throttleSlotInterval",o);const a="object"==typeof e&&!!e.errorPassThrough,s={};let u=null;const c={method:"GET"};let l=!1,h=12e4;if("string"==typeof e)u=e;else if("object"==typeof e){if(null!=e&&null!=e.url||ZM.throwArgumentError("missing URL","connection.url",e),u=e.url,"number"==typeof e.timeout&&e.timeout>0&&(h=e.timeout),e.headers)for(const t in e.headers)s[t.toLowerCase()]={key:t,value:String(e.headers[t])},["if-none-match","if-modified-since"].indexOf(t.toLowerCase())>=0&&(l=!0);if(c.allowGzip=!!e.allowGzip,null!=e.user&&null!=e.password){"https:"!==u.substring(0,6)&&!0!==e.allowInsecureAuthentication&&ZM.throwError("basic authentication requires a secure https url",bp.errors.INVALID_ARGUMENT,{argument:"url",url:u,user:e.user,password:"[REDACTED]"});const t=e.user+":"+e.password;s.authorization={key:"Authorization",value:"Basic "+Rm(Lm(t))}}null!=e.skipFetchSetup&&(c.skipFetchSetup=!!e.skipFetchSetup),null!=e.fetchOptions&&(c.fetchOptions=dy(e.fetchOptions))}const d=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),f=u?u.match(d):null;if(f)try{const e={statusCode:200,statusMessage:"OK",headers:{"content-type":f[1]||"text/plain"},body:f[2]?Bm(f[3]):(p=f[3],Lm(p.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16))))))};let t=e.body;return n&&(t=n(e.body,e)),Promise.resolve(t)}catch(e){ZM.throwError("processing response error",bp.errors.SERVER_ERROR,{body:XM(f[1],f[2]),error:e,requestBody:null,requestMethod:"GET",url:u})}var p;t&&(c.method="POST",c.body=t,null==s["content-type"]&&(s["content-type"]={key:"Content-Type",value:"application/octet-stream"}),null==s["content-length"]&&(s["content-length"]={key:"Content-Length",value:String(t.length)}));const y={};Object.keys(s).forEach((e=>{const t=s[e];y[t.key]=t.value})),c.headers=y;const m=function(){let e=null;return{promise:new Promise((function(t,n){h&&(e=setTimeout((()=>{null!=e&&(e=null,n(ZM.makeError("timeout",bp.errors.TIMEOUT,{requestBody:XM(c.body,y["content-type"]),requestMethod:c.method,timeout:h,url:u})))}),h))})),cancel:function(){null!=e&&(clearTimeout(e),e=null)}}}(),g=function(){return qM(this,void 0,void 0,(function*(){for(let e=0;e<r;e++){let t=null;try{if(t=yield GM(u,c),e<r)if(301===t.statusCode||302===t.statusCode){const e=t.headers.location||"";if("GET"===c.method&&e.match(/^https:/)){u=t.headers.location;continue}}else if(429===t.statusCode){let n=!0;if(i&&(n=yield i(e,u)),n){let n=0;const r=t.headers["retry-after"];n="string"==typeof r&&r.match(/^[1-9][0-9]*$/)?1e3*parseInt(r):o*parseInt(String(Math.random()*Math.pow(2,e))),yield JM(n);continue}}}catch(e){t=e.response,null==t&&(m.cancel(),ZM.throwError("missing response",bp.errors.SERVER_ERROR,{requestBody:XM(c.body,y["content-type"]),requestMethod:c.method,serverError:e,url:u}))}let s=t.body;if(l&&304===t.statusCode?s=null:!a&&(t.statusCode<200||t.statusCode>=300)&&(m.cancel(),ZM.throwError("bad response",bp.errors.SERVER_ERROR,{status:t.statusCode,headers:t.headers,body:XM(s,t.headers?t.headers["content-type"]:null),requestBody:XM(c.body,y["content-type"]),requestMethod:c.method,url:u})),n)try{const e=yield n(s,t);return m.cancel(),e}catch(n){if(n.throttleRetry&&e<r){let t=!0;if(i&&(t=yield i(e,u)),t){const t=o*parseInt(String(Math.random()*Math.pow(2,e)));yield JM(t);continue}}m.cancel(),ZM.throwError("processing response error",bp.errors.SERVER_ERROR,{body:XM(s,t.headers?t.headers["content-type"]:null),error:n,requestBody:XM(c.body,y["content-type"]),requestMethod:c.method,url:u})}return m.cancel(),s}return ZM.throwError("failed response",bp.errors.SERVER_ERROR,{requestBody:XM(c.body,y["content-type"]),requestMethod:c.method,url:u})}))}();return Promise.race([m.promise,g])}(e,r,((e,t)=>{let r=null;if(null!=e)try{r=JSON.parse(Sm(e))}catch(t){ZM.throwError("invalid JSON",bp.errors.SERVER_ERROR,{body:e,error:t})}return n&&(r=n(r,t)),r}))}function $M(e,t){return t||(t={}),null==(t=dy(t)).floor&&(t.floor=0),null==t.ceiling&&(t.ceiling=1e4),null==t.interval&&(t.interval=250),new Promise((function(n,r){let i=null,o=!1;const a=()=>!o&&(o=!0,i&&clearTimeout(i),!0);t.timeout&&(i=setTimeout((()=>{a()&&r(new Error("timeout"))}),t.timeout));const s=t.retryLimit;let u=0;!function i(){return e().then((function(e){if(void 0!==e)a()&&n(e);else if(t.oncePoll)t.oncePoll.once("poll",i);else if(t.onceBlock)t.onceBlock.once("block",i);else if(!o){if(u++,u>s)return void(a()&&r(new Error("retry limit reached")));let e=t.interval*parseInt(String(Math.random()*Math.pow(2,u)));e<t.floor&&(e=t.floor),e>t.ceiling&&(e=t.ceiling),setTimeout(i,e)}return null}),(function(e){a()&&r(e)}))}()}))}for(var eA="qpzry9x8gf2tvdw0s3jn54khce6mua7l",tA={},nA=0;nA<eA.length;nA++){var rA=eA.charAt(nA);if(void 0!==tA[rA])throw new TypeError(rA+" is ambiguous");tA[rA]=nA}function iA(e){var t=e>>25;return(33554431&e)<<5^996825010&-(t>>0&1)^642813549&-(t>>1&1)^513874426&-(t>>2&1)^1027748829&-(t>>3&1)^705979059&-(t>>4&1)}function oA(e){for(var t=1,n=0;n<e.length;++n){var r=e.charCodeAt(n);if(r<33||r>126)return"Invalid prefix ("+e+")";t=iA(t)^r>>5}for(t=iA(t),n=0;n<e.length;++n){var i=e.charCodeAt(n);t=iA(t)^31&i}return t}function aA(e,t){if(t=t||90,e.length<8)return e+" too short";if(e.length>t)return"Exceeds length limit";var n=e.toLowerCase(),r=e.toUpperCase();if(e!==n&&e!==r)return"Mixed-case string "+e;var i=(e=n).lastIndexOf("1");if(-1===i)return"No separator character for "+e;if(0===i)return"Missing prefix for "+e;var o=e.slice(0,i),a=e.slice(i+1);if(a.length<6)return"Data too short";var s=oA(o);if("string"==typeof s)return s;for(var u=[],c=0;c<a.length;++c){var l=a.charAt(c),h=tA[l];if(void 0===h)return"Unknown character "+l;s=iA(s)^h,c+6>=a.length||u.push(h)}return 1!==s?"Invalid checksum for "+e:{prefix:o,words:u}}function sA(e,t,n,r){for(var i=0,o=0,a=(1<<n)-1,s=[],u=0;u<e.length;++u)for(i=i<<t|e[u],o+=t;o>=n;)o-=n,s.push(i>>o&a);if(r)o>0&&s.push(i<<n-o&a);else{if(o>=t)return"Excess padding";if(i<<n-o&a)return"Non-zero padding"}return s}var uA={decodeUnsafe:function(){var e=aA.apply(null,arguments);if("object"==typeof e)return e},decode:function(e){var t=aA.apply(null,arguments);if("object"==typeof t)return t;throw new Error(t)},encode:function(e,t,n){if(n=n||90,e.length+7+t.length>n)throw new TypeError("Exceeds length limit");var r=oA(e=e.toLowerCase());if("string"==typeof r)throw new Error(r);for(var i=e+"1",o=0;o<t.length;++o){var a=t[o];if(a>>5!=0)throw new Error("Non 5-bit word");r=iA(r)^a,i+=eA.charAt(a)}for(o=0;o<6;++o)r=iA(r);for(r^=1,o=0;o<6;++o){i+=eA.charAt(r>>5*(5-o)&31)}return i},toWordsUnsafe:function(e){var t=sA(e,8,5,!0);if(Array.isArray(t))return t},toWords:function(e){var t=sA(e,8,5,!0);if(Array.isArray(t))return t;throw new Error(t)},fromWordsUnsafe:function(e){var t=sA(e,5,8,!1);if(Array.isArray(t))return t},fromWords:function(e){var t=sA(e,5,8,!1);if(Array.isArray(t))return t;throw new Error(t)}};const cA="providers/5.7.2",lA=new bp(cA);class hA{constructor(){this.formats=this.getDefaultFormats()}getDefaultFormats(){const e={},t=this.address.bind(this),n=this.bigNumber.bind(this),r=this.blockTag.bind(this),i=this.data.bind(this),o=this.hash.bind(this),a=this.hex.bind(this),s=this.number.bind(this),u=this.type.bind(this);return e.transaction={hash:o,type:u,accessList:hA.allowNull(this.accessList.bind(this),null),blockHash:hA.allowNull(o,null),blockNumber:hA.allowNull(s,null),transactionIndex:hA.allowNull(s,null),confirmations:hA.allowNull(s,null),from:t,gasPrice:hA.allowNull(n),maxPriorityFeePerGas:hA.allowNull(n),maxFeePerGas:hA.allowNull(n),gasLimit:n,to:hA.allowNull(t,null),value:n,nonce:s,data:i,r:hA.allowNull(this.uint256),s:hA.allowNull(this.uint256),v:hA.allowNull(s),creates:hA.allowNull(t,null),raw:hA.allowNull(i)},e.transactionRequest={from:hA.allowNull(t),nonce:hA.allowNull(s),gasLimit:hA.allowNull(n),gasPrice:hA.allowNull(n),maxPriorityFeePerGas:hA.allowNull(n),maxFeePerGas:hA.allowNull(n),to:hA.allowNull(t),value:hA.allowNull(n),data:hA.allowNull((e=>this.data(e,!0))),type:hA.allowNull(s),accessList:hA.allowNull(this.accessList.bind(this),null)},e.receiptLog={transactionIndex:s,blockNumber:s,transactionHash:o,address:t,topics:hA.arrayOf(o),data:i,logIndex:s,blockHash:o},e.receipt={to:hA.allowNull(this.address,null),from:hA.allowNull(this.address,null),contractAddress:hA.allowNull(t,null),transactionIndex:s,root:hA.allowNull(a),gasUsed:n,logsBloom:hA.allowNull(i),blockHash:o,transactionHash:o,logs:hA.arrayOf(this.receiptLog.bind(this)),blockNumber:s,confirmations:hA.allowNull(s,null),cumulativeGasUsed:n,effectiveGasPrice:hA.allowNull(n),status:hA.allowNull(s),type:u},e.block={hash:hA.allowNull(o),parentHash:o,number:s,timestamp:s,nonce:hA.allowNull(a),difficulty:this.difficulty.bind(this),gasLimit:n,gasUsed:n,miner:hA.allowNull(t),extraData:i,transactions:hA.allowNull(hA.arrayOf(o)),baseFeePerGas:hA.allowNull(n)},e.blockWithTransactions=dy(e.block),e.blockWithTransactions.transactions=hA.allowNull(hA.arrayOf(this.transactionResponse.bind(this))),e.filter={fromBlock:hA.allowNull(r,void 0),toBlock:hA.allowNull(r,void 0),blockHash:hA.allowNull(o,void 0),address:hA.allowNull(t,void 0),topics:hA.allowNull(this.topics.bind(this),void 0)},e.filterLog={blockNumber:hA.allowNull(s),blockHash:hA.allowNull(o),transactionIndex:s,removed:hA.allowNull(this.boolean.bind(this)),address:t,data:hA.allowFalsish(i,"0x"),topics:hA.arrayOf(o),transactionHash:o,logIndex:s},e}accessList(e){return mM(e||[])}number(e){return"0x"===e?0:Yp.from(e).toNumber()}type(e){return"0x"===e||null==e?0:Yp.from(e).toNumber()}bigNumber(e){return Yp.from(e)}boolean(e){if("boolean"==typeof e)return e;if("string"==typeof e){if("true"===(e=e.toLowerCase()))return!0;if("false"===e)return!1}throw new Error("invalid boolean - "+e)}hex(e,t){return"string"==typeof e&&(t||"0x"===e.substring(0,2)||(e="0x"+e),jp(e))?e.toLowerCase():lA.throwArgumentError("invalid hash","value",e)}data(e,t){const n=this.hex(e,t);if(n.length%2!=0)throw new Error("invalid data; odd-length - "+e);return n}address(e){return om(e)}callAddress(e){if(!jp(e,32))return null;const t=om(Op(e,12));return"0x0000000000000000000000000000000000000000"===t?null:t}contractAddress(e){return am(e)}blockTag(e){if(null==e)return"latest";if("earliest"===e)return"0x0";switch(e){case"earliest":return"0x0";case"latest":case"pending":case"safe":case"finalized":return e}if("number"==typeof e||jp(e))return Pp(e);throw new Error("invalid blockTag")}hash(e,t){const n=this.hex(e,t);return 32!==Cp(n)?lA.throwArgumentError("invalid hash","value",e):n}difficulty(e){if(null==e)return null;const t=Yp.from(e);try{return t.toNumber()}catch(e){}return null}uint256(e){if(!jp(e))throw new Error("invalid uint256");return _p(e,32)}_block(e,t){null!=e.author&&null==e.miner&&(e.miner=e.author);const n=null!=e._difficulty?e._difficulty:e.difficulty,r=hA.check(t,e);return r._difficulty=null==n?null:Yp.from(n),r}block(e){return this._block(e,this.formats.block)}blockWithTransactions(e){return this._block(e,this.formats.blockWithTransactions)}transactionRequest(e){return hA.check(this.formats.transactionRequest,e)}transactionResponse(e){null!=e.gas&&null==e.gasLimit&&(e.gasLimit=e.gas),e.to&&Yp.from(e.to).isZero()&&(e.to="0x0000000000000000000000000000000000000000"),null!=e.input&&null==e.data&&(e.data=e.input),null==e.to&&null==e.creates&&(e.creates=this.contractAddress(e)),1!==e.type&&2!==e.type||null!=e.accessList||(e.accessList=[]);const t=hA.check(this.formats.transaction,e);if(null!=e.chainId){let n=e.chainId;jp(n)&&(n=Yp.from(n).toNumber()),t.chainId=n}else{let n=e.networkId;null==n&&null==t.v&&(n=e.chainId),jp(n)&&(n=Yp.from(n).toNumber()),"number"!=typeof n&&null!=t.v&&(n=(t.v-35)/2,n<0&&(n=0),n=parseInt(n)),"number"!=typeof n&&(n=0),t.chainId=n}return t.blockHash&&"x"===t.blockHash.replace(/0/g,"")&&(t.blockHash=null),t}transaction(e){return MM(e)}receiptLog(e){return hA.check(this.formats.receiptLog,e)}receipt(e){const t=hA.check(this.formats.receipt,e);if(null!=t.root)if(t.root.length<=4){const e=Yp.from(t.root).toNumber();0===e||1===e?(null!=t.status&&t.status!==e&&lA.throwArgumentError("alt-root-status/status mismatch","value",{root:t.root,status:t.status}),t.status=e,delete t.root):lA.throwArgumentError("invalid alt-root-status","value.root",t.root)}else 66!==t.root.length&&lA.throwArgumentError("invalid root hash","value.root",t.root);return null!=t.status&&(t.byzantium=!0),t}topics(e){return Array.isArray(e)?e.map((e=>this.topics(e))):null!=e?this.hash(e,!0):null}filter(e){return hA.check(this.formats.filter,e)}filterLog(e){return hA.check(this.formats.filterLog,e)}static check(e,t){const n={};for(const r in e)try{const i=e[r](t[r]);void 0!==i&&(n[r]=i)}catch(e){throw e.checkKey=r,e.checkValue=t[r],e}return n}static allowNull(e,t){return function(n){return null==n?t:e(n)}}static allowFalsish(e,t){return function(n){return n?e(n):t}}static arrayOf(e){return function(t){if(!Array.isArray(t))throw new Error("not an array");const n=[];return t.forEach((function(t){n.push(e(t))})),n}}}var dA=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};const fA=new bp(cA);function pA(e){return null==e?"null":(32!==Cp(e)&&fA.throwArgumentError("invalid topic","topic",e),e.toLowerCase())}function yA(e){for(e=e.slice();e.length>0&&null==e[e.length-1];)e.pop();return e.map((e=>{if(Array.isArray(e)){const t={};e.forEach((e=>{t[pA(e)]=!0}));const n=Object.keys(t);return n.sort(),n.join("|")}return pA(e)})).join("&")}function mA(e){if("string"==typeof e){if(32===Cp(e=e.toLowerCase()))return"tx:"+e;if(-1===e.indexOf(":"))return e}else{if(Array.isArray(e))return"filter:*:"+yA(e);if(Pg.isForkEvent(e))throw fA.warn("not implemented"),new Error("not implemented");if(e&&"object"==typeof e)return"filter:"+(e.address||"*")+":"+yA(e.topics||[])}throw new Error("invalid event - "+e)}function gA(){return(new Date).getTime()}function vA(e){return new Promise((t=>{setTimeout(t,e)}))}const wA=["block","network","pending","poll"];class bA{constructor(e,t,n){cy(this,"tag",e),cy(this,"listener",t),cy(this,"once",n),this._lastBlockNumber=-2,this._inflight=!1}get event(){switch(this.type){case"tx":return this.hash;case"filter":return this.filter}return this.tag}get type(){return this.tag.split(":")[0]}get hash(){const e=this.tag.split(":");return"tx"!==e[0]?null:e[1]}get filter(){const e=this.tag.split(":");if("filter"!==e[0])return null;const t=e[1],n=""===(r=e[2])?[]:r.split(/&/g).map((e=>{if(""===e)return[];const t=e.split("|").map((e=>"null"===e?null:e));return 1===t.length?t[0]:t}));var r;const i={};return n.length>0&&(i.topics=n),t&&"*"!==t&&(i.address=t),i}pollable(){return this.tag.indexOf(":")>=0||wA.indexOf(this.tag)>=0}}const MA={0:{symbol:"btc",p2pkh:0,p2sh:5,prefix:"bc"},2:{symbol:"ltc",p2pkh:48,p2sh:50,prefix:"ltc"},3:{symbol:"doge",p2pkh:30,p2sh:22},60:{symbol:"eth",ilk:"eth"},61:{symbol:"etc",ilk:"eth"},700:{symbol:"xdai",ilk:"eth"}};function AA(e){return _p(Yp.from(e).toHexString(),32)}function IA(e){return _M.encode(kp([e,Op(BM(BM(e)),0,4)]))}const NA=new RegExp("^(ipfs)://(.*)$","i"),TA=[new RegExp("^(https)://(.*)$","i"),new RegExp("^(data):(.*)$","i"),NA,new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$","i")];function EA(e,t){try{return Sm(xA(e,t))}catch(e){}return null}function xA(e,t){if("0x"===e)return null;const n=Yp.from(Op(e,t,t+32)).toNumber(),r=Yp.from(Op(e,n,n+32)).toNumber();return Op(e,n+32,n+32+r)}function kA(e){return e.match(/^ipfs:\/\/ipfs\//i)?e=e.substring(12):e.match(/^ipfs:\/\//i)?e=e.substring(7):fA.throwArgumentError("unsupported IPFS format","link",e),`https://gateway.ipfs.io/ipfs/${e}`}function LA(e){const t=xp(e);if(t.length>32)throw new Error("internal; should not happen");const n=new Uint8Array(32);return n.set(t,32-t.length),n}function SA(e){if(e.length%32==0)return e;const t=new Uint8Array(32*Math.ceil(e.length/32));return t.set(e),t}function jA(e){const t=[];let n=0;for(let r=0;r<e.length;r++)t.push(null),n+=32;for(let r=0;r<e.length;r++){const i=xp(e[r]);t[r]=LA(n),t.push(LA(i.length)),t.push(SA(i)),n+=32+32*Math.ceil(i.length/32)}return zp(t)}class DA{constructor(e,t,n,r){cy(this,"provider",e),cy(this,"name",n),cy(this,"address",e.formatter.address(t)),cy(this,"_resolvedAddress",r)}supportsWildcard(){return this._supportsEip2544||(this._supportsEip2544=this.provider.call({to:this.address,data:"0x01ffc9a79061b92300000000000000000000000000000000000000000000000000000000"}).then((e=>Yp.from(e).eq(1))).catch((e=>{if(e.code===bp.errors.CALL_EXCEPTION)return!1;throw this._supportsEip2544=null,e}))),this._supportsEip2544}_fetch(e,t){return dA(this,void 0,void 0,(function*(){const n={to:this.address,ccipReadEnabled:!0,data:zp([e,cg(this.name),t||"0x"])};let r=!1;var i;(yield this.supportsWildcard())&&(r=!0,n.data=zp(["0x9061b923",jA([(i=this.name,Dp(kp(ug(i).map((e=>{if(e.length>63)throw new Error("invalid DNS encoded entry; length exceeds 63 bytes");const t=new Uint8Array(e.length+1);return t.set(e,1),t[0]=t.length-1,t}))))+"00"),n.data])]));try{let e=yield this.provider.call(n);return xp(e).length%32==4&&fA.throwError("resolver threw error",bp.errors.CALL_EXCEPTION,{transaction:n,data:e}),r&&(e=xA(e,0)),e}catch(e){if(e.code===bp.errors.CALL_EXCEPTION)return null;throw e}}))}_fetchBytes(e,t){return dA(this,void 0,void 0,(function*(){const n=yield this._fetch(e,t);return null!=n?xA(n,0):null}))}_getAddress(e,t){const n=MA[String(e)];if(null==n&&fA.throwError(`unsupported coin type: ${e}`,bp.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`}),"eth"===n.ilk)return this.provider.formatter.address(t);const r=xp(t);if(null!=n.p2pkh){const e=t.match(/^0x76a9([0-9a-f][0-9a-f])([0-9a-f]*)88ac$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return IA(kp([[n.p2pkh],"0x"+e[2]]))}}if(null!=n.p2sh){const e=t.match(/^0xa9([0-9a-f][0-9a-f])([0-9a-f]*)87$/);if(e){const t=parseInt(e[1],16);if(e[2].length===2*t&&t>=1&&t<=75)return IA(kp([[n.p2sh],"0x"+e[2]]))}}if(null!=n.prefix){const e=r[1];let t=r[0];if(0===t?20!==e&&32!==e&&(t=-1):t=-1,t>=0&&r.length===2+e&&e>=1&&e<=75){const e=uA.toWords(r.slice(2));return e.unshift(t),uA.encode(n.prefix,e)}}return null}getAddress(e){return dA(this,void 0,void 0,(function*(){if(null==e&&(e=60),60===e)try{const e=yield this._fetch("0x3b3b57de");return"0x"===e||"0x0000000000000000000000000000000000000000000000000000000000000000"===e?null:this.provider.formatter.callAddress(e)}catch(e){if(e.code===bp.errors.CALL_EXCEPTION)return null;throw e}const t=yield this._fetchBytes("0xf1cb7e06",AA(e));if(null==t||"0x"===t)return null;const n=this._getAddress(e,t);return null==n&&fA.throwError("invalid or unsupported coin data",bp.errors.UNSUPPORTED_OPERATION,{operation:`getAddress(${e})`,coinType:e,data:t}),n}))}getAvatar(){return dA(this,void 0,void 0,(function*(){const e=[{type:"name",content:this.name}];try{const t=yield this.getText("avatar");if(null==t)return null;for(let n=0;n<TA.length;n++){const r=t.match(TA[n]);if(null==r)continue;const i=r[1].toLowerCase();switch(i){case"https":return e.push({type:"url",content:t}),{linkage:e,url:t};case"data":return e.push({type:"data",content:t}),{linkage:e,url:t};case"ipfs":return e.push({type:"ipfs",content:t}),{linkage:e,url:kA(t)};case"erc721":case"erc1155":{const n="erc721"===i?"0xc87b56dd":"0x0e89341c";e.push({type:i,content:t});const o=this._resolvedAddress||(yield this.getAddress()),a=(r[2]||"").split("/");if(2!==a.length)return null;const s=yield this.provider.formatter.address(a[0]),u=_p(Yp.from(a[1]).toHexString(),32);if("erc721"===i){const t=this.provider.formatter.callAddress(yield this.provider.call({to:s,data:zp(["0x6352211e",u])}));if(o!==t)return null;e.push({type:"owner",content:t})}else if("erc1155"===i){const t=Yp.from(yield this.provider.call({to:s,data:zp(["0x00fdd58e",_p(o,32),u])}));if(t.isZero())return null;e.push({type:"balance",content:t.toString()})}const c={to:this.provider.formatter.address(a[0]),data:zp([n,u])};let l=EA(yield this.provider.call(c),0);if(null==l)return null;e.push({type:"metadata-url-base",content:l}),"erc1155"===i&&(l=l.replace("{id}",u.substring(2)),e.push({type:"metadata-url-expanded",content:l})),l.match(/^ipfs:/i)&&(l=kA(l)),e.push({type:"metadata-url",content:l});const h=yield KM(l);if(!h)return null;e.push({type:"metadata",content:JSON.stringify(h)});let d=h.image;if("string"!=typeof d)return null;if(d.match(/^(https:\/\/|data:)/i));else{if(null==d.match(NA))return null;e.push({type:"url-ipfs",content:d}),d=kA(d)}return e.push({type:"url",content:d}),{linkage:e,url:d}}}}}catch(e){}return null}))}getContentHash(){return dA(this,void 0,void 0,(function*(){const e=yield this._fetchBytes("0xbc1c58d1");if(null==e||"0x"===e)return null;const t=e.match(/^0xe3010170(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(t){const e=parseInt(t[3],16);if(t[4].length===2*e)return"ipfs://"+_M.encode("0x"+t[1])}const n=e.match(/^0xe5010172(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/);if(n){const e=parseInt(n[3],16);if(n[4].length===2*e)return"ipns://"+_M.encode("0x"+n[1])}const r=e.match(/^0xe40101fa011b20([0-9a-f]*)$/);if(r&&64===r[1].length)return"bzz://"+r[1];const i=e.match(/^0x90b2c605([0-9a-f]*)$/);if(i&&68===i[1].length){const e={"=":"","+":"-","/":"_"};return"sia://"+Rm("0x"+i[1]).replace(/[=+\/]/g,(t=>e[t]))}return fA.throwError("invalid or unsupported content hash data",bp.errors.UNSUPPORTED_OPERATION,{operation:"getContentHash()",data:e})}))}getText(e){return dA(this,void 0,void 0,(function*(){let t=Lm(e);t=kp([AA(64),AA(t.length),t]),t.length%32!=0&&(t=kp([t,_p("0x",32-e.length%32)]));const n=yield this._fetchBytes("0x59d1d43c",Dp(t));return null==n||"0x"===n?null:Sm(n)}))}}let CA=null,OA=1;class zA extends _g{constructor(e){if(super(),this._events=[],this._emitted={block:-2},this.disableCcipRead=!1,this.formatter=new.target.getFormatter(),cy(this,"anyNetwork","any"===e),this.anyNetwork&&(e=this.detectNetwork()),e instanceof Promise)this._networkPromise=e,e.catch((e=>{})),this._ready().catch((e=>{}));else{const t=ly(new.target,"getNetwork")(e);t?(cy(this,"_network",t),this.emit("network",t,null)):fA.throwArgumentError("invalid network","network",e)}this._maxInternalBlockNumber=-1024,this._lastBlockNumber=-2,this._maxFilterBlockRange=10,this._pollingInterval=4e3,this._fastQueryDate=0}_ready(){return dA(this,void 0,void 0,(function*(){if(null==this._network){let e=null;if(this._networkPromise)try{e=yield this._networkPromise}catch(e){}null==e&&(e=yield this.detectNetwork()),e||fA.throwError("no network detected",bp.errors.UNKNOWN_ERROR,{}),null==this._network&&(this.anyNetwork?this._network=e:cy(this,"_network",e),this.emit("network",e,null))}return this._network}))}get ready(){return $M((()=>this._ready().then((e=>e),(e=>{if(e.code!==bp.errors.NETWORK_ERROR||"noNetwork"!==e.event)throw e}))))}static getFormatter(){return null==CA&&(CA=new hA),CA}static getNetwork(e){return function(e){if(null==e)return null;if("number"==typeof e){for(const t in VM){const n=VM[t];if(n.chainId===e)return{name:n.name,chainId:n.chainId,ensAddress:n.ensAddress||null,_defaultProvider:n._defaultProvider||null}}return{chainId:e,name:"unknown"}}if("string"==typeof e){const t=VM[e];return null==t?null:{name:t.name,chainId:t.chainId,ensAddress:t.ensAddress,_defaultProvider:t._defaultProvider||null}}const t=VM[e.name];if(!t)return"number"!=typeof e.chainId&&RM.throwArgumentError("invalid network chainId","network",e),e;0!==e.chainId&&e.chainId!==t.chainId&&RM.throwArgumentError("network chainId mismatch","network",e);let n=e._defaultProvider||null;var r;return null==n&&t._defaultProvider&&(n=(r=t._defaultProvider)&&"function"==typeof r.renetwork?t._defaultProvider.renetwork(e):t._defaultProvider),{name:e.name,chainId:t.chainId,ensAddress:e.ensAddress||t.ensAddress||null,_defaultProvider:n}}(null==e?"homestead":e)}ccipReadFetch(e,t,n){return dA(this,void 0,void 0,(function*(){if(this.disableCcipRead||0===n.length)return null;const r=e.to.toLowerCase(),i=t.toLowerCase(),o=[];for(let e=0;e<n.length;e++){const t=n[e],a=t.replace("{sender}",r).replace("{data}",i),s=t.indexOf("{data}")>=0?null:JSON.stringify({data:i,sender:r}),u=yield KM({url:a,errorPassThrough:!0},s,((e,t)=>(e.status=t.statusCode,e)));if(u.data)return u.data;const c=u.message||"unknown error";if(u.status>=400&&u.status<500)return fA.throwError(`response not found during CCIP fetch: ${c}`,bp.errors.SERVER_ERROR,{url:t,errorMessage:c});o.push(c)}return fA.throwError(`error encountered during CCIP fetch: ${o.map((e=>JSON.stringify(e))).join(", ")}`,bp.errors.SERVER_ERROR,{urls:n,errorMessages:o})}))}_getInternalBlockNumber(e){return dA(this,void 0,void 0,(function*(){if(yield this._ready(),e>0)for(;this._internalBlockNumber;){const t=this._internalBlockNumber;try{const n=yield t;if(gA()-n.respTime<=e)return n.blockNumber;break}catch(e){if(this._internalBlockNumber===t)break}}const t=gA(),n=hy({blockNumber:this.perform("getBlockNumber",{}),networkError:this.getNetwork().then((e=>null),(e=>e))}).then((({blockNumber:e,networkError:r})=>{if(r)throw this._internalBlockNumber===n&&(this._internalBlockNumber=null),r;const i=gA();return(e=Yp.from(e).toNumber())<this._maxInternalBlockNumber&&(e=this._maxInternalBlockNumber),this._maxInternalBlockNumber=e,this._setFastBlockNumber(e),{blockNumber:e,reqTime:t,respTime:i}}));return this._internalBlockNumber=n,n.catch((e=>{this._internalBlockNumber===n&&(this._internalBlockNumber=null)})),(yield n).blockNumber}))}poll(){return dA(this,void 0,void 0,(function*(){const e=OA++,t=[];let n=null;try{n=yield this._getInternalBlockNumber(100+this.pollingInterval/2)}catch(e){return void this.emit("error",e)}if(this._setFastBlockNumber(n),this.emit("poll",e,n),n!==this._lastBlockNumber){if(-2===this._emitted.block&&(this._emitted.block=n-1),Math.abs(this._emitted.block-n)>1e3)fA.warn(`network block skew detected; skipping block events (emitted=${this._emitted.block} blockNumber${n})`),this.emit("error",fA.makeError("network block skew detected",bp.errors.NETWORK_ERROR,{blockNumber:n,event:"blockSkew",previousBlockNumber:this._emitted.block})),this.emit("block",n);else for(let e=this._emitted.block+1;e<=n;e++)this.emit("block",e);this._emitted.block!==n&&(this._emitted.block=n,Object.keys(this._emitted).forEach((e=>{if("block"===e)return;const t=this._emitted[e];"pending"!==t&&n-t>12&&delete this._emitted[e]}))),-2===this._lastBlockNumber&&(this._lastBlockNumber=n-1),this._events.forEach((e=>{switch(e.type){case"tx":{const n=e.hash;let r=this.getTransactionReceipt(n).then((e=>e&&null!=e.blockNumber?(this._emitted["t:"+n]=e.blockNumber,this.emit(n,e),null):null)).catch((e=>{this.emit("error",e)}));t.push(r);break}case"filter":if(!e._inflight){e._inflight=!0,-2===e._lastBlockNumber&&(e._lastBlockNumber=n-1);const r=e.filter;r.fromBlock=e._lastBlockNumber+1,r.toBlock=n;const i=r.toBlock-this._maxFilterBlockRange;i>r.fromBlock&&(r.fromBlock=i),r.fromBlock<0&&(r.fromBlock=0);const o=this.getLogs(r).then((t=>{e._inflight=!1,0!==t.length&&t.forEach((t=>{t.blockNumber>e._lastBlockNumber&&(e._lastBlockNumber=t.blockNumber),this._emitted["b:"+t.blockHash]=t.blockNumber,this._emitted["t:"+t.transactionHash]=t.blockNumber,this.emit(r,t)}))})).catch((t=>{this.emit("error",t),e._inflight=!1}));t.push(o)}}})),this._lastBlockNumber=n,Promise.all(t).then((()=>{this.emit("didPoll",e)})).catch((e=>{this.emit("error",e)}))}else this.emit("didPoll",e)}))}resetEventsBlock(e){this._lastBlockNumber=e-1,this.polling&&this.poll()}get network(){return this._network}detectNetwork(){return dA(this,void 0,void 0,(function*(){return fA.throwError("provider does not support network detection",bp.errors.UNSUPPORTED_OPERATION,{operation:"provider.detectNetwork"})}))}getNetwork(){return dA(this,void 0,void 0,(function*(){const e=yield this._ready(),t=yield this.detectNetwork();if(e.chainId!==t.chainId){if(this.anyNetwork)return this._network=t,this._lastBlockNumber=-2,this._fastBlockNumber=null,this._fastBlockNumberPromise=null,this._fastQueryDate=0,this._emitted.block=-2,this._maxInternalBlockNumber=-1024,this._internalBlockNumber=null,this.emit("network",t,e),yield vA(0),this._network;const n=fA.makeError("underlying network changed",bp.errors.NETWORK_ERROR,{event:"changed",network:e,detectedNetwork:t});throw this.emit("error",n),n}return e}))}get blockNumber(){return this._getInternalBlockNumber(100+this.pollingInterval/2).then((e=>{this._setFastBlockNumber(e)}),(e=>{})),null!=this._fastBlockNumber?this._fastBlockNumber:-1}get polling(){return null!=this._poller}set polling(e){e&&!this._poller?(this._poller=setInterval((()=>{this.poll()}),this.pollingInterval),this._bootstrapPoll||(this._bootstrapPoll=setTimeout((()=>{this.poll(),this._bootstrapPoll=setTimeout((()=>{this._poller||this.poll(),this._bootstrapPoll=null}),this.pollingInterval)}),0))):!e&&this._poller&&(clearInterval(this._poller),this._poller=null)}get pollingInterval(){return this._pollingInterval}set pollingInterval(e){if("number"!=typeof e||e<=0||parseInt(String(e))!=e)throw new Error("invalid polling interval");this._pollingInterval=e,this._poller&&(clearInterval(this._poller),this._poller=setInterval((()=>{this.poll()}),this._pollingInterval))}_getFastBlockNumber(){const e=gA();return e-this._fastQueryDate>2*this._pollingInterval&&(this._fastQueryDate=e,this._fastBlockNumberPromise=this.getBlockNumber().then((e=>((null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e),this._fastBlockNumber)))),this._fastBlockNumberPromise}_setFastBlockNumber(e){null!=this._fastBlockNumber&&e<this._fastBlockNumber||(this._fastQueryDate=gA(),(null==this._fastBlockNumber||e>this._fastBlockNumber)&&(this._fastBlockNumber=e,this._fastBlockNumberPromise=Promise.resolve(e)))}waitForTransaction(e,t,n){return dA(this,void 0,void 0,(function*(){return this._waitForTransaction(e,null==t?1:t,n||0,null)}))}_waitForTransaction(e,t,n,r){return dA(this,void 0,void 0,(function*(){const i=yield this.getTransactionReceipt(e);return(i?i.confirmations:0)>=t?i:new Promise(((i,o)=>{const a=[];let s=!1;const u=function(){return!!s||(s=!0,a.forEach((e=>{e()})),!1)},c=e=>{e.confirmations<t||u()||i(e)};if(this.on(e,c),a.push((()=>{this.removeListener(e,c)})),r){let n=r.startBlock,i=null;const c=a=>dA(this,void 0,void 0,(function*(){s||(yield vA(1e3),this.getTransactionCount(r.from).then((l=>dA(this,void 0,void 0,(function*(){if(!s){if(l<=r.nonce)n=a;else{{const t=yield this.getTransaction(e);if(t&&null!=t.blockNumber)return}for(null==i&&(i=n-3,i<r.startBlock&&(i=r.startBlock));i<=a;){if(s)return;const n=yield this.getBlockWithTransactions(i);for(let i=0;i<n.transactions.length;i++){const a=n.transactions[i];if(a.hash===e)return;if(a.from===r.from&&a.nonce===r.nonce){if(s)return;const n=yield this.waitForTransaction(a.hash,t);if(u())return;let i="replaced";return a.data===r.data&&a.to===r.to&&a.value.eq(r.value)?i="repriced":"0x"===a.data&&a.from===a.to&&a.value.isZero()&&(i="cancelled"),void o(fA.makeError("transaction was replaced",bp.errors.TRANSACTION_REPLACED,{cancelled:"replaced"===i||"cancelled"===i,reason:i,replacement:this._wrapTransaction(a),hash:e,receipt:n}))}}i++}}s||this.once("block",c)}}))),(e=>{s||this.once("block",c)})))}));if(s)return;this.once("block",c),a.push((()=>{this.removeListener("block",c)}))}if("number"==typeof n&&n>0){const e=setTimeout((()=>{u()||o(fA.makeError("timeout exceeded",bp.errors.TIMEOUT,{timeout:n}))}),n);e.unref&&e.unref(),a.push((()=>{clearTimeout(e)}))}}))}))}getBlockNumber(){return dA(this,void 0,void 0,(function*(){return this._getInternalBlockNumber(0)}))}getGasPrice(){return dA(this,void 0,void 0,(function*(){yield this.getNetwork();const e=yield this.perform("getGasPrice",{});try{return Yp.from(e)}catch(t){return fA.throwError("bad result from backend",bp.errors.SERVER_ERROR,{method:"getGasPrice",result:e,error:t})}}))}getBalance(e,t){return dA(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield hy({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getBalance",n);try{return Yp.from(r)}catch(e){return fA.throwError("bad result from backend",bp.errors.SERVER_ERROR,{method:"getBalance",params:n,result:r,error:e})}}))}getTransactionCount(e,t){return dA(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield hy({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getTransactionCount",n);try{return Yp.from(r).toNumber()}catch(e){return fA.throwError("bad result from backend",bp.errors.SERVER_ERROR,{method:"getTransactionCount",params:n,result:r,error:e})}}))}getCode(e,t){return dA(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield hy({address:this._getAddress(e),blockTag:this._getBlockTag(t)}),r=yield this.perform("getCode",n);try{return Dp(r)}catch(e){return fA.throwError("bad result from backend",bp.errors.SERVER_ERROR,{method:"getCode",params:n,result:r,error:e})}}))}getStorageAt(e,t,n){return dA(this,void 0,void 0,(function*(){yield this.getNetwork();const r=yield hy({address:this._getAddress(e),blockTag:this._getBlockTag(n),position:Promise.resolve(t).then((e=>Pp(e)))}),i=yield this.perform("getStorageAt",r);try{return Dp(i)}catch(e){return fA.throwError("bad result from backend",bp.errors.SERVER_ERROR,{method:"getStorageAt",params:r,result:i,error:e})}}))}_wrapTransaction(e,t,n){if(null!=t&&32!==Cp(t))throw new Error("invalid response - sendTransaction");const r=e;return null!=t&&e.hash!==t&&fA.throwError("Transaction hash mismatch from Provider.sendTransaction.",bp.errors.UNKNOWN_ERROR,{expectedHash:e.hash,returnedHash:t}),r.wait=(t,r)=>dA(this,void 0,void 0,(function*(){let i;null==t&&(t=1),null==r&&(r=0),0!==t&&null!=n&&(i={data:e.data,from:e.from,nonce:e.nonce,to:e.to,value:e.value,startBlock:n});const o=yield this._waitForTransaction(e.hash,t,r,i);return null==o&&0===t?null:(this._emitted["t:"+e.hash]=o.blockNumber,0===o.status&&fA.throwError("transaction failed",bp.errors.CALL_EXCEPTION,{transactionHash:e.hash,transaction:e,receipt:o}),o)})),r}sendTransaction(e){return dA(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield Promise.resolve(e).then((e=>Dp(e))),n=this.formatter.transaction(e);null==n.confirmations&&(n.confirmations=0);const r=yield this._getInternalBlockNumber(100+2*this.pollingInterval);try{const e=yield this.perform("sendTransaction",{signedTransaction:t});return this._wrapTransaction(n,e,r)}catch(e){throw e.transaction=n,e.transactionHash=n.hash,e}}))}_getTransactionRequest(e){return dA(this,void 0,void 0,(function*(){const t=yield e,n={};return["from","to"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>e?this._getAddress(e):null)))})),["gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas","value"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>e?Yp.from(e):null)))})),["type"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>null!=e?e:null)))})),t.accessList&&(n.accessList=this.formatter.accessList(t.accessList)),["data"].forEach((e=>{null!=t[e]&&(n[e]=Promise.resolve(t[e]).then((e=>e?Dp(e):null)))})),this.formatter.transactionRequest(yield hy(n))}))}_getFilter(e){return dA(this,void 0,void 0,(function*(){e=yield e;const t={};return null!=e.address&&(t.address=this._getAddress(e.address)),["blockHash","topics"].forEach((n=>{null!=e[n]&&(t[n]=e[n])})),["fromBlock","toBlock"].forEach((n=>{null!=e[n]&&(t[n]=this._getBlockTag(e[n]))})),this.formatter.filter(yield hy(t))}))}_call(e,t,n){return dA(this,void 0,void 0,(function*(){n>=10&&fA.throwError("CCIP read exceeded maximum redirections",bp.errors.SERVER_ERROR,{redirects:n,transaction:e});const r=e.to,i=yield this.perform("call",{transaction:e,blockTag:t});if(n>=0&&"latest"===t&&null!=r&&"0x556f1830"===i.substring(0,10)&&Cp(i)%32==4)try{const o=Op(i,4),a=Op(o,0,32);Yp.from(a).eq(r)||fA.throwError("CCIP Read sender did not match",bp.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const s=[],u=Yp.from(Op(o,32,64)).toNumber(),c=Yp.from(Op(o,u,u+32)).toNumber(),l=Op(o,u+32);for(let t=0;t<c;t++){const n=EA(l,32*t);null==n&&fA.throwError("CCIP Read contained corrupt URL string",bp.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i}),s.push(n)}const h=xA(o,64);Yp.from(Op(o,100,128)).isZero()||fA.throwError("CCIP Read callback selector included junk",bp.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const d=Op(o,96,100),f=xA(o,128),p=yield this.ccipReadFetch(e,h,s);null==p&&fA.throwError("CCIP Read disabled or provided no URLs",bp.errors.CALL_EXCEPTION,{name:"OffchainLookup",signature:"OffchainLookup(address,string[],bytes,bytes4,bytes)",transaction:e,data:i});const y={to:r,data:zp([d,jA([p,f])])};return this._call(y,t,n+1)}catch(e){if(e.code===bp.errors.SERVER_ERROR)throw e}try{return Dp(i)}catch(n){return fA.throwError("bad result from backend",bp.errors.SERVER_ERROR,{method:"call",params:{transaction:e,blockTag:t},result:i,error:n})}}))}call(e,t){return dA(this,void 0,void 0,(function*(){yield this.getNetwork();const n=yield hy({transaction:this._getTransactionRequest(e),blockTag:this._getBlockTag(t),ccipReadEnabled:Promise.resolve(e.ccipReadEnabled)});return this._call(n.transaction,n.blockTag,n.ccipReadEnabled?0:-1)}))}estimateGas(e){return dA(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield hy({transaction:this._getTransactionRequest(e)}),n=yield this.perform("estimateGas",t);try{return Yp.from(n)}catch(e){return fA.throwError("bad result from backend",bp.errors.SERVER_ERROR,{method:"estimateGas",params:t,result:n,error:e})}}))}_getAddress(e){return dA(this,void 0,void 0,(function*(){"string"!=typeof(e=yield e)&&fA.throwArgumentError("invalid address or ENS name","name",e);const t=yield this.resolveName(e);return null==t&&fA.throwError("ENS name not configured",bp.errors.UNSUPPORTED_OPERATION,{operation:`resolveName(${JSON.stringify(e)})`}),t}))}_getBlock(e,t){return dA(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;let n=-128;const r={includeTransactions:!!t};if(jp(e,32))r.blockHash=e;else try{r.blockTag=yield this._getBlockTag(e),jp(r.blockTag)&&(n=parseInt(r.blockTag.substring(2),16))}catch(t){fA.throwArgumentError("invalid block hash or block tag","blockHashOrBlockTag",e)}return $M((()=>dA(this,void 0,void 0,(function*(){const e=yield this.perform("getBlock",r);if(null==e)return null!=r.blockHash&&null==this._emitted["b:"+r.blockHash]||null!=r.blockTag&&n>this._emitted.block?null:void 0;if(t){let t=null;for(let n=0;n<e.transactions.length;n++){const r=e.transactions[n];if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){null==t&&(t=yield this._getInternalBlockNumber(100+2*this.pollingInterval));let e=t-r.blockNumber+1;e<=0&&(e=1),r.confirmations=e}}const n=this.formatter.blockWithTransactions(e);return n.transactions=n.transactions.map((e=>this._wrapTransaction(e))),n}return this.formatter.block(e)}))),{oncePoll:this})}))}getBlock(e){return this._getBlock(e,!1)}getBlockWithTransactions(e){return this._getBlock(e,!0)}getTransaction(e){return dA(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return $M((()=>dA(this,void 0,void 0,(function*(){const n=yield this.perform("getTransaction",t);if(null==n)return null==this._emitted["t:"+e]?null:void 0;const r=this.formatter.transactionResponse(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;e<=0&&(e=1),r.confirmations=e}return this._wrapTransaction(r)}))),{oncePoll:this})}))}getTransactionReceipt(e){return dA(this,void 0,void 0,(function*(){yield this.getNetwork(),e=yield e;const t={transactionHash:this.formatter.hash(e,!0)};return $M((()=>dA(this,void 0,void 0,(function*(){const n=yield this.perform("getTransactionReceipt",t);if(null==n)return null==this._emitted["t:"+e]?null:void 0;if(null==n.blockHash)return;const r=this.formatter.receipt(n);if(null==r.blockNumber)r.confirmations=0;else if(null==r.confirmations){let e=(yield this._getInternalBlockNumber(100+2*this.pollingInterval))-r.blockNumber+1;e<=0&&(e=1),r.confirmations=e}return r}))),{oncePoll:this})}))}getLogs(e){return dA(this,void 0,void 0,(function*(){yield this.getNetwork();const t=yield hy({filter:this._getFilter(e)}),n=yield this.perform("getLogs",t);return n.forEach((e=>{null==e.removed&&(e.removed=!1)})),hA.arrayOf(this.formatter.filterLog.bind(this.formatter))(n)}))}getEtherPrice(){return dA(this,void 0,void 0,(function*(){return yield this.getNetwork(),this.perform("getEtherPrice",{})}))}_getBlockTag(e){return dA(this,void 0,void 0,(function*(){if("number"==typeof(e=yield e)&&e<0){e%1&&fA.throwArgumentError("invalid BlockTag","blockTag",e);let t=yield this._getInternalBlockNumber(100+2*this.pollingInterval);return t+=e,t<0&&(t=0),this.formatter.blockTag(t)}return this.formatter.blockTag(e)}))}getResolver(e){return dA(this,void 0,void 0,(function*(){let t=e;for(;;){if(""===t||"."===t)return null;if("eth"!==e&&"eth"===t)return null;const n=yield this._getResolver(t,"getResolver");if(null!=n){const r=new DA(this,n,e);return t===e||(yield r.supportsWildcard())?r:null}t=t.split(".").slice(1).join(".")}}))}_getResolver(e,t){return dA(this,void 0,void 0,(function*(){null==t&&(t="ENS");const n=yield this.getNetwork();n.ensAddress||fA.throwError("network does not support ENS",bp.errors.UNSUPPORTED_OPERATION,{operation:t,network:n.name});try{const t=yield this.call({to:n.ensAddress,data:"0x0178b8bf"+cg(e).substring(2)});return this.formatter.callAddress(t)}catch(e){}return null}))}resolveName(e){return dA(this,void 0,void 0,(function*(){e=yield e;try{return Promise.resolve(this.formatter.address(e))}catch(t){if(jp(e))throw t}"string"!=typeof e&&fA.throwArgumentError("invalid ENS name","name",e);const t=yield this.getResolver(e);return t?yield t.getAddress():null}))}lookupAddress(e){return dA(this,void 0,void 0,(function*(){e=yield e;const t=(e=this.formatter.address(e)).substring(2).toLowerCase()+".addr.reverse",n=yield this._getResolver(t,"lookupAddress");if(null==n)return null;const r=EA(yield this.call({to:n,data:"0x691f3431"+cg(t).substring(2)}),0);return(yield this.resolveName(r))!=e?null:r}))}getAvatar(e){return dA(this,void 0,void 0,(function*(){let t=null;if(jp(e)){const n=this.formatter.address(e).substring(2).toLowerCase()+".addr.reverse",r=yield this._getResolver(n,"getAvatar");if(!r)return null;t=new DA(this,r,n);try{const e=yield t.getAvatar();if(e)return e.url}catch(e){if(e.code!==bp.errors.CALL_EXCEPTION)throw e}try{const e=EA(yield this.call({to:r,data:"0x691f3431"+cg(n).substring(2)}),0);t=yield this.getResolver(e)}catch(e){if(e.code!==bp.errors.CALL_EXCEPTION)throw e;return null}}else if(t=yield this.getResolver(e),!t)return null;const n=yield t.getAvatar();return null==n?null:n.url}))}perform(e,t){return fA.throwError(e+" not implemented",bp.errors.NOT_IMPLEMENTED,{operation:e})}_startEvent(e){this.polling=this._events.filter((e=>e.pollable())).length>0}_stopEvent(e){this.polling=this._events.filter((e=>e.pollable())).length>0}_addEventListener(e,t,n){const r=new bA(mA(e),t,n);return this._events.push(r),this._startEvent(r),this}on(e,t){return this._addEventListener(e,t,!1)}once(e,t){return this._addEventListener(e,t,!0)}emit(e,...t){let n=!1,r=[],i=mA(e);return this._events=this._events.filter((e=>e.tag!==i||(setTimeout((()=>{e.listener.apply(this,t)}),0),n=!0,!e.once||(r.push(e),!1)))),r.forEach((e=>{this._stopEvent(e)})),n}listenerCount(e){if(!e)return this._events.length;let t=mA(e);return this._events.filter((e=>e.tag===t)).length}listeners(e){if(null==e)return this._events.map((e=>e.listener));let t=mA(e);return this._events.filter((e=>e.tag===t)).map((e=>e.listener))}off(e,t){if(null==t)return this.removeAllListeners(e);const n=[];let r=!1,i=mA(e);return this._events=this._events.filter((e=>e.tag!==i||e.listener!=t||(!!r||(r=!0,n.push(e),!1)))),n.forEach((e=>{this._stopEvent(e)})),this}removeAllListeners(e){let t=[];if(null==e)t=this._events,this._events=[];else{const n=mA(e);this._events=this._events.filter((e=>e.tag!==n||(t.push(e),!1)))}return t.forEach((e=>{this._stopEvent(e)})),this}}var PA=function(e,t,n,r){return new(n||(n=Promise))((function(i,o){function a(e){try{u(r.next(e))}catch(e){o(e)}}function s(e){try{u(r.throw(e))}catch(e){o(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(a,s)}u((r=r.apply(e,t||[])).next())}))};const _A=new bp(cA),BA=["call","estimateGas"];function RA(e,t){if(null==e)return null;if("string"==typeof e.message&&e.message.match("reverted")){const n=jp(e.data)?e.data:null;if(!t||n)return{message:e.message,data:n}}if("object"==typeof e){for(const n in e){const r=RA(e[n],t);if(r)return r}return null}if("string"==typeof e)try{return RA(JSON.parse(e),t)}catch(e){}return null}function UA(e,t,n){const r=n.transaction||n.signedTransaction;if("call"===e){const e=RA(t,!0);if(e)return e.data;_A.throwError("missing revert data in call exception; Transaction reverted without a reason string",bp.errors.CALL_EXCEPTION,{data:"0x",transaction:r,error:t})}if("estimateGas"===e){let n=RA(t.body,!1);null==n&&(n=RA(t,!1)),n&&_A.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",bp.errors.UNPREDICTABLE_GAS_LIMIT,{reason:n.message,method:e,transaction:r,error:t})}let i=t.message;throw t.code===bp.errors.SERVER_ERROR&&t.error&&"string"==typeof t.error.message?i=t.error.message:"string"==typeof t.body?i=t.body:"string"==typeof t.responseText&&(i=t.responseText),i=(i||"").toLowerCase(),i.match(/insufficient funds|base fee exceeds gas limit|InsufficientFunds/i)&&_A.throwError("insufficient funds for intrinsic transaction cost",bp.errors.INSUFFICIENT_FUNDS,{error:t,method:e,transaction:r}),i.match(/nonce (is )?too low/i)&&_A.throwError("nonce has already been used",bp.errors.NONCE_EXPIRED,{error:t,method:e,transaction:r}),i.match(/replacement transaction underpriced|transaction gas price.*too low/i)&&_A.throwError("replacement fee too low",bp.errors.REPLACEMENT_UNDERPRICED,{error:t,method:e,transaction:r}),i.match(/only replay-protected/i)&&_A.throwError("legacy pre-eip-155 transactions not supported",bp.errors.UNSUPPORTED_OPERATION,{error:t,method:e,transaction:r}),BA.indexOf(e)>=0&&i.match(/gas required exceeds allowance|always failing transaction|execution reverted|revert/)&&_A.throwError("cannot estimate gas; transaction may fail or may require manual gas limit",bp.errors.UNPREDICTABLE_GAS_LIMIT,{error:t,method:e,transaction:r}),t}function QA(e){return new Promise((function(t){setTimeout(t,e)}))}function WA(e){if(e.error){const t=new Error(e.error.message);throw t.code=e.error.code,t.data=e.error.data,t}return e.result}function YA(e){return e?e.toLowerCase():e}const FA={};class VA extends Wg{constructor(e,t,n){if(super(),e!==FA)throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");cy(this,"provider",t),null==n&&(n=0),"string"==typeof n?(cy(this,"_address",this.provider.formatter.address(n)),cy(this,"_index",null)):"number"==typeof n?(cy(this,"_index",n),cy(this,"_address",null)):_A.throwArgumentError("invalid address or index","addressOrIndex",n)}connect(e){return _A.throwError("cannot alter JSON-RPC Signer connection",bp.errors.UNSUPPORTED_OPERATION,{operation:"connect"})}connectUnchecked(){return new HA(FA,this.provider,this._address||this._index)}getAddress(){return this._address?Promise.resolve(this._address):this.provider.send("eth_accounts",[]).then((e=>(e.length<=this._index&&_A.throwError("unknown account #"+this._index,bp.errors.UNSUPPORTED_OPERATION,{operation:"getAddress"}),this.provider.formatter.address(e[this._index]))))}sendUncheckedTransaction(e){e=dy(e);const t=this.getAddress().then((e=>(e&&(e=e.toLowerCase()),e)));if(null==e.gasLimit){const n=dy(e);n.from=t,e.gasLimit=this.provider.estimateGas(n)}return null!=e.to&&(e.to=Promise.resolve(e.to).then((e=>PA(this,void 0,void 0,(function*(){if(null==e)return null;const t=yield this.provider.resolveName(e);return null==t&&_A.throwArgumentError("provided ENS name resolves to null","tx.to",e),t}))))),hy({tx:hy(e),sender:t}).then((({tx:t,sender:n})=>{null!=t.from?t.from.toLowerCase()!==n&&_A.throwArgumentError("from address mismatch","transaction",e):t.from=n;const r=this.provider.constructor.hexlifyTransaction(t,{from:!0});return this.provider.send("eth_sendTransaction",[r]).then((e=>e),(e=>("string"==typeof e.message&&e.message.match(/user denied/i)&&_A.throwError("user rejected transaction",bp.errors.ACTION_REJECTED,{action:"sendTransaction",transaction:t}),UA("sendTransaction",e,r))))}))}signTransaction(e){return _A.throwError("signing transactions is unsupported",bp.errors.UNSUPPORTED_OPERATION,{operation:"signTransaction"})}sendTransaction(e){return PA(this,void 0,void 0,(function*(){const t=yield this.provider._getInternalBlockNumber(100+2*this.provider.pollingInterval),n=yield this.sendUncheckedTransaction(e);try{return yield $M((()=>PA(this,void 0,void 0,(function*(){const e=yield this.provider.getTransaction(n);if(null!==e)return this.provider._wrapTransaction(e,n,t)}))),{oncePoll:this.provider})}catch(e){throw e.transactionHash=n,e}}))}signMessage(e){return PA(this,void 0,void 0,(function*(){const t="string"==typeof e?Lm(e):e,n=yield this.getAddress();try{return yield this.provider.send("personal_sign",[Dp(t),n.toLowerCase()])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&_A.throwError("user rejected signing",bp.errors.ACTION_REJECTED,{action:"signMessage",from:n,messageData:e}),t}}))}_legacySignMessage(e){return PA(this,void 0,void 0,(function*(){const t="string"==typeof e?Lm(e):e,n=yield this.getAddress();try{return yield this.provider.send("eth_sign",[n.toLowerCase(),Dp(t)])}catch(t){throw"string"==typeof t.message&&t.message.match(/user denied/i)&&_A.throwError("user rejected signing",bp.errors.ACTION_REJECTED,{action:"_legacySignMessage",from:n,messageData:e}),t}}))}_signTypedData(e,t,n){return PA(this,void 0,void 0,(function*(){const r=yield Tg.resolveNames(e,t,n,(e=>this.provider.resolveName(e))),i=yield this.getAddress();try{return yield this.provider.send("eth_signTypedData_v4",[i.toLowerCase(),JSON.stringify(Tg.getPayload(r.domain,t,r.value))])}catch(e){throw"string"==typeof e.message&&e.message.match(/user denied/i)&&_A.throwError("user rejected signing",bp.errors.ACTION_REJECTED,{action:"_signTypedData",from:i,messageData:{domain:r.domain,types:t,value:r.value}}),e}}))}unlock(e){return PA(this,void 0,void 0,(function*(){const t=this.provider,n=yield this.getAddress();return t.send("personal_unlockAccount",[n.toLowerCase(),e,null])}))}}class HA extends VA{sendTransaction(e){return this.sendUncheckedTransaction(e).then((e=>({hash:e,nonce:null,gasLimit:null,gasPrice:null,data:null,value:null,chainId:null,confirmations:0,from:null,wait:t=>this.provider.waitForTransaction(e,t)})))}}const GA={chainId:!0,data:!0,gasLimit:!0,gasPrice:!0,nonce:!0,to:!0,value:!0,type:!0,accessList:!0,maxFeePerGas:!0,maxPriorityFeePerGas:!0};class qA extends zA{constructor(e,t){let n=t;null==n&&(n=new Promise(((e,t)=>{setTimeout((()=>{this.detectNetwork().then((t=>{e(t)}),(e=>{t(e)}))}),0)}))),super(n),e||(e=ly(this.constructor,"defaultUrl")()),cy(this,"connection","string"==typeof e?Object.freeze({url:e}):Object.freeze(dy(e))),this._nextId=42}get _cache(){return null==this._eventLoopCache&&(this._eventLoopCache={}),this._eventLoopCache}static defaultUrl(){return"http://localhost:8545"}detectNetwork(){return this._cache.detectNetwork||(this._cache.detectNetwork=this._uncachedDetectNetwork(),setTimeout((()=>{this._cache.detectNetwork=null}),0)),this._cache.detectNetwork}_uncachedDetectNetwork(){return PA(this,void 0,void 0,(function*(){yield QA(0);let e=null;try{e=yield this.send("eth_chainId",[])}catch(t){try{e=yield this.send("net_version",[])}catch(e){}}if(null!=e){const t=ly(this.constructor,"getNetwork");try{return t(Yp.from(e).toNumber())}catch(t){return _A.throwError("could not detect network",bp.errors.NETWORK_ERROR,{chainId:e,event:"invalidNetwork",serverError:t})}}return _A.throwError("could not detect network",bp.errors.NETWORK_ERROR,{event:"noNetwork"})}))}getSigner(e){return new VA(FA,this,e)}getUncheckedSigner(e){return this.getSigner(e).connectUnchecked()}listAccounts(){return this.send("eth_accounts",[]).then((e=>e.map((e=>this.formatter.address(e)))))}send(e,t){const n={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};this.emit("debug",{action:"request",request:my(n),provider:this});const r=["eth_chainId","eth_blockNumber"].indexOf(e)>=0;if(r&&this._cache[e])return this._cache[e];const i=KM(this.connection,JSON.stringify(n),WA).then((e=>(this.emit("debug",{action:"response",request:n,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",error:e,request:n,provider:this}),e}));return r&&(this._cache[e]=i,setTimeout((()=>{this._cache[e]=null}),0)),i}prepareRequest(e,t){switch(e){case"getBlockNumber":return["eth_blockNumber",[]];case"getGasPrice":return["eth_gasPrice",[]];case"getBalance":return["eth_getBalance",[YA(t.address),t.blockTag]];case"getTransactionCount":return["eth_getTransactionCount",[YA(t.address),t.blockTag]];case"getCode":return["eth_getCode",[YA(t.address),t.blockTag]];case"getStorageAt":return["eth_getStorageAt",[YA(t.address),_p(t.position,32),t.blockTag]];case"sendTransaction":return["eth_sendRawTransaction",[t.signedTransaction]];case"getBlock":return t.blockTag?["eth_getBlockByNumber",[t.blockTag,!!t.includeTransactions]]:t.blockHash?["eth_getBlockByHash",[t.blockHash,!!t.includeTransactions]]:null;case"getTransaction":return["eth_getTransactionByHash",[t.transactionHash]];case"getTransactionReceipt":return["eth_getTransactionReceipt",[t.transactionHash]];case"call":return["eth_call",[ly(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0}),t.blockTag]];case"estimateGas":return["eth_estimateGas",[ly(this.constructor,"hexlifyTransaction")(t.transaction,{from:!0})]];case"getLogs":return t.filter&&null!=t.filter.address&&(t.filter.address=YA(t.filter.address)),["eth_getLogs",[t.filter]]}return null}perform(e,t){return PA(this,void 0,void 0,(function*(){if("call"===e||"estimateGas"===e){const e=t.transaction;if(e&&null!=e.type&&Yp.from(e.type).isZero()&&null==e.maxFeePerGas&&null==e.maxPriorityFeePerGas){const n=yield this.getFeeData();null==n.maxFeePerGas&&null==n.maxPriorityFeePerGas&&((t=dy(t)).transaction=dy(e),delete t.transaction.type)}}const n=this.prepareRequest(e,t);null==n&&_A.throwError(e+" not implemented",bp.errors.NOT_IMPLEMENTED,{operation:e});try{return yield this.send(n[0],n[1])}catch(n){return UA(e,n,t)}}))}_startEvent(e){"pending"===e.tag&&this._startPending(),super._startEvent(e)}_startPending(){if(null!=this._pendingFilter)return;const e=this,t=this.send("eth_newPendingTransactionFilter",[]);this._pendingFilter=t,t.then((function(n){return function r(){e.send("eth_getFilterChanges",[n]).then((function(n){if(e._pendingFilter!=t)return null;let r=Promise.resolve();return n.forEach((function(t){e._emitted["t:"+t.toLowerCase()]="pending",r=r.then((function(){return e.getTransaction(t).then((function(t){return e.emit("pending",t),null}))}))})),r.then((function(){return QA(1e3)}))})).then((function(){if(e._pendingFilter==t)return setTimeout((function(){r()}),0),null;e.send("eth_uninstallFilter",[n])})).catch((e=>{}))}(),n})).catch((e=>{}))}_stopEvent(e){"pending"===e.tag&&0===this.listenerCount("pending")&&(this._pendingFilter=null),super._stopEvent(e)}static hexlifyTransaction(e,t){const n=dy(GA);if(t)for(const e in t)t[e]&&(n[e]=!0);var r,i;i=n,(r=e)&&"object"==typeof r||uy.throwArgumentError("invalid object","object",r),Object.keys(r).forEach((e=>{i[e]||uy.throwArgumentError("invalid object key - "+e,"transaction:"+e,r)}));const o={};return["chainId","gasLimit","gasPrice","type","maxFeePerGas","maxPriorityFeePerGas","nonce","value"].forEach((function(t){if(null==e[t])return;const n=Pp(Yp.from(e[t]));"gasLimit"===t&&(t="gas"),o[t]=n})),["from","to","data"].forEach((function(t){null!=e[t]&&(o[t]=Dp(e[t]))})),e.accessList&&(o.accessList=mM(e.accessList)),o}}const ZA=new bp(cA);let JA=1;function XA(e,t){const n="Web3LegacyFetcher";return function(e,r){const i={method:e,params:r,id:JA++,jsonrpc:"2.0"};return new Promise(((e,r)=>{this.emit("debug",{action:"request",fetcher:n,request:my(i),provider:this}),t(i,((t,o)=>{if(t)return this.emit("debug",{action:"response",fetcher:n,error:t,request:i,provider:this}),r(t);if(this.emit("debug",{action:"response",fetcher:n,request:i,response:o,provider:this}),o.error){const e=new Error(o.error.message);return e.code=o.error.code,e.data=o.error.data,r(e)}e(o.result)}))}))}}class KA extends qA{constructor(e,t){null==e&&ZA.throwArgumentError("missing provider","provider",e);let n=null,r=null,i=null;"function"==typeof e?(n="unknown:",r=e):(n=e.host||e.path||"",!n&&e.isMetaMask&&(n="metamask"),i=e,e.request?(""===n&&(n="eip-1193:"),r=function(e){return function(t,n){null==n&&(n=[]);const r={method:t,params:n};return this.emit("debug",{action:"request",fetcher:"Eip1193Fetcher",request:my(r),provider:this}),e.request(r).then((e=>(this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,response:e,provider:this}),e)),(e=>{throw this.emit("debug",{action:"response",fetcher:"Eip1193Fetcher",request:r,error:e,provider:this}),e}))}}(e)):e.sendAsync?r=XA(0,e.sendAsync.bind(e)):e.send?r=XA(0,e.send.bind(e)):ZA.throwArgumentError("unsupported provider","provider",e),n||(n="unknown:")),super(n,t),cy(this,"jsonRpcFetchFunc",r),cy(this,"provider",i)}send(e,t){return this.jsonRpcFetchFunc(e,t)}}const $A=new RegExp("^bytes([0-9]+)$"),eI=new RegExp("^(u?int)([0-9]*)$"),tI=new RegExp("^(.*)\\[([0-9]*)\\]$"),nI=new bp("solidity/5.7.0");function rI(e,t,n){switch(e){case"address":return n?Sp(t,32):xp(t);case"string":return Lm(t);case"bytes":return xp(t);case"bool":return t=t?"0x01":"0x00",n?Sp(t,32):xp(t)}let r=e.match(eI);if(r){let i=parseInt(r[2]||"256");return(r[2]&&String(i)!==r[2]||i%8!=0||0===i||i>256)&&nI.throwArgumentError("invalid number type","type",e),n&&(i=256),Sp(t=Yp.from(t).toTwos(i),i/8)}if(r=e.match($A),r){const i=parseInt(r[1]);return(String(i)!==r[1]||0===i||i>32)&&nI.throwArgumentError("invalid bytes type","type",e),xp(t).byteLength!==i&&nI.throwArgumentError(`invalid value for ${e}`,"value",t),n?xp((t+"0000000000000000000000000000000000000000000000000000000000000000").substring(0,66)):t}if(r=e.match(tI),r&&Array.isArray(t)){const n=r[1];parseInt(r[2]||String(t.length))!=t.length&&nI.throwArgumentError(`invalid array length for ${e}`,"value",t);const i=[];return t.forEach((function(e){i.push(rI(n,e,!0))})),kp(i)}return nI.throwArgumentError("invalid type","type",e)}function iI(e,t){e.length!=t.length&&nI.throwArgumentError("wrong number of values; expected ${ types.length }","values",t);const n=[];return e.forEach((function(e,r){n.push(rI(e,t[r]))})),Dp(kp(n))}const oI=new bp("units/5.7.0"),aI=["wei","kwei","mwei","gwei","szabo","finney","ether"];function sI(e,t){if("string"==typeof t){const e=aI.indexOf(t);-1!==e&&(t=3*e)}return ty(e,null!=t?t:18)}function uI(e,t){if("string"!=typeof e&&oI.throwArgumentError("value must be a string","value",e),"string"==typeof t){const e=aI.indexOf(t);-1!==e&&(t=3*e)}return ny(e,null!=t?t:18)}let cI,lI=()=>cI||(cI="object"==typeof r?r:window,cI);const hI=()=>(void 0===lI()._Web3ClientConfiguration&&(lI()._Web3ClientConfiguration={}),lI()._Web3ClientConfiguration);function dI(e){let t,n=e[0],r=1;for(;r<e.length;){const i=e[r],o=e[r+1];if(r+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=o(n)):"call"!==i&&"optionalCall"!==i||(n=o(((...e)=>n.call(t,...e))),t=void 0)}return n}class fI extends qA{constructor(e,t,n,r){super(e),this._network=t,this._endpoint=e,this._endpoints=n,this._failover=r,this._pendingBatch=[]}handleError(e,t,n){if(t<5&&e){const e=this._endpoints.indexOf(this._endpoint)+1;this._failover(),this._endpoint=e>=this._endpoints.length?this._endpoints[0]:this._endpoints[e],this.requestChunk(n,this._endpoint,t+1)}else n.forEach((t=>{t.reject(e)}))}detectNetwork(){return Promise.resolve(Vf.findByName(this._network).id)}batchRequest(e,t){return new Promise(((n,r)=>{0===e.length&&n([]),fetch(this._endpoint,{method:"POST",body:JSON.stringify(e),headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(1e4)}).then((e=>{e.ok?e.json().then((e=>{e.find((e=>dI([e,"optionalAccess",e=>e.error])&&[-32062,-32016].includes(dI([e,"optionalAccess",e=>e.error,"optionalAccess",e=>e.code]))))&&t<5?r("Error in batch found!"):n(e)})).catch(r):r(`${e.status} ${e.text}`)})).catch(r)}))}requestChunk(e,t,n){const r=e.map((e=>e.request));try{return this.batchRequest(r,n).then((t=>{e.forEach(((e,n)=>{const r=t[n];if(dI([r,"optionalAccess",e=>e.error])){const t=new Error(r.error.message);t.code=r.error.code,t.data=r.error.data,e.reject(t)}else dI([r,"optionalAccess",e=>e.result])?e.resolve(r.result):e.reject()}))})).catch((t=>this.handleError(t,n,e)))}catch(t){this.handleError(t,n,e)}}send(e,t){const n={method:e,params:t,id:this._nextId++,jsonrpc:"2.0"};null==this._pendingBatch&&(this._pendingBatch=[]);const r={request:n,resolve:null,reject:null},i=new Promise(((e,t)=>{r.resolve=e,r.reject=t}));return this._pendingBatch.push(r),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const e=this._pendingBatch;this._pendingBatch=[],this._pendingBatchAggregator=null;const t=[];for(let n=0;n<Math.ceil(e.length/50);n++)t[n]=e.slice(50*n,50*(n+1));t.forEach((e=>(e.map((e=>e.request)),this.requestChunk(e,this._endpoint,1))))}),hI().batchInterval||10)),i}}const pI=()=>(null==lI()._Web3ClientProviders&&(lI()._Web3ClientProviders={}),lI()._Web3ClientProviders),yI=(e,t)=>{if(null==t)return;void 0===pI()[e]&&(pI()[e]=[]);const n=pI()[e].indexOf(t);n>-1&&pI()[e].splice(n,1),pI()[e].unshift(t)},mI=async(e,t,n=!0)=>{let r;pI()[e]=t.map(((r,i)=>new fI(r,e,t,(()=>{1===pI()[e].length?mI(e,t,n):pI()[e].splice(i,1)}))));let i=lI();if(null==i.fetch||void 0!==x&&x.env&&"test"==x.env.NODE_ENV||void 0!==i.cy||!1===n)r=pI()[e][0];else{let n=await Promise.all(t.map((e=>new Promise((async t=>{let n,r=(new Date).getTime();setTimeout((()=>t(900)),900);try{n=await fetch(e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},referrer:"",referrerPolicy:"no-referrer",body:JSON.stringify({method:"net_version",id:1,jsonrpc:"2.0"}),signal:AbortSignal.timeout(1e4)})}catch(e){}if(!function(e){let t,n=e[0],r=1;for(;r<e.length;){const i=e[r],o=e[r+1];if(r+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=o(n)):"call"!==i&&"optionalCall"!==i||(n=o(((...e)=>n.call(t,...e))),t=void 0)}return n}([n,"optionalAccess",e=>e.ok]))return t(999);let i=(new Date).getTime();t(i-r)})))));const i=Math.min(...n),o=n.indexOf(i);r=pI()[e][o]}yI(e,r)};var gI={getProvider:async e=>{let t=pI();if(t&&t[e])return t[e][0];let n=lI();return n._Web3ClientGetProviderPromise&&n._Web3ClientGetProviderPromise[e]||(n._Web3ClientGetProviderPromise||(n._Web3ClientGetProviderPromise={}),n._Web3ClientGetProviderPromise[e]=new Promise((async t=>{await mI(e,Vf[e].endpoints),t(lI()._Web3ClientProviders[e][0])}))),await n._Web3ClientGetProviderPromise[e]},getProviders:async e=>{let t=pI();if(t&&t[e])return t[e];let n=lI();return n._Web3ClientGetProvidersPromise&&n._Web3ClientGetProvidersPromise[e]||(n._Web3ClientGetProvidersPromise||(n._Web3ClientGetProvidersPromise={}),n._Web3ClientGetProvidersPromise[e]=new Promise((async t=>{await mI(e,Vf[e].endpoints),t(lI()._Web3ClientProviders[e])}))),await n._Web3ClientGetProvidersPromise[e]},setProviderEndpoints:mI,setProvider:yI};function vI(e){let t,n=e[0],r=1;for(;r<e.length;){const i=e[r],o=e[r+1];if(r+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=o(n)):"call"!==i&&"optionalCall"!==i||(n=o(((...e)=>n.call(t,...e))),t=void 0)}return n}class wI extends Vl{constructor(e,t,n,r){super(e),this._provider=new Vl(e),this._network=t,this._endpoint=e,this._endpoints=n,this._failover=r,this._pendingBatch=[],this._rpcRequest=this._rpcRequestReplacement.bind(this)}handleError(e,t,n){if(t<10){const e=this._endpoints.indexOf(this._endpoint)+1;this._endpoint=e>=this._endpoints.length?this._endpoints[0]:this._endpoints[e],this._provider=new Vl(this._endpoint),this.requestChunk(n,t+1)}else n.forEach((t=>{t.reject(e)}))}batchRequest(e,t){return new Promise(((n,r)=>{0===e.length&&n([]);const i=e.map((e=>this._rpcClient.request(e.methodName,e.args)));fetch(this._endpoint,{method:"POST",body:JSON.stringify(i),headers:{"Content-Type":"application/json"},signal:AbortSignal.timeout(6e4)}).then((e=>{e.ok?e.json().then((e=>{e.find((e=>vI([e,"optionalAccess",e=>e.error])))&&t<10?r("Error in batch found!"):n(e)})).catch(r):r(`${e.status} ${e.text}`)})).catch(r)}))}requestChunk(e,t){const n=e.map((e=>e.request));try{return this.batchRequest(n,t).then((t=>{e.forEach(((e,n)=>{const r=t[n];if(vI([r,"optionalAccess",e=>e.error])){const t=new Error(r.error.message);t.code=r.error.code,t.data=r.error.data,e.reject(t)}else r?e.resolve(r):e.reject()}))})).catch((n=>this.handleError(n,t,e)))}catch(n){return this.handleError(n,t,e)}}_rpcRequestReplacement(e,t){const n={methodName:e,args:t};null==this._pendingBatch&&(this._pendingBatch=[]);const r={request:n,resolve:null,reject:null},i=new Promise(((e,t)=>{r.resolve=e,r.reject=t}));return this._pendingBatch.push(r),this._pendingBatchAggregator||(this._pendingBatchAggregator=setTimeout((()=>{const e=this._pendingBatch;this._pendingBatch=[],this._pendingBatchAggregator=null;const t=[];for(let n=0;n<Math.ceil(e.length/50);n++)t[n]=e.slice(50*n,50*(n+1));t.forEach((e=>(e.map((e=>e.request)),this.requestChunk(e,1))))}),hI().batchInterval||10)),i}}const bI=()=>(null==lI()._Web3ClientProviders&&(lI()._Web3ClientProviders={}),lI()._Web3ClientProviders),MI=(e,t)=>{if(null==t)return;void 0===bI()[e]&&(bI()[e]=[]);const n=bI()[e].indexOf(t);n>-1&&bI()[e].splice(n,1),bI()[e].unshift(t)},AI=async(e,t,n=!0)=>{let r;bI()[e]=t.map(((r,i)=>new wI(r,e,t,(()=>{1===bI()[e].length?AI(e,t,n):bI()[e].splice(i,1)}))));let i=lI();if(null==i.fetch||void 0!==x&&x.env&&"test"==x.env.NODE_ENV||void 0!==i.cy||!1===n)r=bI()[e][0];else{let n=await Promise.all(t.map((e=>new Promise((async t=>{let n,r=(new Date).getTime();setTimeout((()=>t(900)),900);try{n=await fetch(e,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},referrer:"",referrerPolicy:"no-referrer",body:JSON.stringify({method:"getIdentity",id:1,jsonrpc:"2.0"}),signal:AbortSignal.timeout(1e4)})}catch(e){}if(!function(e){let t,n=e[0],r=1;for(;r<e.length;){const i=e[r],o=e[r+1];if(r+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=o(n)):"call"!==i&&"optionalCall"!==i||(n=o(((...e)=>n.call(t,...e))),t=void 0)}return n}([n,"optionalAccess",e=>e.ok]))return t(999);let i=(new Date).getTime();t(i-r)})))));const i=Math.min(...n),o=n.indexOf(i);r=bI()[e][o]}MI(e,r)};var II={getProvider:async e=>{let t=bI();if(t&&t[e])return t[e][0];let n=lI();return n._Web3ClientGetProviderPromise&&n._Web3ClientGetProviderPromise[e]||(n._Web3ClientGetProviderPromise||(n._Web3ClientGetProviderPromise={}),n._Web3ClientGetProviderPromise[e]=new Promise((async t=>{await AI(e,Vf[e].endpoints),t(lI()._Web3ClientProviders[e][0])}))),await n._Web3ClientGetProviderPromise[e]},getProviders:async e=>{let t=bI();if(t&&t[e])return t[e];let n=lI();return n._Web3ClientGetProvidersPromise&&n._Web3ClientGetProvidersPromise[e]||(n._Web3ClientGetProvidersPromise||(n._Web3ClientGetProvidersPromise={}),n._Web3ClientGetProvidersPromise[e]=new Promise((async t=>{await AI(e,Vf[e].endpoints),t(lI()._Web3ClientProviders[e])}))),await n._Web3ClientGetProvidersPromise[e]},setProviderEndpoints:AI,setProvider:MI};let NI=["ethereum","bsc","polygon","solana","fantom","arbitrum","avalanche","gnosis","optimism","base","worldchain"];NI.evm=["ethereum","bsc","polygon","fantom","arbitrum","avalanche","gnosis","optimism","base","worldchain"],NI.solana=["solana"];let TI=()=>(null==lI()._Web3ClientCacheStore&&(lI()._Web3ClientCacheStore={}),lI()._Web3ClientCacheStore),EI=()=>(null==lI()._Web3ClientPromiseStore&&(lI()._Web3ClientPromiseStore={}),lI()._Web3ClientPromiseStore),xI=function({key:e}){EI()[e]=void 0},kI=function({call:e,key:t,expires:n=0}){return new Promise(((r,i)=>{let o,a=function({key:e}){return EI()[e]}({key:t=JSON.stringify(t)});if(a)return a.then(r).catch(i);(function({key:e,promise:t}){return EI()[e]=t,t})({key:t,promise:new Promise(((a,s)=>0===n?e().then((e=>{r(e),a(e)})).catch((e=>{i(e),s(e)})):(o=function({key:e,expires:t}){let n=TI()[e];if(function(e){let t,n=e[0],r=1;for(;r<e.length;){const i=e[r],o=e[r+1];if(r+=2,("optionalAccess"===i||"optionalCall"===i)&&null==n)return;"access"===i||"optionalAccess"===i?(t=n,n=o(n)):"call"!==i&&"optionalCall"!==i||(n=o(((...e)=>n.call(t,...e))),t=void 0)}return n}([n,"optionalAccess",e=>e.expiresAt])>Date.now())return n.value}({key:t,expires:n}),o?(r(o),a(o),o):void e().then((e=>{e&&function({key:e,value:t,expires:n}){TI()[e]={expiresAt:Date.now()+n,value:t}}({key:t,value:e,expires:n}),r(e),a(e)})).catch((e=>{i(e),s(e)})))))}).then((()=>{xI({key:t})})).catch((()=>{xI({key:t})}))}))};const LI=async e=>{if(NI.evm.includes(e))return await gI.getProvider(e);if(NI.solana.includes(e))return await II.getProvider(e);throw"Unknown blockchain: "+e},SI=({fragments:e,method:t,params:n})=>e.find((e=>!(e.name!=t||e.inputs&&n&&"object"==typeof n&&e.inputs.length!=Object.keys(n).length))),jI=e=>`(${e.map((e=>"tuple"===e.type?jI(e.components):e.type)).join(",")})`;var DI=({provider:e,from:t,to:n,value:r,method:i,api:o,params:a})=>{if(void 0===o)return e.estimateGas({from:t,to:n,value:r});{let s=new zM(n,o,e),u=SI({fragments:s.interface.fragments,method:i,params:a}),c=(({contract:e,method:t,params:n})=>{let r=SI({fragments:e.interface.fragments,method:t,params:n});return n instanceof Array?n:n instanceof Object?r.inputs.map((e=>n[e.name])):void 0})({contract:s,method:i,params:a});void 0===s[i]&&(i=`${i}(${u.inputs.map((e=>"tuple"===e.type?jI(e.components):e.type)).join(",")})`);let l=s.estimateGas[i];return c?l(...c,{from:t,value:r}):l({from:t,value:r})}};let CI=async function({blockchain:e,from:t,to:n,value:r,method:i,api:o,params:a,cache:s}){if(!NI.includes(e))throw"Unknown blockchain: "+e;void 0===r&&(r="0");const u=await LI(e);return await kI({expires:s||0,key:[e,t,n,r,i,a],call:async()=>DI({provider:u,from:t,to:n,value:r,method:i,api:o,params:a})})};const OI=({address:e,api:t,method:n,params:r,provider:i,block:o})=>{const a=new zM(e,t,i),s=(({contract:e,method:t,params:n})=>e.interface.fragments.find((e=>e.name==t)).inputs.map(((e,t)=>Array.isArray(n)?n[t]:n[e.name])))({contract:a,method:n,params:r}),u=a.interface.fragments.find((e=>e.name===n));return void 0===a[n]&&(n=`${n}(${u.inputs.map((e=>e.type)).join(",")})`),u&&"nonpayable"===u.stateMutability?a.callStatic[n](...s,{blockTag:o}):a[n](...s,{blockTag:o})},zI=({blockchain:e,address:t,api:n,method:r,params:i,block:o,provider:a})=>n?OI({address:t,api:n,method:r,params:i,provider:a,block:o}):"latestBlockNumber"===r?a.getBlockNumber():"balance"===r?(({address:e,provider:t})=>t.getBalance(e))({address:t,provider:a}):"transactionCount"===r?(({address:e,provider:t})=>t.getTransactionCount(e))({address:t,provider:a}):void 0;const PI=async({blockchain:e,address:t,api:n,method:r,params:i,block:o,provider:a,providers:s})=>{try{if(null==r||"getAccountInfo"===r)return null==n&&(n=tf),await(async({address:e,api:t,method:n,params:r,provider:i,block:o})=>{const a=await i.getAccountInfo(new qs(e));if(a&&a.data)return t.decode(a.data)})({address:t,api:n,method:r,params:i,provider:a,block:o});if("getProgramAccounts"===r)return await a.getProgramAccounts(new qs(t),i).then((e=>n?e.map((e=>(e.data=n.decode(e.account.data),e))):e));if("getTokenAccountBalance"===r)return await a.getTokenAccountBalance(new qs(t));if("latestBlockNumber"===r)return await a.getSlot(i||void 0);if("balance"===r)return await(({address:e,provider:t})=>t.getBalance(new qs(e)))({address:t,provider:a})}catch(u){if(s&&u&&["Failed to fetch","limit reached","504","503","502","500","429","426","422","413","409","408","406","405","404","403","402","401","400"].some((e=>u.toString().match(e)))){let u=s[s.indexOf(a)+1]||s[0];return PI({blockchain:e,address:t,api:n,method:r,params:i,block:o,provider:u,providers:s})}throw u}};const _I=async function(e,t){const{blockchain:n,address:r,method:i}=(e=>{if("object"==typeof e)return e;let t=e.match(/(?<blockchain>\w+):\/\/(?<part1>[\w\d]+)(\/(?<part2>[\w\d]+)*)?/);return null==t.groups.part2?t.groups.part1.match(/\d/)?{blockchain:t.groups.blockchain,address:t.groups.part1}:{blockchain:t.groups.blockchain,method:t.groups.part1}:{blockchain:t.groups.blockchain,address:t.groups.part1,method:t.groups.part2}})(e),{api:o,params:a,cache:s,block:u,timeout:c,strategy:l,cacheKey:h}=("object"==typeof e?e:t)||{};return await kI({expires:s||0,key:h||[n,r,i,a,u],call:async()=>{if(NI.evm.includes(n))return await(async({blockchain:e,address:t,api:n,method:r,params:i,block:o,timeout:a,strategy:s})=>{if(s=s||hI().strategy||"failover",a=a||hI().timeout||void 0,"fastest"===s){const s=await gI.getProviders(e);let u=[];const c=s.map((a=>new Promise((s=>{u.push(zI({blockchain:e,address:t,api:n,method:r,params:i,block:o,provider:a}).then(s))})))),l=new Promise(((e,t)=>setTimeout((()=>{t(new Error("Web3ClientTimeout"))}),a||1e4)));return u=Promise.all(u.map((e=>new Promise((t=>{e.catch(t)}))))).then((()=>{})),Promise.race([...c,l,u])}{const s=await gI.getProvider(e),u=zI({blockchain:e,address:t,api:n,method:r,params:i,block:o,provider:s});return a?(a=new Promise(((e,t)=>setTimeout((()=>{t(new Error("Web3ClientTimeout"))}),a))),Promise.race([u,a])):u}})({blockchain:n,address:r,api:o,method:i,params:a,block:u,strategy:l,timeout:c});if(NI.solana.includes(n))return await(async({blockchain:e,address:t,api:n,method:r,params:i,block:o,timeout:a,strategy:s})=>{s=s||hI().strategy||"failover",a=a||hI().timeout||void 0;const u=await II.getProviders(e);if("fastest"===s){let s=[];const c=u.map((a=>new Promise((u=>{s.push(PI({blockchain:e,address:t,api:n,method:r,params:i,block:o,provider:a}).then(u))})))),l=new Promise(((e,t)=>setTimeout((()=>{t(new Error("Web3ClientTimeout"))}),a||6e4)));return s=Promise.all(s.map((e=>new Promise((t=>{e.catch(t)}))))).then((()=>{})),Promise.race([...c,l,s])}{const s=await II.getProvider(e),c=PI({blockchain:e,address:t,api:n,method:r,params:i,block:o,provider:s,providers:u});return a?(a=new Promise(((e,t)=>setTimeout((()=>{t(new Error("Web3ClientTimeout"))}),a))),Promise.race([c,a])):c}})({blockchain:n,address:r,api:o,method:i,params:a,block:u,strategy:l,timeout:c});throw"Unknown blockchain: "+n}})};var BI=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=128)}([function(e,t,n){(function(e,r,i){n.d(t,"a",(function(){return Xi})),n.d(t,"b",(function(){return da})),n.d(t,"c",(function(){return eo})),n.d(t,"d",(function(){return Lo})),n.d(t,"e",(function(){return oe})),n.d(t,"f",(function(){return $})),n.d(t,"g",(function(){return Hi})),n.d(t,"h",(function(){return ee})),n.d(t,"i",(function(){return ao})),n.d(t,"j",(function(){return uo})),n.d(t,"k",(function(){return ro})),n.d(t,"l",(function(){return co})),n.d(t,"m",(function(){return so})),n.d(t,"n",(function(){return se})),n.d(t,"o",(function(){return re})),n.d(t,"p",(function(){return Qi})),n.d(t,"q",(function(){return Z})),n.d(t,"r",(function(){return ne})),n.d(t,"s",(function(){return xo})),n.d(t,"t",(function(){return to})),n.d(t,"u",(function(){return no})),n.d(t,"v",(function(){return G})),n.d(t,"w",(function(){return H})),n.d(t,"x",(function(){return Zi})),n.d(t,"y",(function(){return le})),n.d(t,"z",(function(){return Ri})),n.d(t,"A",(function(){return Do})),n.d(t,"B",(function(){return qi})),n.d(t,"C",(function(){return Bi})),n.d(t,"D",(function(){return Ji})),n.d(t,"E",(function(){return yo})),n.d(t,"F",(function(){return po})),n.d(t,"G",(function(){return Co})),n.d(t,"H",(function(){return ce})),n.d(t,"I",(function(){return io})),n.d(t,"J",(function(){return oo})),n.d(t,"K",(function(){return F})),n.d(t,"L",(function(){return aa})),n.d(t,"M",(function(){return ae})),n.d(t,"N",(function(){return W})),n.d(t,"O",(function(){return ca})),n.d(t,"P",(function(){return Wo})),n.d(t,"Q",(function(){return Y})),n.d(t,"R",(function(){return Ro})),n.d(t,"S",(function(){return Yo})),n.d(t,"T",(function(){return fo})),n.d(t,"U",(function(){return Po})),n.d(t,"V",(function(){return Oo})),n.d(t,"W",(function(){return Fo})),n.d(t,"X",(function(){return $o})),n.d(t,"Y",(function(){return na})),n.d(t,"Z",(function(){return Xo})),n.d(t,"ab",(function(){return qo})),n.d(t,"bb",(function(){return ra})),n.d(t,"cb",(function(){return oa})),n.d(t,"db",(function(){return ia})),n.d(t,"eb",(function(){return zo})),n.d(t,"fb",(function(){return Ko})),n.d(t,"gb",(function(){return Zo})),n.d(t,"hb",(function(){return Jo})),n.d(t,"ib",(function(){return ea})),n.d(t,"jb",(function(){return ua})),n.d(t,"kb",(function(){return Go})),n.d(t,"lb",(function(){return ta})),n.d(t,"mb",(function(){return _o})),n.d(t,"nb",(function(){return Qo})),n.d(t,"ob",(function(){return X})),n.d(t,"pb",(function(){return Gi})),n.d(t,"qb",(function(){return K})),n.d(t,"rb",(function(){return S})),n.d(t,"sb",(function(){return ie})),n.d(t,"tb",(function(){return To})),n.d(t,"ub",(function(){return la})),n.d(t,"vb",(function(){return lo})),n.d(t,"wb",(function(){return ho})),n.d(t,"xb",(function(){return Ui}));var o=n(71),a=n(1),s=n(21),u=n(68),c=n(32),l=n(43),h=n(69),d=n(24),f=n(38),p=n(44),y=n(5),m=n(70);function g(e,t,n){return(t=M(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function v(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,M(r.key),r)}}function b(e,t,n){return t&&w(e.prototype,t),n&&w(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function M(e){var t=function(e,t){if("object"!=I(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=I(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==I(t)?t:t+""}function A(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */A=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var o=t&&t.prototype instanceof m?t:m,a=Object.create(o.prototype),s=new j(r||[]);return i(a,"_invoke",{value:x(e,n,s)}),a}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var d="suspendedStart",f="executing",p="completed",y={};function m(){}function g(){}function v(){}var w={};c(w,a,(function(){return this}));var b=Object.getPrototypeOf,M=b&&b(b(D([])));M&&M!==n&&r.call(M,a)&&(w=M);var N=v.prototype=m.prototype=Object.create(w);function T(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function E(e,t){function n(i,o,a,s){var u=h(e[i],e,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==I(l)&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(l).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function x(t,n,r){var i=d;return function(o,a){if(i===f)throw Error("Generator is already running");if(i===p){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var u=k(s,r);if(u){if(u===y)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=f;var c=h(t,n,r);if("normal"===c.type){if(i=r.done?p:"suspendedYield",c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=p,r.method="throw",r.arg=c.arg)}}}function k(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,k(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=h(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function D(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(I(t)+" is not iterable")}return g.prototype=v,i(N,"constructor",{value:v,configurable:!0}),i(v,"constructor",{value:g,configurable:!0}),g.displayName=c(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,c(e,u,"GeneratorFunction")),e.prototype=Object.create(N),e},t.awrap=function(e){return{__await:e}},T(E.prototype),c(E.prototype,s,(function(){return this})),t.AsyncIterator=E,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new E(l(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},T(N),c(N,u,"Generator"),c(N,a,(function(){return this})),c(N,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=D,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(S),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:D(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function I(e){return(I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function N(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=x(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function T(e){return function(e){if(Array.isArray(e))return k(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||x(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,i,o,a,s=[],u=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;u=!1}else for(;!(u=(r=o.call(n)).done)&&(s.push(r.value),s.length!==t);u=!0);}catch(e){c=!0,i=e}finally{try{if(!u&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(c)throw i}}return s}}(e,t)||x(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function x(e,t){if(e){if("string"==typeof e)return k(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?k(e,t):void 0}}function k(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var L=function(e,t,n){return new Promise((function(r,i){var o=function(e){try{s(n.next(e))}catch(e){i(e)}},a=function(e){try{s(n.throw(e))}catch(e){i(e)}},s=function(e){return e.done?r(e.value):Promise.resolve(e.value).then(o,a)};s((n=n.apply(e,t)).next())}))};function S(e){var t=E(e.split(":"),2);return{namespace:t[0],reference:t[1]}}function j(e,t){return e.includes(":")?[e]:t.chains||[]}var D=Object.defineProperty,C=Object.getOwnPropertySymbols,O=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable,P=function(e,t,n){return t in e?D(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},_=function(e,t){for(var n in t||(t={}))O.call(t,n)&&P(e,n,t[n]);if(C){var r,i=N(C(t));try{for(i.s();!(r=i.n()).done;)n=r.value,z.call(t,n)&&P(e,n,t[n])}catch(e){i.e(e)}finally{i.f()}}return e},B="react-native",R="node",U="browser",Q="js";function W(){return(void 0===e?"undefined":I(e))<"u"&&I(e.versions)<"u"&&I(e.versions.node)<"u"}function Y(){return!Object(s.getDocument)()&&!!Object(s.getNavigator)()&&"ReactNative"===navigator.product}function F(){return!W()&&!!Object(s.getNavigator)()&&!!Object(s.getDocument)()}function V(){return Y()?B:W()?R:F()?U:"unknown"}function H(){var e;try{return Y()&&(void 0===r?"undefined":I(r))<"u"&&I(null==r?void 0:r.Application)<"u"?null==(e=r.Application)?void 0:e.applicationId:void 0}catch(e){return}}function G(){return Object(u.getWindowMetadata)()||{name:"",description:"",url:"",icons:[""]}}function q(e,t,n){var i=function(){if(V()===B&&(void 0===r?"undefined":I(r))<"u"&&I(null==r?void 0:r.Platform)<"u"){var e=r.Platform;return[e.OS,e.Version].join("-")}var t=Object(o.a)();if(null===t)return"unknown";var n=t.os?t.os.replace(" ","").toLowerCase():"unknown";return"browser"===t.type?[n,t.name,t.version].join("-"):[n,t.version].join("-")}(),a=function(){var e,t=V();return t===U?[t,(null==(e=Object(s.getLocation)())?void 0:e.host)||"unknown"].join(":"):t}();return[[e,t].join("-"),[Q,n].join("-"),i,a].join("/")}function Z(e){var t=e.protocol,n=e.version,r=e.relayUrl,i=e.sdkVersion,o=e.auth,a=e.projectId,s=e.useOnCloseEvent,u=e.bundleId,l=r.split("?"),h={auth:o,ua:q(t,n,i),projectId:a,useOnCloseEvent:s||void 0,origin:u||void 0},d=function(e,t){var n=c.parse(e);return n=_(_({},n),t),c.stringify(n)}(l[1]||"",h);return l[0]+"?"+d}function J(e,t){return e.filter((function(e){return t.includes(e)})).length===e.length}function X(e){return Object.fromEntries(e.entries())}function K(e){return new Map(Object.entries(e))}function $(){var e,t,n,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:a.FIVE_MINUTES,i=arguments.length>1?arguments[1]:void 0,o=Object(a.toMiliseconds)(r||a.FIVE_MINUTES);return{resolve:function(t){n&&e&&(clearTimeout(n),e(t))},reject:function(e){n&&t&&(clearTimeout(n),t(e))},done:function(){return new Promise((function(r,a){n=setTimeout((function(){a(new Error(i))}),o),e=r,t=a}))}}}function ee(e,t,n){var r=this;return new Promise((function(i,o){return L(r,null,A().mark((function r(){var a,s;return A().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return a=setTimeout((function(){return o(new Error(n))}),t),r.prev=1,r.next=4,e;case 4:s=r.sent,i(s),r.next=11;break;case 8:r.prev=8,r.t0=r.catch(1),o(r.t0);case 11:clearTimeout(a);case 12:case"end":return r.stop()}}),r,null,[[1,8]])})))}))}function te(e,t){if("string"==typeof t&&t.startsWith("".concat(e,":")))return t;if("topic"===e.toLowerCase()){if("string"!=typeof t)throw new Error('Value must be "string" for expirer target type: topic');return"topic:".concat(t)}if("id"===e.toLowerCase()){if("number"!=typeof t)throw new Error('Value must be "number" for expirer target type: id');return"id:".concat(t)}throw new Error("Unknown expirer target type: ".concat(e))}function ne(e){return te("topic",e)}function re(e){return te("id",e)}function ie(e){var t=E(e.split(":"),2),n=t[0],r=t[1],i={id:void 0,topic:void 0};if("topic"===n&&"string"==typeof r)i.topic=r;else{if("id"!==n||!Number.isInteger(Number(r)))throw new Error("Invalid target, expected id:number or topic:string, got ".concat(n,":").concat(r));i.id=Number(r)}return i}function oe(e,t){return Object(a.fromMiliseconds)((t||Date.now())+Object(a.toMiliseconds)(e))}function ae(e){return Date.now()>=Object(a.toMiliseconds)(e)}function se(e,t){return"".concat(e).concat(t?":".concat(t):"")}function ue(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return T(new Set([].concat(T(e),T(t))))}function ce(e){return L(this,arguments,(function(e){var t=e.id,n=e.topic,i=e.wcDeepLink;return A().mark((function e(){var o,a,s,u;return A().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,i){e.next=3;break}return e.abrupt("return");case 3:if(o="string"==typeof i?JSON.parse(i):i,"string"==typeof(a=null==o?void 0:o.href)){e.next=7;break}return e.abrupt("return");case 7:if(a.endsWith("/")&&(a=a.slice(0,-1)),s="".concat(a,"/wc?requestId=").concat(t,"&sessionTopic=").concat(n),(u=V())!==U){e.next=13;break}s.startsWith("https://")||s.startsWith("http://")?window.open(s,"_blank","noreferrer noopener"):window.open(s,"_self","noreferrer noopener"),e.next=17;break;case 13:if(e.t0=u===B&&I(null==r?void 0:r.Linking)<"u",!e.t0){e.next=17;break}return e.next=17,r.Linking.openURL(s);case 17:e.next=22;break;case 19:e.prev=19,e.t1=e.catch(0),console.error(e.t1);case 22:case"end":return e.stop()}}),e,null,[[0,19]])}))()}))}function le(e,t){return L(this,null,A().mark((function n(){return A().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.prev=0,n.next=3,e.getItem(t);case 3:if(n.t0=n.sent,n.t0){n.next=6;break}n.t0=F()?localStorage.getItem(t):void 0;case 6:return n.abrupt("return",n.t0);case 9:n.prev=9,n.t1=n.catch(0),console.error(n.t1);case 12:case"end":return n.stop()}}),n,null,[[0,9]])})))}var he=("undefined"==typeof globalThis?"undefined":I(globalThis))<"u"?globalThis:("undefined"==typeof window?"undefined":I(window))<"u"?window:(void 0===r?"undefined":I(r))<"u"?r:("undefined"==typeof self?"undefined":I(self))<"u"?self:{},de={exports:{}};!function(t){!function(){var n="input is invalid type",r="object"==("undefined"==typeof window?"undefined":I(window)),i=r?window:{};i.JS_SHA3_NO_WINDOW&&(r=!1);var o=!r&&"object"==("undefined"==typeof self?"undefined":I(self));!i.JS_SHA3_NO_NODE_JS&&"object"==(void 0===e?"undefined":I(e))&&e.versions&&e.versions.node?i=he:o&&(i=self);var a=!i.JS_SHA3_NO_COMMON_JS&&t.exports,s=!i.JS_SHA3_NO_ARRAY_BUFFER&&("undefined"==typeof ArrayBuffer?"undefined":I(ArrayBuffer))<"u",u="0123456789abcdef".split(""),c=[4,1024,262144,67108864],l=[0,8,16,24],h=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],d=[224,256,384,512],f=[128,256],p=["hex","buffer","arrayBuffer","array","digest"],y={128:168,256:136};(i.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),s&&(i.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(e){return"object"==I(e)&&e.buffer&&e.buffer.constructor===ArrayBuffer});for(var m=function(e,t,n){return function(r){return new D(e,t,e).update(r)[n]()}},g=function(e,t,n){return function(r,i){return new D(e,t,i).update(r)[n]()}},v=function(e,t,n){return function(t,r,i,o){return N["cshake"+e].update(t,r,i,o)[n]()}},w=function(e,t,n){return function(t,r,i,o){return N["kmac"+e].update(t,r,i,o)[n]()}},b=function(e,t,n,r){for(var i=0;i<p.length;++i){var o=p[i];e[o]=t(n,r,o)}return e},M=function(e,t){var n=m(e,t,"hex");return n.create=function(){return new D(e,t,e)},n.update=function(e){return n.create().update(e)},b(n,m,e,t)},A=[{name:"keccak",padding:[1,256,65536,16777216],bits:d,createMethod:M},{name:"sha3",padding:[6,1536,393216,100663296],bits:d,createMethod:M},{name:"shake",padding:[31,7936,2031616,520093696],bits:f,createMethod:function(e,t){var n=g(e,t,"hex");return n.create=function(n){return new D(e,t,n)},n.update=function(e,t){return n.create(t).update(e)},b(n,g,e,t)}},{name:"cshake",padding:c,bits:f,createMethod:function(e,t){var n=y[e],r=v(e,0,"hex");return r.create=function(r,i,o){return i||o?new D(e,t,r).bytepad([i,o],n):N["shake"+e].create(r)},r.update=function(e,t,n,i){return r.create(t,n,i).update(e)},b(r,v,e,t)}},{name:"kmac",padding:c,bits:f,createMethod:function(e,t){var n=y[e],r=w(e,0,"hex");return r.create=function(r,i,o){return new C(e,t,i).bytepad(["KMAC",o],n).bytepad([r],n)},r.update=function(e,t,n,i){return r.create(e,n,i).update(t)},b(r,w,e,t)}}],N={},T=[],E=0;E<A.length;++E)for(var x=A[E],k=x.bits,L=0;L<k.length;++L){var S=x.name+"_"+k[L];if(T.push(S),N[S]=x.createMethod(k[L],x.padding),"sha3"!==x.name){var j=x.name+k[L];T.push(j),N[j]=N[S]}}function D(e,t,n){this.blocks=[],this.s=[],this.padding=t,this.outputBits=n,this.reset=!0,this.finalized=!1,this.block=0,this.start=0,this.blockCount=1600-(e<<1)>>5,this.byteCount=this.blockCount<<2,this.outputBlocks=n>>5,this.extraBytes=(31&n)>>3;for(var r=0;r<50;++r)this.s[r]=0}function C(e,t,n){D.call(this,e,t,n)}D.prototype.update=function(e){if(this.finalized)throw new Error("finalize already called");var t,r=I(e);if("string"!==r){if("object"!==r)throw new Error(n);if(null===e)throw new Error(n);if(s&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||s&&ArrayBuffer.isView(e)))throw new Error(n);t=!0}for(var i,o,a=this.blocks,u=this.byteCount,c=e.length,h=this.blockCount,d=0,f=this.s;d<c;){if(this.reset)for(this.reset=!1,a[0]=this.block,i=1;i<h+1;++i)a[i]=0;if(t)for(i=this.start;d<c&&i<u;++d)a[i>>2]|=e[d]<<l[3&i++];else for(i=this.start;d<c&&i<u;++d)(o=e.charCodeAt(d))<128?a[i>>2]|=o<<l[3&i++]:o<2048?(a[i>>2]|=(192|o>>6)<<l[3&i++],a[i>>2]|=(128|63&o)<<l[3&i++]):o<55296||o>=57344?(a[i>>2]|=(224|o>>12)<<l[3&i++],a[i>>2]|=(128|o>>6&63)<<l[3&i++],a[i>>2]|=(128|63&o)<<l[3&i++]):(o=65536+((1023&o)<<10|1023&e.charCodeAt(++d)),a[i>>2]|=(240|o>>18)<<l[3&i++],a[i>>2]|=(128|o>>12&63)<<l[3&i++],a[i>>2]|=(128|o>>6&63)<<l[3&i++],a[i>>2]|=(128|63&o)<<l[3&i++]);if(this.lastByteIndex=i,i>=u){for(this.start=i-u,this.block=a[h],i=0;i<h;++i)f[i]^=a[i];O(f),this.reset=!0}else this.start=i}return this},D.prototype.encode=function(e,t){var n=255&e,r=1,i=[n];for(n=255&(e>>=8);n>0;)i.unshift(n),n=255&(e>>=8),++r;return t?i.push(r):i.unshift(r),this.update(i),i.length},D.prototype.encodeString=function(e){var t,r=I(e);if("string"!==r){if("object"!==r)throw new Error(n);if(null===e)throw new Error(n);if(s&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!(Array.isArray(e)||s&&ArrayBuffer.isView(e)))throw new Error(n);t=!0}var i=0,o=e.length;if(t)i=o;else for(var a=0;a<e.length;++a){var u=e.charCodeAt(a);u<128?i+=1:u<2048?i+=2:u<55296||u>=57344?i+=3:(u=65536+((1023&u)<<10|1023&e.charCodeAt(++a)),i+=4)}return i+=this.encode(8*i),this.update(e),i},D.prototype.bytepad=function(e,t){for(var n=this.encode(t),r=0;r<e.length;++r)n+=this.encodeString(e[r]);var i=t-n%t,o=[];return o.length=i,this.update(o),this},D.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex,n=this.blockCount,r=this.s;if(e[t>>2]|=this.padding[3&t],this.lastByteIndex===this.byteCount)for(e[0]=e[n],t=1;t<n+1;++t)e[t]=0;for(e[n-1]|=2147483648,t=0;t<n;++t)r[t]^=e[t];O(r)}},D.prototype.toString=D.prototype.hex=function(){this.finalize();for(var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s="";a<r;){for(o=0;o<t&&a<r;++o,++a)e=n[o],s+=u[e>>4&15]+u[15&e]+u[e>>12&15]+u[e>>8&15]+u[e>>20&15]+u[e>>16&15]+u[e>>28&15]+u[e>>24&15];a%t==0&&(O(n),o=0)}return i&&(e=n[o],s+=u[e>>4&15]+u[15&e],i>1&&(s+=u[e>>12&15]+u[e>>8&15]),i>2&&(s+=u[e>>20&15]+u[e>>16&15])),s},D.prototype.arrayBuffer=function(){this.finalize();var e,t=this.blockCount,n=this.s,r=this.outputBlocks,i=this.extraBytes,o=0,a=0,s=this.outputBits>>3;e=i?new ArrayBuffer(r+1<<2):new ArrayBuffer(s);for(var u=new Uint32Array(e);a<r;){for(o=0;o<t&&a<r;++o,++a)u[a]=n[o];a%t==0&&O(n)}return i&&(u[o]=n[o],e=e.slice(0,s)),e},D.prototype.buffer=D.prototype.arrayBuffer,D.prototype.digest=D.prototype.array=function(){this.finalize();for(var e,t,n=this.blockCount,r=this.s,i=this.outputBlocks,o=this.extraBytes,a=0,s=0,u=[];s<i;){for(a=0;a<n&&s<i;++a,++s)e=s<<2,t=r[a],u[e]=255&t,u[e+1]=t>>8&255,u[e+2]=t>>16&255,u[e+3]=t>>24&255;s%n==0&&O(r)}return o&&(e=s<<2,t=r[a],u[e]=255&t,o>1&&(u[e+1]=t>>8&255),o>2&&(u[e+2]=t>>16&255)),u},C.prototype=new D,C.prototype.finalize=function(){return this.encode(this.outputBits,!0),D.prototype.finalize.call(this)};var O=function(e){var t,n,r,i,o,a,s,u,c,l,d,f,p,y,m,g,v,w,b,M,A,I,N,T,E,x,k,L,S,j,D,C,O,z,P,_,B,R,U,Q,W,Y,F,V,H,G,q,Z,J,X,K,$,ee,te,ne,re,ie,oe,ae,se,ue,ce,le;for(r=0;r<48;r+=2)i=e[0]^e[10]^e[20]^e[30]^e[40],o=e[1]^e[11]^e[21]^e[31]^e[41],a=e[2]^e[12]^e[22]^e[32]^e[42],s=e[3]^e[13]^e[23]^e[33]^e[43],u=e[4]^e[14]^e[24]^e[34]^e[44],c=e[5]^e[15]^e[25]^e[35]^e[45],l=e[6]^e[16]^e[26]^e[36]^e[46],d=e[7]^e[17]^e[27]^e[37]^e[47],t=(f=e[8]^e[18]^e[28]^e[38]^e[48])^(a<<1|s>>>31),n=(p=e[9]^e[19]^e[29]^e[39]^e[49])^(s<<1|a>>>31),e[0]^=t,e[1]^=n,e[10]^=t,e[11]^=n,e[20]^=t,e[21]^=n,e[30]^=t,e[31]^=n,e[40]^=t,e[41]^=n,t=i^(u<<1|c>>>31),n=o^(c<<1|u>>>31),e[2]^=t,e[3]^=n,e[12]^=t,e[13]^=n,e[22]^=t,e[23]^=n,e[32]^=t,e[33]^=n,e[42]^=t,e[43]^=n,t=a^(l<<1|d>>>31),n=s^(d<<1|l>>>31),e[4]^=t,e[5]^=n,e[14]^=t,e[15]^=n,e[24]^=t,e[25]^=n,e[34]^=t,e[35]^=n,e[44]^=t,e[45]^=n,t=u^(f<<1|p>>>31),n=c^(p<<1|f>>>31),e[6]^=t,e[7]^=n,e[16]^=t,e[17]^=n,e[26]^=t,e[27]^=n,e[36]^=t,e[37]^=n,e[46]^=t,e[47]^=n,t=l^(i<<1|o>>>31),n=d^(o<<1|i>>>31),e[8]^=t,e[9]^=n,e[18]^=t,e[19]^=n,e[28]^=t,e[29]^=n,e[38]^=t,e[39]^=n,e[48]^=t,e[49]^=n,y=e[0],m=e[1],G=e[11]<<4|e[10]>>>28,q=e[10]<<4|e[11]>>>28,L=e[20]<<3|e[21]>>>29,S=e[21]<<3|e[20]>>>29,se=e[31]<<9|e[30]>>>23,ue=e[30]<<9|e[31]>>>23,Y=e[40]<<18|e[41]>>>14,F=e[41]<<18|e[40]>>>14,z=e[2]<<1|e[3]>>>31,P=e[3]<<1|e[2]>>>31,g=e[13]<<12|e[12]>>>20,v=e[12]<<12|e[13]>>>20,Z=e[22]<<10|e[23]>>>22,J=e[23]<<10|e[22]>>>22,j=e[33]<<13|e[32]>>>19,D=e[32]<<13|e[33]>>>19,ce=e[42]<<2|e[43]>>>30,le=e[43]<<2|e[42]>>>30,te=e[5]<<30|e[4]>>>2,ne=e[4]<<30|e[5]>>>2,_=e[14]<<6|e[15]>>>26,B=e[15]<<6|e[14]>>>26,w=e[25]<<11|e[24]>>>21,b=e[24]<<11|e[25]>>>21,X=e[34]<<15|e[35]>>>17,K=e[35]<<15|e[34]>>>17,C=e[45]<<29|e[44]>>>3,O=e[44]<<29|e[45]>>>3,T=e[6]<<28|e[7]>>>4,E=e[7]<<28|e[6]>>>4,re=e[17]<<23|e[16]>>>9,ie=e[16]<<23|e[17]>>>9,R=e[26]<<25|e[27]>>>7,U=e[27]<<25|e[26]>>>7,M=e[36]<<21|e[37]>>>11,A=e[37]<<21|e[36]>>>11,$=e[47]<<24|e[46]>>>8,ee=e[46]<<24|e[47]>>>8,V=e[8]<<27|e[9]>>>5,H=e[9]<<27|e[8]>>>5,x=e[18]<<20|e[19]>>>12,k=e[19]<<20|e[18]>>>12,oe=e[29]<<7|e[28]>>>25,ae=e[28]<<7|e[29]>>>25,Q=e[38]<<8|e[39]>>>24,W=e[39]<<8|e[38]>>>24,I=e[48]<<14|e[49]>>>18,N=e[49]<<14|e[48]>>>18,e[0]=y^~g&w,e[1]=m^~v&b,e[10]=T^~x&L,e[11]=E^~k&S,e[20]=z^~_&R,e[21]=P^~B&U,e[30]=V^~G&Z,e[31]=H^~q&J,e[40]=te^~re&oe,e[41]=ne^~ie&ae,e[2]=g^~w&M,e[3]=v^~b&A,e[12]=x^~L&j,e[13]=k^~S&D,e[22]=_^~R&Q,e[23]=B^~U&W,e[32]=G^~Z&X,e[33]=q^~J&K,e[42]=re^~oe&se,e[43]=ie^~ae&ue,e[4]=w^~M&I,e[5]=b^~A&N,e[14]=L^~j&C,e[15]=S^~D&O,e[24]=R^~Q&Y,e[25]=U^~W&F,e[34]=Z^~X&$,e[35]=J^~K&ee,e[44]=oe^~se&ce,e[45]=ae^~ue&le,e[6]=M^~I&y,e[7]=A^~N&m,e[16]=j^~C&T,e[17]=D^~O&E,e[26]=Q^~Y&z,e[27]=W^~F&P,e[36]=X^~$&V,e[37]=K^~ee&H,e[46]=se^~ce&te,e[47]=ue^~le&ne,e[8]=I^~y&g,e[9]=N^~m&v,e[18]=C^~T&x,e[19]=O^~E&k,e[28]=Y^~z&_,e[29]=F^~P&B,e[38]=$^~V&G,e[39]=ee^~H&q,e[48]=ce^~te&re,e[49]=le^~ne&ie,e[0]^=h[r],e[1]^=h[r+1]};if(a)t.exports=N;else for(E=0;E<T.length;++E)i[T[E]]=N[T[E]]}()}(de);var fe,pe,ye=de.exports,me=!1,ge=!1,ve={debug:1,default:2,info:2,warning:3,error:4,off:5},we=ve.default,be=null,Me=function(){try{var e=[];if(["NFD","NFC","NFKD","NFKC"].forEach((function(t){try{if("test"!=="test".normalize(t))throw new Error("bad normalize")}catch(n){e.push(t)}})),e.length)throw new Error("missing "+e.join(", "));if(String.fromCharCode(233).normalize("NFD")!==String.fromCharCode(101,769))throw new Error("broken implementation")}catch(e){return e.message}return null}();!function(e){e.DEBUG="DEBUG",e.INFO="INFO",e.WARNING="WARNING",e.ERROR="ERROR",e.OFF="OFF"}(fe||(fe={})),function(e){e.UNKNOWN_ERROR="UNKNOWN_ERROR",e.NOT_IMPLEMENTED="NOT_IMPLEMENTED",e.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",e.NETWORK_ERROR="NETWORK_ERROR",e.SERVER_ERROR="SERVER_ERROR",e.TIMEOUT="TIMEOUT",e.BUFFER_OVERRUN="BUFFER_OVERRUN",e.NUMERIC_FAULT="NUMERIC_FAULT",e.MISSING_NEW="MISSING_NEW",e.INVALID_ARGUMENT="INVALID_ARGUMENT",e.MISSING_ARGUMENT="MISSING_ARGUMENT",e.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",e.CALL_EXCEPTION="CALL_EXCEPTION",e.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",e.NONCE_EXPIRED="NONCE_EXPIRED",e.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",e.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",e.TRANSACTION_REPLACED="TRANSACTION_REPLACED",e.ACTION_REJECTED="ACTION_REJECTED"}(pe||(pe={}));var Ae="0123456789abcdef",Ie=function(){function e(t){v(this,e),Object.defineProperty(this,"version",{enumerable:!0,value:t,writable:!1})}return b(e,[{key:"_log",value:function(e,t){var n=e.toLowerCase();null==ve[n]&&this.throwArgumentError("invalid log level name","logLevel",e),!(we>ve[n])&&console.log.apply(console,t)}},{key:"debug",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this._log(e.levels.DEBUG,n)}},{key:"info",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this._log(e.levels.INFO,n)}},{key:"warn",value:function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];this._log(e.levels.WARNING,n)}},{key:"makeError",value:function(t,n,r){if(ge)return this.makeError("censored error",n,{});n||(n=e.errors.UNKNOWN_ERROR),r||(r={});var i=[];Object.keys(r).forEach((function(e){var t=r[e];try{if(t instanceof Uint8Array){for(var n="",o=0;o<t.length;o++)n+=Ae[t[o]>>4],n+=Ae[15&t[o]];i.push(e+"=Uint8Array(0x"+n+")")}else i.push(e+"="+JSON.stringify(t))}catch(t){i.push(e+"="+JSON.stringify(r[e].toString()))}})),i.push("code=".concat(n)),i.push("version=".concat(this.version));var o=t,a="";switch(n){case pe.NUMERIC_FAULT:a="NUMERIC_FAULT";var s=t;switch(s){case"overflow":case"underflow":case"division-by-zero":a+="-"+s;break;case"negative-power":case"negative-width":a+="-unsupported";break;case"unbound-bitwise-result":a+="-unbound-result"}break;case pe.CALL_EXCEPTION:case pe.INSUFFICIENT_FUNDS:case pe.MISSING_NEW:case pe.NONCE_EXPIRED:case pe.REPLACEMENT_UNDERPRICED:case pe.TRANSACTION_REPLACED:case pe.UNPREDICTABLE_GAS_LIMIT:a=n}a&&(t+=" [ See: https://links.ethers.org/v5-errors-"+a+" ]"),i.length&&(t+=" ("+i.join(", ")+")");var u=new Error(t);return u.reason=o,u.code=n,Object.keys(r).forEach((function(e){u[e]=r[e]})),u}},{key:"throwError",value:function(e,t,n){throw this.makeError(e,t,n)}},{key:"throwArgumentError",value:function(t,n,r){return this.throwError(t,e.errors.INVALID_ARGUMENT,{argument:n,value:r})}},{key:"assert",value:function(e,t,n,r){e||this.throwError(t,n,r)}},{key:"assertArgument",value:function(e,t,n,r){e||this.throwArgumentError(t,n,r)}},{key:"checkNormalize",value:function(t){Me&&this.throwError("platform missing String.prototype.normalize",e.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Me})}},{key:"checkSafeUint53",value:function(t,n){"number"==typeof t&&(null==n&&(n="value not safe"),(t<0||t>=9007199254740991)&&this.throwError(n,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:t}),t%1&&this.throwError(n,e.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:t}))}},{key:"checkArgumentCount",value:function(t,n,r){r=r?": "+r:"",t<n&&this.throwError("missing argument"+r,e.errors.MISSING_ARGUMENT,{count:t,expectedCount:n}),t>n&&this.throwError("too many arguments"+r,e.errors.UNEXPECTED_ARGUMENT,{count:t,expectedCount:n})}},{key:"checkNew",value:function(t,n){(t===Object||null==t)&&this.throwError("missing new",e.errors.MISSING_NEW,{name:n.name})}},{key:"checkAbstract",value:function(t,n){t===n?this.throwError("cannot instantiate abstract class "+JSON.stringify(n.name)+" directly; use a sub-class",e.errors.UNSUPPORTED_OPERATION,{name:t.name,operation:"new"}):(t===Object||null==t)&&this.throwError("missing new",e.errors.MISSING_NEW,{name:n.name})}}],[{key:"globalLogger",value:function(){return be||(be=new e("logger/5.7.0")),be}},{key:"setCensorship",value:function(t,n){if(!t&&n&&this.globalLogger().throwError("cannot permanently disable censorship",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),me){if(!t)return;this.globalLogger().throwError("error censorship permanent",e.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}ge=!!t,me=!!n}},{key:"setLogLevel",value:function(t){var n=ve[t.toLowerCase()];null!=n?we=n:e.globalLogger().warn("invalid log level - "+t)}},{key:"from",value:function(t){return new e(t)}}])}();Ie.errors=pe,Ie.levels=fe;var Ne=new Ie("bytes/5.7.0");function Te(e){return!!e.toHexString}function Ee(e){return e.slice||(e.slice=function(){var t=Array.prototype.slice.call(arguments);return Ee(new Uint8Array(Array.prototype.slice.apply(e,t)))}),e}function xe(e){return"number"==typeof e&&e==e&&e%1==0}function ke(e){if(null==e)return!1;if(e.constructor===Uint8Array)return!0;if("string"==typeof e||!xe(e.length)||e.length<0)return!1;for(var t=0;t<e.length;t++){var n=e[t];if(!xe(n)||n<0||n>=256)return!1}return!0}function Le(e,t){if(t||(t={}),"number"==typeof e){Ne.checkSafeUint53(e,"invalid arrayify value");for(var n=[];e;)n.unshift(255&e),e=parseInt(String(e/256));return 0===n.length&&n.push(0),Ee(new Uint8Array(n))}if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Te(e)&&(e=e.toHexString()),Se(e)){var r=e.substring(2);r.length%2&&("left"===t.hexPad?r="0"+r:"right"===t.hexPad?r+="0":Ne.throwArgumentError("hex data is odd-length","value",e));for(var i=[],o=0;o<r.length;o+=2)i.push(parseInt(r.substring(o,o+2),16));return Ee(new Uint8Array(i))}return ke(e)?Ee(new Uint8Array(e)):Ne.throwArgumentError("invalid arrayify value","value",e)}function Se(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/)||t&&e.length!==2+2*t)}var je="0123456789abcdef";function De(e,t){if(t||(t={}),"number"==typeof e){Ne.checkSafeUint53(e,"invalid hexlify value");for(var n="";e;)n=je[15&e]+n,e=Math.floor(e/16);return n.length?(n.length%2&&(n="0"+n),"0x"+n):"0x00"}if("bigint"==typeof e)return(e=e.toString(16)).length%2?"0x0"+e:"0x"+e;if(t.allowMissingPrefix&&"string"==typeof e&&"0x"!==e.substring(0,2)&&(e="0x"+e),Te(e))return e.toHexString();if(Se(e))return e.length%2&&("left"===t.hexPad?e="0x0"+e.substring(2):"right"===t.hexPad?e+="0":Ne.throwArgumentError("hex data is odd-length","value",e)),e.toLowerCase();if(ke(e)){for(var r="0x",i=0;i<e.length;i++){var o=e[i];r+=je[(240&o)>>4]+je[15&o]}return r}return Ne.throwArgumentError("invalid hexlify value","value",e)}function Ce(e,t,n){return"string"!=typeof e?e=De(e):(!Se(e)||e.length%2)&&Ne.throwArgumentError("invalid hexData","value",e),t=2+2*t,null!=n?"0x"+e.substring(t,2+2*n):"0x"+e.substring(t)}function Oe(e,t){for("string"!=typeof e?e=De(e):Se(e)||Ne.throwArgumentError("invalid hex string","value",e),e.length>2*t+2&&Ne.throwArgumentError("value out of range","value",arguments[1]);e.length<2*t+2;)e="0x0"+e.substring(2);return e}function ze(e){var t={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(function(e){return Se(e)&&!(e.length%2)||ke(e)}(e)){var n=Le(e);64===n.length?(t.v=27+(n[32]>>7),n[32]&=127,t.r=De(n.slice(0,32)),t.s=De(n.slice(32,64))):65===n.length?(t.r=De(n.slice(0,32)),t.s=De(n.slice(32,64)),t.v=n[64]):Ne.throwArgumentError("invalid signature string","signature",e),t.v<27&&(0===t.v||1===t.v?t.v+=27:Ne.throwArgumentError("signature invalid v byte","signature",e)),t.recoveryParam=1-t.v%2,t.recoveryParam&&(n[32]|=128),t._vs=De(n.slice(32,64))}else{if(t.r=e.r,t.s=e.s,t.v=e.v,t.recoveryParam=e.recoveryParam,t._vs=e._vs,null!=t._vs){var r=function(e,t){(e=Le(e)).length>t&&Ne.throwArgumentError("value out of range","value",arguments[0]);var n=new Uint8Array(t);return n.set(e,t-e.length),Ee(n)}(Le(t._vs),32);t._vs=De(r);var i=r[0]>=128?1:0;null==t.recoveryParam?t.recoveryParam=i:t.recoveryParam!==i&&Ne.throwArgumentError("signature recoveryParam mismatch _vs","signature",e),r[0]&=127;var o=De(r);null==t.s?t.s=o:t.s!==o&&Ne.throwArgumentError("signature v mismatch _vs","signature",e)}if(null==t.recoveryParam)null==t.v?Ne.throwArgumentError("signature missing v and recoveryParam","signature",e):0===t.v||1===t.v?t.recoveryParam=t.v:t.recoveryParam=1-t.v%2;else if(null==t.v)t.v=27+t.recoveryParam;else{var a=0===t.v||1===t.v?t.v:1-t.v%2;t.recoveryParam!==a&&Ne.throwArgumentError("signature recoveryParam mismatch v","signature",e)}null!=t.r&&Se(t.r)?t.r=Oe(t.r,32):Ne.throwArgumentError("signature missing or invalid r","signature",e),null!=t.s&&Se(t.s)?t.s=Oe(t.s,32):Ne.throwArgumentError("signature missing or invalid s","signature",e);var s=Le(t.s);s[0]>=128&&Ne.throwArgumentError("signature s out of range","signature",e),t.recoveryParam&&(s[0]|=128);var u=De(s);t._vs&&(Se(t._vs)||Ne.throwArgumentError("signature invalid _vs","signature",e),t._vs=Oe(t._vs,32)),null==t._vs?t._vs=u:t._vs!==u&&Ne.throwArgumentError("signature _vs mismatch v and s","signature",e)}return t.yParityAndS=t._vs,t.compact=t.r+t.yParityAndS.substring(2),t}function Pe(e){return"0x"+ye.keccak_256(Le(e))}var _e={exports:{}},Be=function(e){var t=e.default;if("function"==typeof t){var n=function(){return t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})})),n}(Object.freeze({__proto__:null,default:{}}));!function(e){!function(e,t){function n(e,t){if(!e)throw new Error(t||"Assertion failed")}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&(("le"===t||"be"===t)&&(n=t,t=10),this._init(e||0,t||10,n||"be"))}var o;"object"==I(e)?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;try{o=("undefined"==typeof window?"undefined":I(window))<"u"&&I(window.Buffer)<"u"?window.Buffer:Be.Buffer}catch(e){}function a(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function s(e,t,n){var r=a(e,n);return n-1>=t&&(r|=a(e,n-1)<<4),r}function u(e,t,r,i){for(var o=0,a=0,s=Math.min(e.length,r),u=t;u<s;u++){var c=e.charCodeAt(u)-48;o*=i,a=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&a<i,"Invalid character"),o+=a}return o}function c(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(i.isBN=function(e){return e instanceof i||null!==e&&"object"==I(e)&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==I(e))return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var o,a,s=0;if("be"===r)for(i=e.length-1,o=0;i>=0;i-=3)a=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);else if("le"===r)for(i=0,o=0;i<e.length;i+=3)a=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[o]|=a<<s&67108863,this.words[o+1]=a>>>26-s&67108863,(s+=24)>=26&&(s-=26,o++);return this._strip()},i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i,o=0,a=0;if("be"===n)for(r=e.length-1;r>=t;r-=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)i=s(e,t,r)<<o,this.words[a]|=67108863&i,o>=18?(o-=18,a+=1,this.words[a]|=i>>>26):o+=8;this._strip()},i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var o=e.length-n,a=o%r,s=Math.min(o,o-a)+n,c=0,l=n;l<s;l+=r)c=u(e,l,l+r,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==a){var h=1;for(c=u(e,l,e.length,t),l=0;l<a;l++)h*=t;this.imuln(h),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype._move=function(e){c(e,this)},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},i.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},("undefined"==typeof Symbol?"undefined":I(Symbol))<"u"&&"function"==typeof Symbol.for)try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=l}catch(e){i.prototype.inspect=l}else i.prototype.inspect=l;function l(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var h=["","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"],d=[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],f=[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 p(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=0|e.words[0],o=0|t.words[0],a=i*o,s=67108863&a,u=a/67108864|0;n.words[0]=s;for(var c=1;c<r;c++){for(var l=u>>>26,h=67108863&u,d=Math.min(c,t.length-1),f=Math.max(0,c-e.length+1);f<=d;f++){var p=c-f|0;l+=(a=(i=0|e.words[p])*(o=0|t.words[f])+h)/67108864|0,h=67108863&a}n.words[c]=0|h,u=0|l}return 0!==u?n.words[c]=0|u:n.length--,n._strip()}i.prototype.toString=function(e,t){var r;if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var i=0,o=0,a=0;a<this.length;a++){var s=this.words[a],u=(16777215&(s<<i|o)).toString(16);o=s>>>24-i&16777215,(i+=2)>=26&&(i-=26,a--),r=0!==o||a!==this.length-1?h[6-u.length]+u+r:u+r}for(0!==o&&(r=o.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=d[e],l=f[e];r="";var p=this.clone();for(p.negative=0;!p.isZero();){var y=p.modrn(l).toString(e);r=(p=p.idivn(l)).isZero()?y+r:h[c-y.length]+y+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(e,t){return this.toArrayLike(o,e,t)}),i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),o=r||Math.max(1,i);n(i<=o,"byte array longer than desired length"),n(o>0,"Requested array length <= 0");var a=function(e,t){return e.allocUnsafe?e.allocUnsafe(t):new e(t)}(e,o);return this["_toArrayLike"+("le"===t?"LE":"BE")](a,i),a},i.prototype._toArrayLikeLE=function(e,t){for(var n=0,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n++]=255&a,n<e.length&&(e[n++]=a>>8&255),n<e.length&&(e[n++]=a>>16&255),6===o?(n<e.length&&(e[n++]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n<e.length)for(e[n++]=r;n<e.length;)e[n++]=0},i.prototype._toArrayLikeBE=function(e,t){for(var n=e.length-1,r=0,i=0,o=0;i<this.length;i++){var a=this.words[i]<<o|r;e[n--]=255&a,n>=0&&(e[n--]=a>>8&255),n>=0&&(e[n--]=a>>16&255),6===o?(n>=0&&(e[n--]=a>>24&255),r=0,o=0):(r=a>>>24,o+=2)}if(n>=0)for(e[n--]=r;n>=0;)e[n--]=0},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,n=0;return 8191&t||(n+=13,t>>>=13),127&t||(n+=7,t>>>=7),15&t||(n+=4,t>>>=4),3&t||(n+=2,t>>>=2),1&t||n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return 26*(this.length-1)+t},i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,26!==n)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return 0!==this.negative},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},i.prototype.ior=function(e){return n(0==(this.negative|e.negative)),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this._strip()},i.prototype.iand=function(e){return n(0==(this.negative|e.negative)),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this._strip()},i.prototype.ixor=function(e){return n(0==(this.negative|e.negative)),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),this.words[r]=t?this.words[r]|1<<i:this.words[r]&~(1<<i),this._strip()},i.prototype.iadd=function(e){var t,n,r;if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,o=0;o<r.length;o++)t=(0|n.words[o])+(0|r.words[o])+i,this.words[o]=67108863&t,i=t>>>26;for(;0!==i&&o<n.length;o++)t=(0|n.words[o])+i,this.words[o]=67108863&t,i=t>>>26;if(this.length=n.length,0!==i)this.words[this.length]=i,this.length++;else if(n!==this)for(;o<n.length;o++)this.words[o]=n.words[o];return this},i.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n,r,i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(n=this,r=e):(n=e,r=this);for(var o=0,a=0;a<r.length;a++)o=(t=(0|n.words[a])-(0|r.words[a])+o)>>26,this.words[a]=67108863&t;for(;0!==o&&a<n.length;a++)o=(t=(0|n.words[a])+o)>>26,this.words[a]=67108863&t;if(0===o&&a<n.length&&n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this.length=Math.max(this.length,a),n!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(e){return this.clone().isub(e)};var y=function(e,t,n){var r,i,o,a=e.words,s=t.words,u=n.words,c=0,l=0|a[0],h=8191&l,d=l>>>13,f=0|a[1],p=8191&f,y=f>>>13,m=0|a[2],g=8191&m,v=m>>>13,w=0|a[3],b=8191&w,M=w>>>13,A=0|a[4],I=8191&A,N=A>>>13,T=0|a[5],E=8191&T,x=T>>>13,k=0|a[6],L=8191&k,S=k>>>13,j=0|a[7],D=8191&j,C=j>>>13,O=0|a[8],z=8191&O,P=O>>>13,_=0|a[9],B=8191&_,R=_>>>13,U=0|s[0],Q=8191&U,W=U>>>13,Y=0|s[1],F=8191&Y,V=Y>>>13,H=0|s[2],G=8191&H,q=H>>>13,Z=0|s[3],J=8191&Z,X=Z>>>13,K=0|s[4],$=8191&K,ee=K>>>13,te=0|s[5],ne=8191&te,re=te>>>13,ie=0|s[6],oe=8191&ie,ae=ie>>>13,se=0|s[7],ue=8191&se,ce=se>>>13,le=0|s[8],he=8191&le,de=le>>>13,fe=0|s[9],pe=8191&fe,ye=fe>>>13;n.negative=e.negative^t.negative,n.length=19;var me=(c+(r=Math.imul(h,Q))|0)+((8191&(i=(i=Math.imul(h,W))+Math.imul(d,Q)|0))<<13)|0;c=((o=Math.imul(d,W))+(i>>>13)|0)+(me>>>26)|0,me&=67108863,r=Math.imul(p,Q),i=(i=Math.imul(p,W))+Math.imul(y,Q)|0,o=Math.imul(y,W);var ge=(c+(r=r+Math.imul(h,F)|0)|0)+((8191&(i=(i=i+Math.imul(h,V)|0)+Math.imul(d,F)|0))<<13)|0;c=((o=o+Math.imul(d,V)|0)+(i>>>13)|0)+(ge>>>26)|0,ge&=67108863,r=Math.imul(g,Q),i=(i=Math.imul(g,W))+Math.imul(v,Q)|0,o=Math.imul(v,W),r=r+Math.imul(p,F)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(y,F)|0,o=o+Math.imul(y,V)|0;var ve=(c+(r=r+Math.imul(h,G)|0)|0)+((8191&(i=(i=i+Math.imul(h,q)|0)+Math.imul(d,G)|0))<<13)|0;c=((o=o+Math.imul(d,q)|0)+(i>>>13)|0)+(ve>>>26)|0,ve&=67108863,r=Math.imul(b,Q),i=(i=Math.imul(b,W))+Math.imul(M,Q)|0,o=Math.imul(M,W),r=r+Math.imul(g,F)|0,i=(i=i+Math.imul(g,V)|0)+Math.imul(v,F)|0,o=o+Math.imul(v,V)|0,r=r+Math.imul(p,G)|0,i=(i=i+Math.imul(p,q)|0)+Math.imul(y,G)|0,o=o+Math.imul(y,q)|0;var we=(c+(r=r+Math.imul(h,J)|0)|0)+((8191&(i=(i=i+Math.imul(h,X)|0)+Math.imul(d,J)|0))<<13)|0;c=((o=o+Math.imul(d,X)|0)+(i>>>13)|0)+(we>>>26)|0,we&=67108863,r=Math.imul(I,Q),i=(i=Math.imul(I,W))+Math.imul(N,Q)|0,o=Math.imul(N,W),r=r+Math.imul(b,F)|0,i=(i=i+Math.imul(b,V)|0)+Math.imul(M,F)|0,o=o+Math.imul(M,V)|0,r=r+Math.imul(g,G)|0,i=(i=i+Math.imul(g,q)|0)+Math.imul(v,G)|0,o=o+Math.imul(v,q)|0,r=r+Math.imul(p,J)|0,i=(i=i+Math.imul(p,X)|0)+Math.imul(y,J)|0,o=o+Math.imul(y,X)|0;var be=(c+(r=r+Math.imul(h,$)|0)|0)+((8191&(i=(i=i+Math.imul(h,ee)|0)+Math.imul(d,$)|0))<<13)|0;c=((o=o+Math.imul(d,ee)|0)+(i>>>13)|0)+(be>>>26)|0,be&=67108863,r=Math.imul(E,Q),i=(i=Math.imul(E,W))+Math.imul(x,Q)|0,o=Math.imul(x,W),r=r+Math.imul(I,F)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(N,F)|0,o=o+Math.imul(N,V)|0,r=r+Math.imul(b,G)|0,i=(i=i+Math.imul(b,q)|0)+Math.imul(M,G)|0,o=o+Math.imul(M,q)|0,r=r+Math.imul(g,J)|0,i=(i=i+Math.imul(g,X)|0)+Math.imul(v,J)|0,o=o+Math.imul(v,X)|0,r=r+Math.imul(p,$)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(y,$)|0,o=o+Math.imul(y,ee)|0;var Me=(c+(r=r+Math.imul(h,ne)|0)|0)+((8191&(i=(i=i+Math.imul(h,re)|0)+Math.imul(d,ne)|0))<<13)|0;c=((o=o+Math.imul(d,re)|0)+(i>>>13)|0)+(Me>>>26)|0,Me&=67108863,r=Math.imul(L,Q),i=(i=Math.imul(L,W))+Math.imul(S,Q)|0,o=Math.imul(S,W),r=r+Math.imul(E,F)|0,i=(i=i+Math.imul(E,V)|0)+Math.imul(x,F)|0,o=o+Math.imul(x,V)|0,r=r+Math.imul(I,G)|0,i=(i=i+Math.imul(I,q)|0)+Math.imul(N,G)|0,o=o+Math.imul(N,q)|0,r=r+Math.imul(b,J)|0,i=(i=i+Math.imul(b,X)|0)+Math.imul(M,J)|0,o=o+Math.imul(M,X)|0,r=r+Math.imul(g,$)|0,i=(i=i+Math.imul(g,ee)|0)+Math.imul(v,$)|0,o=o+Math.imul(v,ee)|0,r=r+Math.imul(p,ne)|0,i=(i=i+Math.imul(p,re)|0)+Math.imul(y,ne)|0,o=o+Math.imul(y,re)|0;var Ae=(c+(r=r+Math.imul(h,oe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ae)|0)+Math.imul(d,oe)|0))<<13)|0;c=((o=o+Math.imul(d,ae)|0)+(i>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,r=Math.imul(D,Q),i=(i=Math.imul(D,W))+Math.imul(C,Q)|0,o=Math.imul(C,W),r=r+Math.imul(L,F)|0,i=(i=i+Math.imul(L,V)|0)+Math.imul(S,F)|0,o=o+Math.imul(S,V)|0,r=r+Math.imul(E,G)|0,i=(i=i+Math.imul(E,q)|0)+Math.imul(x,G)|0,o=o+Math.imul(x,q)|0,r=r+Math.imul(I,J)|0,i=(i=i+Math.imul(I,X)|0)+Math.imul(N,J)|0,o=o+Math.imul(N,X)|0,r=r+Math.imul(b,$)|0,i=(i=i+Math.imul(b,ee)|0)+Math.imul(M,$)|0,o=o+Math.imul(M,ee)|0,r=r+Math.imul(g,ne)|0,i=(i=i+Math.imul(g,re)|0)+Math.imul(v,ne)|0,o=o+Math.imul(v,re)|0,r=r+Math.imul(p,oe)|0,i=(i=i+Math.imul(p,ae)|0)+Math.imul(y,oe)|0,o=o+Math.imul(y,ae)|0;var Ie=(c+(r=r+Math.imul(h,ue)|0)|0)+((8191&(i=(i=i+Math.imul(h,ce)|0)+Math.imul(d,ue)|0))<<13)|0;c=((o=o+Math.imul(d,ce)|0)+(i>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,r=Math.imul(z,Q),i=(i=Math.imul(z,W))+Math.imul(P,Q)|0,o=Math.imul(P,W),r=r+Math.imul(D,F)|0,i=(i=i+Math.imul(D,V)|0)+Math.imul(C,F)|0,o=o+Math.imul(C,V)|0,r=r+Math.imul(L,G)|0,i=(i=i+Math.imul(L,q)|0)+Math.imul(S,G)|0,o=o+Math.imul(S,q)|0,r=r+Math.imul(E,J)|0,i=(i=i+Math.imul(E,X)|0)+Math.imul(x,J)|0,o=o+Math.imul(x,X)|0,r=r+Math.imul(I,$)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(N,$)|0,o=o+Math.imul(N,ee)|0,r=r+Math.imul(b,ne)|0,i=(i=i+Math.imul(b,re)|0)+Math.imul(M,ne)|0,o=o+Math.imul(M,re)|0,r=r+Math.imul(g,oe)|0,i=(i=i+Math.imul(g,ae)|0)+Math.imul(v,oe)|0,o=o+Math.imul(v,ae)|0,r=r+Math.imul(p,ue)|0,i=(i=i+Math.imul(p,ce)|0)+Math.imul(y,ue)|0,o=o+Math.imul(y,ce)|0;var Ne=(c+(r=r+Math.imul(h,he)|0)|0)+((8191&(i=(i=i+Math.imul(h,de)|0)+Math.imul(d,he)|0))<<13)|0;c=((o=o+Math.imul(d,de)|0)+(i>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,r=Math.imul(B,Q),i=(i=Math.imul(B,W))+Math.imul(R,Q)|0,o=Math.imul(R,W),r=r+Math.imul(z,F)|0,i=(i=i+Math.imul(z,V)|0)+Math.imul(P,F)|0,o=o+Math.imul(P,V)|0,r=r+Math.imul(D,G)|0,i=(i=i+Math.imul(D,q)|0)+Math.imul(C,G)|0,o=o+Math.imul(C,q)|0,r=r+Math.imul(L,J)|0,i=(i=i+Math.imul(L,X)|0)+Math.imul(S,J)|0,o=o+Math.imul(S,X)|0,r=r+Math.imul(E,$)|0,i=(i=i+Math.imul(E,ee)|0)+Math.imul(x,$)|0,o=o+Math.imul(x,ee)|0,r=r+Math.imul(I,ne)|0,i=(i=i+Math.imul(I,re)|0)+Math.imul(N,ne)|0,o=o+Math.imul(N,re)|0,r=r+Math.imul(b,oe)|0,i=(i=i+Math.imul(b,ae)|0)+Math.imul(M,oe)|0,o=o+Math.imul(M,ae)|0,r=r+Math.imul(g,ue)|0,i=(i=i+Math.imul(g,ce)|0)+Math.imul(v,ue)|0,o=o+Math.imul(v,ce)|0,r=r+Math.imul(p,he)|0,i=(i=i+Math.imul(p,de)|0)+Math.imul(y,he)|0,o=o+Math.imul(y,de)|0;var Te=(c+(r=r+Math.imul(h,pe)|0)|0)+((8191&(i=(i=i+Math.imul(h,ye)|0)+Math.imul(d,pe)|0))<<13)|0;c=((o=o+Math.imul(d,ye)|0)+(i>>>13)|0)+(Te>>>26)|0,Te&=67108863,r=Math.imul(B,F),i=(i=Math.imul(B,V))+Math.imul(R,F)|0,o=Math.imul(R,V),r=r+Math.imul(z,G)|0,i=(i=i+Math.imul(z,q)|0)+Math.imul(P,G)|0,o=o+Math.imul(P,q)|0,r=r+Math.imul(D,J)|0,i=(i=i+Math.imul(D,X)|0)+Math.imul(C,J)|0,o=o+Math.imul(C,X)|0,r=r+Math.imul(L,$)|0,i=(i=i+Math.imul(L,ee)|0)+Math.imul(S,$)|0,o=o+Math.imul(S,ee)|0,r=r+Math.imul(E,ne)|0,i=(i=i+Math.imul(E,re)|0)+Math.imul(x,ne)|0,o=o+Math.imul(x,re)|0,r=r+Math.imul(I,oe)|0,i=(i=i+Math.imul(I,ae)|0)+Math.imul(N,oe)|0,o=o+Math.imul(N,ae)|0,r=r+Math.imul(b,ue)|0,i=(i=i+Math.imul(b,ce)|0)+Math.imul(M,ue)|0,o=o+Math.imul(M,ce)|0,r=r+Math.imul(g,he)|0,i=(i=i+Math.imul(g,de)|0)+Math.imul(v,he)|0,o=o+Math.imul(v,de)|0;var Ee=(c+(r=r+Math.imul(p,pe)|0)|0)+((8191&(i=(i=i+Math.imul(p,ye)|0)+Math.imul(y,pe)|0))<<13)|0;c=((o=o+Math.imul(y,ye)|0)+(i>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,r=Math.imul(B,G),i=(i=Math.imul(B,q))+Math.imul(R,G)|0,o=Math.imul(R,q),r=r+Math.imul(z,J)|0,i=(i=i+Math.imul(z,X)|0)+Math.imul(P,J)|0,o=o+Math.imul(P,X)|0,r=r+Math.imul(D,$)|0,i=(i=i+Math.imul(D,ee)|0)+Math.imul(C,$)|0,o=o+Math.imul(C,ee)|0,r=r+Math.imul(L,ne)|0,i=(i=i+Math.imul(L,re)|0)+Math.imul(S,ne)|0,o=o+Math.imul(S,re)|0,r=r+Math.imul(E,oe)|0,i=(i=i+Math.imul(E,ae)|0)+Math.imul(x,oe)|0,o=o+Math.imul(x,ae)|0,r=r+Math.imul(I,ue)|0,i=(i=i+Math.imul(I,ce)|0)+Math.imul(N,ue)|0,o=o+Math.imul(N,ce)|0,r=r+Math.imul(b,he)|0,i=(i=i+Math.imul(b,de)|0)+Math.imul(M,he)|0,o=o+Math.imul(M,de)|0;var xe=(c+(r=r+Math.imul(g,pe)|0)|0)+((8191&(i=(i=i+Math.imul(g,ye)|0)+Math.imul(v,pe)|0))<<13)|0;c=((o=o+Math.imul(v,ye)|0)+(i>>>13)|0)+(xe>>>26)|0,xe&=67108863,r=Math.imul(B,J),i=(i=Math.imul(B,X))+Math.imul(R,J)|0,o=Math.imul(R,X),r=r+Math.imul(z,$)|0,i=(i=i+Math.imul(z,ee)|0)+Math.imul(P,$)|0,o=o+Math.imul(P,ee)|0,r=r+Math.imul(D,ne)|0,i=(i=i+Math.imul(D,re)|0)+Math.imul(C,ne)|0,o=o+Math.imul(C,re)|0,r=r+Math.imul(L,oe)|0,i=(i=i+Math.imul(L,ae)|0)+Math.imul(S,oe)|0,o=o+Math.imul(S,ae)|0,r=r+Math.imul(E,ue)|0,i=(i=i+Math.imul(E,ce)|0)+Math.imul(x,ue)|0,o=o+Math.imul(x,ce)|0,r=r+Math.imul(I,he)|0,i=(i=i+Math.imul(I,de)|0)+Math.imul(N,he)|0,o=o+Math.imul(N,de)|0;var ke=(c+(r=r+Math.imul(b,pe)|0)|0)+((8191&(i=(i=i+Math.imul(b,ye)|0)+Math.imul(M,pe)|0))<<13)|0;c=((o=o+Math.imul(M,ye)|0)+(i>>>13)|0)+(ke>>>26)|0,ke&=67108863,r=Math.imul(B,$),i=(i=Math.imul(B,ee))+Math.imul(R,$)|0,o=Math.imul(R,ee),r=r+Math.imul(z,ne)|0,i=(i=i+Math.imul(z,re)|0)+Math.imul(P,ne)|0,o=o+Math.imul(P,re)|0,r=r+Math.imul(D,oe)|0,i=(i=i+Math.imul(D,ae)|0)+Math.imul(C,oe)|0,o=o+Math.imul(C,ae)|0,r=r+Math.imul(L,ue)|0,i=(i=i+Math.imul(L,ce)|0)+Math.imul(S,ue)|0,o=o+Math.imul(S,ce)|0,r=r+Math.imul(E,he)|0,i=(i=i+Math.imul(E,de)|0)+Math.imul(x,he)|0,o=o+Math.imul(x,de)|0;var Le=(c+(r=r+Math.imul(I,pe)|0)|0)+((8191&(i=(i=i+Math.imul(I,ye)|0)+Math.imul(N,pe)|0))<<13)|0;c=((o=o+Math.imul(N,ye)|0)+(i>>>13)|0)+(Le>>>26)|0,Le&=67108863,r=Math.imul(B,ne),i=(i=Math.imul(B,re))+Math.imul(R,ne)|0,o=Math.imul(R,re),r=r+Math.imul(z,oe)|0,i=(i=i+Math.imul(z,ae)|0)+Math.imul(P,oe)|0,o=o+Math.imul(P,ae)|0,r=r+Math.imul(D,ue)|0,i=(i=i+Math.imul(D,ce)|0)+Math.imul(C,ue)|0,o=o+Math.imul(C,ce)|0,r=r+Math.imul(L,he)|0,i=(i=i+Math.imul(L,de)|0)+Math.imul(S,he)|0,o=o+Math.imul(S,de)|0;var Se=(c+(r=r+Math.imul(E,pe)|0)|0)+((8191&(i=(i=i+Math.imul(E,ye)|0)+Math.imul(x,pe)|0))<<13)|0;c=((o=o+Math.imul(x,ye)|0)+(i>>>13)|0)+(Se>>>26)|0,Se&=67108863,r=Math.imul(B,oe),i=(i=Math.imul(B,ae))+Math.imul(R,oe)|0,o=Math.imul(R,ae),r=r+Math.imul(z,ue)|0,i=(i=i+Math.imul(z,ce)|0)+Math.imul(P,ue)|0,o=o+Math.imul(P,ce)|0,r=r+Math.imul(D,he)|0,i=(i=i+Math.imul(D,de)|0)+Math.imul(C,he)|0,o=o+Math.imul(C,de)|0;var je=(c+(r=r+Math.imul(L,pe)|0)|0)+((8191&(i=(i=i+Math.imul(L,ye)|0)+Math.imul(S,pe)|0))<<13)|0;c=((o=o+Math.imul(S,ye)|0)+(i>>>13)|0)+(je>>>26)|0,je&=67108863,r=Math.imul(B,ue),i=(i=Math.imul(B,ce))+Math.imul(R,ue)|0,o=Math.imul(R,ce),r=r+Math.imul(z,he)|0,i=(i=i+Math.imul(z,de)|0)+Math.imul(P,he)|0,o=o+Math.imul(P,de)|0;var De=(c+(r=r+Math.imul(D,pe)|0)|0)+((8191&(i=(i=i+Math.imul(D,ye)|0)+Math.imul(C,pe)|0))<<13)|0;c=((o=o+Math.imul(C,ye)|0)+(i>>>13)|0)+(De>>>26)|0,De&=67108863,r=Math.imul(B,he),i=(i=Math.imul(B,de))+Math.imul(R,he)|0,o=Math.imul(R,de);var Ce=(c+(r=r+Math.imul(z,pe)|0)|0)+((8191&(i=(i=i+Math.imul(z,ye)|0)+Math.imul(P,pe)|0))<<13)|0;c=((o=o+Math.imul(P,ye)|0)+(i>>>13)|0)+(Ce>>>26)|0,Ce&=67108863;var Oe=(c+(r=Math.imul(B,pe))|0)+((8191&(i=(i=Math.imul(B,ye))+Math.imul(R,pe)|0))<<13)|0;return c=((o=Math.imul(R,ye))+(i>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,u[0]=me,u[1]=ge,u[2]=ve,u[3]=we,u[4]=be,u[5]=Me,u[6]=Ae,u[7]=Ie,u[8]=Ne,u[9]=Te,u[10]=Ee,u[11]=xe,u[12]=ke,u[13]=Le,u[14]=Se,u[15]=je,u[16]=De,u[17]=Ce,u[18]=Oe,0!==c&&(u[19]=c,n.length++),n};function m(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,o=0;o<n.length-1;o++){var a=i;i=0;for(var s=67108863&r,u=Math.min(o,t.length-1),c=Math.max(0,o-e.length+1);c<=u;c++){var l=o-c,h=(0|e.words[l])*(0|t.words[c]),d=67108863&h;s=67108863&(d=d+s|0),i+=(a=(a=a+(h/67108864|0)|0)+(d>>>26)|0)>>>26,a&=67108863}n.words[o]=s,r=a,a=i}return 0!==r?n.words[o]=r:n.length--,n._strip()}function g(e,t,n){return m(e,t,n)}Math.imul||(y=p),i.prototype.mulTo=function(e,t){var n=this.length+e.length;return 10===this.length&&10===e.length?y(this,e,t):n<63?p(this,e,t):n<1024?m(this,e,t):g(this,e,t)},i.prototype.mul=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=new Array(this.length+e.length),g(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var o=(0|this.words[i])*e,a=(67108863&o)+(67108863&r);r>>=26,r+=o/67108864|0,r+=a>>>26,this.words[i]=67108863&a}return 0!==r&&(this.words[i]=r,this.length++),t?this.ineg():this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=function(e){for(var t=new Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=e.words[r]>>>i&1}return t}(e);if(0===t.length)return new i(1);for(var n=this,r=0;r<t.length&&0===t[r];r++,n=n.sqr());if(++r<t.length)for(var o=n.sqr();r<t.length;r++,o=o.sqr())0!==t[r]&&(n=n.mul(o));return n},i.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,o=67108863>>>26-r<<26-r;if(0!==r){var a=0;for(t=0;t<this.length;t++){var s=this.words[t]&o,u=(0|this.words[t])-s<<r;this.words[t]=u|a,a=s>>>26-r}a&&(this.words[t]=a,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},i.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},i.prototype.iushrn=function(e,t,r){var i;n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var o=e%26,a=Math.min((e-o)/26,this.length),s=67108863^67108863>>>o<<o,u=r;if(i-=a,i=Math.max(0,i),u){for(var c=0;c<a;c++)u.words[c]=this.words[c];u.length=a}if(0!==a)if(this.length>a)for(this.length-=a,c=0;c<this.length;c++)this.words[c]=this.words[c+a];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=i);c--){var h=0|this.words[c];this.words[c]=l<<26-o|h>>>o,l=h&s}return u&&0!==l&&(u.words[u.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return!(this.length<=r||!(this.words[r]&i))},i.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;if(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)return this;if(0!==t&&r++,this.length=Math.min(r,this.length),0!==t){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this._strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return n("number"==typeof e),n(e<67108864),e<0?this.isubn(-e):0!==this.negative?1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,r){var i,o=e.length+r;this._expand(o);var a,s=0;for(i=0;i<e.length;i++){a=(0|this.words[i+r])+s;var u=(0|e.words[i])*t;s=((a-=67108863&u)>>26)-(u/67108864|0),this.words[i+r]=67108863&a}for(;i<this.length-r;i++)s=(a=(0|this.words[i+r])+s)>>26,this.words[i+r]=67108863&a;if(0===s)return this._strip();for(n(-1===s),s=0,i=0;i<this.length;i++)s=(a=-(0|this.words[i])+s)>>26,this.words[i]=67108863&a;return this.negative=1,this._strip()},i.prototype._wordDiv=function(e,t){var n=(this.length,e.length),r=this.clone(),o=e,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),r.iushln(n),a=0|o.words[o.length-1]);var s,u=r.length-o.length;if("mod"!==t){(s=new i(null)).length=u+1,s.words=new Array(s.length);for(var c=0;c<s.length;c++)s.words[c]=0}var l=r.clone()._ishlnsubmul(o,1,u);0===l.negative&&(r=l,s&&(s.words[u]=1));for(var h=u-1;h>=0;h--){var d=67108864*(0|r.words[o.length+h])+(0|r.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),r._ishlnsubmul(o,d,h);0!==r.negative;)d--,r.negative=0,r._ishlnsubmul(o,1,h),r.isZero()||(r.negative^=1);s&&(s.words[h]=d)}return s&&s._strip(),r._strip(),"div"!==t&&0!==n&&r.iushrn(n),{div:s||null,mod:r}},i.prototype.divmod=function(e,t,r){return n(!e.isZero()),this.isZero()?{div:new i(0),mod:new i(0)}:0!==this.negative&&0===e.negative?(s=this.neg().divmod(e,t),"mod"!==t&&(o=s.div.neg()),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.iadd(e)),{div:o,mod:a}):0===this.negative&&0!==e.negative?(s=this.divmod(e.neg(),t),"mod"!==t&&(o=s.div.neg()),{div:o,mod:s.mod}):this.negative&e.negative?(s=this.neg().divmod(e.neg(),t),"div"!==t&&(a=s.mod.neg(),r&&0!==a.negative&&a.isub(e)),{div:s.div,mod:a}):e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new i(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modrn(e.words[0]))}:this._wordDiv(e,t);var o,a,s},i.prototype.div=function(e){return this.divmod(e,"div",!1).div},i.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},i.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=0!==t.div.negative?t.mod.isub(e):t.mod,r=e.ushrn(1),i=e.andln(1),o=n.cmp(r);return o<0||1===i&&0===o?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},i.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=(1<<26)%e,i=0,o=this.length-1;o>=0;o--)i=(r*i+(0|this.words[o]))%e;return t?-i:i},i.prototype.modn=function(e){return this.modrn(e)},i.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var o=(0|this.words[i])+67108864*r;this.words[i]=o/e|0,r=o%e}return this._strip(),t?this.ineg():this},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var o=new i(1),a=new i(0),s=new i(0),u=new i(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var l=r.clone(),h=t.clone();!t.isZero();){for(var d=0,f=1;!(t.words[0]&f)&&d<26;++d,f<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(o.isOdd()||a.isOdd())&&(o.iadd(l),a.isub(h)),o.iushrn(1),a.iushrn(1);for(var p=0,y=1;!(r.words[0]&y)&&p<26;++p,y<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(s.isOdd()||u.isOdd())&&(s.iadd(l),u.isub(h)),s.iushrn(1),u.iushrn(1);t.cmp(r)>=0?(t.isub(r),o.isub(s),a.isub(u)):(r.isub(t),s.isub(o),u.isub(a))}return{a:s,b:u,gcd:r.iushln(c)}},i.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t,r=this,o=e.clone();r=0!==r.negative?r.umod(e):r.clone();for(var a=new i(1),s=new i(0),u=o.clone();r.cmpn(1)>0&&o.cmpn(1)>0;){for(var c=0,l=1;!(r.words[0]&l)&&c<26;++c,l<<=1);if(c>0)for(r.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(u),a.iushrn(1);for(var h=0,d=1;!(o.words[0]&d)&&h<26;++h,d<<=1);if(h>0)for(o.iushrn(h);h-- >0;)s.isOdd()&&s.iadd(u),s.iushrn(1);r.cmp(o)>=0?(r.isub(o),a.isub(s)):(o.isub(r),s.isub(a))}return(t=0===r.cmpn(1)?a:s).cmpn(0)<0&&t.iadd(e),t},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var o=t;t=n,n=o}else if(0===i||0===n.cmpn(1))break;t.isub(n)}return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return 0==(1&this.words[0])},i.prototype.isOdd=function(){return 1==(1&this.words[0])},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var o=i,a=r;0!==o&&a<this.length;a++){var s=0|this.words[a];o=(s+=o)>>>26,s&=67108863,this.words[a]=s}return 0!==o&&(this.words[a]=o,this.length++),this},i.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},i.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return-1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},i.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return-1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=0|this.words[n],i=0|e.words[n];if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return 1===this.cmpn(e)},i.prototype.gt=function(e){return 1===this.cmp(e)},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return-1===this.cmpn(e)},i.prototype.lt=function(e){return-1===this.cmp(e)},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return 0===this.cmpn(e)},i.prototype.eq=function(e){return 0===this.cmp(e)},i.red=function(e){return new T(e)},i.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},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(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var v={k256:null,p224:null,p192:null,p25519:null};function w(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function b(){w.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function M(){w.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function A(){w.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function N(){w.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function T(e){if("string"==typeof e){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function E(e){T.call(this,e),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)}w.prototype._tmp=function(){var e=new i(null);return e.words=new Array(Math.ceil(this.n/13)),e},w.prototype.ireduce=function(e){var t,n=e;do{this.split(n,this.tmp),t=(n=(n=this.imulK(n)).iadd(this.tmp)).bitLength()}while(t>this.n);var r=t<this.n?-1:n.ucmp(this.p);return 0===r?(n.words[0]=0,n.length=1):r>0?n.isub(this.p):void 0!==n.strip?n.strip():n._strip(),n},w.prototype.split=function(e,t){e.iushrn(this.n,0,t)},w.prototype.imulK=function(e){return e.imul(this.k)},r(b,w),b.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9)return e.words[0]=0,void(e.length=1);var o=e.words[9];for(t.words[t.length++]=o&n,i=10;i<e.length;i++){var a=0|e.words[i];e.words[i-10]=(a&n)<<4|o>>>22,o=a}o>>>=22,e.words[i-10]=o,0===o&&e.length>10?e.length-=10:e.length-=9},b.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=0|e.words[n];t+=977*r,e.words[n]=67108863&t,t=64*r+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},r(M,w),r(A,w),r(N,w),N.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=19*(0|e.words[n])+t,i=67108863&r;r>>>=26,e.words[n]=i,t=r}return 0!==t&&(e.words[e.length++]=t),e},i._prime=function(e){if(v[e])return v[e];var t;if("k256"===e)t=new b;else if("p224"===e)t=new M;else if("p192"===e)t=new A;else{if("p25519"!==e)throw new Error("Unknown prime "+e);t=new N}return v[e]=t,t},T.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},T.prototype._verify2=function(e,t){n(0==(e.negative|t.negative),"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},T.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(c(e,e.umod(this.m)._forceRed(this)),e)},T.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},T.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},T.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},T.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},T.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},T.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},T.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},T.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},T.prototype.isqr=function(e){return this.imul(e,e.clone())},T.prototype.sqr=function(e){return this.mul(e,e)},T.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var o=this.m.subn(1),a=0;!o.isZero()&&0===o.andln(1);)a++,o.iushrn(1);n(!o.isZero());var s=new i(1).toRed(this),u=s.redNeg(),c=this.m.subn(1).iushrn(1),l=this.m.bitLength();for(l=new i(2*l*l).toRed(this);0!==this.pow(l,c).cmp(u);)l.redIAdd(u);for(var h=this.pow(l,o),d=this.pow(e,o.addn(1).iushrn(1)),f=this.pow(e,o),p=a;0!==f.cmp(s);){for(var y=f,m=0;0!==y.cmp(s);m++)y=y.redSqr();n(m<p);var g=this.pow(h,new i(1).iushln(p-m-1));d=d.redMul(g),h=g.redSqr(),f=f.redMul(h),p=m}return d},T.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},T.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(0===t.cmpn(1))return e.clone();var n=new Array(16);n[0]=new i(1).toRed(this),n[1]=e;for(var r=2;r<n.length;r++)n[r]=this.mul(n[r-1],e);var o=n[0],a=0,s=0,u=t.bitLength()%26;for(0===u&&(u=26),r=t.length-1;r>=0;r--){for(var c=t.words[r],l=u-1;l>=0;l--){var h=c>>l&1;o!==n[0]&&(o=this.sqr(o)),0!==h||0!==a?(a<<=1,a|=h,(4==++s||0===r&&0===l)&&(o=this.mul(o,n[a]),s=0,a=0)):s=0}u=26}return o},T.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},T.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new E(e)},r(E,T),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):i.cmpn(0)<0&&(o=i.iadd(this.m)),o._forceRed(this)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),o=n.isub(r).iushrn(this.shift),a=o;return o.cmp(this.m)>=0?a=o.isub(this.m):o.cmpn(0)<0&&(a=o.iadd(this.m)),a._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e,he)}(_e);var Re=_e.exports,Ue="bignumber/5.7.0",Qe=Re.BN,We=new Ie(Ue),Ye={},Fe=9007199254740991,Ve=!1,He=function(){function e(t,n){v(this,e),t!==Ye&&We.throwError("cannot call constructor directly; use BigNumber.from",Ie.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=n,this._isBigNumber=!0,Object.freeze(this)}return b(e,[{key:"fromTwos",value:function(e){return qe(Ze(this).fromTwos(e))}},{key:"toTwos",value:function(e){return qe(Ze(this).toTwos(e))}},{key:"abs",value:function(){return"-"===this._hex[0]?e.from(this._hex.substring(1)):this}},{key:"add",value:function(e){return qe(Ze(this).add(Ze(e)))}},{key:"sub",value:function(e){return qe(Ze(this).sub(Ze(e)))}},{key:"div",value:function(t){return e.from(t).isZero()&&Je("division-by-zero","div"),qe(Ze(this).div(Ze(t)))}},{key:"mul",value:function(e){return qe(Ze(this).mul(Ze(e)))}},{key:"mod",value:function(e){var t=Ze(e);return t.isNeg()&&Je("division-by-zero","mod"),qe(Ze(this).umod(t))}},{key:"pow",value:function(e){var t=Ze(e);return t.isNeg()&&Je("negative-power","pow"),qe(Ze(this).pow(t))}},{key:"and",value:function(e){var t=Ze(e);return(this.isNegative()||t.isNeg())&&Je("unbound-bitwise-result","and"),qe(Ze(this).and(t))}},{key:"or",value:function(e){var t=Ze(e);return(this.isNegative()||t.isNeg())&&Je("unbound-bitwise-result","or"),qe(Ze(this).or(t))}},{key:"xor",value:function(e){var t=Ze(e);return(this.isNegative()||t.isNeg())&&Je("unbound-bitwise-result","xor"),qe(Ze(this).xor(t))}},{key:"mask",value:function(e){return(this.isNegative()||e<0)&&Je("negative-width","mask"),qe(Ze(this).maskn(e))}},{key:"shl",value:function(e){return(this.isNegative()||e<0)&&Je("negative-width","shl"),qe(Ze(this).shln(e))}},{key:"shr",value:function(e){return(this.isNegative()||e<0)&&Je("negative-width","shr"),qe(Ze(this).shrn(e))}},{key:"eq",value:function(e){return Ze(this).eq(Ze(e))}},{key:"lt",value:function(e){return Ze(this).lt(Ze(e))}},{key:"lte",value:function(e){return Ze(this).lte(Ze(e))}},{key:"gt",value:function(e){return Ze(this).gt(Ze(e))}},{key:"gte",value:function(e){return Ze(this).gte(Ze(e))}},{key:"isNegative",value:function(){return"-"===this._hex[0]}},{key:"isZero",value:function(){return Ze(this).isZero()}},{key:"toNumber",value:function(){try{return Ze(this).toNumber()}catch(e){Je("overflow","toNumber",this.toString())}return null}},{key:"toBigInt",value:function(){try{return BigInt(this.toString())}catch(e){}return We.throwError("this platform does not support BigInt",Ie.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}},{key:"toString",value:function(){return arguments.length>0&&(10===arguments[0]?Ve||(Ve=!0,We.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):16===arguments[0]?We.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",Ie.errors.UNEXPECTED_ARGUMENT,{}):We.throwError("BigNumber.toString does not accept parameters",Ie.errors.UNEXPECTED_ARGUMENT,{})),Ze(this).toString(10)}},{key:"toHexString",value:function(){return this._hex}},{key:"toJSON",value:function(e){return{type:"BigNumber",hex:this.toHexString()}}}],[{key:"from",value:function(t){if(t instanceof e)return t;if("string"==typeof t)return t.match(/^-?0x[0-9a-f]+$/i)?new e(Ye,Ge(t)):t.match(/^-?[0-9]+$/)?new e(Ye,Ge(new Qe(t))):We.throwArgumentError("invalid BigNumber string","value",t);if("number"==typeof t)return t%1&&Je("underflow","BigNumber.from",t),(t>=Fe||t<=-Fe)&&Je("overflow","BigNumber.from",t),e.from(String(t));var n=t;if("bigint"==typeof n)return e.from(n.toString());if(ke(n))return e.from(De(n));if(n)if(n.toHexString){var r=n.toHexString();if("string"==typeof r)return e.from(r)}else{var i=n._hex;if(null==i&&"BigNumber"===n.type&&(i=n.hex),"string"==typeof i&&(Se(i)||"-"===i[0]&&Se(i.substring(1))))return e.from(i)}return We.throwArgumentError("invalid BigNumber value","value",t)}},{key:"isBigNumber",value:function(e){return!(!e||!e._isBigNumber)}}])}();function Ge(e){if("string"!=typeof e)return Ge(e.toString(16));if("-"===e[0])return"-"===(e=e.substring(1))[0]&&We.throwArgumentError("invalid hex","value",e),"0x00"===(e=Ge(e))?e:"-"+e;if("0x"!==e.substring(0,2)&&(e="0x"+e),"0x"===e)return"0x00";for(e.length%2&&(e="0x0"+e.substring(2));e.length>4&&"0x00"===e.substring(0,4);)e="0x"+e.substring(4);return e}function qe(e){return He.from(Ge(e))}function Ze(e){var t=He.from(e).toHexString();return"-"===t[0]?new Qe("-"+t.substring(3),16):new Qe(t.substring(2),16)}function Je(e,t,n){var r={fault:e,operation:t};return null!=n&&(r.value=n),We.throwError(e,Ie.errors.NUMERIC_FAULT,r)}var Xe=new Ie(Ue),Ke={},$e=He.from(0),et=He.from(-1);function tt(e,t,n,r){var i={fault:t,operation:n};return void 0!==r&&(i.value=r),Xe.throwError(e,Ie.errors.NUMERIC_FAULT,i)}for(var nt="0";nt.length<256;)nt+=nt;function rt(e){if("number"!=typeof e)try{e=He.from(e).toNumber()}catch(e){}return"number"==typeof e&&e>=0&&e<=256&&!(e%1)?"1"+nt.substring(0,e):Xe.throwArgumentError("invalid decimal size","decimals",e)}function it(e,t){null==t&&(t=0);var n=rt(t),r=(e=He.from(e)).lt($e);r&&(e=e.mul(et));for(var i=e.mod(n).toString();i.length<n.length-1;)i="0"+i;i=i.match(/^([0-9]*[1-9]|0)(0*)/)[1];var o=e.div(n).toString();return e=1===n.length?o:o+"."+i,r&&(e="-"+e),e}function ot(e,t){null==t&&(t=0);var n=rt(t);("string"!=typeof e||!e.match(/^-?[0-9.]+$/))&&Xe.throwArgumentError("invalid decimal value","value",e);var r="-"===e.substring(0,1);r&&(e=e.substring(1)),"."===e&&Xe.throwArgumentError("missing value","value",e);var i=e.split(".");i.length>2&&Xe.throwArgumentError("too many decimal points","value",e);var o=i[0],a=i[1];for(o||(o="0"),a||(a="0");"0"===a[a.length-1];)a=a.substring(0,a.length-1);for(a.length>n.length-1&&tt("fractional component exceeds decimals","underflow","parseFixed"),""===a&&(a="0");a.length<n.length-1;)a+="0";var s=He.from(o),u=He.from(a),c=s.mul(n).add(u);return r&&(c=c.mul(et)),c}var at,st,ut=function(){function e(t,n,r,i){v(this,e),t!==Ke&&Xe.throwError("cannot use FixedFormat constructor; use FixedFormat.from",Ie.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.signed=n,this.width=r,this.decimals=i,this.name=(n?"":"u")+"fixed"+String(r)+"x"+String(i),this._multiplier=rt(i),Object.freeze(this)}return b(e,null,[{key:"from",value:function(t){if(t instanceof e)return t;"number"==typeof t&&(t="fixed128x".concat(t));var n=!0,r=128,i=18;if("string"==typeof t){if("fixed"!==t)if("ufixed"===t)n=!1;else{var o=t.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);o||Xe.throwArgumentError("invalid fixed format","format",t),n="u"!==o[1],r=parseInt(o[2]),i=parseInt(o[3])}}else if(t){var a=function(e,n,r){return null==t[e]?r:(I(t[e])!==n&&Xe.throwArgumentError("invalid fixed format ("+e+" not "+n+")","format."+e,t[e]),t[e])};n=a("signed","boolean",n),r=a("width","number",r),i=a("decimals","number",i)}return r%8&&Xe.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",r),i>80&&Xe.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",i),new e(Ke,n,r,i)}}])}(),ct=function(){function e(t,n,r,i){v(this,e),t!==Ke&&Xe.throwError("cannot use FixedNumber constructor; use FixedNumber.from",Ie.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=i,this._hex=n,this._value=r,this._isFixedNumber=!0,Object.freeze(this)}return b(e,[{key:"_checkFormat",value:function(e){this.format.name!==e.format.name&&Xe.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}},{key:"addUnsafe",value:function(t){this._checkFormat(t);var n=ot(this._value,this.format.decimals),r=ot(t._value,t.format.decimals);return e.fromValue(n.add(r),this.format.decimals,this.format)}},{key:"subUnsafe",value:function(t){this._checkFormat(t);var n=ot(this._value,this.format.decimals),r=ot(t._value,t.format.decimals);return e.fromValue(n.sub(r),this.format.decimals,this.format)}},{key:"mulUnsafe",value:function(t){this._checkFormat(t);var n=ot(this._value,this.format.decimals),r=ot(t._value,t.format.decimals);return e.fromValue(n.mul(r).div(this.format._multiplier),this.format.decimals,this.format)}},{key:"divUnsafe",value:function(t){this._checkFormat(t);var n=ot(this._value,this.format.decimals),r=ot(t._value,t.format.decimals);return e.fromValue(n.mul(this.format._multiplier).div(r),this.format.decimals,this.format)}},{key:"floor",value:function(){var t=this.toString().split(".");1===t.length&&t.push("0");var n=e.from(t[0],this.format),r=!t[1].match(/^(0*)$/);return this.isNegative()&&r&&(n=n.subUnsafe(lt.toFormat(n.format))),n}},{key:"ceiling",value:function(){var t=this.toString().split(".");1===t.length&&t.push("0");var n=e.from(t[0],this.format),r=!t[1].match(/^(0*)$/);return!this.isNegative()&&r&&(n=n.addUnsafe(lt.toFormat(n.format))),n}},{key:"round",value:function(t){null==t&&(t=0);var n=this.toString().split(".");if(1===n.length&&n.push("0"),(t<0||t>80||t%1)&&Xe.throwArgumentError("invalid decimal count","decimals",t),n[1].length<=t)return this;var r=e.from("1"+nt.substring(0,t),this.format),i=ht.toFormat(this.format);return this.mulUnsafe(r).addUnsafe(i).floor().divUnsafe(r)}},{key:"isZero",value:function(){return"0.0"===this._value||"0"===this._value}},{key:"isNegative",value:function(){return"-"===this._value[0]}},{key:"toString",value:function(){return this._value}},{key:"toHexString",value:function(e){return null==e?this._hex:(e%8&&Xe.throwArgumentError("invalid byte width","width",e),Oe(He.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString(),e/8))}},{key:"toUnsafeFloat",value:function(){return parseFloat(this.toString())}},{key:"toFormat",value:function(t){return e.fromString(this._value,t)}}],[{key:"fromValue",value:function(t,n,r){return null==r&&null!=n&&!function(e){return null!=e&&(He.isBigNumber(e)||"number"==typeof e&&e%1==0||"string"==typeof e&&!!e.match(/^-?[0-9]+$/)||Se(e)||"bigint"==typeof e||ke(e))}(n)&&(r=n,n=null),null==n&&(n=0),null==r&&(r="fixed"),e.fromString(it(t,n),ut.from(r))}},{key:"fromString",value:function(t,n){null==n&&(n="fixed");var r=ut.from(n),i=ot(t,r.decimals);!r.signed&&i.lt($e)&&tt("unsigned value cannot be negative","overflow","value",t);var o=null;o=r.signed?i.toTwos(r.width).toHexString():Oe(o=i.toHexString(),r.width/8);var a=it(i,r.decimals);return new e(Ke,o,a,r)}},{key:"fromBytes",value:function(t,n){null==n&&(n="fixed");var r=ut.from(n);if(Le(t).length>r.width/8)throw new Error("overflow");var i=He.from(t);r.signed&&(i=i.fromTwos(r.width));var o=i.toTwos((r.signed?0:1)+r.width).toHexString(),a=it(i,r.decimals);return new e(Ke,o,a,r)}},{key:"from",value:function(t,n){if("string"==typeof t)return e.fromString(t,n);if(ke(t))return e.fromBytes(t,n);try{return e.fromValue(t,0,n)}catch(e){if(e.code!==Ie.errors.INVALID_ARGUMENT)throw e}return Xe.throwArgumentError("invalid FixedNumber value","value",t)}},{key:"isFixedNumber",value:function(e){return!(!e||!e._isFixedNumber)}}])}(),lt=ct.from(1),ht=ct.from("0.5"),dt=new Ie("strings/5.7.0");function ft(e,t,n,r,i){if(e===st.BAD_PREFIX||e===st.UNEXPECTED_CONTINUE){for(var o=0,a=t+1;a<n.length&&n[a]>>6==2;a++)o++;return o}return e===st.OVERRUN?n.length-t-1:0}function pt(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:at.current;t!=at.current&&(dt.checkNormalize(),e=e.normalize(t));for(var n=[],r=0;r<e.length;r++){var i=e.charCodeAt(r);if(i<128)n.push(i);else if(i<2048)n.push(i>>6|192),n.push(63&i|128);else if(55296==(64512&i)){r++;var o=e.charCodeAt(r);if(r>=e.length||56320!=(64512&o))throw new Error("invalid utf-8 string");var a=65536+((1023&i)<<10)+(1023&o);n.push(a>>18|240),n.push(a>>12&63|128),n.push(a>>6&63|128),n.push(63&a|128)}else n.push(i>>12|224),n.push(i>>6&63|128),n.push(63&i|128)}return Le(n)}function yt(e,t){t||(t=function(e){return[parseInt(e,16)]});var n=0,r={};return e.split(",").forEach((function(e){var i=e.split(":");n+=parseInt(i[0],16),r[n]=t(i[1])})),r}function mt(e){var t=0;return e.split(",").map((function(e){var n=e.split("-");return 1===n.length?n[1]="0":""===n[1]&&(n[1]="1"),{l:t+parseInt(n[0],16),h:t=parseInt(n[1],16)}}))}!function(e){e.current="",e.NFC="NFC",e.NFD="NFD",e.NFKC="NFKC",e.NFKD="NFKD"}(at||(at={})),function(e){e.UNEXPECTED_CONTINUE="unexpected continuation byte",e.BAD_PREFIX="bad codepoint prefix",e.OVERRUN="string overrun",e.MISSING_CONTINUE="missing continuation byte",e.OUT_OF_RANGE="out of UTF-8 range",e.UTF16_SURROGATE="UTF-16 surrogate",e.OVERLONG="overlong representation"}(st||(st={})),Object.freeze({error:function(e,t,n,r,i){return dt.throwArgumentError("invalid codepoint at offset ".concat(t,"; ").concat(e),"bytes",n)},ignore:ft,replace:function(e,t,n,r,i){return e===st.OVERLONG?(r.push(i),0):(r.push(65533),ft(e,t,n))}}),mt("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map((function(e){return parseInt(e,16)})),yt("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),yt("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),yt("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",(function(e){if(e.length%4!=0)throw new Error("bad data");for(var t=[],n=0;n<e.length;n+=4)t.push(parseInt(e.substring(n,n+4),16));return t})),mt("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");var gt="hash/5.7.0";function vt(e,t){null==t&&(t=1);var n=[],r=n.forEach;return function e(t,i){r.call(t,(function(t){i>0&&Array.isArray(t)?e(t,i-1):n.push(t)}))}(e,t),n}function wt(e){return 1&e?~e>>1:e>>1}function bt(e,t){for(var n=Array(e),r=0,i=-1;r<e;r++)n[r]=i+=1+t();return n}function Mt(e,t){for(var n=Array(e),r=0,i=0;r<e;r++)n[r]=i+=wt(t());return n}function At(e,t){for(var n=bt(e(),e),r=e(),i=bt(r,e),o=function(e,t){for(var n=Array(e),r=0;r<e;r++)n[r]=1+t();return n}(r,e),a=0;a<r;a++)for(var s=0;s<o[a];s++)n.push(i[a]+s);return t?n.map((function(e){return t[e]})):n}function It(e,t,n){for(var r=Array(e).fill(void 0).map((function(){return[]})),i=0;i<t;i++)Mt(e,n).forEach((function(e,t){return r[t].push(e)}));return r}function Nt(e,t){var n=1+t(),r=t(),i=function(e){for(var t=[];;){var n=e();if(0==n)break;t.push(n)}return t}(t);return vt(It(i.length,1+e,t).map((function(e,t){var o=e[0],a=e.slice(1);return Array(i[t]).fill(void 0).map((function(e,t){var i=t*r;return[o+t*n,a.map((function(e){return e+i}))]}))})))}function Tt(e,t){return It(1+t(),1+e,t).map((function(e){return[e[0],e.slice(1)]}))}var Et=function(e){return function(e){var t=0;return function(){return e[t++]}}(function(e){var t=0;function n(){return e[t++]<<8|e[t++]}for(var r=n(),i=1,o=[0,1],a=1;a<r;a++)o.push(i+=n());var s=n(),u=t;t+=s;var c=0,l=0;function h(){return 0==c&&(l=l<<8|e[t++],c=8),l>>--c&1}for(var d=Math.pow(2,31),f=d>>>1,p=f>>1,y=d-1,m=0,g=0;g<31;g++)m=m<<1|h();for(var v=[],w=0,b=d;;){for(var M=Math.floor(((m-w+1)*i-1)/b),A=0,I=r;I-A>1;){var N=A+I>>>1;M<o[N]?I=N:A=N}if(0==A)break;v.push(A);for(var T=w+Math.floor(b*o[A]/i),E=w+Math.floor(b*o[A+1]/i)-1;!((T^E)&f);)m=m<<1&y|h(),T=T<<1&y,E=E<<1&y|1;for(;T&~E&p;)m=m&f|m<<1&y>>>1|h(),T=T<<1^f,E=(E^f)<<1|f|1;w=T,b=1+E-T}var x=r-4;return v.map((function(t){switch(t-x){case 3:return x+65792+(e[u++]<<16|e[u++]<<8|e[u++]);case 2:return x+256+(e[u++]<<8|e[u++]);case 1:return x+e[u++];default:return t-1}}))}(e))}(function(e){e=atob(e);for(var t=[],n=0;n<e.length;n++)t.push(e.charCodeAt(n));return Le(t)}("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="));function xt(e){return"string"==typeof e&&(e=pt(e)),Pe(function(e){var t=e.map((function(e){return Le(e)})),n=t.reduce((function(e,t){return e+t.length}),0),r=new Uint8Array(n);return t.reduce((function(e,t){return r.set(t,e),e+t.length}),0),Ee(r)}([pt("Ethereum Signed Message:\n"),pt(String(e.length)),e]))}new Set(At(Et)),new Set(At(Et)),function(e){for(var t=[];;){var n=e();if(0==n)break;t.push(Nt(n,e))}for(;;){var r=e()-1;if(r<0)break;t.push(Tt(r,e))}!function(e){for(var t={},n=0;n<e.length;n++){var r=e[n];t[r[0]]=r[1]}}(vt(t))}(Et),function(e){var t=At(e).sort((function(e,t){return e-t}));!function n(){for(var r=[];;){var i=At(e,t);if(0==i.length)break;r.push({set:new Set(i),node:n()})}r.sort((function(e,t){return t.set.size-e.set.size}));var o=e();return{branches:r,valid:o%3,fe0f:!!(1&(o=o/3|0)),save:1==(o>>=1),check:2==o}}()}(Et),new Ie(gt),new Uint8Array(32).fill(0),new Ie("rlp/5.7.0");var kt=new Ie("address/5.7.0");function Lt(e){Se(e,20)||kt.throwArgumentError("invalid address","address",e);for(var t=(e=e.toLowerCase()).substring(2).split(""),n=new Uint8Array(40),r=0;r<40;r++)n[r]=t[r].charCodeAt(0);for(var i=Le(Pe(n)),o=0;o<40;o+=2)i[o>>1]>>4>=8&&(t[o]=t[o].toUpperCase()),(15&i[o>>1])>=8&&(t[o+1]=t[o+1].toUpperCase());return"0x"+t.join("")}for(var St={},jt=0;jt<10;jt++)St[String(jt)]=String(jt);for(var Dt=0;Dt<26;Dt++)St[String.fromCharCode(65+Dt)]=String(10+Dt);var Ct=Math.floor(function(e){return Math.log10?Math.log10(e):Math.log(e)/Math.LN10}(9007199254740991));function Ot(e,t,n){Object.defineProperty(e,t,{enumerable:!0,value:n,writable:!1})}new Ie("properties/5.7.0"),new Ie(gt),new Uint8Array(32).fill(0),He.from(-1);var zt=He.from(0),Pt=He.from(1);He.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Oe(Pt.toHexString(),32),Oe(zt.toHexString(),32);var _t={},Bt={},Rt=Ut;function Ut(e,t){if(!e)throw new Error(t||"Assertion failed")}Ut.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)};var Qt={exports:{}};"function"==typeof Object.create?Qt.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:Qt.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}};var Wt=Rt,Yt=Qt.exports;function Ft(e,t){return!(55296!=(64512&e.charCodeAt(t))||t<0||t+1>=e.length)&&56320==(64512&e.charCodeAt(t+1))}function Vt(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(255&e)<<24)>>>0}function Ht(e){return 1===e.length?"0"+e:e}function Gt(e){return 7===e.length?"0"+e:6===e.length?"00"+e:5===e.length?"000"+e:4===e.length?"0000"+e:3===e.length?"00000"+e:2===e.length?"000000"+e:1===e.length?"0000000"+e:e}Bt.inherits=Yt,Bt.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"==typeof e)if(t){if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),i=0;i<e.length;i+=2)n.push(parseInt(e[i]+e[i+1],16))}else for(var r=0,i=0;i<e.length;i++){var o=e.charCodeAt(i);o<128?n[r++]=o:o<2048?(n[r++]=o>>6|192,n[r++]=63&o|128):Ft(e,i)?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++i)),n[r++]=o>>18|240,n[r++]=o>>12&63|128,n[r++]=o>>6&63|128,n[r++]=63&o|128):(n[r++]=o>>12|224,n[r++]=o>>6&63|128,n[r++]=63&o|128)}else for(i=0;i<e.length;i++)n[i]=0|e[i];return n},Bt.toHex=function(e){for(var t="",n=0;n<e.length;n++)t+=Ht(e[n].toString(16));return t},Bt.htonl=Vt,Bt.toHex32=function(e,t){for(var n="",r=0;r<e.length;r++){var i=e[r];"little"===t&&(i=Vt(i)),n+=Gt(i.toString(16))}return n},Bt.zero2=Ht,Bt.zero8=Gt,Bt.join32=function(e,t,n,r){var i=n-t;Wt(i%4==0);for(var o=new Array(i/4),a=0,s=t;a<o.length;a++,s+=4){var u;u="big"===r?e[s]<<24|e[s+1]<<16|e[s+2]<<8|e[s+3]:e[s+3]<<24|e[s+2]<<16|e[s+1]<<8|e[s],o[a]=u>>>0}return o},Bt.split32=function(e,t){for(var n=new Array(4*e.length),r=0,i=0;r<e.length;r++,i+=4){var o=e[r];"big"===t?(n[i]=o>>>24,n[i+1]=o>>>16&255,n[i+2]=o>>>8&255,n[i+3]=255&o):(n[i+3]=o>>>24,n[i+2]=o>>>16&255,n[i+1]=o>>>8&255,n[i]=255&o)}return n},Bt.rotr32=function(e,t){return e>>>t|e<<32-t},Bt.rotl32=function(e,t){return e<<t|e>>>32-t},Bt.sum32=function(e,t){return e+t>>>0},Bt.sum32_3=function(e,t,n){return e+t+n>>>0},Bt.sum32_4=function(e,t,n,r){return e+t+n+r>>>0},Bt.sum32_5=function(e,t,n,r,i){return e+t+n+r+i>>>0},Bt.sum64=function(e,t,n,r){var i=e[t],o=r+e[t+1]>>>0,a=(o<r?1:0)+n+i;e[t]=a>>>0,e[t+1]=o},Bt.sum64_hi=function(e,t,n,r){return(t+r>>>0<t?1:0)+e+n>>>0},Bt.sum64_lo=function(e,t,n,r){return t+r>>>0},Bt.sum64_4_hi=function(e,t,n,r,i,o,a,s){var u=0,c=t;return u+=(c=c+r>>>0)<t?1:0,u+=(c=c+o>>>0)<o?1:0,e+n+i+a+(u+=(c=c+s>>>0)<s?1:0)>>>0},Bt.sum64_4_lo=function(e,t,n,r,i,o,a,s){return t+r+o+s>>>0},Bt.sum64_5_hi=function(e,t,n,r,i,o,a,s,u,c){var l=0,h=t;return l+=(h=h+r>>>0)<t?1:0,l+=(h=h+o>>>0)<o?1:0,l+=(h=h+s>>>0)<s?1:0,e+n+i+a+u+(l+=(h=h+c>>>0)<c?1:0)>>>0},Bt.sum64_5_lo=function(e,t,n,r,i,o,a,s,u,c){return t+r+o+s+c>>>0},Bt.rotr64_hi=function(e,t,n){return(t<<32-n|e>>>n)>>>0},Bt.rotr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0},Bt.shr64_hi=function(e,t,n){return e>>>n},Bt.shr64_lo=function(e,t,n){return(e<<32-n|t>>>n)>>>0};var qt={},Zt=Bt,Jt=Rt;function Xt(){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}qt.BlockHash=Xt,Xt.prototype.update=function(e,t){if(e=Zt.toArray(e,t),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){var n=(e=this.pending).length%this._delta8;this.pending=e.slice(e.length-n,e.length),0===this.pending.length&&(this.pending=null),e=Zt.join32(e,0,e.length-n,this.endian);for(var r=0;r<e.length;r+=this._delta32)this._update(e,r,r+this._delta32)}return this},Xt.prototype.digest=function(e){return this.update(this._pad()),Jt(null===this.pending),this._digest(e)},Xt.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,r=new Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(e<<=3,"big"===this.endian){for(var o=8;o<this.padLength;o++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=e>>>24&255,r[i++]=e>>>16&255,r[i++]=e>>>8&255,r[i++]=255&e}else for(r[i++]=255&e,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,o=8;o<this.padLength;o++)r[i++]=0;return r};var Kt={},$t={},en=Bt.rotr32;function tn(e,t,n){return e&t^~e&n}function nn(e,t,n){return e&t^e&n^t&n}function rn(e,t,n){return e^t^n}$t.ft_1=function(e,t,n,r){return 0===e?tn(t,n,r):1===e||3===e?rn(t,n,r):2===e?nn(t,n,r):void 0},$t.ch32=tn,$t.maj32=nn,$t.p32=rn,$t.s0_256=function(e){return en(e,2)^en(e,13)^en(e,22)},$t.s1_256=function(e){return en(e,6)^en(e,11)^en(e,25)},$t.g0_256=function(e){return en(e,7)^en(e,18)^e>>>3},$t.g1_256=function(e){return en(e,17)^en(e,19)^e>>>10};var on=Bt,an=qt,sn=$t,un=on.rotl32,cn=on.sum32,ln=on.sum32_5,hn=sn.ft_1,dn=an.BlockHash,fn=[1518500249,1859775393,2400959708,3395469782];function pn(){if(!(this instanceof pn))return new pn;dn.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}on.inherits(pn,dn);var yn=pn;pn.blockSize=512,pn.outSize=160,pn.hmacStrength=80,pn.padLength=64,pn.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=un(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4];for(r=0;r<n.length;r++){var c=~~(r/20),l=ln(un(i,5),hn(c,o,a,s),u,n[r],fn[c]);u=s,s=a,a=un(o,30),o=i,i=l}this.h[0]=cn(this.h[0],i),this.h[1]=cn(this.h[1],o),this.h[2]=cn(this.h[2],a),this.h[3]=cn(this.h[3],s),this.h[4]=cn(this.h[4],u)},pn.prototype._digest=function(e){return"hex"===e?on.toHex32(this.h,"big"):on.split32(this.h,"big")};var mn=Bt,gn=qt,vn=$t,wn=Rt,bn=mn.sum32,Mn=mn.sum32_4,An=mn.sum32_5,In=vn.ch32,Nn=vn.maj32,Tn=vn.s0_256,En=vn.s1_256,xn=vn.g0_256,kn=vn.g1_256,Ln=gn.BlockHash,Sn=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function jn(){if(!(this instanceof jn))return new jn;Ln.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=Sn,this.W=new Array(64)}mn.inherits(jn,Ln);var Dn=jn;jn.blockSize=512,jn.outSize=256,jn.hmacStrength=192,jn.padLength=64,jn.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=Mn(kn(n[r-2]),n[r-7],xn(n[r-15]),n[r-16]);var i=this.h[0],o=this.h[1],a=this.h[2],s=this.h[3],u=this.h[4],c=this.h[5],l=this.h[6],h=this.h[7];for(wn(this.k.length===n.length),r=0;r<n.length;r++){var d=An(h,En(u),In(u,c,l),this.k[r],n[r]),f=bn(Tn(i),Nn(i,o,a));h=l,l=c,c=u,u=bn(s,d),s=a,a=o,o=i,i=bn(d,f)}this.h[0]=bn(this.h[0],i),this.h[1]=bn(this.h[1],o),this.h[2]=bn(this.h[2],a),this.h[3]=bn(this.h[3],s),this.h[4]=bn(this.h[4],u),this.h[5]=bn(this.h[5],c),this.h[6]=bn(this.h[6],l),this.h[7]=bn(this.h[7],h)},jn.prototype._digest=function(e){return"hex"===e?mn.toHex32(this.h,"big"):mn.split32(this.h,"big")};var Cn=Bt,On=Dn;function zn(){if(!(this instanceof zn))return new zn;On.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}Cn.inherits(zn,On);var Pn=zn;zn.blockSize=512,zn.outSize=224,zn.hmacStrength=192,zn.padLength=64,zn.prototype._digest=function(e){return"hex"===e?Cn.toHex32(this.h.slice(0,7),"big"):Cn.split32(this.h.slice(0,7),"big")};var _n=Bt,Bn=qt,Rn=Rt,Un=_n.rotr64_hi,Qn=_n.rotr64_lo,Wn=_n.shr64_hi,Yn=_n.shr64_lo,Fn=_n.sum64,Vn=_n.sum64_hi,Hn=_n.sum64_lo,Gn=_n.sum64_4_hi,qn=_n.sum64_4_lo,Zn=_n.sum64_5_hi,Jn=_n.sum64_5_lo,Xn=Bn.BlockHash,Kn=[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 $n(){if(!(this instanceof $n))return new $n;Xn.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=Kn,this.W=new Array(160)}_n.inherits($n,Xn);var er=$n;function tr(e,t,n,r,i){var o=e&n^~e&i;return o<0&&(o+=4294967296),o}function nr(e,t,n,r,i,o){var a=t&r^~t&o;return a<0&&(a+=4294967296),a}function rr(e,t,n,r,i){var o=e&n^e&i^n&i;return o<0&&(o+=4294967296),o}function ir(e,t,n,r,i,o){var a=t&r^t&o^r&o;return a<0&&(a+=4294967296),a}function or(e,t){var n=Un(e,t,28)^Un(t,e,2)^Un(t,e,7);return n<0&&(n+=4294967296),n}function ar(e,t){var n=Qn(e,t,28)^Qn(t,e,2)^Qn(t,e,7);return n<0&&(n+=4294967296),n}function sr(e,t){var n=Un(e,t,14)^Un(e,t,18)^Un(t,e,9);return n<0&&(n+=4294967296),n}function ur(e,t){var n=Qn(e,t,14)^Qn(e,t,18)^Qn(t,e,9);return n<0&&(n+=4294967296),n}function cr(e,t){var n=Un(e,t,1)^Un(e,t,8)^Wn(e,t,7);return n<0&&(n+=4294967296),n}function lr(e,t){var n=Qn(e,t,1)^Qn(e,t,8)^Yn(e,t,7);return n<0&&(n+=4294967296),n}function hr(e,t){var n=Un(e,t,19)^Un(t,e,29)^Wn(e,t,6);return n<0&&(n+=4294967296),n}function dr(e,t){var n=Qn(e,t,19)^Qn(t,e,29)^Yn(e,t,6);return n<0&&(n+=4294967296),n}$n.blockSize=1024,$n.outSize=512,$n.hmacStrength=192,$n.padLength=128,$n.prototype._prepareBlock=function(e,t){for(var n=this.W,r=0;r<32;r++)n[r]=e[t+r];for(;r<n.length;r+=2){var i=hr(n[r-4],n[r-3]),o=dr(n[r-4],n[r-3]),a=n[r-14],s=n[r-13],u=cr(n[r-30],n[r-29]),c=lr(n[r-30],n[r-29]),l=n[r-32],h=n[r-31];n[r]=Gn(i,o,a,s,u,c,l,h),n[r+1]=qn(i,o,a,s,u,c,l,h)}},$n.prototype._update=function(e,t){this._prepareBlock(e,t);var n=this.W,r=this.h[0],i=this.h[1],o=this.h[2],a=this.h[3],s=this.h[4],u=this.h[5],c=this.h[6],l=this.h[7],h=this.h[8],d=this.h[9],f=this.h[10],p=this.h[11],y=this.h[12],m=this.h[13],g=this.h[14],v=this.h[15];Rn(this.k.length===n.length);for(var w=0;w<n.length;w+=2){var b=g,M=v,A=sr(h,d),I=ur(h,d),N=tr(h,0,f,0,y),T=nr(0,d,0,p,0,m),E=this.k[w],x=this.k[w+1],k=n[w],L=n[w+1],S=Zn(b,M,A,I,N,T,E,x,k,L),j=Jn(b,M,A,I,N,T,E,x,k,L);b=or(r,i),M=ar(r,i),A=rr(r,0,o,0,s),I=ir(0,i,0,a,0,u);var D=Vn(b,M,A,I),C=Hn(b,M,A,I);g=y,v=m,y=f,m=p,f=h,p=d,h=Vn(c,l,S,j),d=Hn(l,l,S,j),c=s,l=u,s=o,u=a,o=r,a=i,r=Vn(S,j,D,C),i=Hn(S,j,D,C)}Fn(this.h,0,r,i),Fn(this.h,2,o,a),Fn(this.h,4,s,u),Fn(this.h,6,c,l),Fn(this.h,8,h,d),Fn(this.h,10,f,p),Fn(this.h,12,y,m),Fn(this.h,14,g,v)},$n.prototype._digest=function(e){return"hex"===e?_n.toHex32(this.h,"big"):_n.split32(this.h,"big")};var fr=Bt,pr=er;function yr(){if(!(this instanceof yr))return new yr;pr.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}fr.inherits(yr,pr);var mr=yr;yr.blockSize=1024,yr.outSize=384,yr.hmacStrength=192,yr.padLength=128,yr.prototype._digest=function(e){return"hex"===e?fr.toHex32(this.h.slice(0,12),"big"):fr.split32(this.h.slice(0,12),"big")},Kt.sha1=yn,Kt.sha224=Pn,Kt.sha256=Dn,Kt.sha384=mr,Kt.sha512=er;var gr={},vr=Bt,wr=qt,br=vr.rotl32,Mr=vr.sum32,Ar=vr.sum32_3,Ir=vr.sum32_4,Nr=wr.BlockHash;function Tr(){if(!(this instanceof Tr))return new Tr;Nr.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian="little"}function Er(e,t,n,r){return e<=15?t^n^r:e<=31?t&n|~t&r:e<=47?(t|~n)^r:e<=63?t&r|n&~r:t^(n|~r)}function xr(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function kr(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}vr.inherits(Tr,Nr),gr.ripemd160=Tr,Tr.blockSize=512,Tr.outSize=160,Tr.hmacStrength=192,Tr.padLength=64,Tr.prototype._update=function(e,t){for(var n=this.h[0],r=this.h[1],i=this.h[2],o=this.h[3],a=this.h[4],s=n,u=r,c=i,l=o,h=a,d=0;d<80;d++){var f=Mr(br(Ir(n,Er(d,r,i,o),e[Lr[d]+t],xr(d)),jr[d]),a);n=a,a=o,o=br(i,10),i=r,r=f,f=Mr(br(Ir(s,Er(79-d,u,c,l),e[Sr[d]+t],kr(d)),Dr[d]),h),s=h,h=l,l=br(c,10),c=u,u=f}f=Ar(this.h[1],i,l),this.h[1]=Ar(this.h[2],o,h),this.h[2]=Ar(this.h[3],a,s),this.h[3]=Ar(this.h[4],n,u),this.h[4]=Ar(this.h[0],r,c),this.h[0]=f},Tr.prototype._digest=function(e){return"hex"===e?vr.toHex32(this.h,"little"):vr.split32(this.h,"little")};var Lr=[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],Sr=[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],jr=[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],Dr=[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],Cr=Bt,Or=Rt;function zr(e,t,n){if(!(this instanceof zr))return new zr(e,t,n);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(Cr.toArray(t,n))}var Pr=zr;function _r(e,t,n){return e(n={path:t,exports:{},require:function(e,t){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null!=t||n.path)}},n.exports),n.exports}zr.prototype._init=function(e){e.length>this.blockSize&&(e=(new this.Hash).update(e).digest()),Or(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=(new this.Hash).update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=(new this.Hash).update(e)},zr.prototype.update=function(e,t){return this.inner.update(e,t),this},zr.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)},function(e){var t=e;t.utils=Bt,t.common=qt,t.sha=Kt,t.ripemd=gr,t.hmac=Pr,t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160}(_t);var Br=Rr;function Rr(e,t){if(!e)throw new Error(t||"Assertion failed")}Rr.equal=function(e,t,n){if(e!=t)throw new Error(n||"Assertion failed: "+e+" != "+t)};var Ur=_r((function(e,t){var n=t;function r(e){return 1===e.length?"0"+e:e}function i(e){for(var t="",n=0;n<e.length;n++)t+=r(e[n].toString(16));return t}n.toArray=function(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if("string"!=typeof e){for(var r=0;r<e.length;r++)n[r]=0|e[r];return n}if("hex"===t)for((e=e.replace(/[^a-z0-9]+/gi,"")).length%2!=0&&(e="0"+e),r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16));else for(r=0;r<e.length;r++){var i=e.charCodeAt(r),o=i>>8,a=255&i;o?n.push(o,a):n.push(a)}return n},n.zero2=r,n.toHex=i,n.encode=function(e,t){return"hex"===t?i(e):e}})),Qr=_r((function(e,t){var n=t;n.assert=Br,n.toArray=Ur.toArray,n.zero2=Ur.zero2,n.toHex=Ur.toHex,n.encode=Ur.encode,n.getNAF=function(e,t,n){var r=new Array(Math.max(e.bitLength(),n)+1);r.fill(0);for(var i=1<<t+1,o=e.clone(),a=0;a<r.length;a++){var s,u=o.andln(i-1);o.isOdd()?(s=u>(i>>1)-1?(i>>1)-u:u,o.isubn(s)):s=0,r[a]=s,o.iushrn(1)}return r},n.getJSF=function(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r,i=0,o=0;e.cmpn(-i)>0||t.cmpn(-o)>0;){var a,s,u=e.andln(3)+i&3,c=t.andln(3)+o&3;3===u&&(u=-1),3===c&&(c=-1),a=1&u?3!=(r=e.andln(7)+i&7)&&5!==r||2!==c?u:-u:0,n[0].push(a),s=1&c?3!=(r=t.andln(7)+o&7)&&5!==r||2!==u?c:-c:0,n[1].push(s),2*i===a+1&&(i=1-i),2*o===s+1&&(o=1-o),e.iushrn(1),t.iushrn(1)}return n},n.cachedProperty=function(e,t,n){var r="_"+t;e.prototype[t]=function(){return void 0!==this[r]?this[r]:this[r]=n.call(this)}},n.parseBytes=function(e){return"string"==typeof e?n.toArray(e,"hex"):e},n.intFromLE=function(e){return new Re(e,"hex","le")}})),Wr=Qr.getNAF,Yr=Qr.getJSF,Fr=Qr.assert;function Vr(e,t){this.type=e,this.p=new Re(t.p,16),this.red=t.prime?Re.red(t.prime):Re.mont(this.p),this.zero=new Re(0).toRed(this.red),this.one=new Re(1).toRed(this.red),this.two=new Re(2).toRed(this.red),this.n=t.n&&new Re(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 n=this.n&&this.p.div(this.n);!n||n.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Hr=Vr;function Gr(e,t){this.curve=e,this.type=t,this.precomputed=null}Vr.prototype.point=function(){throw new Error("Not implemented")},Vr.prototype.validate=function(){throw new Error("Not implemented")},Vr.prototype._fixedNafMul=function(e,t){Fr(e.precomputed);var n=e._getDoubles(),r=Wr(t,1,this._bitLength),i=(1<<n.step+1)-(n.step%2==0?2:1);i/=3;var o,a,s=[];for(o=0;o<r.length;o+=n.step){a=0;for(var u=o+n.step-1;u>=o;u--)a=(a<<1)+r[u];s.push(a)}for(var c=this.jpoint(null,null,null),l=this.jpoint(null,null,null),h=i;h>0;h--){for(o=0;o<s.length;o++)(a=s[o])===h?l=l.mixedAdd(n.points[o]):a===-h&&(l=l.mixedAdd(n.points[o].neg()));c=c.add(l)}return c.toP()},Vr.prototype._wnafMul=function(e,t){var n=4,r=e._getNAFPoints(n);n=r.wnd;for(var i=r.points,o=Wr(t,n,this._bitLength),a=this.jpoint(null,null,null),s=o.length-1;s>=0;s--){for(var u=0;s>=0&&0===o[s];s--)u++;if(s>=0&&u++,a=a.dblp(u),s<0)break;var c=o[s];Fr(0!==c),a="affine"===e.type?c>0?a.mixedAdd(i[c-1>>1]):a.mixedAdd(i[-c-1>>1].neg()):c>0?a.add(i[c-1>>1]):a.add(i[-c-1>>1].neg())}return"affine"===e.type?a.toP():a},Vr.prototype._wnafMulAdd=function(e,t,n,r,i){var o,a,s,u=this._wnafT1,c=this._wnafT2,l=this._wnafT3,h=0;for(o=0;o<r;o++){var d=(s=t[o])._getNAFPoints(e);u[o]=d.wnd,c[o]=d.points}for(o=r-1;o>=1;o-=2){var f=o-1,p=o;if(1===u[f]&&1===u[p]){var y=[t[f],null,null,t[p]];0===t[f].y.cmp(t[p].y)?(y[1]=t[f].add(t[p]),y[2]=t[f].toJ().mixedAdd(t[p].neg())):0===t[f].y.cmp(t[p].y.redNeg())?(y[1]=t[f].toJ().mixedAdd(t[p]),y[2]=t[f].add(t[p].neg())):(y[1]=t[f].toJ().mixedAdd(t[p]),y[2]=t[f].toJ().mixedAdd(t[p].neg()));var m=[-3,-1,-5,-7,0,7,5,1,3],g=Yr(n[f],n[p]);for(h=Math.max(g[0].length,h),l[f]=new Array(h),l[p]=new Array(h),a=0;a<h;a++){var v=0|g[0][a],w=0|g[1][a];l[f][a]=m[3*(v+1)+(w+1)],l[p][a]=0,c[f]=y}}else l[f]=Wr(n[f],u[f],this._bitLength),l[p]=Wr(n[p],u[p],this._bitLength),h=Math.max(l[f].length,h),h=Math.max(l[p].length,h)}var b=this.jpoint(null,null,null),M=this._wnafT4;for(o=h;o>=0;o--){for(var A=0;o>=0;){var I=!0;for(a=0;a<r;a++)M[a]=0|l[a][o],0!==M[a]&&(I=!1);if(!I)break;A++,o--}if(o>=0&&A++,b=b.dblp(A),o<0)break;for(a=0;a<r;a++){var N=M[a];0!==N&&(N>0?s=c[a][N-1>>1]:N<0&&(s=c[a][-N-1>>1].neg()),b="affine"===s.type?b.mixedAdd(s):b.add(s))}}for(o=0;o<r;o++)c[o]=null;return i?b:b.toP()},Vr.BasePoint=Gr,Gr.prototype.eq=function(){throw new Error("Not implemented")},Gr.prototype.validate=function(){return this.curve.validate(this)},Vr.prototype.decodePoint=function(e,t){e=Qr.toArray(e,t);var n=this.p.byteLength();if((4===e[0]||6===e[0]||7===e[0])&&e.length-1==2*n)return 6===e[0]?Fr(e[e.length-1]%2==0):7===e[0]&&Fr(e[e.length-1]%2==1),this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));if((2===e[0]||3===e[0])&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),3===e[0]);throw new Error("Unknown point format")},Gr.prototype.encodeCompressed=function(e){return this.encode(e,!0)},Gr.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray("be",t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray("be",t))},Gr.prototype.encode=function(e,t){return Qr.encode(this._encode(t),e)},Gr.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},Gr.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return!!t&&t.points.length>=Math.ceil((e.bitLength()+1)/t.step)},Gr.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<t;i+=e){for(var o=0;o<e;o++)r=r.dbl();n.push(r)}return{step:e,points:n}},Gr.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,r=1===n?null:this.dbl(),i=1;i<n;i++)t[i]=t[i-1].add(r);return{wnd:e,points:t}},Gr.prototype._getBeta=function(){return null},Gr.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t};var qr=_r((function(e){"function"==typeof Object.create?e.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:e.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}})),Zr=Qr.assert;function Jr(e){Hr.call(this,"short",e),this.a=new Re(e.a,16).toRed(this.red),this.b=new Re(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=0===this.a.fromRed().cmpn(0),this.threeA=0===this.a.fromRed().sub(this.p).cmpn(-3),this.endo=this._getEndomorphism(e),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}qr(Jr,Hr);var Xr=Jr;function Kr(e,t,n,r){Hr.BasePoint.call(this,e,"affine"),null===t&&null===n?(this.x=null,this.y=null,this.inf=!0):(this.x=new Re(t,16),this.y=new Re(n,16),r&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}function $r(e,t,n,r){Hr.BasePoint.call(this,e,"jacobian"),null===t&&null===n&&null===r?(this.x=this.curve.one,this.y=this.curve.one,this.z=new Re(0)):(this.x=new Re(t,16),this.y=new Re(n,16),this.z=new Re(r,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}Jr.prototype._getEndomorphism=function(e){if(this.zeroA&&this.g&&this.n&&1===this.p.modn(3)){var t,n;if(e.beta)t=new Re(e.beta,16).toRed(this.red);else{var r=this._getEndoRoots(this.p);t=(t=r[0].cmp(r[1])<0?r[0]:r[1]).toRed(this.red)}if(e.lambda)n=new Re(e.lambda,16);else{var i=this._getEndoRoots(this.n);0===this.g.mul(i[0]).x.cmp(this.g.x.redMul(t))?n=i[0]:(n=i[1],Zr(0===this.g.mul(n).x.cmp(this.g.x.redMul(t))))}return{beta:t,lambda:n,basis:e.basis?e.basis.map((function(e){return{a:new Re(e.a,16),b:new Re(e.b,16)}})):this._getEndoBasis(n)}}},Jr.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:Re.mont(e),n=new Re(2).toRed(t).redInvm(),r=n.redNeg(),i=new Re(3).toRed(t).redNeg().redSqrt().redMul(n);return[r.redAdd(i).fromRed(),r.redSub(i).fromRed()]},Jr.prototype._getEndoBasis=function(e){for(var t,n,r,i,o,a,s,u,c,l=this.n.ushrn(Math.floor(this.n.bitLength()/2)),h=e,d=this.n.clone(),f=new Re(1),p=new Re(0),y=new Re(0),m=new Re(1),g=0;0!==h.cmpn(0);){var v=d.div(h);u=d.sub(v.mul(h)),c=y.sub(v.mul(f));var w=m.sub(v.mul(p));if(!r&&u.cmp(l)<0)t=s.neg(),n=f,r=u.neg(),i=c;else if(r&&2==++g)break;s=u,d=h,h=u,y=f,f=c,m=p,p=w}o=u.neg(),a=c;var b=r.sqr().add(i.sqr());return o.sqr().add(a.sqr()).cmp(b)>=0&&(o=t,a=n),r.negative&&(r=r.neg(),i=i.neg()),o.negative&&(o=o.neg(),a=a.neg()),[{a:r,b:i},{a:o,b:a}]},Jr.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),o=n.b.neg().mul(e).divRound(this.n),a=i.mul(n.a),s=o.mul(r.a),u=i.mul(n.b),c=o.mul(r.b);return{k1:e.sub(a).sub(s),k2:u.add(c).neg()}},Jr.prototype.pointFromX=function(e,t){(e=new Re(e,16)).red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),r=n.redSqrt();if(0!==r.redSqr().redSub(n).cmp(this.zero))throw new Error("invalid point");var i=r.fromRed().isOdd();return(t&&!i||!t&&i)&&(r=r.redNeg()),this.point(e,r)},Jr.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return 0===n.redSqr().redISub(i).cmpn(0)},Jr.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,o=0;o<e.length;o++){var a=this._endoSplit(t[o]),s=e[o],u=s._getBeta();a.k1.negative&&(a.k1.ineg(),s=s.neg(!0)),a.k2.negative&&(a.k2.ineg(),u=u.neg(!0)),r[2*o]=s,r[2*o+1]=u,i[2*o]=a.k1,i[2*o+1]=a.k2}for(var c=this._wnafMulAdd(1,r,i,2*o,n),l=0;l<2*o;l++)r[l]=null,i[l]=null;return c},qr(Kr,Hr.BasePoint),Jr.prototype.point=function(e,t,n){return new Kr(this,e,t,n)},Jr.prototype.pointFromJSON=function(e,t){return Kr.fromJSON(this,e,t)},Kr.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,r=function(e){return n.point(e.x.redMul(n.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(r)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(r)}}}return t}},Kr.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},Kr.fromJSON=function(e,t,n){"string"==typeof t&&(t=JSON.parse(t));var r=e.point(t[0],t[1],n);if(!t[2])return r;function i(t){return e.point(t[0],t[1],n)}var o=t[2];return r.precomputed={beta:null,doubles:o.doubles&&{step:o.doubles.step,points:[r].concat(o.doubles.points.map(i))},naf:o.naf&&{wnd:o.naf.wnd,points:[r].concat(o.naf.points.map(i))}},r},Kr.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"},Kr.prototype.isInfinity=function(){return this.inf},Kr.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e))return this.curve.point(null,null);if(0===this.x.cmp(e.x))return this.curve.point(null,null);var t=this.y.redSub(e.y);0!==t.cmpn(0)&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},Kr.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(0===e.cmpn(0))return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),o=i.redSqr().redISub(this.x.redAdd(this.x)),a=i.redMul(this.x.redSub(o)).redISub(this.y);return this.curve.point(o,a)},Kr.prototype.getX=function(){return this.x.fromRed()},Kr.prototype.getY=function(){return this.y.fromRed()},Kr.prototype.mul=function(e){return e=new Re(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},Kr.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},Kr.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},Kr.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||0===this.x.cmp(e.x)&&0===this.y.cmp(e.y))},Kr.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},Kr.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)},qr($r,Hr.BasePoint),Jr.prototype.jpoint=function(e,t,n){return new $r(this,e,t,n)},$r.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},$r.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},$r.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),o=this.y.redMul(t.redMul(e.z)),a=e.y.redMul(n.redMul(this.z)),s=r.redSub(i),u=o.redSub(a);if(0===s.cmpn(0))return 0!==u.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var c=s.redSqr(),l=c.redMul(s),h=r.redMul(c),d=u.redSqr().redIAdd(l).redISub(h).redISub(h),f=u.redMul(h.redISub(d)).redISub(o.redMul(l)),p=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(d,f,p)},$r.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,o=e.y.redMul(t).redMul(this.z),a=n.redSub(r),s=i.redSub(o);if(0===a.cmpn(0))return 0!==s.cmpn(0)?this.curve.jpoint(null,null,null):this.dbl();var u=a.redSqr(),c=u.redMul(a),l=n.redMul(u),h=s.redSqr().redIAdd(c).redISub(l).redISub(l),d=s.redMul(l.redISub(h)).redISub(i.redMul(c)),f=this.z.redMul(a);return this.curve.jpoint(h,d,f)},$r.prototype.dblp=function(e){if(0===e)return this;if(this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t<e;t++)n=n.dbl();return n}var r=this.curve.a,i=this.curve.tinv,o=this.x,a=this.y,s=this.z,u=s.redSqr().redSqr(),c=a.redAdd(a);for(t=0;t<e;t++){var l=o.redSqr(),h=c.redSqr(),d=h.redSqr(),f=l.redAdd(l).redIAdd(l).redIAdd(r.redMul(u)),p=o.redMul(h),y=f.redSqr().redISub(p.redAdd(p)),m=p.redISub(y),g=f.redMul(m);g=g.redIAdd(g).redISub(d);var v=c.redMul(s);t+1<e&&(u=u.redMul(d)),o=y,s=v,c=g}return this.curve.jpoint(o,c.redMul(i),s)},$r.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},$r.prototype._zeroDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r),u=s.redSqr().redISub(a).redISub(a),c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),e=u,t=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.x.redSqr(),h=this.y.redSqr(),d=h.redSqr(),f=this.x.redAdd(h).redSqr().redISub(l).redISub(d);f=f.redIAdd(f);var p=l.redAdd(l).redIAdd(l),y=p.redSqr(),m=d.redIAdd(d);m=(m=m.redIAdd(m)).redIAdd(m),e=y.redISub(f).redISub(f),t=p.redMul(f.redISub(e)).redISub(m),n=(n=this.y.redMul(this.z)).redIAdd(n)}return this.curve.jpoint(e,t,n)},$r.prototype._threeDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),o=i.redSqr(),a=this.x.redAdd(i).redSqr().redISub(r).redISub(o);a=a.redIAdd(a);var s=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),u=s.redSqr().redISub(a).redISub(a);e=u;var c=o.redIAdd(o);c=(c=c.redIAdd(c)).redIAdd(c),t=s.redMul(a.redISub(u)).redISub(c),n=this.y.redAdd(this.y)}else{var l=this.z.redSqr(),h=this.y.redSqr(),d=this.x.redMul(h),f=this.x.redSub(l).redMul(this.x.redAdd(l));f=f.redAdd(f).redIAdd(f);var p=d.redIAdd(d),y=(p=p.redIAdd(p)).redAdd(p);e=f.redSqr().redISub(y),n=this.y.redAdd(this.z).redSqr().redISub(h).redISub(l);var m=h.redSqr();m=(m=(m=m.redIAdd(m)).redIAdd(m)).redIAdd(m),t=f.redMul(p.redISub(e)).redISub(m)}return this.curve.jpoint(e,t,n)},$r.prototype._dbl=function(){var e=this.curve.a,t=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),o=t.redSqr(),a=n.redSqr(),s=o.redAdd(o).redIAdd(o).redIAdd(e.redMul(i)),u=t.redAdd(t),c=(u=u.redIAdd(u)).redMul(a),l=s.redSqr().redISub(c.redAdd(c)),h=c.redISub(l),d=a.redSqr();d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=s.redMul(h).redISub(d),p=n.redAdd(n).redMul(r);return this.curve.jpoint(l,f,p)},$r.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),r=t.redSqr(),i=e.redAdd(e).redIAdd(e),o=i.redSqr(),a=this.x.redAdd(t).redSqr().redISub(e).redISub(r),s=(a=(a=(a=a.redIAdd(a)).redAdd(a).redIAdd(a)).redISub(o)).redSqr(),u=r.redIAdd(r);u=(u=(u=u.redIAdd(u)).redIAdd(u)).redIAdd(u);var c=i.redIAdd(a).redSqr().redISub(o).redISub(s).redISub(u),l=t.redMul(c);l=(l=l.redIAdd(l)).redIAdd(l);var h=this.x.redMul(s).redISub(l);h=(h=h.redIAdd(h)).redIAdd(h);var d=this.y.redMul(c.redMul(u.redISub(c)).redISub(a.redMul(s)));d=(d=(d=d.redIAdd(d)).redIAdd(d)).redIAdd(d);var f=this.z.redAdd(a).redSqr().redISub(n).redISub(s);return this.curve.jpoint(h,d,f)},$r.prototype.mul=function(e,t){return e=new Re(e,t),this.curve._wnafMul(this,e)},$r.prototype.eq=function(e){if("affine"===e.type)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(0!==this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0))return!1;var r=t.redMul(this.z),i=n.redMul(e.z);return 0===this.y.redMul(i).redISub(e.y.redMul(r)).cmpn(0)},$r.prototype.eqXToP=function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(0===this.x.cmp(n))return!0;for(var r=e.clone(),i=this.curve.redN.redMul(t);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),0===this.x.cmp(n))return!0}},$r.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"},$r.prototype.isInfinity=function(){return 0===this.z.cmpn(0)};var ei=_r((function(e,t){var n=t;n.base=Hr,n.short=Xr,n.mont=null,n.edwards=null})),ti=_r((function(e,t){var n,r=t,i=Qr.assert;function o(e){"short"===e.type?this.curve=new ei.short(e):"edwards"===e.type?this.curve=new ei.edwards(e):this.curve=new ei.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),"Invalid curve"),i(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}function a(e,t){Object.defineProperty(r,e,{configurable:!0,enumerable:!0,get:function(){var n=new o(t);return Object.defineProperty(r,e,{configurable:!0,enumerable:!0,value:n}),n}})}r.PresetCurve=o,a("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:_t.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),a("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:_t.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),a("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:_t.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),a("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:_t.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),a("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:_t.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),a("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:_t.sha256,gRed:!1,g:["9"]}),a("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:_t.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});try{n=null.crash()}catch(e){n=void 0}a("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:_t.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",n]})}));function ni(e){if(!(this instanceof ni))return new ni(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=Ur.toArray(e.entropy,e.entropyEnc||"hex"),n=Ur.toArray(e.nonce,e.nonceEnc||"hex"),r=Ur.toArray(e.pers,e.persEnc||"hex");Br(t.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(t,n,r)}var ri=ni;ni.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},ni.prototype._hmac=function(){return new _t.hmac(this.hash,this.K)},ni.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},ni.prototype.reseed=function(e,t,n,r){"string"!=typeof t&&(r=n,n=t,t=null),e=Ur.toArray(e,t),n=Ur.toArray(n,r),Br(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(e.concat(n||[])),this._reseed=1},ni.prototype.generate=function(e,t,n,r){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");"string"!=typeof t&&(r=n,n=t,t=null),n&&(n=Ur.toArray(n,r||"hex"),this._update(n));for(var i=[];i.length<e;)this.V=this._hmac().update(this.V).digest(),i=i.concat(this.V);var o=i.slice(0,e);return this._update(n),this._reseed++,Ur.encode(o,t)};var ii=Qr.assert;function oi(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}var ai=oi;oi.fromPublic=function(e,t,n){return t instanceof oi?t:new oi(e,{pub:t,pubEnc:n})},oi.fromPrivate=function(e,t,n){return t instanceof oi?t:new oi(e,{priv:t,privEnc:n})},oi.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:"Invalid public key"}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}},oi.prototype.getPublic=function(e,t){return"string"==typeof e&&(t=e,e=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),t?this.pub.encode(t,e):this.pub},oi.prototype.getPrivate=function(e){return"hex"===e?this.priv.toString(16,2):this.priv},oi.prototype._importPrivate=function(e,t){this.priv=new Re(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},oi.prototype._importPublic=function(e,t){if(e.x||e.y)return"mont"===this.ec.curve.type?ii(e.x,"Need x coordinate"):("short"===this.ec.curve.type||"edwards"===this.ec.curve.type)&&ii(e.x&&e.y,"Need both x and y coordinate"),void(this.pub=this.ec.curve.point(e.x,e.y));this.pub=this.ec.curve.decodePoint(e,t)},oi.prototype.derive=function(e){return e.validate()||ii(e.validate(),"public point not validated"),e.mul(this.priv).getX()},oi.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},oi.prototype.verify=function(e,t){return this.ec.verify(e,t,this)},oi.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var si=Qr.assert;function ui(e,t){if(e instanceof ui)return e;this._importDER(e,t)||(si(e.r&&e.s,"Signature without r or s"),this.r=new Re(e.r,16),this.s=new Re(e.s,16),void 0===e.recoveryParam?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}var ci=ui;function li(){this.place=0}function hi(e,t){var n=e[t.place++];if(!(128&n))return n;var r=15&n;if(0===r||r>4)return!1;for(var i=0,o=0,a=t.place;o<r;o++,a++)i<<=8,i|=e[a],i>>>=0;return!(i<=127)&&(t.place=a,i)}function di(e){for(var t=0,n=e.length-1;!e[t]&&!(128&e[t+1])&&t<n;)t++;return 0===t?e:e.slice(t)}function fi(e,t){if(t<128)e.push(t);else{var n=1+(Math.log(t)/Math.LN2>>>3);for(e.push(128|n);--n;)e.push(t>>>(n<<3)&255);e.push(t)}}ui.prototype._importDER=function(e,t){e=Qr.toArray(e,t);var n=new li;if(48!==e[n.place++])return!1;var r=hi(e,n);if(!1===r||r+n.place!==e.length||2!==e[n.place++])return!1;var i=hi(e,n);if(!1===i)return!1;var o=e.slice(n.place,i+n.place);if(n.place+=i,2!==e[n.place++])return!1;var a=hi(e,n);if(!1===a||e.length!==a+n.place)return!1;var s=e.slice(n.place,a+n.place);if(0===o[0]){if(!(128&o[1]))return!1;o=o.slice(1)}if(0===s[0]){if(!(128&s[1]))return!1;s=s.slice(1)}return this.r=new Re(o),this.s=new Re(s),this.recoveryParam=null,!0},ui.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(128&t[0]&&(t=[0].concat(t)),128&n[0]&&(n=[0].concat(n)),t=di(t),n=di(n);!(n[0]||128&n[1]);)n=n.slice(1);var r=[2];fi(r,t.length),(r=r.concat(t)).push(2),fi(r,n.length);var i=r.concat(n),o=[48];return fi(o,i.length),o=o.concat(i),Qr.encode(o,e)};var pi=function(){throw new Error("unsupported")},yi=Qr.assert;function mi(e){if(!(this instanceof mi))return new mi(e);"string"==typeof e&&(yi(Object.prototype.hasOwnProperty.call(ti,e),"Unknown curve "+e),e=ti[e]),e instanceof ti.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}var gi=mi;mi.prototype.keyPair=function(e){return new ai(this,e)},mi.prototype.keyFromPrivate=function(e,t){return ai.fromPrivate(this,e,t)},mi.prototype.keyFromPublic=function(e,t){return ai.fromPublic(this,e,t)},mi.prototype.genKeyPair=function(e){e||(e={});for(var t=new ri({hash:this.hash,pers:e.pers,persEnc:e.persEnc||"utf8",entropy:e.entropy||pi(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||"utf8",nonce:this.n.toArray()}),n=this.n.byteLength(),r=this.n.sub(new Re(2));;){var i=new Re(t.generate(n));if(!(i.cmp(r)>0))return i.iaddn(1),this.keyFromPrivate(i)}},mi.prototype._truncateToN=function(e,t){var n=8*e.byteLength()-this.n.bitLength();return n>0&&(e=e.ushrn(n)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},mi.prototype.sign=function(e,t,n,r){"object"==I(n)&&(r=n,n=null),r||(r={}),t=this.keyFromPrivate(t,n),e=this._truncateToN(new Re(e,16));for(var i=this.n.byteLength(),o=t.getPrivate().toArray("be",i),a=e.toArray("be",i),s=new ri({hash:this.hash,entropy:o,nonce:a,pers:r.pers,persEnc:r.persEnc||"utf8"}),u=this.n.sub(new Re(1)),c=0;;c++){var l=r.k?r.k(c):new Re(s.generate(this.n.byteLength()));if(!((l=this._truncateToN(l,!0)).cmpn(1)<=0||l.cmp(u)>=0)){var h=this.g.mul(l);if(!h.isInfinity()){var d=h.getX(),f=d.umod(this.n);if(0!==f.cmpn(0)){var p=l.invm(this.n).mul(f.mul(t.getPrivate()).iadd(e));if(0!==(p=p.umod(this.n)).cmpn(0)){var y=(h.getY().isOdd()?1:0)|(0!==d.cmp(f)?2:0);return r.canonical&&p.cmp(this.nh)>0&&(p=this.n.sub(p),y^=1),new ci({r:f,s:p,recoveryParam:y})}}}}}},mi.prototype.verify=function(e,t,n,r){e=this._truncateToN(new Re(e,16)),n=this.keyFromPublic(n,r);var i=(t=new ci(t,"hex")).r,o=t.s;if(i.cmpn(1)<0||i.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var a,s=o.invm(this.n),u=s.mul(e).umod(this.n),c=s.mul(i).umod(this.n);return this.curve._maxwellTrick?!(a=this.g.jmulAdd(u,n.getPublic(),c)).isInfinity()&&a.eqXToP(i):!(a=this.g.mulAdd(u,n.getPublic(),c)).isInfinity()&&0===a.getX().umod(this.n).cmp(i)},mi.prototype.recoverPubKey=function(e,t,n,r){yi((3&n)===n,"The recovery param is more than two bits"),t=new ci(t,r);var i=this.n,o=new Re(e),a=t.r,s=t.s,u=1&n,c=n>>1;if(a.cmp(this.curve.p.umod(this.curve.n))>=0&&c)throw new Error("Unable to find sencond key candinate");a=c?this.curve.pointFromX(a.add(this.curve.n),u):this.curve.pointFromX(a,u);var l=t.r.invm(i),h=i.sub(o).mul(l).umod(i),d=s.mul(l).umod(i);return this.g.mulAdd(h,a,d)},mi.prototype.getKeyRecoveryParam=function(e,t,n,r){if(null!==(t=new ci(t,r)).recoveryParam)return t.recoveryParam;for(var i=0;i<4;i++){var o;try{o=this.recoverPubKey(e,t,i)}catch(e){continue}if(o.eq(n))return i}throw new Error("Unable to find valid recovery factor")};var vi=_r((function(e,t){var n=t;n.version="6.5.4",n.utils=Qr,n.rand=function(){throw new Error("unsupported")},n.curve=ei,n.curves=ti,n.ec=gi,n.eddsa=null})).ec,wi=new Ie("signing-key/5.7.0"),bi=null;function Mi(){return bi||(bi=new vi("secp256k1")),bi}var Ai,Ii=b((function e(t){v(this,e),Ot(this,"curve","secp256k1"),Ot(this,"privateKey",De(t)),32!==function(e){if("string"!=typeof e)e=De(e);else if(!Se(e)||e.length%2)return null;return(e.length-2)/2}(this.privateKey)&&wi.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");var n=Mi().keyFromPrivate(Le(this.privateKey));Ot(this,"publicKey","0x"+n.getPublic(!1,"hex")),Ot(this,"compressedPublicKey","0x"+n.getPublic(!0,"hex")),Ot(this,"_isSigningKey",!0)}),[{key:"_addPoint",value:function(e){var t=Mi().keyFromPublic(Le(this.publicKey)),n=Mi().keyFromPublic(Le(e));return"0x"+t.pub.add(n.pub).encodeCompressed("hex")}},{key:"signDigest",value:function(e){var t=Mi().keyFromPrivate(Le(this.privateKey)),n=Le(e);32!==n.length&&wi.throwArgumentError("bad digest length","digest",e);var r=t.sign(n,{canonical:!0});return ze({recoveryParam:r.recoveryParam,r:Oe("0x"+r.r.toString(16),32),s:Oe("0x"+r.s.toString(16),32)})}},{key:"computeSharedSecret",value:function(e){var t=Mi().keyFromPrivate(Le(this.privateKey)),n=Mi().keyFromPublic(Le(Ni(e)));return Oe("0x"+t.derive(n.getPublic()).toString(16),32)}}],[{key:"isSigningKey",value:function(e){return!(!e||!e._isSigningKey)}}]);function Ni(e,t){var n=Le(e);if(32===n.length){var r=new Ii(n);return t?"0x"+Mi().keyFromPrivate(n).getPublic(!0,"hex"):r.publicKey}return 33===n.length?t?De(n):"0x"+Mi().keyFromPublic(n).getPublic(!1,"hex"):65===n.length?t?"0x"+Mi().keyFromPublic(n).getPublic(!0,"hex"):De(n):wi.throwArgumentError("invalid public or private key","key","[REDACTED]")}function Ti(e,t){return function(e){return function(e){var t=null;if("string"!=typeof e&&kt.throwArgumentError("invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/))"0x"!==e.substring(0,2)&&(e="0x"+e),t=Lt(e),e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&t!==e&&kt.throwArgumentError("bad address checksum","address",e);else if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(e.substring(2,4)!==function(e){for(var t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map((function(e){return St[e]})).join("");t.length>=Ct;){var n=t.substring(0,Ct);t=parseInt(n,10)%97+t.substring(n.length)}for(var r=String(98-parseInt(t,10)%97);r.length<2;)r="0"+r;return r}(e)&&kt.throwArgumentError("bad icap checksum","address",e),t=function(e){return new Qe(e,36).toString(16)}(e.substring(4));t.length<40;)t="0"+t;t=Lt("0x"+t)}else kt.throwArgumentError("invalid address","address",e);return t}(Ce(Pe(Ce(Ni(e),1)),12))}(function(e,t){var n=ze(t),r={r:Le(n.r),s:Le(n.s)};return"0x"+Mi().recoverPubKey(Le(e),r,n.recoveryParam).encode("hex",!1)}(Le(e),t))}function Ei(e,t,n,r,i,o){return L(this,null,A().mark((function a(){return A().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:a.t0=n.t,a.next="eip191"===a.t0?3:"eip1271"===a.t0?4:7;break;case 3:return a.abrupt("return",xi(e,t,n.s));case 4:return a.next=6,ki(e,t,n.s,r,i,o);case 6:return a.abrupt("return",a.sent);case 7:throw new Error("verifySignature failed: Attempted to verify CacaoSignature with unknown type: ".concat(n.t));case 8:case"end":return a.stop()}}),a)})))}function xi(e,t,n){return Ti(xt(t),n).toLowerCase()===e.toLowerCase()}function ki(e,t,n,r,i,o){return L(this,null,A().mark((function a(){var s,u,c,l,h,d,f;return A().wrap((function(a){for(;;)switch(a.prev=a.next){case 0:return a.prev=0,s="0x1626ba7e",u=n.substring(2),c=xt(t).substring(2),l=s+c+"00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000041"+u,a.next=9,fetch("".concat(o||"https://rpc.walletconnect.com/v1","/?chainId=").concat(r,"&projectId=").concat(i),{method:"POST",body:JSON.stringify({id:Date.now()+Math.floor(1e3*Math.random()),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:l},"latest"]})});case 9:return h=a.sent,a.next=12,h.json();case 12:return d=a.sent,f=d.result,a.abrupt("return",!!f&&f.slice(0,s.length).toLowerCase()===s.toLowerCase());case 17:return a.prev=17,a.t0=a.catch(0),a.abrupt("return",(console.error("isValidEip1271Signature: ",a.t0),!1));case 20:case"end":return a.stop()}}),a,null,[[0,17]])})))}new Ie("transactions/5.7.0"),function(e){e[e.legacy=0]="legacy",e[e.eip2930=1]="eip2930",e[e.eip1559=2]="eip1559"}(Ai||(Ai={}));var Li=Object.defineProperty,Si=Object.defineProperties,ji=Object.getOwnPropertyDescriptors,Di=Object.getOwnPropertySymbols,Ci=Object.prototype.hasOwnProperty,Oi=Object.prototype.propertyIsEnumerable,zi=function(e,t,n){return t in e?Li(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Pi=function(e){return null==e?void 0:e.split(":")},_i=function(e){var t=e&&Pi(e);if(t)return e.includes("did:pkh:")?t[3]:t[1]},Bi=function(e){var t=e&&Pi(e);if(t)return t[2]+":"+t[3]},Ri=function(e){var t=e&&Pi(e);if(t)return t.pop()};function Ui(e){return L(this,null,A().mark((function t(){var n,r,i,o,a,s;return A().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.cacao,r=e.projectId,i=n.s,o=n.p,a=Qi(o,o.iss),s=Ri(o.iss),t.next=3,Ei(s,a,i,_i(o.iss),r);case 3:return t.abrupt("return",t.sent);case 4:case"end":return t.stop()}}),t)})))}var Qi=function(e,t){var n="".concat(e.domain," wants you to sign in with your Ethereum account:"),r=Ri(t);if(!e.aud&&!e.uri)throw new Error("Either `aud` or `uri` is required to construct the message");var i=e.statement||void 0,o="URI: ".concat(e.aud||e.uri),a="Version: ".concat(e.version),s="Chain ID: ".concat(_i(t)),u="Nonce: ".concat(e.nonce),c="Issued At: ".concat(e.iat),l=e.resources?"Resources:".concat(e.resources.map((function(e){return"\n- ".concat(e)})).join("")):void 0,h=Ji(e.resources);return h&&(i=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;Wi(t);var n="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(n))return e;var r=[],i=0;Object.keys(t.att).forEach((function(e){var n=Object.keys(t.att[e]).map((function(e){return{ability:e.split("/")[0],action:e.split("/")[1]}}));n.sort((function(e,t){return e.action.localeCompare(t.action)}));var o={};n.forEach((function(e){o[e.ability]||(o[e.ability]=[]),o[e.ability].push(e.action)}));var a=Object.keys(o).map((function(t){return i++,"(".concat(i,") '").concat(t,"': '").concat(o[t].join("', '"),"' for '").concat(e,"'.")}));r.push(a.join(", ").replace(".,","."))}));var o=r.join(" "),a="".concat(n).concat(o);return"".concat(e?e+" ":"").concat(a)}(i,Vi(h))),[n,r,"",i,"",o,a,s,u,c,l].filter((function(e){return null!=e})).join("\n")};function Wi(e){if(!e)throw new Error("No recap provided, value is undefined");if(!e.att)throw new Error("No `att` property found");var t=Object.keys(e.att);if(null==t||!t.length)throw new Error("No resources found in `att` property");t.forEach((function(t){var n=e.att[t];if(Array.isArray(n))throw new Error("Resource must be an object: ".concat(t));if("object"!=I(n))throw new Error("Resource must be an object: ".concat(t));if(!Object.keys(n).length)throw new Error("Resource object is empty: ".concat(t));Object.keys(n).forEach((function(e){var t=n[e];if(!Array.isArray(t))throw new Error("Ability limits ".concat(e," must be an array of objects, found: ").concat(t));if(!t.length)throw new Error("Value of ".concat(e," is empty array, must be an array with objects"));t.forEach((function(t){if("object"!=I(t))throw new Error("Ability limits (".concat(e,") must be an array of objects, found: ").concat(t))}))}))}))}function Yi(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=(t=null==t?void 0:t.sort((function(e,t){return e.localeCompare(t)}))).map((function(t){return g({},"".concat(e,"/").concat(t),[n])}));return Object.assign.apply(Object,[{}].concat(T(r)))}function Fi(e){return Wi(e),"urn:recap:".concat(function(e){return i.from(JSON.stringify(e)).toString("base64")}(e).replace(/=/g,""))}function Vi(e){var t=function(e){return JSON.parse(i.from(e,"base64").toString("utf-8"))}(e.replace("urn:recap:",""));return Wi(t),t}function Hi(e,t,n){return Fi(function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return null==n||n.sort((function(e,t){return e.localeCompare(t)})),{att:g({},e,Yi(t,n,r))}}(e,t,n))}function Gi(e,t){return Fi(function(e,t){Wi(e),Wi(t);var n=Object.keys(e.att).concat(Object.keys(t.att)).sort((function(e,t){return e.localeCompare(t)})),r={att:{}};return n.forEach((function(n){var i,o;Object.keys((null==(i=e.att)?void 0:i[n])||{}).concat(Object.keys((null==(o=t.att)?void 0:o[n])||{})).sort((function(e,t){return e.localeCompare(t)})).forEach((function(i){var o,a;r.att[n]=function(e,t){return Si(e,ji(t))}(function(e,t){for(var n in t||(t={}))Ci.call(t,n)&&zi(e,n,t[n]);if(Di){var r,i=N(Di(t));try{for(i.s();!(r=i.n()).done;)n=r.value,Oi.call(t,n)&&zi(e,n,t[n])}catch(e){i.e(e)}finally{i.f()}}return e}({},r.att[n]),g({},i,(null==(o=e.att[n])?void 0:o[i])||(null==(a=t.att[n])?void 0:a[i])))}))})),r}(Vi(e),Vi(t)))}function qi(e){var t,n=Vi(e);Wi(n);var r=null==(t=n.att)?void 0:t.eip155;return r?Object.keys(r).map((function(e){return e.split("/")[1]})):[]}function Zi(e){var t=Vi(e);Wi(t);var n=[];return Object.values(t.att).forEach((function(e){Object.values(e).forEach((function(e){var t;null!=(t=null==e?void 0:e[0])&&t.chains&&n.push(e[0].chains)}))})),T(new Set(n.flat()))}function Ji(e){if(e){var t=null==e?void 0:e[e.length-1];return function(e){return e&&e.includes("urn:recap:")}(t)?t:void 0}}var Xi="base16",Ki="base64pad",$i="utf8",eo=1;function to(){var e=p.generateKeyPair();return{privateKey:Object(y.toString)(e.secretKey,Xi),publicKey:Object(y.toString)(e.publicKey,Xi)}}function no(){var e=Object(d.randomBytes)(32);return Object(y.toString)(e,Xi)}function ro(e,t){var n=p.sharedKey(Object(y.fromString)(e,Xi),Object(y.fromString)(t,Xi),!0),r=new h.HKDF(f.SHA256,n).expand(32);return Object(y.toString)(r,Xi)}function io(e){var t=Object(f.hash)(Object(y.fromString)(e,Xi));return Object(y.toString)(t,Xi)}function oo(e){var t=Object(f.hash)(Object(y.fromString)(e,$i));return Object(y.toString)(t,Xi)}function ao(e){return Number(Object(y.toString)(e,"base10"))}function so(e){var t=function(e){return Object(y.fromString)("".concat(e),"base10")}(I(e.type)<"u"?e.type:0);if(ao(t)===eo&&I(e.senderPublicKey)>"u")throw new Error("Missing sender public key for type 1 envelope");var n=I(e.senderPublicKey)<"u"?Object(y.fromString)(e.senderPublicKey,Xi):void 0,r=I(e.iv)<"u"?Object(y.fromString)(e.iv,Xi):Object(d.randomBytes)(12);return function(e){if(ao(e.type)===eo){if(I(e.senderPublicKey)>"u")throw new Error("Missing sender public key for type 1 envelope");return Object(y.toString)(Object(y.concat)([e.type,e.senderPublicKey,e.iv,e.sealed]),Ki)}return Object(y.toString)(Object(y.concat)([e.type,e.iv,e.sealed]),Ki)}({type:t,sealed:new l.ChaCha20Poly1305(Object(y.fromString)(e.symKey,Xi)).seal(r,Object(y.fromString)(e.message,$i)),iv:r,senderPublicKey:n})}function uo(e){var t=new l.ChaCha20Poly1305(Object(y.fromString)(e.symKey,Xi)),n=co(e.encoded),r=n.sealed,i=n.iv,o=t.open(i,r);if(null===o)throw new Error("Failed to decrypt");return Object(y.toString)(o,$i)}function co(e){var t=Object(y.fromString)(e,Ki),n=t.slice(0,1);if(ao(n)===eo){var r=t.slice(1,33),i=t.slice(33,45);return{type:n,sealed:t.slice(45),iv:i,senderPublicKey:r}}var o=t.slice(1,13);return{type:n,sealed:t.slice(13),iv:o}}function lo(e,t){var n=co(e);return ho({type:ao(n.type),senderPublicKey:I(n.senderPublicKey)<"u"?Object(y.toString)(n.senderPublicKey,Xi):void 0,receiverPublicKey:null==t?void 0:t.receiverPublicKey})}function ho(e){var t=(null==e?void 0:e.type)||0;if(t===eo){if(I(null==e?void 0:e.senderPublicKey)>"u")throw new Error("missing sender public key");if(I(null==e?void 0:e.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:null==e?void 0:e.senderPublicKey,receiverPublicKey:null==e?void 0:e.receiverPublicKey}}function fo(e){return e.type===eo&&"string"==typeof e.senderPublicKey&&"string"==typeof e.receiverPublicKey}function po(e){return(null==e?void 0:e.relay)||{protocol:"irn"}}function yo(e){var t=m.RELAY_JSONRPC[e];if(I(t)>"u")throw new Error("Relay Protocol not supported: ".concat(e));return t}var mo=Object.defineProperty,go=Object.defineProperties,vo=Object.getOwnPropertyDescriptors,wo=Object.getOwnPropertySymbols,bo=Object.prototype.hasOwnProperty,Mo=Object.prototype.propertyIsEnumerable,Ao=function(e,t,n){return t in e?mo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},Io=function(e,t){for(var n in t||(t={}))bo.call(t,n)&&Ao(e,n,t[n]);if(wo){var r,i=N(wo(t));try{for(i.s();!(r=i.n()).done;)n=r.value,Mo.call(t,n)&&Ao(e,n,t[n])}catch(e){i.e(e)}finally{i.f()}}return e};function No(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-",n={},r="relay"+t;return Object.keys(e).forEach((function(t){if(t.startsWith(r)){var i=t.replace(r,""),o=e[t];n[i]=o}})),n}function To(e){var t=(e=(e=e.includes("wc://")?e.replace("wc://",""):e).includes("wc:")?e.replace("wc:",""):e).indexOf(":"),n=-1!==e.indexOf("?")?e.indexOf("?"):void 0,r=e.substring(0,t),i=e.substring(t+1,n).split("@"),o=I(n)<"u"?e.substring(n):"",a=c.parse(o),s="string"==typeof a.methods?a.methods.split(","):void 0;return{protocol:r,topic:Eo(i[0]),version:parseInt(i[1],10),symKey:a.symKey,relay:No(a),methods:s,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function Eo(e){return e.startsWith("//")?e.substring(2):e}function xo(e){return"".concat(e.protocol,":").concat(e.topic,"@").concat(e.version,"?")+c.stringify(Io(function(e,t){return go(e,vo(t))}(Io({symKey:e.symKey},function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"-",n="relay",r={};return Object.keys(e).forEach((function(i){var o=n+t+i;e[i]&&(r[o]=e[i])})),r}(e.relay)),{expiryTimestamp:e.expiryTimestamp}),e.methods?{methods:e.methods.join(",")}:{}))}function ko(e){var t=[];return e.forEach((function(e){var n=E(e.split(":"),2),r=n[0],i=n[1];t.push("".concat(r,":").concat(i))})),t}function Lo(e,t){for(var n=function(e){var t={};return null==e||e.forEach((function(e){var n=E(e.split(":"),2),r=n[0],i=n[1];t[r]||(t[r]={accounts:[],chains:[],events:[]}),t[r].accounts.push(e),t[r].chains.push("".concat(r,":").concat(i))})),t}(t=t.map((function(e){return e.replace("did:pkh:","")}))),r=0,i=Object.entries(n);r<i.length;r++){var o=E(i[r],2),a=(o[0],o[1]);a.methods?a.methods=ue(a.methods,e):a.methods=e,a.events=["chainChanged","accountsChanged"]}return n}var So={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},jo={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function Do(e,t){var n=jo[e],r=n.message,i=n.code;return{message:t?"".concat(r," ").concat(t):r,code:i}}function Co(e,t){var n=So[e],r=n.message,i=n.code;return{message:t?"".concat(r," ").concat(t):r,code:i}}function Oo(e,t){return!!Array.isArray(e)&&(!(I(t)<"u"&&e.length)||e.every(t))}function zo(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function Po(e){return I(e)>"u"}function _o(e,t){return!(!t||!Po(e))||"string"==typeof e&&!!e.trim().length}function Bo(e,t){return!(!t||!Po(e))||"number"==typeof e&&!isNaN(e)}function Ro(e,t){var n=t.requiredNamespaces,r=Object.keys(e.namespaces),i=Object.keys(n),o=!0;return!!J(i,r)&&(r.forEach((function(t){var r=e.namespaces[t],i=r.accounts,a=r.methods,s=r.events,u=ko(i),c=n[t];J(j(t,c),u)&&J(c.methods,a)&&J(c.events,s)||(o=!1)})),o)}function Uo(e){return!(!_o(e,!1)||!e.includes(":"))&&2===e.split(":").length}function Qo(e){if(_o(e,!1))try{return I(new URL(e))<"u"}catch(e){return!1}return!1}function Wo(e){var t;return null==(t=null==e?void 0:e.proposer)?void 0:t.publicKey}function Yo(e){return null==e?void 0:e.topic}function Fo(e,t){var n=null;return _o(null==e?void 0:e.publicKey,!1)||(n=Do("MISSING_OR_INVALID","".concat(t," controller public key should be a string"))),n}function Vo(e){var t=!0;return Oo(e)?e.length&&(t=e.every((function(e){return _o(e,!1)}))):t=!1,t}function Ho(e,t){var n=null;return Object.values(e).forEach((function(e){if(!n){var r=function(e,t){var n=null;return Vo(null==e?void 0:e.methods)?Vo(null==e?void 0:e.events)||(n=Co("UNSUPPORTED_EVENTS","".concat(t,", events should be an array of strings or empty array for no events"))):n=Co("UNSUPPORTED_METHODS","".concat(t,", methods should be an array of strings or empty array for no methods")),n}(e,"".concat(t,", namespace"));r&&(n=r)}})),n}function Go(e,t,n){var r=null;if(e&&zo(e)){var i=Ho(e,t);i&&(r=i);var o=function(e,t,n){var r=null;return Object.entries(e).forEach((function(e){var i=E(e,2),o=i[0],a=i[1];if(!r){var s=function(e,t,n){var r=null;return Oo(t)&&t.length?t.forEach((function(e){r||Uo(e)||(r=Co("UNSUPPORTED_CHAINS","".concat(n,", chain ").concat(e,' should be a string and conform to "namespace:chainId" format')))})):Uo(e)||(r=Co("UNSUPPORTED_CHAINS","".concat(n,', chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }'))),r}(o,j(o,a),"".concat(t," ").concat(n));s&&(r=s)}})),r}(e,t,n);o&&(r=o)}else r=Do("MISSING_OR_INVALID","".concat(t,", ").concat(n," should be an object with data"));return r}function qo(e,t){var n=null;if(e&&zo(e)){var r=Ho(e,t);r&&(n=r);var i=function(e,t){var n=null;return Object.values(e).forEach((function(e){if(!n){var r=function(e,t){var n=null;return Oo(e)?e.forEach((function(e){n||function(e){if(_o(e,!1)&&e.includes(":")){var t=e.split(":");if(3===t.length){var n=t[0]+":"+t[1];return!!t[2]&&Uo(n)}}return!1}(e)||(n=Co("UNSUPPORTED_ACCOUNTS","".concat(t,", account ").concat(e,' should be a string and conform to "namespace:chainId:address" format')))})):n=Co("UNSUPPORTED_ACCOUNTS","".concat(t,', accounts should be an array of strings conforming to "namespace:chainId:address" format')),n}(null==e?void 0:e.accounts,"".concat(t," namespace"));r&&(n=r)}})),n}(e,t);i&&(n=i)}else n=Do("MISSING_OR_INVALID","".concat(t,", namespaces should be an object with data"));return n}function Zo(e){return _o(e.protocol,!0)}function Jo(e,t){var n=!1;return t&&!e?n=!0:e&&Oo(e)&&e.length&&e.forEach((function(e){n=Zo(e)})),n}function Xo(e){return"number"==typeof e}function Ko(e){return I(e)<"u"&&null!==I(e)}function $o(e){return!!(e&&"object"==I(e)&&e.code&&Bo(e.code,!1)&&e.message&&_o(e.message,!1))}function ea(e){return!(Po(e)||!_o(e.method,!1))}function ta(e){return!(Po(e)||Po(e.result)&&Po(e.error)||!Bo(e.id,!1)||!_o(e.jsonrpc,!1))}function na(e){return!(Po(e)||!_o(e.name,!1))}function ra(e,t){return!(!Uo(t)||!function(e){var t=[];return Object.values(e).forEach((function(e){t.push.apply(t,T(ko(e.accounts)))})),t}(e).includes(t))}function ia(e,t,n){return!!_o(n,!1)&&function(e,t){var n=[];return Object.values(e).forEach((function(e){ko(e.accounts).includes(t)&&n.push.apply(n,T(e.methods))})),n}(e,t).includes(n)}function oa(e,t,n){return!!_o(n,!1)&&function(e,t){var n=[];return Object.values(e).forEach((function(e){ko(e.accounts).includes(t)&&n.push.apply(n,T(e.events))})),n}(e,t).includes(n)}function aa(e,t,n){var r=null,i=function(e){var t={};return Object.keys(e).forEach((function(n){var r;n.includes(":")?t[n]=e[n]:null==(r=e[n].chains)||r.forEach((function(r){t[r]={methods:e[n].methods,events:e[n].events}}))})),t}(e),o=function(e){var t={};return Object.keys(e).forEach((function(n){if(n.includes(":"))t[n]=e[n];else{var r=ko(e[n].accounts);null==r||r.forEach((function(r){t[r]={accounts:e[n].accounts.filter((function(e){return e.includes("".concat(r,":"))})),methods:e[n].methods,events:e[n].events}}))}})),t}(t),a=Object.keys(i),s=Object.keys(o),u=sa(Object.keys(e)),c=sa(Object.keys(t)),l=u.filter((function(e){return!c.includes(e)}));return l.length&&(r=Do("NON_CONFORMING_NAMESPACES","".concat(n," namespaces keys don't satisfy requiredNamespaces.\n Required: ").concat(l.toString(),"\n Received: ").concat(Object.keys(t).toString()))),J(a,s)||(r=Do("NON_CONFORMING_NAMESPACES","".concat(n," namespaces chains don't satisfy required namespaces.\n Required: ").concat(a.toString(),"\n Approved: ").concat(s.toString()))),Object.keys(t).forEach((function(e){if(e.includes(":")&&!r){var i=ko(t[e].accounts);i.includes(e)||(r=Do("NON_CONFORMING_NAMESPACES","".concat(n," namespaces accounts don't satisfy namespace accounts for ").concat(e,"\n Required: ").concat(e,"\n Approved: ").concat(i.toString())))}})),a.forEach((function(e){r||(J(i[e].methods,o[e].methods)?J(i[e].events,o[e].events)||(r=Do("NON_CONFORMING_NAMESPACES","".concat(n," namespaces events don't satisfy namespace events for ").concat(e))):r=Do("NON_CONFORMING_NAMESPACES","".concat(n," namespaces methods don't satisfy namespace methods for ").concat(e)))})),r}function sa(e){return T(new Set(e.map((function(e){return e.includes(":")?e.split(":")[0]:e}))))}function ua(e,t){return Bo(e,!1)&&e<=t.max&&e>=t.min}function ca(){var e=V();return new Promise((function(t){switch(e){case U:t(F()&&(null==navigator?void 0:navigator.onLine));break;case B:t(function(){return L(this,null,A().mark((function e(){var t;return A().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(Y()&&(void 0===r?"undefined":I(r))<"u"&&null!=r&&r.NetInfo)){e.next=5;break}return e.next=3,null==r?void 0:r.NetInfo.fetch();case 3:return t=e.sent,e.abrupt("return",null==t?void 0:t.isConnected);case 5:return e.abrupt("return",!0);case 6:case"end":return e.stop()}}),e)})))}());break;case R:t(!0);break;default:t(!0)}}))}function la(e){switch(V()){case U:!function(e){!Y()&&F()&&(window.addEventListener("online",(function(){return e(!0)})),window.addEventListener("offline",(function(){return e(!1)})))}(e);break;case B:!function(e){Y()&&(void 0===r?"undefined":I(r))<"u"&&null!=r&&r.NetInfo&&(null==r||r.NetInfo.addEventListener((function(t){return e(null==t?void 0:t.isConnected)})))}(e)}}var ha={},da=b((function e(){v(this,e)}),null,[{key:"get",value:function(e){return ha[e]}},{key:"set",value:function(e,t){ha[e]=t}},{key:"delete",value:function(e){delete ha[e]}}])}).call(this,n(33),n(26),n(116).Buffer)},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(16);r.__exportStar(n(76),t),r.__exportStar(n(81),t),r.__exportStar(n(82),t),r.__exportStar(n(45),t)},function(e,t,n){n(7);var r=n(25);n.d(t,"parseConnectionError",(function(){return r.d}));var i=n(54);n.o(i,"IJsonRpcProvider")&&n.d(t,"IJsonRpcProvider",(function(){return i.IJsonRpcProvider})),n.o(i,"formatJsonRpcError")&&n.d(t,"formatJsonRpcError",(function(){return i.formatJsonRpcError})),n.o(i,"formatJsonRpcRequest")&&n.d(t,"formatJsonRpcRequest",(function(){return i.formatJsonRpcRequest})),n.o(i,"formatJsonRpcResult")&&n.d(t,"formatJsonRpcResult",(function(){return i.formatJsonRpcResult})),n.o(i,"getBigIntRpcId")&&n.d(t,"getBigIntRpcId",(function(){return i.getBigIntRpcId})),n.o(i,"isJsonRpcError")&&n.d(t,"isJsonRpcError",(function(){return i.isJsonRpcError})),n.o(i,"isJsonRpcRequest")&&n.d(t,"isJsonRpcRequest",(function(){return i.isJsonRpcRequest})),n.o(i,"isJsonRpcResponse")&&n.d(t,"isJsonRpcResponse",(function(){return i.isJsonRpcResponse})),n.o(i,"isJsonRpcResult")&&n.d(t,"isJsonRpcResult",(function(){return i.isJsonRpcResult})),n.o(i,"isLocalhostUrl")&&n.d(t,"isLocalhostUrl",(function(){return i.isLocalhostUrl})),n.o(i,"isReactNative")&&n.d(t,"isReactNative",(function(){return i.isReactNative})),n.o(i,"isWsUrl")&&n.d(t,"isWsUrl",(function(){return i.isWsUrl})),n.o(i,"payloadId")&&n.d(t,"payloadId",(function(){return i.payloadId}));var o=n(55);n.d(t,"formatJsonRpcError",(function(){return o.a})),n.d(t,"formatJsonRpcRequest",(function(){return o.b})),n.d(t,"formatJsonRpcResult",(function(){return o.c})),n.d(t,"getBigIntRpcId",(function(){return o.d})),n.d(t,"payloadId",(function(){return o.e})),n(56);var a=n(63);n.d(t,"IJsonRpcProvider",(function(){return a.a}));var s=n(57);n.d(t,"isLocalhostUrl",(function(){return s.a})),n.d(t,"isWsUrl",(function(){return s.b}));var u=n(58);n.d(t,"isJsonRpcError",(function(){return u.a})),n.d(t,"isJsonRpcRequest",(function(){return u.b})),n.d(t,"isJsonRpcResponse",(function(){return u.c})),n.d(t,"isJsonRpcResult",(function(){return u.d}))},function(e,t,n){n.d(t,"h",(function(){return r})),n.d(t,"i",(function(){return i})),n.d(t,"f",(function(){return o})),n.d(t,"g",(function(){return a})),n.d(t,"e",(function(){return s})),n.d(t,"a",(function(){return u})),n.d(t,"b",(function(){return c})),n.d(t,"d",(function(){return l})),n.d(t,"c",(function(){return h})),n.d(t,"l",(function(){return d})),n.d(t,"k",(function(){return f})),n.d(t,"m",(function(){return p})),n.d(t,"n",(function(){return y})),n.d(t,"j",(function(){return m}));var r="EdDSA",i="JWT",o=".",a="base64url",s="utf8",u="utf8",c=":",l="did",h="key",d="base58btc",f="z",p="K36",y=32,m=32},function(e,t,n){n.d(t,"a",(function(){return C})),n.d(t,"b",(function(){return O})),n.d(t,"c",(function(){return k})),n.d(t,"d",(function(){return j}));var r=n(15),i=n.n(r);n.d(t,"e",(function(){return i.a}));var o=n(8);function a(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function s(e){return(s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,h(r.key),r)}}function l(e,t,n){return t&&c(e.prototype,t),n&&c(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e){var t=function(e,t){if("object"!=s(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=s(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==s(t)?t:t+""}var d="custom_context",f=1024e3,p=l((function e(t){u(this,e),this.nodeValue=t,this.sizeInBytes=(new TextEncoder).encode(this.nodeValue).length,this.next=null}),[{key:"value",get:function(){return this.nodeValue}},{key:"size",get:function(){return this.sizeInBytes}}]),y=l((function e(t){u(this,e),this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}),[{key:"append",value:function(e){var t=new p(e);if(t.size>this.maxSizeInBytes)throw new Error("[LinkedList] Value too big to insert into list: ".concat(e," with size ").concat(t.size));for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}},{key:"shift",value:function(){if(this.head){var e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}}},{key:"toArray",value:function(){for(var e=[],t=this.head;null!==t;)e.push(t.value),t=t.next;return e}},{key:"length",get:function(){return this.lengthInNodes}},{key:"size",get:function(){return this.sizeInBytes}},{key:"toOrderedArray",value:function(){return Array.from(this)}},{key:Symbol.iterator,value:function(){var e=this.head;return{next:function(){if(!e)return{done:!0,value:null};var t=e.value;return e=e.next,{done:!1,value:t}}}}}]),m=l((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;u(this,e),this.level=null!=t?t:"error",this.levelValue=r.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=n,this.logs=new y(this.MAX_LOG_SIZE_IN_BYTES)}),[{key:"forwardToConsole",value:function(e,t){t===r.levels.values.error?console.error(e):t===r.levels.values.warn?console.warn(e):t===r.levels.values.debug?console.debug(e):t===r.levels.values.trace?console.trace(e):console.log(e)}},{key:"appendToLogs",value:function(e){this.logs.append(Object(o.b)({timestamp:(new Date).toISOString(),log:e}));var t="string"==typeof e?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}},{key:"getLogs",value:function(){return this.logs}},{key:"clearLogs",value:function(){this.logs=new y(this.MAX_LOG_SIZE_IN_BYTES)}},{key:"getLogArray",value:function(){return Array.from(this.logs)}},{key:"logsToBlob",value:function(e){var t=this.getLogArray();return t.push(Object(o.b)({extraMetadata:e})),new Blob(t,{type:"application/json"})}}]),g=l((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;u(this,e),this.baseChunkLogger=new m(t,n)}),[{key:"write",value:function(e){this.baseChunkLogger.appendToLogs(e)}},{key:"getLogs",value:function(){return this.baseChunkLogger.getLogs()}},{key:"clearLogs",value:function(){this.baseChunkLogger.clearLogs()}},{key:"getLogArray",value:function(){return this.baseChunkLogger.getLogArray()}},{key:"logsToBlob",value:function(e){return this.baseChunkLogger.logsToBlob(e)}},{key:"downloadLogsBlobInBrowser",value:function(e){var t=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement("a");n.href=t,n.download="walletconnect-logs-".concat((new Date).toISOString(),".txt"),document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}}]),v=l((function e(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:f;u(this,e),this.baseChunkLogger=new m(t,n)}),[{key:"write",value:function(e){this.baseChunkLogger.appendToLogs(e)}},{key:"getLogs",value:function(){return this.baseChunkLogger.getLogs()}},{key:"clearLogs",value:function(){this.baseChunkLogger.clearLogs()}},{key:"getLogArray",value:function(){return this.baseChunkLogger.getLogArray()}},{key:"logsToBlob",value:function(e){return this.baseChunkLogger.logsToBlob(e)}}]),w=Object.defineProperty,b=Object.defineProperties,M=Object.getOwnPropertyDescriptors,A=Object.getOwnPropertySymbols,I=Object.prototype.hasOwnProperty,N=Object.prototype.propertyIsEnumerable,T=function(e,t,n){return t in e?w(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},E=function(e,t){for(var n in t||(t={}))I.call(t,n)&&T(e,n,t[n]);if(A){var r,i=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return a(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,s=!0,u=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return s=e.done,e},e:function(e){u=!0,o=e},f:function(){try{s||null==n.return||n.return()}finally{if(u)throw o}}}}(A(t));try{for(i.s();!(r=i.n()).done;)n=r.value,N.call(t,n)&&T(e,n,t[n])}catch(e){i.e(e)}finally{i.f()}}return e},x=function(e,t){return b(e,M(t))};function k(e){return x(E({},e),{level:(null==e?void 0:e.level)||"info"})}function L(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d;return e[t]||""}function S(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d;return e[n]=t,e}function j(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d;return s(e.bindings)>"u"?L(e,t):e.bindings().context||""}function D(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d,r=j(e,n);return r.trim()?"".concat(r,"/").concat(t):t}function C(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:d,r=D(e,t,n),i=e.child({context:r});return S(i,r,n)}function O(e){return s(e.loggerOverride)<"u"&&"string"!=typeof e.loggerOverride?{logger:e.loggerOverride,chunkLoggerController:null}:("undefined"==typeof window?"undefined":s(window))<"u"?function(e){var t,n,r=new g(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:i()(x(E({},e.opts),{level:"trace",browser:x(E({},null==(n=e.opts)?void 0:n.browser),{write:function(e){return r.write(e)}})})),chunkLoggerController:r}}(e):function(e){var t,n=new v(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:i()(x(E({},e.opts),{level:"trace"}),n),chunkLoggerController:n}}(e)}},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0});var r=n(109),i=n(42),o=n(110),a=n(17),s=n(20),u=n(111);t.compare=r.compare,t.concat=i.concat,t.equals=o.equals,t.fromString=a.fromString,t.toString=s.toString,t.xor=u.xor},function(e,t,n){var r,i="object"==typeof Reflect?Reflect:null,o=i&&"function"==typeof i.apply?i.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};r=i&&"function"==typeof i.ownKeys?i.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var a=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise((function(n,r){function i(n){e.removeListener(t,o),r(n)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),n([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&g(e,"error",t,{once:!0})}(e,i)}))},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var u=10;function c(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function h(e,t,n,r){var i,o,a,s;if(c(n),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),o=e._events),a=o[t]),void 0===a)a=o[t]=n,++e._eventsCount;else if("function"==typeof a?a=o[t]=r?[n,a]:[a,n]:r?a.unshift(n):a.push(n),(i=l(e))>0&&a.length>i&&!a.warned){a.warned=!0;var u=new Error("Possible EventEmitter memory leak detected. "+a.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");u.name="MaxListenersExceededWarning",u.emitter=e,u.type=t,u.count=a.length,s=u,console&&console.warn&&console.warn(s)}return e}function d(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=d.bind(r);return i.listener=n,r.wrapFn=i,i}function p(e,t,n){var r=e._events;if(void 0===r)return[];var i=r[t];return void 0===i?[]:"function"==typeof i?n?[i.listener||i]:[i]:n?function(e){for(var t=new Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}(i):m(i,i.length)}function y(e){var t=this._events;if(void 0!==t){var n=t[e];if("function"==typeof n)return 1;if(void 0!==n)return n.length}return 0}function m(e,t){for(var n=new Array(t),r=0;r<t;++r)n[r]=e[r];return n}function g(e,t,n,r){if("function"==typeof e.on)r.once?e.once(t,n):e.on(t,n);else{if("function"!=typeof e.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e);e.addEventListener(t,(function i(o){r.once&&e.removeEventListener(t,i),n(o)}))}}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return u},set:function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");u=e}}),s.init=function(){void 0!==this._events&&this._events!==Object.getPrototypeOf(this)._events||(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||a(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return l(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var r="error"===e,i=this._events;if(void 0!==i)r=r&&void 0===i.error;else if(!r)return!1;if(r){var a;if(t.length>0&&(a=t[0]),a instanceof Error)throw a;var s=new Error("Unhandled error."+(a?" ("+a.message+")":""));throw s.context=a,s}var u=i[e];if(void 0===u)return!1;if("function"==typeof u)o(u,this,t);else{var c=u.length,l=m(u,c);for(n=0;n<c;++n)o(l[n],this,t)}return!0},s.prototype.addListener=function(e,t){return h(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return h(this,e,t,!0)},s.prototype.once=function(e,t){return c(t),this.on(e,f(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return c(t),this.prependListener(e,f(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,o,a;if(c(t),void 0===(r=this._events))return this;if(void 0===(n=r[e]))return this;if(n===t||n.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit("removeListener",e,n.listener||t));else if("function"!=typeof n){for(i=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){a=n[o].listener,i=o;break}if(i<0)return this;0===i?n.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(n,i),1===n.length&&(r[e]=n[0]),void 0!==r.removeListener&&this.emit("removeListener",e,a||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n,r;if(void 0===(n=this._events))return this;if(void 0===n.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==n[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete n[e]),this;if(0===arguments.length){var i,o=Object.keys(n);for(r=0;r<o.length;++r)"removeListener"!==(i=o[r])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=n[e]))this.removeListener(e,t);else if(void 0!==t)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this},s.prototype.listeners=function(e){return p(this,e,!0)},s.prototype.rawListeners=function(e){return p(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):y.call(e,t)},s.prototype.listenerCount=y,s.prototype.eventNames=function(){return this._eventsCount>0?r(this._events):[]}},function(e,t,n){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t,n){var i;return i=function(e,t){if("object"!=r(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t);if("object"!=r(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(t,"string"),(t="symbol"==r(i)?i:i+"")in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}n.d(t,"b",(function(){return o})),n.d(t,"d",(function(){return a})),n.d(t,"c",(function(){return s})),n.d(t,"e",(function(){return u})),n.d(t,"f",(function(){return c})),n.d(t,"a",(function(){return l}));var o="INTERNAL_ERROR",a="SERVER_ERROR",s=[-32700,-32600,-32601,-32602,-32603],u=[-32e3,-32099],c=i(i(i(i(i(i({},"PARSE_ERROR",{code:-32700,message:"Parse error"}),"INVALID_REQUEST",{code:-32600,message:"Invalid Request"}),"METHOD_NOT_FOUND",{code:-32601,message:"Method not found"}),"INVALID_PARAMS",{code:-32602,message:"Invalid params"}),o,{code:-32603,message:"Internal error"}),a,{code:-32e3,message:"Server error"}),l=a},function(e,t,n){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e){if("string"!=typeof e)throw new Error("Cannot safe json parse value of type ".concat(r(e)));try{return t=e.replace(/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,'$1"$2n"$3'),JSON.parse(t,(function(e,t){return"string"==typeof t&&t.match(/^\d+n$/)?BigInt(t.substring(0,t.length-1)):t}))}catch(t){return e}var t}function o(e){return"string"==typeof e?e:(t=e,JSON.stringify(t,(function(e,t){return"bigint"==typeof t?t.toString()+"n":t}))||"");var t}n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return o}))},function(e,t,n){(function(e){n.d(t,"a",(function(){return Ln})),n.d(t,"b",(function(){return _t})),n.d(t,"c",(function(){return Ct})),n.d(t,"d",(function(){return bt})),n.d(t,"e",(function(){return It})),n.d(t,"f",(function(){return gn})),n.d(t,"g",(function(){return Rt}));var r=n(6),i=n.n(r),o=n(64),a=n(27),s=n(4),u=n(11),c=n(8),l=n(31),h=n(0),d=n(5),f=n(1),p=n(72),y=n(2),m=n(65),g=n(66),v=n.n(g),w=n(67),b=n.n(w);function M(e){return function(e){if(Array.isArray(e))return P(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||z(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function A(e,t,n){return t=N(t),function(e,t){if(t&&("object"===x(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return I(e)}(e,function(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return!!e}()?Reflect.construct(t,n||[],N(e).constructor):t.apply(e,n))}function I(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function N(e){return(N=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function T(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&E(e,t)}function E(e,t){return(E=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}function x(e){return(x="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function k(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */k=function(){return t};var e,t={},n=Object.prototype,r=n.hasOwnProperty,i=Object.defineProperty||function(e,t,n){e[t]=n.value},o="function"==typeof Symbol?Symbol:{},a=o.iterator||"@@iterator",s=o.asyncIterator||"@@asyncIterator",u=o.toStringTag||"@@toStringTag";function c(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{c({},"")}catch(e){c=function(e,t,n){return e[t]=n}}function l(e,t,n,r){var o=t&&t.prototype instanceof m?t:m,a=Object.create(o.prototype),s=new j(r||[]);return i(a,"_invoke",{value:T(e,n,s)}),a}function h(e,t,n){try{return{type:"normal",arg:e.call(t,n)}}catch(e){return{type:"throw",arg:e}}}t.wrap=l;var d="suspendedStart",f="executing",p="completed",y={};function m(){}function g(){}function v(){}var w={};c(w,a,(function(){return this}));var b=Object.getPrototypeOf,M=b&&b(b(D([])));M&&M!==n&&r.call(M,a)&&(w=M);var A=v.prototype=m.prototype=Object.create(w);function I(e){["next","throw","return"].forEach((function(t){c(e,t,(function(e){return this._invoke(t,e)}))}))}function N(e,t){function n(i,o,a,s){var u=h(e[i],e,o);if("throw"!==u.type){var c=u.arg,l=c.value;return l&&"object"==x(l)&&r.call(l,"__await")?t.resolve(l.__await).then((function(e){n("next",e,a,s)}),(function(e){n("throw",e,a,s)})):t.resolve(l).then((function(e){c.value=e,a(c)}),(function(e){return n("throw",e,a,s)}))}s(u.arg)}var o;i(this,"_invoke",{value:function(e,r){function i(){return new t((function(t,i){n(e,r,t,i)}))}return o=o?o.then(i,i):i()}})}function T(t,n,r){var i=d;return function(o,a){if(i===f)throw Error("Generator is already running");if(i===p){if("throw"===o)throw a;return{value:e,done:!0}}for(r.method=o,r.arg=a;;){var s=r.delegate;if(s){var u=E(s,r);if(u){if(u===y)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if(i===d)throw i=p,r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);i=f;var c=h(t,n,r);if("normal"===c.type){if(i=r.done?p:"suspendedYield",c.arg===y)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(i=p,r.method="throw",r.arg=c.arg)}}}function E(t,n){var r=n.method,i=t.iterator[r];if(i===e)return n.delegate=null,"throw"===r&&t.iterator.return&&(n.method="return",n.arg=e,E(t,n),"throw"===n.method)||"return"!==r&&(n.method="throw",n.arg=new TypeError("The iterator does not provide a '"+r+"' method")),y;var o=h(i,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,y;var a=o.arg;return a?a.done?(n[t.resultName]=a.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,y):a:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,y)}function L(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function S(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function j(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(L,this),this.reset(!0)}function D(t){if(t||""===t){var n=t[a];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,o=function n(){for(;++i<t.length;)if(r.call(t,i))return n.value=t[i],n.done=!1,n;return n.value=e,n.done=!0,n};return o.next=o}}throw new TypeError(x(t)+" is not iterable")}return g.prototype=v,i(A,"constructor",{value:v,configurable:!0}),i(v,"constructor",{value:g,configurable:!0}),g.displayName=c(v,u,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===g||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,v):(e.__proto__=v,c(e,u,"GeneratorFunction")),e.prototype=Object.create(A),e},t.awrap=function(e){return{__await:e}},I(N.prototype),c(N.prototype,s,(function(){return this})),t.AsyncIterator=N,t.async=function(e,n,r,i,o){void 0===o&&(o=Promise);var a=new N(l(e,n,r,i),o);return t.isGeneratorFunction(n)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},I(A),c(A,u,"Generator"),c(A,a,(function(){return this})),c(A,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),n=[];for(var r in t)n.push(r);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=D,j.prototype={constructor:j,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(S),!t)for(var n in this)"t"===n.charAt(0)&&r.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function i(r,i){return s.type="throw",s.arg=t,n.next=r,i&&(n.method="next",n.arg=e),!!i}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],s=a.completion;if("root"===a.tryLoc)return i("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return i(a.catchLoc,!0);if(this.prev<a.finallyLoc)return i(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return i(a.catchLoc,!0)}else{if(!c)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return i(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n];if(i.tryLoc<=this.prev&&r.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var a=o?o.completion:{};return a.type=e,a.arg=t,o?(this.method="next",this.next=o.finallyLoc,y):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),y},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.finallyLoc===e)return this.complete(n.completion,n.afterLoc),S(n),y}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var n=this.tryEntries[t];if(n.tryLoc===e){var r=n.completion;if("throw"===r.type){var i=r.arg;S(n)}return i}}throw Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:D(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),y}},t}function L(e,t,n){return(t=C(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function j(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,C(r.key),r)}}function D(e,t,n){return t&&j(e.prototype,t),n&&j(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function C(e){var t=function(e,t){if("object"!=x(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=x(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==x(t)?t:t+""}function O(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=z(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,i=function(){};return{s:i,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){s=!0,o=e},f:function(){try{a||null==n.return||n.return()}finally{if(s)throw o}}}}function z(e,t){if(e){if("string"==typeof e)return P(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?P(e,t):void 0}}function P(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}var _=Object.defineProperty,B=Object.getOwnPropertySymbols,R=Object.prototype.hasOwnProperty,U=Object.prototype.propertyIsEnumerable,Q=function(e,t,n){return t in e?_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},W=function(e,t){for(var n in t||(t={}))R.call(t,n)&&Q(e,n,t[n]);if(B){var r,i=O(B(t));try{for(i.s();!(r=i.n()).done;)n=r.value,U.call(t,n)&&Q(e,n,t[n])}catch(e){i.e(e)}finally{i.f()}}return e},Y=function(e,t,n){return new Promise((function(r,i){var o=function(e){try{s(n.next(e))}catch(e){i(e)}},a=function(e){try{s(n.throw(e))}catch(e){i(e)}},s=function(e){return e.done?r(e.value):Promise.resolve(e.value).then(o,a)};s((n=n.apply(e,t)).next())}))},F=function(e){if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},V=D((function e(t,n,r){S(this,e),this.name=t,this.prefix=n,this.baseEncode=r}),[{key:"encode",value:function(e){if(e instanceof Uint8Array)return"".concat(this.prefix).concat(this.baseEncode(e));throw Error("Unknown type, must be binary type")}}]),H=D((function e(t,n,r){if(S(this,e),this.name=t,this.prefix=n,void 0===n.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=r}),[{key:"decode",value:function(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error("Unable to decode multibase string ".concat(JSON.stringify(e),", ").concat(this.name," decoder only supports inputs prefixed with ").concat(this.prefix));return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}},{key:"or",value:function(e){return q(this,e)}}]),G=D((function e(t){S(this,e),this.decoders=t}),[{key:"or",value:function(e){return q(this,e)}},{key:"decode",value:function(e){var t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError("Unable to decode multibase string ".concat(JSON.stringify(e),", only inputs prefixed with ").concat(Object.keys(this.decoders)," are supported"))}}]),q=function(e,t){return new G(W(W({},e.decoders||L({},e.prefix,e)),t.decoders||L({},t.prefix,t)))},Z=D((function e(t,n,r,i){S(this,e),this.name=t,this.prefix=n,this.baseEncode=r,this.baseDecode=i,this.encoder=new V(t,n,r),this.decoder=new H(t,n,i)}),[{key:"encode",value:function(e){return this.encoder.encode(e)}},{key:"decode",value:function(e){return this.decoder.decode(e)}}]),J=function(e){var t=e.name,n=e.prefix,r=e.encode,i=e.decode;return new Z(t,n,r,i)},X=function(e){var t=e.prefix,n=e.name,r=function(e,t){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),a=o.charCodeAt(0);if(255!==n[a])throw new TypeError(o+" is ambiguous");n[a]=i}var s=e.length,u=e.charAt(0),c=Math.log(s)/Math.log(256),l=Math.log(256)/Math.log(s);function h(e){if("string"!=typeof e)throw new TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[t]){for(var r=0,i=0;e[t]===u;)r++,t++;for(var o=(e.length-t)*c+1>>>0,a=new Uint8Array(o);e[t];){var l=n[e.charCodeAt(t)];if(255===l)return;for(var h=0,d=o-1;(0!==l||h<i)&&-1!==d;d--,h++)l+=s*a[d]>>>0,a[d]=l%256>>>0,l=l/256>>>0;if(0!==l)throw new Error("Non-zero carry");i=h,t++}if(" "!==e[t]){for(var f=o-i;f!==o&&0===a[f];)f++;for(var p=new Uint8Array(r+(o-f)),y=r;f!==o;)p[y++]=a[f++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===t.length)return"";for(var n=0,r=0,i=0,o=t.length;i!==o&&0===t[i];)i++,n++;for(var a=(o-i)*l+1>>>0,c=new Uint8Array(a);i!==o;){for(var h=t[i],d=0,f=a-1;(0!==h||d<r)&&-1!==f;f--,d++)h+=256*c[f]>>>0,c[f]=h%s>>>0,h=h/s>>>0;if(0!==h)throw new Error("Non-zero carry");r=d,i++}for(var p=a-r;p!==a&&0===c[p];)p++;for(var y=u.repeat(n);p<a;++p)y+=e.charAt(c[p]);return y},decodeUnsafe:h,decode:function(e){var n=h(e);if(n)return n;throw new Error("Non-".concat(t," character"))}}}(e.alphabet,n),i=r.encode,o=r.decode;return J({prefix:t,name:n,encode:i,decode:function(e){return F(o(e))}})},K=function(e){var t=e.name,n=e.prefix,r=e.bitsPerChar,i=e.alphabet;return J({prefix:n,name:t,encode:function(e){return function(e,t,n){for(var r="="===t[t.length-1],i=(1<<n)-1,o="",a=0,s=0,u=0;u<e.length;++u)for(s=s<<8|e[u],a+=8;a>n;)o+=t[i&s>>(a-=n)];if(a&&(o+=t[i&s<<n-a]),r)for(;o.length*n&7;)o+="=";return o}(e,i,r)},decode:function(e){return function(e,t,n,r){for(var i={},o=0;o<t.length;++o)i[t[o]]=o;for(var a=e.length;"="===e[a-1];)--a;for(var s=new Uint8Array(a*n/8|0),u=0,c=0,l=0,h=0;h<a;++h){var d=i[e[h]];if(void 0===d)throw new SyntaxError("Non-".concat(r," character"));c=c<<n|d,(u+=n)>=8&&(u-=8,s[l++]=255&c>>u)}if(u>=n||255&c<<8-u)throw new SyntaxError("Unexpected end of data");return s}(e,i,r,t)}})},$=J({prefix:"\0",name:"identity",encode:function(e){return function(e){return(new TextDecoder).decode(e)}(e)},decode:function(e){return function(e){return(new TextEncoder).encode(e)}(e)}}),ee=Object.freeze({__proto__:null,identity:$}),te=K({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),ne=Object.freeze({__proto__:null,base2:te}),re=K({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),ie=Object.freeze({__proto__:null,base8:re}),oe=X({prefix:"9",name:"base10",alphabet:"0123456789"}),ae=Object.freeze({__proto__:null,base10:oe}),se=K({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ue=K({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),ce=Object.freeze({__proto__:null,base16:se,base16upper:ue}),le=K({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),he=K({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),de=K({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),fe=K({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),pe=K({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ye=K({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),me=K({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ge=K({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ve=K({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),we=Object.freeze({__proto__:null,base32:le,base32upper:he,base32pad:de,base32padupper:fe,base32hex:pe,base32hexupper:ye,base32hexpad:me,base32hexpadupper:ge,base32z:ve}),be=X({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Me=X({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Ae=Object.freeze({__proto__:null,base36:be,base36upper:Me}),Ie=X({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Ne=X({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Te=Object.freeze({__proto__:null,base58btc:Ie,base58flickr:Ne}),Ee=K({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),xe=K({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),ke=K({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Le=K({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Se=Object.freeze({__proto__:null,base64:Ee,base64pad:xe,base64url:ke,base64urlpad:Le}),je=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),De=je.reduce((function(e,t,n){return e[n]=t,e}),[]),Ce=je.reduce((function(e,t,n){return e[t.codePointAt(0)]=n,e}),[]),Oe=J({prefix:"🚀",name:"base256emoji",encode:function(e){return e.reduce((function(e,t){return e+De[t]}),"")},decode:function(e){var t,n=[],r=O(e);try{for(r.s();!(t=r.n()).done;){var i=t.value,o=Ce[i.codePointAt(0)];if(void 0===o)throw new Error("Non-base256emoji character: ".concat(i));n.push(o)}}catch(e){r.e(e)}finally{r.f()}return new Uint8Array(n)}}),ze=Object.freeze({__proto__:null,base256emoji:Oe}),Pe=Math.pow(2,31),_e=Math.pow(2,7),Be=Math.pow(2,14),Re=Math.pow(2,21),Ue=Math.pow(2,28),Qe=Math.pow(2,35),We=Math.pow(2,42),Ye=Math.pow(2,49),Fe=Math.pow(2,56),Ve=Math.pow(2,63),He=function e(t,n,r){n=n||[];for(var i=r=r||0;t>=Pe;)n[r++]=255&t|128,t/=128;for(;-128&t;)n[r++]=255&t|128,t>>>=7;return n[r]=0|t,e.bytes=r-i+1,n},Ge=function(e){return e<_e?1:e<Be?2:e<Re?3:e<Ue?4:e<Qe?5:e<We?6:e<Ye?7:e<Fe?8:e<Ve?9:10},qe=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return He(e,t,n),t},Ze=function(e){return Ge(e)},Je=function(e,t){var n=t.byteLength,r=Ze(e),i=r+Ze(n),o=new Uint8Array(i+n);return qe(e,o,0),qe(n,o,r),o.set(t,i),new Xe(e,n,t,o)},Xe=D((function e(t,n,r,i){S(this,e),this.code=t,this.size=n,this.digest=r,this.bytes=i})),Ke=function(e){var t=e.name,n=e.code,r=e.encode;return new $e(t,n,r)},$e=D((function e(t,n,r){S(this,e),this.name=t,this.code=n,this.encode=r}),[{key:"digest",value:function(e){var t=this;if(e instanceof Uint8Array){var n=this.encode(e);return n instanceof Uint8Array?Je(this.code,n):n.then((function(e){return Je(t.code,e)}))}throw Error("Unknown type, must be binary type")}}]),et=function(e){return function(t){return Y(void 0,null,k().mark((function n(){return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.t0=Uint8Array,n.next=3,crypto.subtle.digest(e,t);case 3:return n.t1=n.sent,n.abrupt("return",new n.t0(n.t1));case 5:case"end":return n.stop()}}),n)})))}},tt=Ke({name:"sha2-256",code:18,encode:et("SHA-256")}),nt=Ke({name:"sha2-512",code:19,encode:et("SHA-512")}),rt=Object.freeze({__proto__:null,sha256:tt,sha512:nt}),it=F,ot={code:0,name:"identity",encode:it,digest:function(e){return Je(0,it(e))}},at=Object.freeze({__proto__:null,identity:ot});new TextEncoder,new TextDecoder;var st=W(W(W(W(W(W(W(W(W(W({},ee),ne),ie),ae),ce),we),Ae),Te),Se),ze);function ut(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function ct(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}W(W({},rt),at);var lt=ct("utf8","u",(function(e){return"u"+new TextDecoder("utf8").decode(e)}),(function(e){return(new TextEncoder).encode(e.substring(1))})),ht=ct("ascii","a",(function(e){for(var t="a",n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t}),(function(e){for(var t=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?ut(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}((e=e.substring(1)).length),n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t})),dt=W({utf8:lt,"utf-8":lt,hex:st.base16,latin1:ht,ascii:ht,binary:ht},st);function ft(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"utf8",n=dt[t];if(!n)throw new Error('Unsupported encoding "'.concat(t,'"'));return"utf8"!==t&&"utf-8"!==t||null==globalThis.Buffer||null==globalThis.Buffer.from?n.decoder.decode("".concat(n.prefix).concat(e)):ut(globalThis.Buffer.from(e,"utf-8"))}var pt="core",yt="".concat("wc","@2:").concat(pt,":"),mt={database:":memory:"},gt="client_ed25519_seed",vt=f.ONE_DAY,wt=f.SIX_HOURS,bt="irn",Mt="wss://relay.walletconnect.com",At="wss://relay.walletconnect.org",It={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},Nt="payload",Tt="connect",Et="disconnect",xt="error",kt=f.ONE_SECOND,Lt="subscription_created",St="subscription_deleted",jt=(f.THIRTY_DAYS,1e3*f.FIVE_SECONDS),Dt=(f.THIRTY_DAYS,{wc_pairingDelete:{req:{ttl:f.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:f.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:f.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:f.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:f.ONE_DAY,prompt:!1,tag:0},res:{ttl:f.ONE_DAY,prompt:!1,tag:0}}}),Ct={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},Ot="history_created",zt="history_updated",Pt="history_deleted",_t={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},Bt=(f.ONE_DAY,"verify-api"),Rt="https://verify.walletconnect.com",Ut="https://verify.walletconnect.org",Qt=[Rt,Ut],Wt=D((function e(t,n){var r=this;S(this,e),this.core=t,this.logger=n,this.keychain=new Map,this.name="keychain",this.version="0.3",this.initialized=!1,this.storagePrefix=yt,this.init=function(){return Y(r,null,k().mark((function e(){var t;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.initialized){e.next=5;break}return e.next=3,this.getKeyChain();case 3:x(t=e.sent)<"u"&&(this.keychain=t),this.initialized=!0;case 5:case"end":return e.stop()}}),e,this)})))},this.has=function(e){return r.isInitialized(),r.keychain.has(e)},this.set=function(e,t){return Y(r,null,k().mark((function n(){return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),this.keychain.set(e,t),n.next=4,this.persist();case 4:case"end":return n.stop()}}),n,this)})))},this.get=function(e){r.isInitialized();var t=r.keychain.get(e);if(x(t)>"u"){var n=Object(h.A)("NO_MATCHING_KEY","".concat(r.name,": ").concat(e)).message;throw new Error(n)}return t},this.del=function(e){return Y(r,null,k().mark((function t(){return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.isInitialized(),this.keychain.delete(e),t.next=4,this.persist();case 4:case"end":return t.stop()}}),t,this)})))},this.core=t,this.logger=Object(s.a)(n,this.name)}),[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"setKeyChain",value:function(e){return Y(this,null,k().mark((function t(){return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.setItem(this.storageKey,Object(h.ob)(e));case 2:case"end":return t.stop()}}),t,this)})))}},{key:"getKeyChain",value:function(){return Y(this,null,k().mark((function e(){var t;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.getItem(this.storageKey);case 2:return t=e.sent,e.abrupt("return",x(t)<"u"?Object(h.qb)(t):void 0);case 4:case"end":return e.stop()}}),e,this)})))}},{key:"persist",value:function(){return Y(this,null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setKeyChain(this.keychain);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"isInitialized",value:function(){if(!this.initialized){var e=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(e)}}}]),Yt=D((function e(t,n,r){var i=this;S(this,e),this.core=t,this.logger=n,this.name="crypto",this.initialized=!1,this.init=function(){return Y(i,null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.initialized,e.t0){e.next=5;break}return e.next=4,this.keychain.init();case 4:this.initialized=!0;case 5:case"end":return e.stop()}}),e,this)})))},this.hasKeys=function(e){return i.isInitialized(),i.keychain.has(e)},this.getClientId=function(){return Y(i,null,k().mark((function e(){var t,n;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.isInitialized(),e.next=3,this.getClientSeed();case 3:return t=e.sent,n=l.generateKeyPair(t),e.abrupt("return",l.encodeIss(n.publicKey));case 6:case"end":return e.stop()}}),e,this)})))},this.generateKeyPair=function(){i.isInitialized();var e=Object(h.t)();return i.setPrivateKey(e.publicKey,e.privateKey)},this.signJWT=function(e){return Y(i,null,k().mark((function t(){var n,r,i,o;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.isInitialized(),t.next=3,this.getClientSeed();case 3:return n=t.sent,r=l.generateKeyPair(n),i=Object(h.u)(),o=vt,t.next=9,l.signJWT(i,e,o,r);case 9:return t.abrupt("return",t.sent);case 10:case"end":return t.stop()}}),t,this)})))},this.generateSharedKey=function(e,t,n){i.isInitialized();var r=i.getPrivateKey(e),o=Object(h.k)(r,t);return i.setSymKey(o,n)},this.setSymKey=function(e,t){return Y(i,null,k().mark((function n(){var r;return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),r=t||Object(h.I)(e),n.next=4,this.keychain.set(r,e);case 4:return n.abrupt("return",r);case 5:case"end":return n.stop()}}),n,this)})))},this.deleteKeyPair=function(e){return Y(i,null,k().mark((function t(){return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.isInitialized(),t.next=3,this.keychain.del(e);case 3:case"end":return t.stop()}}),t,this)})))},this.deleteSymKey=function(e){return Y(i,null,k().mark((function t(){return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.isInitialized(),t.next=3,this.keychain.del(e);case 3:case"end":return t.stop()}}),t,this)})))},this.encode=function(e,t,n){return Y(i,null,k().mark((function r(){var i,o,a,s,u,l,d;return k().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(this.isInitialized(),i=Object(h.wb)(n),o=Object(c.b)(t),!Object(h.T)(i)){r.next=7;break}return a=i.senderPublicKey,s=i.receiverPublicKey,r.next=6,this.generateSharedKey(a,s);case 6:e=r.sent;case 7:return u=this.getSymKey(e),l=i.type,d=i.senderPublicKey,r.abrupt("return",Object(h.m)({type:l,symKey:u,message:o,senderPublicKey:d}));case 9:case"end":return r.stop()}}),r,this)})))},this.decode=function(e,t,n){return Y(i,null,k().mark((function r(){var i,o,a,s,u;return k().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:if(this.isInitialized(),i=Object(h.vb)(t,n),!Object(h.T)(i)){r.next=7;break}return o=i.receiverPublicKey,a=i.senderPublicKey,r.next=6,this.generateSharedKey(o,a);case 6:e=r.sent;case 7:return r.prev=7,s=this.getSymKey(e),u=Object(h.j)({symKey:s,encoded:t}),r.abrupt("return",Object(c.a)(u));case 12:return r.prev=12,r.t0=r.catch(7),r.t1=this.logger,r.t2="Failed to decode message from topic: '".concat(e,"', clientId: '"),r.next=18,this.getClientId();case 18:r.t3=r.sent,r.t4=r.t2.concat.call(r.t2,r.t3,"'"),r.t1.error.call(r.t1,r.t4),this.logger.error(r.t0);case 22:case"end":return r.stop()}}),r,this,[[7,12]])})))},this.getPayloadType=function(e){var t=Object(h.l)(e);return Object(h.i)(t.type)},this.getPayloadSenderPublicKey=function(e){var t=Object(h.l)(e);return t.senderPublicKey?Object(d.toString)(t.senderPublicKey,h.a):void 0},this.core=t,this.logger=Object(s.a)(n,this.name),this.keychain=r||new Wt(this.core,this.logger)}),[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"setPrivateKey",value:function(e,t){return Y(this,null,k().mark((function n(){return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.keychain.set(e,t);case 2:return n.abrupt("return",e);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"getPrivateKey",value:function(e){return this.keychain.get(e)}},{key:"getClientSeed",value:function(){return Y(this,null,k().mark((function e(){var t;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:t="",e.prev=1,t=this.keychain.get(gt),e.next=10;break;case 5:return e.prev=5,e.t0=e.catch(1),t=Object(h.u)(),e.next=10,this.keychain.set(gt,t);case 10:return e.abrupt("return",ft(t,"base16"));case 11:case"end":return e.stop()}}),e,this,[[1,5]])})))}},{key:"getSymKey",value:function(e){return this.keychain.get(e)}},{key:"isInitialized",value:function(){if(!this.initialized){var e=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(e)}}}]),Ft=function(e){function t(e,n){var r;return S(this,t),(r=A(this,t,[e,n])).logger=e,r.core=n,r.messages=new Map,r.name="messages",r.version="0.3",r.initialized=!1,r.storagePrefix=yt,r.init=function(){return Y(I(r),null,k().mark((function e(){var t;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.initialized){e.next=15;break}return this.logger.trace("Initialized"),e.prev=2,e.next=5,this.getRelayerMessages();case 5:x(t=e.sent)<"u"&&(this.messages=t),this.logger.debug("Successfully Restored records for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",size:this.messages.size}),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(2),this.logger.debug("Failed to Restore records for ".concat(this.name)),this.logger.error(e.t0);case 12:return e.prev=12,this.initialized=!0,e.finish(12);case 15:case"end":return e.stop()}}),e,this,[[2,9,12,15]])})))},r.set=function(e,t){return Y(I(r),null,k().mark((function n(){var r,i;return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.isInitialized(),r=Object(h.J)(t),x(i=this.messages.get(e))>"u"&&(i={}),n.t0=x(i[r])<"u",n.t0){n.next=10;break}return i[r]=t,this.messages.set(e,i),n.next=10,this.persist();case 10:return n.abrupt("return",r);case 11:case"end":return n.stop()}}),n,this)})))},r.get=function(e){r.isInitialized();var t=r.messages.get(e);return x(t)>"u"&&(t={}),t},r.has=function(e,t){return r.isInitialized(),x(r.get(e)[Object(h.J)(t)])<"u"},r.del=function(e){return Y(I(r),null,k().mark((function t(){return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.isInitialized(),this.messages.delete(e),t.next=4,this.persist();case 4:case"end":return t.stop()}}),t,this)})))},r.logger=Object(s.a)(e,r.name),r.core=n,r}return T(t,e),D(t,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"setRelayerMessages",value:function(e){return Y(this,null,k().mark((function t(){return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.setItem(this.storageKey,Object(h.ob)(e));case 2:case"end":return t.stop()}}),t,this)})))}},{key:"getRelayerMessages",value:function(){return Y(this,null,k().mark((function e(){var t;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.getItem(this.storageKey);case 2:return t=e.sent,e.abrupt("return",x(t)<"u"?Object(h.qb)(t):void 0);case 4:case"end":return e.stop()}}),e,this)})))}},{key:"persist",value:function(){return Y(this,null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setRelayerMessages(this.messages);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"isInitialized",value:function(){if(!this.initialized){var e=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(e)}}}])}(u.f),Vt=function(e){function t(e,n){var i;return S(this,t),(i=A(this,t,[e,n])).relayer=e,i.logger=n,i.events=new r.EventEmitter,i.name="publisher",i.queue=new Map,i.publishTimeout=Object(f.toMiliseconds)(f.ONE_MINUTE),i.failedPublishTimeout=Object(f.toMiliseconds)(f.ONE_SECOND),i.needsTransportRestart=!1,i.publish=function(e,t,n){return Y(I(i),null,k().mark((function r(){var i,o,a,s,u,c,l,d,f,p,m,g=this;return k().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:n}}),o=(null==n?void 0:n.ttl)||wt,a=Object(h.F)(n),s=(null==n?void 0:n.prompt)||!1,u=(null==n?void 0:n.tag)||0,c=(null==n?void 0:n.id)||Object(y.getBigIntRpcId)().toString(),l={topic:e,message:t,opts:{ttl:o,relay:a,prompt:s,tag:u,id:c}},d="Failed to publish payload, please try again. id:".concat(c," tag:").concat(u),f=Date.now(),m=1,r.prev=3;case 4:if(void 0!==p){r.next=20;break}if(!(Date.now()-f>this.publishTimeout)){r.next=7;break}throw new Error(d);case 7:return this.logger.trace({id:c,attempts:m},"publisher.publish - attempt ".concat(m)),r.next=10,Object(h.h)(this.rpcPublish(e,t,o,a,s,u,c).catch((function(e){return g.logger.warn(e)})),this.publishTimeout,d);case 10:return r.next=12,r.sent;case 12:if(p=r.sent,m++,r.t0=p,r.t0){r.next=18;break}return r.next=18,new Promise((function(e){return setTimeout(e,g.failedPublishTimeout)}));case 18:r.next=4;break;case 20:this.relayer.events.emit(It.publish,l),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:c,topic:e,message:t,opts:n}}),r.next=28;break;case 23:if(r.prev=23,r.t1=r.catch(3),this.logger.debug("Failed to Publish Payload"),this.logger.error(r.t1),null==(i=null==n?void 0:n.internal)||!i.throwOnFailedPublish){r.next=27;break}throw r.t1;case 27:this.queue.set(c,l);case 28:case"end":return r.stop()}}),r,this,[[3,23]])})))},i.on=function(e,t){i.events.on(e,t)},i.once=function(e,t){i.events.once(e,t)},i.off=function(e,t){i.events.off(e,t)},i.removeListener=function(e,t){i.events.removeListener(e,t)},i.relayer=e,i.logger=Object(s.a)(n,i.name),i.registerEventListeners(),i}return T(t,e),D(t,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"rpcPublish",value:function(e,t,n,r,i,o,a){var s,u,c,l,d={method:Object(h.E)(r.protocol).publish,params:{topic:e,message:t,ttl:n,prompt:i,tag:o},id:a};return Object(h.U)(null==(s=d.params)?void 0:s.prompt)&&(null==(u=d.params)||delete u.prompt),Object(h.U)(null==(c=d.params)?void 0:c.tag)&&(null==(l=d.params)||delete l.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:d}),this.relayer.request(d)}},{key:"removeRequestFromQueue",value:function(e){this.queue.delete(e)}},{key:"checkQueue",value:function(){var e=this;this.queue.forEach((function(t){return Y(e,null,k().mark((function e(){var n,r,i;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.topic,r=t.message,i=t.opts,e.next=3,this.publish(n,r,i);case 3:case"end":return e.stop()}}),e,this)})))}))}},{key:"registerEventListeners",value:function(){var e=this;this.relayer.core.heartbeat.on(a.HEARTBEAT_EVENTS.pulse,(function(){if(e.needsTransportRestart)return e.needsTransportRestart=!1,void e.relayer.events.emit(It.connection_stalled);e.checkQueue()})),this.relayer.on(It.message_ack,(function(t){e.removeRequestFromQueue(t.id.toString())}))}}])}(u.g),Ht=D((function e(){var t=this;S(this,e),this.map=new Map,this.set=function(e,n){var r=t.get(e);t.exists(e,n)||t.map.set(e,[].concat(M(r),[n]))},this.get=function(e){return t.map.get(e)||[]},this.exists=function(e,n){return t.get(e).includes(n)},this.delete=function(e,n){if(x(n)>"u")t.map.delete(e);else if(t.map.has(e)){var r=t.get(e);if(t.exists(e,n)){var i=r.filter((function(e){return e!==n}));i.length?t.map.set(e,i):t.map.delete(e)}}},this.clear=function(){t.map.clear()}}),[{key:"topics",get:function(){return Array.from(this.map.keys())}}]),Gt=Object.defineProperty,qt=Object.defineProperties,Zt=Object.getOwnPropertyDescriptors,Jt=Object.getOwnPropertySymbols,Xt=Object.prototype.hasOwnProperty,Kt=Object.prototype.propertyIsEnumerable,$t=function(e,t,n){return t in e?Gt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},en=function(e,t){for(var n in t||(t={}))Xt.call(t,n)&&$t(e,n,t[n]);if(Jt){var r,i=O(Jt(t));try{for(i.s();!(r=i.n()).done;)n=r.value,Kt.call(t,n)&&$t(e,n,t[n])}catch(e){i.e(e)}finally{i.f()}}return e},tn=function(e,t){return qt(e,Zt(t))},nn=function(e){function t(e,n){var i;return S(this,t),(i=A(this,t,[e,n])).relayer=e,i.logger=n,i.subscriptions=new Map,i.topicMap=new Ht,i.events=new r.EventEmitter,i.name="subscription",i.version="0.3",i.pending=new Map,i.cached=[],i.initialized=!1,i.pendingSubscriptionWatchLabel="pending_sub_watch_label",i.pollingInterval=20,i.storagePrefix=yt,i.subscribeTimeout=Object(f.toMiliseconds)(f.ONE_MINUTE),i.restartInProgress=!1,i.batchSubscribeTopicsLimit=500,i.init=function(){return Y(I(i),null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.initialized,e.t0){e.next=7;break}return this.logger.trace("Initialized"),this.registerEventListeners(),e.next=6,this.relayer.core.crypto.getClientId();case 6:this.clientId=e.sent;case 7:case"end":return e.stop()}}),e,this)})))},i.subscribe=function(e,t){return Y(I(i),null,k().mark((function n(){var r,i,o;return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.restartToComplete();case 2:return this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}}),n.prev=5,r=Object(h.F)(t),i={topic:e,relay:r},this.pending.set(e,i),n.next=10,this.rpcSubscribe(e,r);case 10:return o=n.sent,n.abrupt("return",("string"==typeof o&&(this.onSubscribe(o,i),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}})),o));case 14:throw n.prev=14,n.t0=n.catch(5),this.logger.debug("Failed to Subscribe Topic"),this.logger.error(n.t0),n.t0;case 17:case"end":return n.stop()}}),n,this,[[5,14]])})))},i.unsubscribe=function(e,t){return Y(I(i),null,k().mark((function n(){return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.restartToComplete();case 2:if(this.isInitialized(),!(x(null==t?void 0:t.id)<"u")){n.next=8;break}return n.next=6,this.unsubscribeById(e,t.id,t);case 6:n.next=10;break;case 8:return n.next=10,this.unsubscribeByTopic(e,t);case 10:case"end":return n.stop()}}),n,this)})))},i.isSubscribed=function(e){return Y(I(i),null,k().mark((function t(){var n,r=this;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.topics.includes(e)){t.next=2;break}return t.abrupt("return",!0);case 2:return n="".concat(this.pendingSubscriptionWatchLabel,"_").concat(e),t.next=5,new Promise((function(t,i){var o=new f.Watch;o.start(n);var a=setInterval((function(){!r.pending.has(e)&&r.topics.includes(e)&&(clearInterval(a),o.stop(n),t(!0)),o.elapsed(n)>=jt&&(clearInterval(a),o.stop(n),i(new Error("Subscription resolution timeout")))}),r.pollingInterval)})).catch((function(){return!1}));case 5:return t.abrupt("return",t.sent);case 6:case"end":return t.stop()}}),t,this)})))},i.on=function(e,t){i.events.on(e,t)},i.once=function(e,t){i.events.once(e,t)},i.off=function(e,t){i.events.off(e,t)},i.removeListener=function(e,t){i.events.removeListener(e,t)},i.start=function(){return Y(I(i),null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.onConnect();case 2:case"end":return e.stop()}}),e,this)})))},i.stop=function(){return Y(I(i),null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.onDisconnect();case 2:case"end":return e.stop()}}),e,this)})))},i.restart=function(){return Y(I(i),null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.restartInProgress=!0,e.next=3,this.restore();case 3:return e.next=5,this.reset();case 5:this.restartInProgress=!1;case 6:case"end":return e.stop()}}),e,this)})))},i.relayer=e,i.logger=Object(s.a)(n,i.name),i.clientId="",i}return T(t,e),D(t,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}},{key:"length",get:function(){return this.subscriptions.size}},{key:"ids",get:function(){return Array.from(this.subscriptions.keys())}},{key:"values",get:function(){return Array.from(this.subscriptions.values())}},{key:"topics",get:function(){return this.topicMap.topics}},{key:"hasSubscription",value:function(e,t){var n=!1;try{n=this.getSubscription(e).topic===t}catch(e){}return n}},{key:"onEnable",value:function(){this.cached=[],this.initialized=!0}},{key:"onDisable",value:function(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}},{key:"unsubscribeByTopic",value:function(e,t){return Y(this,null,k().mark((function n(){var r,i=this;return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=this.topicMap.get(e),n.next=3,Promise.all(r.map((function(n){return Y(i,null,k().mark((function r(){return k().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.unsubscribeById(e,n,t);case 2:return r.abrupt("return",r.sent);case 3:case"end":return r.stop()}}),r,this)})))})));case 3:case"end":return n.stop()}}),n,this)})))}},{key:"unsubscribeById",value:function(e,t,n){return Y(this,null,k().mark((function r(){var i,o;return k().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}}),r.prev=1,i=Object(h.F)(n),r.next=5,this.rpcUnsubscribe(e,t,i);case 5:return o=Object(h.G)("USER_DISCONNECTED","".concat(this.name,", ").concat(e)),r.next=8,this.onUnsubscribe(e,t,o);case 8:this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:n}}),r.next=15;break;case 12:throw r.prev=12,r.t0=r.catch(1),this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(r.t0),r.t0;case 15:case"end":return r.stop()}}),r,this,[[1,12]])})))}},{key:"rpcSubscribe",value:function(e,t){return Y(this,null,k().mark((function n(){var r,i=this;return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r={method:Object(h.E)(t.protocol).subscribe,params:{topic:e}},this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),n.prev=2,n.next=5,Object(h.h)(this.relayer.request(r).catch((function(e){return i.logger.warn(e)})),this.subscribeTimeout);case 5:return n.next=7,n.sent;case 7:if(!n.sent){n.next=11;break}n.t0=Object(h.J)(e+this.clientId),n.next=12;break;case 11:n.t0=null;case 12:return n.abrupt("return",n.t0);case 15:n.prev=15,n.t1=n.catch(2),this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(It.connection_stalled);case 18:return n.abrupt("return",null);case 19:case"end":return n.stop()}}),n,this,[[2,15]])})))}},{key:"rpcBatchSubscribe",value:function(e){return Y(this,null,k().mark((function t(){var n,r,i=this;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.length){t.next=2;break}return t.abrupt("return");case 2:return n=e[0].relay,r={method:Object(h.E)(n.protocol).batchSubscribe,params:{topics:e.map((function(e){return e.topic}))}},this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),t.prev=4,t.next=7,Object(h.h)(this.relayer.request(r).catch((function(e){return i.logger.warn(e)})),this.subscribeTimeout);case 7:return t.next=9,t.sent;case 9:return t.abrupt("return",t.sent);case 12:t.prev=12,t.t0=t.catch(4),this.relayer.events.emit(It.connection_stalled);case 15:case"end":return t.stop()}}),t,this,[[4,12]])})))}},{key:"rpcUnsubscribe",value:function(e,t,n){var r={method:Object(h.E)(n.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),this.relayer.request(r)}},{key:"onSubscribe",value:function(e,t){this.setSubscription(e,tn(en({},t),{id:e})),this.pending.delete(t.topic)}},{key:"onBatchSubscribe",value:function(e){var t=this;e.length&&e.forEach((function(e){t.setSubscription(e.id,en({},e)),t.pending.delete(e.topic)}))}},{key:"onUnsubscribe",value:function(e,t,n){return Y(this,null,k().mark((function r(){return k().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,n),r.next=4,this.relayer.messages.del(e);case 4:case"end":return r.stop()}}),r,this)})))}},{key:"setRelayerSubscriptions",value:function(e){return Y(this,null,k().mark((function t(){return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.relayer.core.storage.setItem(this.storageKey,e);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"getRelayerSubscriptions",value:function(){return Y(this,null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.relayer.core.storage.getItem(this.storageKey);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"setSubscription",value:function(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}},{key:"addSubscription",value:function(e,t){this.subscriptions.set(e,en({},t)),this.topicMap.set(t.topic,e),this.events.emit(Lt,t)}},{key:"getSubscription",value:function(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});var t=this.subscriptions.get(e);if(!t){var n=Object(h.A)("NO_MATCHING_KEY","".concat(this.name,": ").concat(e)).message;throw new Error(n)}return t}},{key:"deleteSubscription",value:function(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});var n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(St,tn(en({},n),{reason:t}))}},{key:"persist",value:function(){return Y(this,null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setRelayerSubscriptions(this.values);case 2:this.events.emit("subscription_sync");case 3:case"end":return e.stop()}}),e,this)})))}},{key:"reset",value:function(){return Y(this,null,k().mark((function e(){var t,n,r;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.cached.length){e.next=10;break}t=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit),n=0;case 3:if(!(n<t)){e.next=10;break}return r=this.cached.splice(0,this.batchSubscribeTopicsLimit),e.next=7,this.batchSubscribe(r);case 7:n++,e.next=3;break;case 10:this.events.emit("subscription_resubscribed");case 11:case"end":return e.stop()}}),e,this)})))}},{key:"restore",value:function(){return Y(this,null,k().mark((function e(){var t,n,r;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getRelayerSubscriptions();case 3:if(!(x(t=e.sent)>"u")&&t.length){e.next=6;break}return e.abrupt("return");case 6:if(!this.subscriptions.size){e.next=9;break}throw n=Object(h.A)("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),this.logger.error("".concat(this.name,": ").concat(JSON.stringify(this.values))),new Error(r);case 9:this.cached=t,this.logger.debug("Successfully Restored subscriptions for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",subscriptions:this.values}),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),this.logger.debug("Failed to Restore subscriptions for ".concat(this.name)),this.logger.error(e.t0);case 15:case"end":return e.stop()}}),e,this,[[0,12]])})))}},{key:"batchSubscribe",value:function(e){return Y(this,null,k().mark((function t(){var n;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(e.length){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,this.rpcBatchSubscribe(e);case 4:n=t.sent,Object(h.V)(n)&&this.onBatchSubscribe(n.map((function(t,n){return tn(en({},e[n]),{id:t})})));case 6:case"end":return t.stop()}}),t,this)})))}},{key:"onConnect",value:function(){return Y(this,null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.restart();case 2:this.onEnable();case 3:case"end":return e.stop()}}),e,this)})))}},{key:"onDisconnect",value:function(){this.onDisable()}},{key:"checkPending",value:function(){return Y(this,null,k().mark((function e(){var t;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.initialized&&this.relayer.connected){e.next=2;break}return e.abrupt("return");case 2:return t=[],this.pending.forEach((function(e){t.push(e)})),e.next=6,this.batchSubscribe(t);case 6:case"end":return e.stop()}}),e,this)})))}},{key:"registerEventListeners",value:function(){var e=this;this.relayer.core.heartbeat.on(a.HEARTBEAT_EVENTS.pulse,(function(){return Y(e,null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.checkPending();case 2:case"end":return e.stop()}}),e,this)})))})),this.events.on(Lt,(function(t){return Y(e,null,k().mark((function e(){var n;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=Lt,this.logger.info("Emitting ".concat(n)),this.logger.debug({type:"event",event:n,data:t}),e.next=5,this.persist();case 5:case"end":return e.stop()}}),e,this)})))})),this.events.on(St,(function(t){return Y(e,null,k().mark((function e(){var n;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=St,this.logger.info("Emitting ".concat(n)),this.logger.debug({type:"event",event:n,data:t}),e.next=5,this.persist();case 5:case"end":return e.stop()}}),e,this)})))}))}},{key:"isInitialized",value:function(){if(!this.initialized){var e=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(e)}}},{key:"restartToComplete",value:function(){return Y(this,null,k().mark((function e(){var t=this;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.restartInProgress,!e.t0){e.next=4;break}return e.next=4,new Promise((function(e){var n=setInterval((function(){t.restartInProgress||(clearInterval(n),e())}),t.pollingInterval)}));case 4:case"end":return e.stop()}}),e,this)})))}}])}(u.k),rn=Object.defineProperty,on=Object.getOwnPropertySymbols,an=Object.prototype.hasOwnProperty,sn=Object.prototype.propertyIsEnumerable,un=function(e,t,n){return t in e?rn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},cn=function(e,t){for(var n in t||(t={}))an.call(t,n)&&un(e,n,t[n]);if(on){var r,i=O(on(t));try{for(i.s();!(r=i.n()).done;)n=r.value,sn.call(t,n)&&un(e,n,t[n])}catch(e){i.e(e)}finally{i.f()}}return e},ln=function(e){function t(e){var n;return S(this,t),(n=A(this,t,[e])).protocol="wc",n.version=2,n.events=new r.EventEmitter,n.name="relayer",n.transportExplicitlyClosed=!1,n.initialized=!1,n.connectionAttemptInProgress=!1,n.connectionStatusPollingInterval=20,n.staleConnectionErrors=["socket hang up","socket stalled","interrupted"],n.hasExperiencedNetworkDisruption=!1,n.requestsInFlight=new Map,n.heartBeatTimeout=Object(f.toMiliseconds)(f.THIRTY_SECONDS+f.ONE_SECOND),n.request=function(e){return Y(I(n),null,k().mark((function t(){var n,r,i,o,a,s=this;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.logger.debug("Publishing Request Payload"),i=e.id||Object(y.getBigIntRpcId)().toString(),t.next=4,this.toEstablishConnection();case 4:return t.prev=4,o=this.provider.request(e),this.requestsInFlight.set(i,{promise:o,request:e}),this.logger.trace({id:i,method:e.method,topic:null==(n=e.params)?void 0:n.topic},"relayer.request - attempt to publish..."),t.next=9,new Promise((function(e,t){return Y(s,null,k().mark((function n(){var r,a;return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=function(){t(new Error("relayer.request - publish interrupted, id: ".concat(i)))},this.provider.on(Et,r),n.next=4,o;case 4:a=n.sent,this.provider.off(Et,r),e(a);case 6:case"end":return n.stop()}}),n,this)})))}));case 9:return a=t.sent,t.abrupt("return",(this.logger.trace({id:i,method:e.method,topic:null==(r=e.params)?void 0:r.topic},"relayer.request - published"),a));case 13:throw t.prev=13,t.t0=t.catch(4),this.logger.debug("Failed to Publish Request: ".concat(i)),t.t0;case 16:return t.prev=16,this.requestsInFlight.delete(i),t.finish(16);case 19:case"end":return t.stop()}}),t,this,[[4,13,16,19]])})))},n.resetPingTimeout=function(){if(Object(h.N)())try{clearTimeout(n.pingTimeout),n.pingTimeout=setTimeout((function(){var e,t,r;null==(r=null==(t=null==(e=n.provider)?void 0:e.connection)?void 0:t.socket)||r.terminate()}),n.heartBeatTimeout)}catch(e){n.logger.warn(e)}},n.onPayloadHandler=function(e){n.onProviderPayload(e),n.resetPingTimeout()},n.onConnectHandler=function(){n.startPingTimeout(),n.events.emit(It.connect)},n.onDisconnectHandler=function(){n.onProviderDisconnect()},n.onProviderErrorHandler=function(e){n.logger.error(e),n.events.emit(It.error,e),n.logger.info("Fatal socket error received, closing transport"),n.transportClose()},n.registerProviderListeners=function(){n.provider.on(Nt,n.onPayloadHandler),n.provider.on(Tt,n.onConnectHandler),n.provider.on(Et,n.onDisconnectHandler),n.provider.on(xt,n.onProviderErrorHandler)},n.core=e.core,n.logger=x(e.logger)<"u"&&"string"!=typeof e.logger?Object(s.a)(e.logger,n.name):Object(s.e)(Object(s.c)({level:e.logger||"error"})),n.messages=new Ft(n.logger,e.core),n.subscriber=new nn(I(n),n.logger),n.publisher=new Vt(I(n),n.logger),n.relayUrl=(null==e?void 0:e.relayUrl)||Mt,n.projectId=e.projectId,n.bundleId=Object(h.w)(),n.provider={},n}return T(t,e),D(t,[{key:"init",value:function(){return Y(this,null,k().mark((function e(){var t=this;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.trace("Initialized"),this.registerEventListeners(),e.next=4,this.createProvider();case 4:return e.next=6,Promise.all([this.messages.init(),this.subscriber.init()]);case 6:return e.prev=6,e.next=9,this.transportOpen();case 9:e.next=16;break;case 11:return e.prev=11,e.t0=e.catch(6),this.logger.warn("Connection via ".concat(this.relayUrl," failed, attempting to connect via failover domain ").concat(At,"...")),e.next=16,this.restartTransport(At);case 16:this.initialized=!0,setTimeout((function(){return Y(t,null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=0===this.subscriber.topics.length&&0===this.subscriber.pending.size,!e.t0){e.next=6;break}return this.logger.info("No topics subscribed to after init, closing transport"),e.next=5,this.transportClose();case 5:this.transportExplicitlyClosed=!1;case 6:case"end":return e.stop()}}),e,this)})))}),1e4);case 17:case"end":return e.stop()}}),e,this,[[6,11]])})))}},{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"connected",get:function(){var e,t,n;return 1===(null==(n=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:n.readyState)}},{key:"connecting",get:function(){var e,t,n;return 0===(null==(n=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:n.readyState)}},{key:"publish",value:function(e,t,n){return Y(this,null,k().mark((function r(){return k().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return this.isInitialized(),r.next=3,this.publisher.publish(e,t,n);case 3:return r.next=5,this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now()});case 5:case"end":return r.stop()}}),r,this)})))}},{key:"subscribe",value:function(e,t){return Y(this,null,k().mark((function n(){var r,i,o,a,s=this;return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),i=(null==(r=this.subscriber.topicMap.get(e))?void 0:r[0])||"",a=function t(n){n.topic===e&&(s.subscriber.off(Lt,t),o())},n.next=5,Promise.all([new Promise((function(e){o=e,s.subscriber.on(Lt,a)})),new Promise((function(n){return Y(s,null,k().mark((function r(){return k().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.next=2,this.subscriber.subscribe(e,t);case 2:if(r.t0=r.sent,r.t0){r.next=5;break}r.t0=i;case 5:i=r.t0,n();case 7:case"end":return r.stop()}}),r,this)})))}))]);case 5:return n.abrupt("return",i);case 6:case"end":return n.stop()}}),n,this)})))}},{key:"unsubscribe",value:function(e,t){return Y(this,null,k().mark((function n(){return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),n.next=3,this.subscriber.unsubscribe(e,t);case 3:case"end":return n.stop()}}),n,this)})))}},{key:"on",value:function(e,t){this.events.on(e,t)}},{key:"once",value:function(e,t){this.events.once(e,t)}},{key:"off",value:function(e,t){this.events.off(e,t)}},{key:"removeListener",value:function(e,t){this.events.removeListener(e,t)}},{key:"transportDisconnect",value:function(){return Y(this,null,k().mark((function e(){var t=this;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)){e.next=9;break}return e.prev=1,e.next=4,Promise.all(Array.from(this.requestsInFlight.values()).map((function(e){return e.promise})));case 4:e.next=9;break;case 6:e.prev=6,e.t0=e.catch(1),this.logger.warn(e.t0);case 9:if(!this.hasExperiencedNetworkDisruption&&!this.connected){e.next=14;break}return e.next=12,Object(h.h)(this.provider.disconnect(),2e3,"provider.disconnect()").catch((function(){return t.onProviderDisconnect()}));case 12:e.next=15;break;case 14:this.onProviderDisconnect();case 15:case"end":return e.stop()}}),e,this,[[1,6]])})))}},{key:"transportClose",value:function(){return Y(this,null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.transportExplicitlyClosed=!0,e.next=3,this.transportDisconnect();case 3:case"end":return e.stop()}}),e,this)})))}},{key:"transportOpen",value:function(e){return Y(this,null,k().mark((function t(){var n,r=this;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.confirmOnlineStateOrThrow();case 2:if(t.t0=e&&e!==this.relayUrl,!t.t0){t.next=9;break}return this.relayUrl=e,t.next=7,this.transportDisconnect();case 7:return t.next=9,this.createProvider();case 9:return this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1,t.prev=11,t.next=14,new Promise((function(e,t){return Y(r,null,k().mark((function n(){var r,i=this;return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=function e(){i.provider.off(Et,e),t(new Error("Connection interrupted while trying to subscribe"))},this.provider.on(Et,r),n.next=4,Object(h.h)(this.provider.connect(),Object(f.toMiliseconds)(f.ONE_MINUTE),"Socket stalled when trying to connect to ".concat(this.relayUrl)).catch((function(e){t(e)}));case 4:return n.next=6,this.subscriber.start();case 6:this.hasExperiencedNetworkDisruption=!1,e();case 8:case"end":return n.stop()}}),n,this)})))}));case 14:t.next=22;break;case 16:if(t.prev=16,t.t1=t.catch(11),this.logger.error(t.t1),n=t.t1,this.isConnectionStalled(n.message)){t.next=22;break}throw t.t1;case 22:return t.prev=22,this.connectionAttemptInProgress=!1,t.finish(22);case 25:case"end":return t.stop()}}),t,this,[[11,16,22,25]])})))}},{key:"restartTransport",value:function(e){return Y(this,null,k().mark((function t(){return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.t0=this.connectionAttemptInProgress,t.t0){t.next=11;break}return this.relayUrl=e||this.relayUrl,t.next=5,this.confirmOnlineStateOrThrow();case 5:return t.next=7,this.transportClose();case 7:return t.next=9,this.createProvider();case 9:return t.next=11,this.transportOpen();case 11:case"end":return t.stop()}}),t,this)})))}},{key:"confirmOnlineStateOrThrow",value:function(){return Y(this,null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(h.O)();case 2:if(e.sent){e.next=4;break}throw new Error("No internet connection detected. Please restart your network and try again.");case 4:case"end":return e.stop()}}),e)})))}},{key:"startPingTimeout",value:function(){var e,t,n,r,i,o=this;if(Object(h.N)())try{null!=(t=null==(e=this.provider)?void 0:e.connection)&&t.socket&&(null==(i=null==(r=null==(n=this.provider)?void 0:n.connection)?void 0:r.socket)||i.once("ping",(function(){o.resetPingTimeout()}))),this.resetPingTimeout()}catch(e){this.logger.warn(e)}}},{key:"isConnectionStalled",value:function(e){return this.staleConnectionErrors.some((function(t){return e.includes(t)}))}},{key:"createProvider",value:function(){return Y(this,null,k().mark((function e(){var t;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.provider.connection&&this.unregisterProviderListeners(),e.next=3,this.core.crypto.signJWT(this.relayUrl);case 3:t=e.sent,this.provider=new p.a(new m.a(Object(h.q)({sdkVersion:"2.12.2",protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:t,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners();case 5:case"end":return e.stop()}}),e,this)})))}},{key:"recordMessageEvent",value:function(e){return Y(this,null,k().mark((function t(){var n,r;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.topic,r=e.message,t.next=3,this.messages.set(n,r);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"shouldIgnoreMessageEvent",value:function(e){return Y(this,null,k().mark((function t(){var n,r,i;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=e.topic,(r=e.message)&&0!==r.length){t.next=3;break}return t.abrupt("return",(this.logger.debug("Ignoring invalid/empty message: ".concat(r)),!0));case 3:return t.next=5,this.subscriber.isSubscribed(n);case 5:if(t.sent){t.next=7;break}return t.abrupt("return",(this.logger.debug("Ignoring message for non-subscribed topic ".concat(n)),!0));case 7:return i=this.messages.has(n,r),t.abrupt("return",(i&&this.logger.debug("Ignoring duplicate message: ".concat(r)),i));case 9:case"end":return t.stop()}}),t,this)})))}},{key:"onProviderPayload",value:function(e){return Y(this,null,k().mark((function t(){var n,r,i,o,a,s;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),!Object(y.isJsonRpcRequest)(e)){t.next=13;break}if(e.method.endsWith("_subscription")){t.next=3;break}return t.abrupt("return");case 3:return n=e.params,r=n.data,i=r.topic,o=r.message,a=r.publishedAt,s={topic:i,message:o,publishedAt:a},this.logger.debug("Emitting Relayer Payload"),this.logger.trace(cn({type:"event",event:n.id},s)),this.events.emit(n.id,s),t.next=9,this.acknowledgePayload(e);case 9:return t.next=11,this.onMessageEvent(s);case 11:t.next=14;break;case 13:Object(y.isJsonRpcResponse)(e)&&this.events.emit(It.message_ack,e);case 14:case"end":return t.stop()}}),t,this)})))}},{key:"onMessageEvent",value:function(e){return Y(this,null,k().mark((function t(){return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.shouldIgnoreMessageEvent(e);case 2:if(t.t0=t.sent,t.t0){t.next=7;break}return this.events.emit(It.message,e),t.next=7,this.recordMessageEvent(e);case 7:case"end":return t.stop()}}),t,this)})))}},{key:"acknowledgePayload",value:function(e){return Y(this,null,k().mark((function t(){var n;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=Object(y.formatJsonRpcResult)(e.id,!0),t.next=3,this.provider.connection.send(n);case 3:case"end":return t.stop()}}),t,this)})))}},{key:"unregisterProviderListeners",value:function(){this.provider.off(Nt,this.onPayloadHandler),this.provider.off(Tt,this.onConnectHandler),this.provider.off(Et,this.onDisconnectHandler),this.provider.off(xt,this.onProviderErrorHandler)}},{key:"registerEventListeners",value:function(){return Y(this,null,k().mark((function e(){var t,n=this;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(h.O)();case 2:t=e.sent,Object(h.ub)((function(e){return Y(n,null,k().mark((function n(){var r=this;return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(n.t0=t!==e,!n.t0){n.next=12;break}if(t=e,!e){n.next=8;break}return n.next=6,this.restartTransport().catch((function(e){return r.logger.error(e)}));case 6:n.next=12;break;case 8:return this.hasExperiencedNetworkDisruption=!0,n.next=11,this.transportDisconnect();case 11:this.transportExplicitlyClosed=!1;case 12:case"end":return n.stop()}}),n,this)})))}));case 4:case"end":return e.stop()}}),e)})))}},{key:"onProviderDisconnect",value:function(){return Y(this,null,k().mark((function e(){var t=this;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.subscriber.stop();case 2:this.events.emit(It.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&setTimeout((function(){return Y(t,null,k().mark((function e(){var t=this;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.transportOpen().catch((function(e){return t.logger.error(e)}));case 2:case"end":return e.stop()}}),e,this)})))}),Object(f.toMiliseconds)(kt));case 5:case"end":return e.stop()}}),e,this)})))}},{key:"isInitialized",value:function(){if(!this.initialized){var e=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(e)}}},{key:"toEstablishConnection",value:function(){return Y(this,null,k().mark((function e(){var t=this;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.confirmOnlineStateOrThrow();case 2:if(e.t0=!this.connected,!e.t0){e.next=10;break}if(e.t1=this.connectionAttemptInProgress,!e.t1){e.next=8;break}return e.next=8,new Promise((function(e){var n=setInterval((function(){t.connected&&(clearInterval(n),e())}),t.connectionStatusPollingInterval)}));case 8:return e.next=10,this.transportOpen();case 10:case"end":return e.stop()}}),e,this)})))}}])}(u.h),hn=Object.defineProperty,dn=Object.getOwnPropertySymbols,fn=Object.prototype.hasOwnProperty,pn=Object.prototype.propertyIsEnumerable,yn=function(e,t,n){return t in e?hn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},mn=function(e,t){for(var n in t||(t={}))fn.call(t,n)&&yn(e,n,t[n]);if(dn){var r,i=O(dn(t));try{for(i.s();!(r=i.n()).done;)n=r.value,pn.call(t,n)&&yn(e,n,t[n])}catch(e){i.e(e)}finally{i.f()}}return e},gn=function(e){function t(e,n,r){var i,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:yt,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:void 0;return S(this,t),(i=A(this,t,[e,n,r,o])).core=e,i.logger=n,i.name=r,i.map=new Map,i.version="0.3",i.cached=[],i.initialized=!1,i.storagePrefix=yt,i.recentlyDeleted=[],i.recentlyDeletedLimit=200,i.init=function(){return Y(I(i),null,k().mark((function e(){var t=this;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.initialized,e.t0){e.next=8;break}return this.logger.trace("Initialized"),e.next=5,this.restore();case 5:this.cached.forEach((function(e){t.getKey&&null!==e&&!Object(h.U)(e)?t.map.set(t.getKey(e),e):Object(h.P)(e)?t.map.set(e.id,e):Object(h.S)(e)&&t.map.set(e.topic,e)})),this.cached=[],this.initialized=!0;case 8:case"end":return e.stop()}}),e,this)})))},i.set=function(e,t){return Y(I(i),null,k().mark((function n(){return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.isInitialized(),!this.map.has(e)){n.next=6;break}return n.next=4,this.update(e,t);case 4:n.next=11;break;case 6:return this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:e,value:t}),this.map.set(e,t),n.next=11,this.persist();case 11:case"end":return n.stop()}}),n,this)})))},i.get=function(e){return i.isInitialized(),i.logger.debug("Getting value"),i.logger.trace({type:"method",method:"get",key:e}),i.getData(e)},i.getAll=function(e){return i.isInitialized(),e?i.values.filter((function(t){return Object.keys(e).every((function(n){return v()(t[n],e[n])}))})):i.values},i.update=function(e,t){return Y(I(i),null,k().mark((function n(){var r;return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:e,update:t}),r=mn(mn({},this.getData(e)),t),this.map.set(e,r),n.next=5,this.persist();case 5:case"end":return n.stop()}}),n,this)})))},i.delete=function(e,t){return Y(I(i),null,k().mark((function n(){return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.isInitialized(),n.t0=this.map.has(e),!n.t0){n.next=9;break}return this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:e,reason:t}),this.map.delete(e),this.addToRecentlyDeleted(e),n.next=9,this.persist();case 9:case"end":return n.stop()}}),n,this)})))},i.logger=Object(s.a)(n,i.name),i.storagePrefix=o,i.getKey=a,i}return T(t,e),D(t,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"length",get:function(){return this.map.size}},{key:"keys",get:function(){return Array.from(this.map.keys())}},{key:"values",get:function(){return Array.from(this.map.values())}},{key:"addToRecentlyDeleted",value:function(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}},{key:"setDataStore",value:function(e){return Y(this,null,k().mark((function t(){return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.setItem(this.storageKey,e);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"getDataStore",value:function(){return Y(this,null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.getItem(this.storageKey);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getData",value:function(e){var t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){var n=Object(h.A)("MISSING_OR_INVALID","Record was recently deleted - ".concat(this.name,": ").concat(e)).message;throw this.logger.error(n),new Error(n)}var r=Object(h.A)("NO_MATCHING_KEY","".concat(this.name,": ").concat(e)).message;throw this.logger.error(r),new Error(r)}return t}},{key:"persist",value:function(){return Y(this,null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setDataStore(this.values);case 2:case"end":return e.stop()}}),e,this)})))}},{key:"restore",value:function(){return Y(this,null,k().mark((function e(){var t,n,r;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getDataStore();case 3:if(!(x(t=e.sent)>"u")&&t.length){e.next=6;break}return e.abrupt("return");case 6:if(!this.map.size){e.next=9;break}throw n=Object(h.A)("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),new Error(r);case 9:this.cached=t,this.logger.debug("Successfully Restored value for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",value:this.values}),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),this.logger.debug("Failed to Restore value for ".concat(this.name)),this.logger.error(e.t0);case 15:case"end":return e.stop()}}),e,this,[[0,12]])})))}},{key:"isInitialized",value:function(){if(!this.initialized){var e=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(e)}}}])}(u.j),vn=D((function e(t,n){var r=this;S(this,e),this.core=t,this.logger=n,this.name="pairing",this.version="0.3",this.events=new i.a,this.initialized=!1,this.storagePrefix=yt,this.ignoredPayloadTypes=[h.c],this.registeredMethods=[],this.init=function(){return Y(r,null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.initialized,e.t0){e.next=10;break}return e.next=4,this.pairings.init();case 4:return e.next=6,this.cleanup();case 6:this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized");case 10:case"end":return e.stop()}}),e,this)})))},this.register=function(e){var t=e.methods;r.isInitialized(),r.registeredMethods=M(new Set([].concat(M(r.registeredMethods),M(t))))},this.create=function(e){return Y(r,null,k().mark((function t(){var n,r,i,o,a,s;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.isInitialized(),n=Object(h.u)(),t.next=4,this.core.crypto.setSymKey(n);case 4:return r=t.sent,i=Object(h.e)(f.FIVE_MINUTES),a={topic:r,expiry:i,relay:o={protocol:bt},active:!1},s=Object(h.s)({protocol:this.core.protocol,version:this.core.version,topic:r,symKey:n,relay:o,expiryTimestamp:i,methods:null==e?void 0:e.methods}),t.next=11,this.pairings.set(r,a);case 11:return t.next=13,this.core.relayer.subscribe(r);case 13:return this.core.expirer.set(r,i),t.abrupt("return",{topic:r,uri:s});case 15:case"end":return t.stop()}}),t,this)})))},this.pair=function(e){return Y(r,null,k().mark((function t(){var n,r,i,o,a,s,u,c;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.isInitialized(),this.isValidPair(e),n=Object(h.tb)(e.uri),r=n.topic,i=n.symKey,o=n.relay,a=n.expiryTimestamp,s=n.methods,!this.pairings.keys.includes(r)||!this.pairings.get(r).active){t.next=4;break}throw new Error("Pairing already exists: ".concat(r,". Please try again with a new connection URI."));case 4:return u=a||Object(h.e)(f.FIVE_MINUTES),c={topic:r,relay:o,expiry:u,active:!1,methods:s},t.next=7,this.pairings.set(r,c);case 7:if(this.core.expirer.set(r,u),t.t0=e.activatePairing,!t.t0){t.next=12;break}return t.next=12,this.activate({topic:r});case 12:if(this.events.emit(Ct.create,c),t.t1=this.core.crypto.keychain.has(r),t.t1){t.next=17;break}return t.next=17,this.core.crypto.setSymKey(i,r);case 17:return t.next=19,this.core.relayer.subscribe(r,{relay:o});case 19:return t.abrupt("return",c);case 20:case"end":return t.stop()}}),t,this)})))},this.activate=function(e){return Y(r,[e],(function(e){var t=this,n=e.topic;return k().mark((function e(){var r;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.isInitialized(),r=Object(h.e)(f.THIRTY_DAYS),e.next=4,t.pairings.update(n,{active:!0,expiry:r});case 4:t.core.expirer.set(n,r);case 5:case"end":return e.stop()}}),e)}))()}))},this.ping=function(e){return Y(r,null,k().mark((function t(){var n,r,i,o,a,s;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.isInitialized(),t.next=3,this.isValidPing(e);case 3:if(n=e.topic,!this.pairings.keys.includes(n)){t.next=15;break}return t.next=7,this.sendRequest(n,"wc_pairingPing",{});case 7:return r=t.sent,i=Object(h.f)(),o=i.done,a=i.resolve,s=i.reject,this.events.once(Object(h.n)("pairing_ping",r),(function(e){var t=e.error;t?s(t):a()})),t.next=15,o();case 15:case"end":return t.stop()}}),t,this)})))},this.updateExpiry=function(e){return Y(r,[e],(function(e){var t=this,n=e.topic,r=e.expiry;return k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.isInitialized(),e.next=3,t.pairings.update(n,{expiry:r});case 3:case"end":return e.stop()}}),e)}))()}))},this.updateMetadata=function(e){return Y(r,[e],(function(e){var t=this,n=e.topic,r=e.metadata;return k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.isInitialized(),e.next=3,t.pairings.update(n,{peerMetadata:r});case 3:case"end":return e.stop()}}),e)}))()}))},this.getPairings=function(){return r.isInitialized(),r.pairings.values},this.disconnect=function(e){return Y(r,null,k().mark((function t(){var n;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.isInitialized(),t.next=3,this.isValidDisconnect(e);case 3:if(n=e.topic,t.t0=this.pairings.keys.includes(n),!t.t0){t.next=10;break}return t.next=8,this.sendRequest(n,"wc_pairingDelete",Object(h.G)("USER_DISCONNECTED"));case 8:return t.next=10,this.deletePairing(n);case 10:case"end":return t.stop()}}),t,this)})))},this.sendRequest=function(e,t,n){return Y(r,null,k().mark((function r(){var i,o,a;return k().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=Object(y.formatJsonRpcRequest)(t,n),r.next=3,this.core.crypto.encode(e,i);case 3:return o=r.sent,a=Dt[t].req,r.abrupt("return",(this.core.history.set(e,i),this.core.relayer.publish(e,o,a),i.id));case 6:case"end":return r.stop()}}),r,this)})))},this.sendResult=function(e,t,n){return Y(r,null,k().mark((function r(){var i,o,a,s;return k().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=Object(y.formatJsonRpcResult)(e,n),r.next=3,this.core.crypto.encode(t,i);case 3:return o=r.sent,r.next=6,this.core.history.get(t,e);case 6:return a=r.sent,s=Dt[a.request.method].res,r.next=10,this.core.relayer.publish(t,o,s);case 10:return r.next=12,this.core.history.resolve(i);case 12:case"end":return r.stop()}}),r,this)})))},this.sendError=function(e,t,n){return Y(r,null,k().mark((function r(){var i,o,a,s;return k().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return i=Object(y.formatJsonRpcError)(e,n),r.next=3,this.core.crypto.encode(t,i);case 3:return o=r.sent,r.next=6,this.core.history.get(t,e);case 6:return a=r.sent,s=Dt[a.request.method]?Dt[a.request.method].res:Dt.unregistered_method.res,r.next=10,this.core.relayer.publish(t,o,s);case 10:return r.next=12,this.core.history.resolve(i);case 12:case"end":return r.stop()}}),r,this)})))},this.deletePairing=function(e,t){return Y(r,null,k().mark((function n(){return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return n.next=2,this.core.relayer.unsubscribe(e);case 2:return n.next=4,Promise.all([this.pairings.delete(e,Object(h.G)("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(e),t?Promise.resolve():this.core.expirer.del(e)]);case 4:case"end":return n.stop()}}),n,this)})))},this.cleanup=function(){return Y(r,null,k().mark((function e(){var t,n=this;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t=this.pairings.getAll().filter((function(e){return Object(h.M)(e.expiry)})),e.next=3,Promise.all(t.map((function(e){return n.deletePairing(e.topic)})));case 3:case"end":return e.stop()}}),e,this)})))},this.onRelayEventRequest=function(e){var t=e.topic,n=e.payload;switch(n.method){case"wc_pairingPing":return r.onPairingPingRequest(t,n);case"wc_pairingDelete":return r.onPairingDeleteRequest(t,n);default:return r.onUnknownRpcMethodRequest(t,n)}},this.onRelayEventResponse=function(e){return Y(r,null,k().mark((function t(){var n,r,i;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.topic,r=e.payload,t.next=4,this.core.history.get(n,r.id);case 4:i=t.sent.request.method,t.t0=i,t.next="wc_pairingPing"===t.t0?8:9;break;case 8:return t.abrupt("return",this.onPairingPingResponse(n,r));case 9:return t.abrupt("return",this.onUnknownRpcMethodResponse(i));case 10:case"end":return t.stop()}}),t,this)})))},this.onPairingPingRequest=function(e,t){return Y(r,null,k().mark((function n(){var r;return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=t.id,n.prev=1,this.isValidPing({topic:e}),n.next=5,this.sendResult(r,e,!0);case 5:this.events.emit(Ct.ping,{id:r,topic:e}),n.next=13;break;case 8:return n.prev=8,n.t0=n.catch(1),n.next=12,this.sendError(r,e,n.t0);case 12:this.logger.error(n.t0);case 13:case"end":return n.stop()}}),n,this,[[1,8]])})))},this.onPairingPingResponse=function(e,t){var n=t.id;setTimeout((function(){Object(y.isJsonRpcResult)(t)?r.events.emit(Object(h.n)("pairing_ping",n),{}):Object(y.isJsonRpcError)(t)&&r.events.emit(Object(h.n)("pairing_ping",n),{error:t.error})}),500)},this.onPairingDeleteRequest=function(e,t){return Y(r,null,k().mark((function n(){var r;return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=t.id,n.prev=1,this.isValidDisconnect({topic:e}),n.next=5,this.deletePairing(e);case 5:this.events.emit(Ct.delete,{id:r,topic:e}),n.next=13;break;case 8:return n.prev=8,n.t0=n.catch(1),n.next=12,this.sendError(r,e,n.t0);case 12:this.logger.error(n.t0);case 13:case"end":return n.stop()}}),n,this,[[1,8]])})))},this.onUnknownRpcMethodRequest=function(e,t){return Y(r,null,k().mark((function n(){var r,i,o;return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(r=t.id,i=t.method,n.prev=1,!this.registeredMethods.includes(i)){n.next=4;break}return n.abrupt("return");case 4:return o=Object(h.G)("WC_METHOD_UNSUPPORTED",i),n.next=7,this.sendError(r,e,o);case 7:this.logger.error(o),n.next=15;break;case 10:return n.prev=10,n.t0=n.catch(1),n.next=14,this.sendError(r,e,n.t0);case 14:this.logger.error(n.t0);case 15:case"end":return n.stop()}}),n,this,[[1,10]])})))},this.onUnknownRpcMethodResponse=function(e){r.registeredMethods.includes(e)||r.logger.error(Object(h.G)("WC_METHOD_UNSUPPORTED",e))},this.isValidPair=function(e){var t;if(!Object(h.fb)(e)){var n=Object(h.A)("MISSING_OR_INVALID","pair() params: ".concat(e)).message;throw new Error(n)}if(!Object(h.nb)(e.uri)){var r=Object(h.A)("MISSING_OR_INVALID","pair() uri: ".concat(e.uri)).message;throw new Error(r)}var i=Object(h.tb)(e.uri);if(null==(t=null==i?void 0:i.relay)||!t.protocol){var o=Object(h.A)("MISSING_OR_INVALID","pair() uri#relay-protocol").message;throw new Error(o)}if(null==i||!i.symKey){var a=Object(h.A)("MISSING_OR_INVALID","pair() uri#symKey").message;throw new Error(a)}if(null!=i&&i.expiryTimestamp&&Object(f.toMiliseconds)(null==i?void 0:i.expiryTimestamp)<Date.now()){var s=Object(h.A)("EXPIRED","pair() URI has expired. Please try again with a new connection URI.").message;throw new Error(s)}},this.isValidPing=function(e){return Y(r,null,k().mark((function t(){var n,r,i;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Object(h.fb)(e)){t.next=3;break}throw n=Object(h.A)("MISSING_OR_INVALID","ping() params: ".concat(e)),r=n.message,new Error(r);case 3:return i=e.topic,t.next=6,this.isValidPairingTopic(i);case 6:case"end":return t.stop()}}),t,this)})))},this.isValidDisconnect=function(e){return Y(r,null,k().mark((function t(){var n,r,i;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Object(h.fb)(e)){t.next=3;break}throw n=Object(h.A)("MISSING_OR_INVALID","disconnect() params: ".concat(e)),r=n.message,new Error(r);case 3:return i=e.topic,t.next=6,this.isValidPairingTopic(i);case 6:case"end":return t.stop()}}),t,this)})))},this.isValidPairingTopic=function(e){return Y(r,null,k().mark((function t(){var n,r,i,o,a,s;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(Object(h.mb)(e,!1)){t.next=3;break}throw n=Object(h.A)("MISSING_OR_INVALID","pairing topic should be a string: ".concat(e)),r=n.message,new Error(r);case 3:if(this.pairings.keys.includes(e)){t.next=6;break}throw i=Object(h.A)("NO_MATCHING_KEY","pairing topic doesn't exist: ".concat(e)),o=i.message,new Error(o);case 6:if(!Object(h.M)(this.pairings.get(e).expiry)){t.next=11;break}return t.next=9,this.deletePairing(e);case 9:throw a=Object(h.A)("EXPIRED","pairing topic: ".concat(e)),s=a.message,new Error(s);case 11:case"end":return t.stop()}}),t,this)})))},this.core=t,this.logger=Object(s.a)(n,this.name),this.pairings=new gn(this.core,this.logger,this.name,this.storagePrefix)}),[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"isInitialized",value:function(){if(!this.initialized){var e=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(e)}}},{key:"registerRelayerEvents",value:function(){var e=this;this.core.relayer.on(It.message,(function(t){return Y(e,null,k().mark((function e(){var n,r,i;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.topic,r=t.message,this.pairings.keys.includes(n)&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r))){e.next=3;break}return e.abrupt("return");case 3:return e.next=5,this.core.crypto.decode(n,r);case 5:if(i=e.sent,e.prev=6,!Object(y.isJsonRpcRequest)(i)){e.next=11;break}this.core.history.set(n,i),this.onRelayEventRequest({topic:n,payload:i}),e.next=18;break;case 11:if(e.t0=Object(y.isJsonRpcResponse)(i),!e.t0){e.next=18;break}return e.next=15,this.core.history.resolve(i);case 15:return e.next=17,this.onRelayEventResponse({topic:n,payload:i});case 17:this.core.history.delete(n,i.id);case 18:e.next=23;break;case 20:e.prev=20,e.t1=e.catch(6),this.logger.error(e.t1);case 23:case"end":return e.stop()}}),e,this,[[6,20]])})))}))}},{key:"registerExpirerEvents",value:function(){var e=this;this.core.expirer.on(_t.expired,(function(t){return Y(e,null,k().mark((function e(){var n,r;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=Object(h.sb)(t.target),r=n.topic,e.t0=r&&this.pairings.keys.includes(r),!e.t0){e.next=6;break}return e.next=5,this.deletePairing(r,!0);case 5:this.events.emit(Ct.expire,{topic:r});case 6:case"end":return e.stop()}}),e,this)})))}))}}]),wn=function(e){function t(e,n){var i;return S(this,t),(i=A(this,t,[e,n])).core=e,i.logger=n,i.records=new Map,i.events=new r.EventEmitter,i.name="history",i.version="0.3",i.cached=[],i.initialized=!1,i.storagePrefix=yt,i.init=function(){return Y(I(i),null,k().mark((function e(){var t=this;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.initialized,e.t0){e.next=9;break}return this.logger.trace("Initialized"),e.next=5,this.restore();case 5:this.cached.forEach((function(e){return t.records.set(e.id,e)})),this.cached=[],this.registerEventListeners(),this.initialized=!0;case 9:case"end":return e.stop()}}),e,this)})))},i.set=function(e,t,n){if(i.isInitialized(),i.logger.debug("Setting JSON-RPC request history record"),i.logger.trace({type:"method",method:"set",topic:e,request:t,chainId:n}),!i.records.has(t.id)){var r={id:t.id,topic:e,request:{method:t.method,params:t.params||null},chainId:n,expiry:Object(h.e)(f.THIRTY_DAYS)};i.records.set(r.id,r),i.persist(),i.events.emit(Ot,r)}},i.resolve=function(e){return Y(I(i),null,k().mark((function t(){var n;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:e}),this.records.has(e.id)){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,this.getRecord(e.id);case 4:x((n=t.sent).response)>"u"&&(n.response=Object(y.isJsonRpcError)(e)?{error:e.error}:{result:e.result},this.records.set(n.id,n),this.persist(),this.events.emit(zt,n));case 6:case"end":return t.stop()}}),t,this)})))},i.get=function(e,t){return Y(I(i),null,k().mark((function n(){return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:e,id:t}),n.next=5,this.getRecord(t);case 5:return n.abrupt("return",n.sent);case 6:case"end":return n.stop()}}),n,this)})))},i.delete=function(e,t){i.isInitialized(),i.logger.debug("Deleting record"),i.logger.trace({type:"method",method:"delete",id:t}),i.values.forEach((function(n){if(n.topic===e){if(x(t)<"u"&&n.id!==t)return;i.records.delete(n.id),i.events.emit(Pt,n)}})),i.persist()},i.exists=function(e,t){return Y(I(i),null,k().mark((function n(){return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(this.isInitialized(),!this.records.has(t)){n.next=9;break}return n.next=4,this.getRecord(t);case 4:n.t1=n.sent.topic,n.t2=e,n.t0=n.t1===n.t2,n.next=10;break;case 9:n.t0=!1;case 10:return n.abrupt("return",n.t0);case 11:case"end":return n.stop()}}),n,this)})))},i.on=function(e,t){i.events.on(e,t)},i.once=function(e,t){i.events.once(e,t)},i.off=function(e,t){i.events.off(e,t)},i.removeListener=function(e,t){i.events.removeListener(e,t)},i.logger=Object(s.a)(n,i.name),i}return T(t,e),D(t,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"size",get:function(){return this.records.size}},{key:"keys",get:function(){return Array.from(this.records.keys())}},{key:"values",get:function(){return Array.from(this.records.values())}},{key:"pending",get:function(){var e=[];return this.values.forEach((function(t){if(!(x(t.response)<"u")){var n={topic:t.topic,request:Object(y.formatJsonRpcRequest)(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(n)}})),e}},{key:"setJsonRpcRecords",value:function(e){return Y(this,null,k().mark((function t(){return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.setItem(this.storageKey,e);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"getJsonRpcRecords",value:function(){return Y(this,null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.getItem(this.storageKey);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"getRecord",value:function(e){this.isInitialized();var t=this.records.get(e);if(!t){var n=Object(h.A)("NO_MATCHING_KEY","".concat(this.name,": ").concat(e)).message;throw new Error(n)}return t}},{key:"persist",value:function(){return Y(this,null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setJsonRpcRecords(this.values);case 2:this.events.emit("history_sync");case 3:case"end":return e.stop()}}),e,this)})))}},{key:"restore",value:function(){return Y(this,null,k().mark((function e(){var t,n,r;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getJsonRpcRecords();case 3:if(!(x(t=e.sent)>"u")&&t.length){e.next=6;break}return e.abrupt("return");case 6:if(!this.records.size){e.next=9;break}throw n=Object(h.A)("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),new Error(r);case 9:this.cached=t,this.logger.debug("Successfully Restored records for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",records:this.values}),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),this.logger.debug("Failed to Restore records for ".concat(this.name)),this.logger.error(e.t0);case 15:case"end":return e.stop()}}),e,this,[[0,12]])})))}},{key:"registerEventListeners",value:function(){var e=this;this.events.on(Ot,(function(t){var n=Ot;e.logger.info("Emitting ".concat(n)),e.logger.debug({type:"event",event:n,record:t})})),this.events.on(zt,(function(t){var n=zt;e.logger.info("Emitting ".concat(n)),e.logger.debug({type:"event",event:n,record:t})})),this.events.on(Pt,(function(t){var n=Pt;e.logger.info("Emitting ".concat(n)),e.logger.debug({type:"event",event:n,record:t})})),this.core.heartbeat.on(a.HEARTBEAT_EVENTS.pulse,(function(){e.cleanup()}))}},{key:"cleanup",value:function(){var e=this;try{this.isInitialized();var t=!1;this.records.forEach((function(n){Object(f.toMiliseconds)(n.expiry||0)-Date.now()<=0&&(e.logger.info("Deleting expired history log: ".concat(n.id)),e.records.delete(n.id),e.events.emit(Pt,n,!1),t=!0)})),t&&this.persist()}catch(t){this.logger.warn(t)}}},{key:"isInitialized",value:function(){if(!this.initialized){var e=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(e)}}}])}(u.e),bn=function(e){function t(e,n){var i;return S(this,t),(i=A(this,t,[e,n])).core=e,i.logger=n,i.expirations=new Map,i.events=new r.EventEmitter,i.name="expirer",i.version="0.3",i.cached=[],i.initialized=!1,i.storagePrefix=yt,i.init=function(){return Y(I(i),null,k().mark((function e(){var t=this;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.initialized,e.t0){e.next=9;break}return this.logger.trace("Initialized"),e.next=5,this.restore();case 5:this.cached.forEach((function(e){return t.expirations.set(e.target,e)})),this.cached=[],this.registerEventListeners(),this.initialized=!0;case 9:case"end":return e.stop()}}),e,this)})))},i.has=function(e){try{var t=i.formatTarget(e);return x(i.getExpiration(t))<"u"}catch(e){return!1}},i.set=function(e,t){i.isInitialized();var n=i.formatTarget(e),r={target:n,expiry:t};i.expirations.set(n,r),i.checkExpiry(n,r),i.events.emit(_t.created,{target:n,expiration:r})},i.get=function(e){i.isInitialized();var t=i.formatTarget(e);return i.getExpiration(t)},i.del=function(e){if(i.isInitialized(),i.has(e)){var t=i.formatTarget(e),n=i.getExpiration(t);i.expirations.delete(t),i.events.emit(_t.deleted,{target:t,expiration:n})}},i.on=function(e,t){i.events.on(e,t)},i.once=function(e,t){i.events.once(e,t)},i.off=function(e,t){i.events.off(e,t)},i.removeListener=function(e,t){i.events.removeListener(e,t)},i.logger=Object(s.a)(n,i.name),i}return T(t,e),D(t,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"storageKey",get:function(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}},{key:"length",get:function(){return this.expirations.size}},{key:"keys",get:function(){return Array.from(this.expirations.keys())}},{key:"values",get:function(){return Array.from(this.expirations.values())}},{key:"formatTarget",value:function(e){if("string"==typeof e)return Object(h.r)(e);if("number"==typeof e)return Object(h.o)(e);var t=Object(h.A)("UNKNOWN_TYPE","Target type: ".concat(x(e))).message;throw new Error(t)}},{key:"setExpirations",value:function(e){return Y(this,null,k().mark((function t(){return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.core.storage.setItem(this.storageKey,e);case 2:case"end":return t.stop()}}),t,this)})))}},{key:"getExpirations",value:function(){return Y(this,null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.core.storage.getItem(this.storageKey);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"persist",value:function(){return Y(this,null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setExpirations(this.values);case 2:this.events.emit(_t.sync);case 3:case"end":return e.stop()}}),e,this)})))}},{key:"restore",value:function(){return Y(this,null,k().mark((function e(){var t,n,r;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,this.getExpirations();case 3:if(!(x(t=e.sent)>"u")&&t.length){e.next=6;break}return e.abrupt("return");case 6:if(!this.expirations.size){e.next=9;break}throw n=Object(h.A)("RESTORE_WILL_OVERRIDE",this.name),r=n.message,this.logger.error(r),new Error(r);case 9:this.cached=t,this.logger.debug("Successfully Restored expirations for ".concat(this.name)),this.logger.trace({type:"method",method:"restore",expirations:this.values}),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),this.logger.debug("Failed to Restore expirations for ".concat(this.name)),this.logger.error(e.t0);case 15:case"end":return e.stop()}}),e,this,[[0,12]])})))}},{key:"getExpiration",value:function(e){var t=this.expirations.get(e);if(!t){var n=Object(h.A)("NO_MATCHING_KEY","".concat(this.name,": ").concat(e)).message;throw this.logger.warn(n),new Error(n)}return t}},{key:"checkExpiry",value:function(e,t){var n=t.expiry;Object(f.toMiliseconds)(n)-Date.now()<=0&&this.expire(e,t)}},{key:"expire",value:function(e,t){this.expirations.delete(e),this.events.emit(_t.expired,{target:e,expiration:t})}},{key:"checkExpirations",value:function(){var e=this;this.core.relayer.connected&&this.expirations.forEach((function(t,n){return e.checkExpiry(n,t)}))}},{key:"registerEventListeners",value:function(){var e=this;this.core.heartbeat.on(a.HEARTBEAT_EVENTS.pulse,(function(){return e.checkExpirations()})),this.events.on(_t.created,(function(t){var n=_t.created;e.logger.info("Emitting ".concat(n)),e.logger.debug({type:"event",event:n,data:t}),e.persist()})),this.events.on(_t.expired,(function(t){var n=_t.expired;e.logger.info("Emitting ".concat(n)),e.logger.debug({type:"event",event:n,data:t}),e.persist()})),this.events.on(_t.deleted,(function(t){var n=_t.deleted;e.logger.info("Emitting ".concat(n)),e.logger.debug({type:"event",event:n,data:t}),e.persist()}))}},{key:"isInitialized",value:function(){if(!this.initialized){var e=Object(h.A)("NOT_INITIALIZED",this.name).message;throw new Error(e)}}}])}(u.d),Mn=function(t){function n(t,r){var i;return S(this,n),(i=A(this,n,[t,r])).projectId=t,i.logger=r,i.name=Bt,i.initialized=!1,i.queue=[],i.verifyDisabled=!1,i.init=function(e){return Y(I(i),null,k().mark((function t(){var n;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.verifyDisabled&&!Object(h.Q)()&&Object(h.K)()){t.next=2;break}return t.abrupt("return");case 2:return n=this.getVerifyUrl(null==e?void 0:e.verifyUrl),this.verifyUrl!==n&&this.removeIframe(),this.verifyUrl=n,t.prev=4,t.next=7,this.createIframe();case 7:t.next=12;break;case 9:t.prev=9,t.t0=t.catch(4),this.logger.info("Verify iframe failed to load: ".concat(this.verifyUrl)),this.logger.info(t.t0);case 12:if(this.initialized){t.next=22;break}return this.removeIframe(),this.verifyUrl=Ut,t.prev=14,t.next=17,this.createIframe();case 17:t.next=22;break;case 19:t.prev=19,t.t1=t.catch(14),this.logger.info("Verify iframe failed to load: ".concat(this.verifyUrl)),this.logger.info(t.t1),this.verifyDisabled=!0;case 22:case"end":return t.stop()}}),t,this,[[4,9],[14,19]])})))},i.register=function(e){return Y(I(i),null,k().mark((function t(){return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.initialized){t.next=4;break}this.sendPost(e.attestationId),t.next=7;break;case 4:return this.addToQueue(e.attestationId),t.next=7,this.init();case 7:case"end":return t.stop()}}),t,this)})))},i.resolve=function(e){return Y(I(i),null,k().mark((function t(){var n,r;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!this.isDevEnv){t.next=2;break}return t.abrupt("return","");case 2:return n=this.getVerifyUrl(null==e?void 0:e.verifyUrl),t.prev=3,t.next=6,this.fetchAttestation(e.attestationId,n);case 6:r=t.sent,t.next=16;break;case 9:return t.prev=9,t.t0=t.catch(3),this.logger.info("failed to resolve attestation: ".concat(e.attestationId," from url: ").concat(n)),this.logger.info(t.t0),t.next=15,this.fetchAttestation(e.attestationId,Ut);case 15:r=t.sent;case 16:return t.abrupt("return",r);case 17:case"end":return t.stop()}}),t,this,[[3,9]])})))},i.fetchAttestation=function(e,t){return Y(I(i),null,k().mark((function n(){var r,i;return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return this.logger.info("resolving attestation: ".concat(e," from url: ").concat(t)),r=this.startAbortTimer(2*f.ONE_SECOND),n.next=4,fetch("".concat(t,"/attestation/").concat(e),{signal:this.abortController.signal});case 4:if(i=n.sent,clearTimeout(r),200!==i.status){n.next=12;break}return n.next=9,i.json();case 9:n.t0=n.sent,n.next=13;break;case 12:n.t0=void 0;case 13:return n.abrupt("return",n.t0);case 14:case"end":return n.stop()}}),n,this)})))},i.addToQueue=function(e){i.queue.push(e)},i.processQueue=function(){0!==i.queue.length&&(i.queue.forEach((function(e){return i.sendPost(e)})),i.queue=[])},i.sendPost=function(e){var t;try{if(!i.iframe)return;null==(t=i.iframe.contentWindow)||t.postMessage(e,"*"),i.logger.info("postMessage sent: ".concat(e," ").concat(i.verifyUrl))}catch(e){}},i.createIframe=function(){return Y(I(i),null,k().mark((function e(){var t,n,r=this;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=function e(n){"verify_ready"===n.data&&(r.onInit(),window.removeEventListener("message",e),t())},e.next=3,Promise.race([new Promise((function(e){var i=document.getElementById(Bt);if(i)return r.iframe=i,r.onInit(),e();window.addEventListener("message",n);var o=document.createElement("iframe");o.id=Bt,o.src="".concat(r.verifyUrl,"/").concat(r.projectId),o.style.display="none",document.body.append(o),r.iframe=o,t=e})),new Promise((function(e,t){return setTimeout((function(){window.removeEventListener("message",n),t("verify iframe load timeout")}),Object(f.toMiliseconds)(f.FIVE_SECONDS))}))]);case 3:case"end":return e.stop()}}),e)})))},i.onInit=function(){i.initialized=!0,i.processQueue()},i.removeIframe=function(){i.iframe&&(i.iframe.remove(),i.iframe=void 0,i.initialized=!1)},i.getVerifyUrl=function(e){var t=e||Rt;return Qt.includes(t)||(i.logger.info("verify url: ".concat(t,", not included in trusted list, assigning default: ").concat(Rt)),t=Rt),t},i.logger=Object(s.a)(r,i.name),i.verifyUrl=Rt,i.abortController=new AbortController,i.isDevEnv=Object(h.N)()&&e.env.IS_VITEST,i}return T(n,t),D(n,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"startAbortTimer",value:function(e){var t=this;return this.abortController=new AbortController,setTimeout((function(){return t.abortController.abort()}),Object(f.toMiliseconds)(e))}}])}(u.l),An=function(e){function t(e,n){var r;return S(this,t),(r=A(this,t,[e,n])).projectId=e,r.logger=n,r.context="echo",r.registerDeviceToken=function(e){return Y(I(r),null,k().mark((function t(){var n,r,i,o,a,s;return k().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n=e.clientId,r=e.token,i=e.notificationType,o=e.enableEncrypted,a=void 0!==o&&o,s="".concat("https://echo.walletconnect.com","/").concat(this.projectId,"/clients"),t.next=3,b()(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:n,type:i,token:r,always_raw:a})});case 3:case"end":return t.stop()}}),t,this)})))},r.logger=Object(s.a)(n,r.context),r}return T(t,e),D(t)}(u.b),In=Object.defineProperty,Nn=Object.getOwnPropertySymbols,Tn=Object.prototype.hasOwnProperty,En=Object.prototype.propertyIsEnumerable,xn=function(e,t,n){return t in e?In(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n},kn=function(e,t){for(var n in t||(t={}))Tn.call(t,n)&&xn(e,n,t[n]);if(Nn){var r,i=O(Nn(t));try{for(i.s();!(r=i.n()).done;)n=r.value,En.call(t,n)&&xn(e,n,t[n])}catch(e){i.e(e)}finally{i.f()}}return e},Ln=function(e){function t(e){var n,i;S(this,t),(n=A(this,t,[e])).protocol="wc",n.version=2,n.name=pt,n.events=new r.EventEmitter,n.initialized=!1,n.on=function(e,t){return n.events.on(e,t)},n.once=function(e,t){return n.events.once(e,t)},n.off=function(e,t){return n.events.off(e,t)},n.removeListener=function(e,t){return n.events.removeListener(e,t)},n.projectId=null==e?void 0:e.projectId,n.relayUrl=(null==e?void 0:e.relayUrl)||Mt,n.customStoragePrefix=null!=e&&e.customStoragePrefix?":".concat(e.customStoragePrefix):"";var u=Object(s.c)({level:"string"==typeof(null==e?void 0:e.logger)&&e.logger?e.logger:"error"}),c=Object(s.b)({opts:u,maxSizeInBytes:null==e?void 0:e.maxLogBlobSizeInBytes,loggerOverride:null==e?void 0:e.logger}),l=c.logger,h=c.chunkLoggerController;return n.logChunkController=h,null!=(i=n.logChunkController)&&i.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=function(){return Y(n,null,k().mark((function e(){var t,n;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=null!=(t=this.logChunkController)&&t.downloadLogsBlobInBrowser,!e.t0){e.next=10;break}if(e.t1=null==(n=this.logChunkController),e.t1){e.next=10;break}return e.t2=n,e.next=7,this.crypto.getClientId();case 7:e.t3=e.sent,e.t4={clientId:e.t3},e.t2.downloadLogsBlobInBrowser.call(e.t2,e.t4);case 10:case"end":return e.stop()}}),e,this)})))}),n.logger=Object(s.a)(l,n.name),n.heartbeat=new a.HeartBeat,n.crypto=new Yt(n,n.logger,null==e?void 0:e.keychain),n.history=new wn(n,n.logger),n.expirer=new bn(n,n.logger),n.storage=null!=e&&e.storage?e.storage:new o.a(kn(kn({},mt),null==e?void 0:e.storageOptions)),n.relayer=new ln({core:n,logger:n.logger,relayUrl:n.relayUrl,projectId:n.projectId}),n.pairing=new vn(n,n.logger),n.verify=new Mn(n.projectId||"",n.logger),n.echoClient=new An(n.projectId||"",n.logger),n}return T(t,e),D(t,[{key:"context",get:function(){return Object(s.d)(this.logger)}},{key:"start",value:function(){return Y(this,null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=this.initialized,e.t0){e.next=4;break}return e.next=4,this.initialize();case 4:case"end":return e.stop()}}),e,this)})))}},{key:"getLogsBlob",value:function(){return Y(this,null,k().mark((function e(){var t;return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(t=this.logChunkController)){e.next=4;break}e.t0=void 0,e.next=10;break;case 4:return e.t1=t,e.next=7,this.crypto.getClientId();case 7:e.t2=e.sent,e.t3={clientId:e.t2},e.t0=e.t1.logsToBlob.call(e.t1,e.t3);case 10:return e.abrupt("return",e.t0);case 11:case"end":return e.stop()}}),e,this)})))}},{key:"initialize",value:function(){return Y(this,null,k().mark((function e(){return k().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return this.logger.trace("Initialized"),e.prev=1,e.next=4,this.crypto.init();case 4:return e.next=6,this.history.init();case 6:return e.next=8,this.expirer.init();case 8:return e.next=10,this.relayer.init();case 10:return e.next=12,this.heartbeat.init();case 12:return e.next=14,this.pairing.init();case 14:this.initialized=!0,this.logger.info("Core Initialization Success"),e.next=21;break;case 18:throw e.prev=18,e.t0=e.catch(1),this.logger.warn("Core Initialization Failure at epoch ".concat(Date.now()),e.t0),this.logger.error(e.t0.message),e.t0;case 21:case"end":return e.stop()}}),e,this,[[1,18]])})))}}],[{key:"init",value:function(e){return Y(this,null,k().mark((function n(){var r,i;return k().wrap((function(n){for(;;)switch(n.prev=n.next){case 0:return r=new t(e),n.next=3,r.initialize();case 3:return n.next=5,r.crypto.getClientId();case 5:return i=n.sent,n.next=8,r.storage.setItem("WALLETCONNECT_CLIENT_ID",i);case 8:return n.abrupt("return",r);case 9:case"end":return n.stop()}}),n)})))}}])}(u.a)}).call(this,n(33))},function(e,t,n){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function i(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"string";if(!e[t]||r(e[t])!==n)throw new Error('Missing or invalid "'.concat(t,'" param'))}function o(e,t,n){return!!(n.length?function(e,t){return Array.isArray(e)?e.length>=t:Object.keys(e).length>=t}(e,t.length):function(e,t){return Array.isArray(e)?e.length===t:Object.keys(e).length===t}(e,t.length))&&function(e,t){var n=!0;return t.forEach((function(t){t in e||(n=!1)})),n}(e,t)}function a(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"_",r=e.split(n);return r[r.length-1].trim().toLowerCase()===t.trim().toLowerCase()}n.d(t,"a",(function(){return i})),n.d(t,"b",(function(){return o})),n.d(t,"c",(function(){return a}))},function(e,t,n){n.d(t,"a",(function(){return y})),n.d(t,"b",(function(){return N})),n.d(t,"c",(function(){return E})),n.d(t,"d",(function(){return A})),n.d(t,"e",(function(){return m})),n.d(t,"f",(function(){return g})),n.d(t,"g",(function(){return v})),n.d(t,"h",(function(){return w})),n.d(t,"i",(function(){return T})),n.d(t,"j",(function(){return b})),n.d(t,"k",(function(){return M})),n.d(t,"l",(function(){return I}));var r=n(22),i=n(6),o=n.n(i);function a(e){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function s(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,c(r.key),r)}}function u(e,t,n){return t&&s(e.prototype,t),n&&s(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function c(e){var t=function(e,t){if("object"!=a(e)||!e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var r=n.call(e,t);if("object"!=a(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e,"string");return"symbol"==a(t)?t:t+""}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t,n){return t=d(t),function(e,t){if(t&&("object"===a(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,function(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return!!e}()?Reflect.construct(t,n||[],d(e).constructor):t.apply(e,n))}function d(e){return(d=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function f(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}function p(e,t){return(p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e})(e,t)}var y=function(e){function t(e){var n;return l(this,t),(n=h(this,t)).opts=e,n.protocol="wc",n.version=2,n}return f(t,e),u(t)}(r.IEvents),m=function(e){function t(e,n){var r;return l(this,t),(r=h(this,t)).core=e,r.logger=n,r.records=new Map,r}return f(t,e),u(t)}(r.IEvents),g=u((function e(t,n){l(this,e),this.logger=t,this.core=n})),v=function(e){function t(e,n){var r;return l(this,t),(r=h(this,t)).relayer=e,r.logger=n,r}return f(t,e),u(t)}(r.IEvents),w=function(e){function t(e){return l(this,t),h(this,t)}return f(t,e),u(t)}(r.IEvents),b=u((function e(t,n,r,i){l(this,e),this.core=t,this.logger=n,this.name=r})),M=function(e){function t(e,n){var r;return l(this,t),(r=h(this,t)).relayer=e,r.logger=n,r}return f(t,e),u(t)}(r.IEvents),A=function(e){function t(e,n){var r;return l(this,t),(r=h(this,t)).core=e,r.logger=n,r}return f(t,e),u(t)}(r.IEvents),I=u((function e(t,n){l(this,e),this.projectId=t,this.logger=n})),N=u((function e(t,n){l(this,e),this.projectId=t,this.logger=n})),T=(o.a,u((function e(t){l(this,e),this.opts=t,this.protocol="wc",this.version=2}))),E=(i.EventEmitter,u((function e(t){l(this,e),this.client=t})))},function(e,t,n){Object.defineProperty(t,"__esModule",{value:!0}),t.wipe=function(e){for(var t=0;t<e.length;t++)e[t]=0;return e}},function(e,t,n){n.d(t,"c",(function(){return i})),n.d(t,"d",(function(){return o})),n.d(t,"a",(function(){return a})),n.d(t,"b",(function(){return s})),n.d(t,"g",(function(){return u})),n.d(t,"h",(function(){return c})),n.d(t,"e",(function(){return l})),n.d(t,"f",(function(){return h}));var r=n(10);function i(e){return Object(r.c)(e,"subscribe")}function o(e){return Object(r.b)(e,["topic"],[])}function a(e){return Object(r.c)(e,"publish")}function s(e){return Object(r.b)(e,["message","topic","ttl"],["prompt","tag"])}function u(e){return Object(r.c)(e,"unsubscribe")}function c(e){return Object(r.b)(e,["id","topic"],[])}function l(e){return Object(r.c)(e,"subscription")}function h(e){return Object(r.b)(e,["id","data"],[])}},function(e,t,n){var r=Object.defineProperty,i=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable,s=(e,t,n)=>t in e?r(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,u=(e,t)=>{for(var n in t||(t={}))o.call(t,n)&&s(e,n,t[n]);if(i)for(var n of i(t))a.call(t,n)&&s(e,n,t[n]);return e};Object.defineProperty(t,"__esModule",{value:!0});var c=n(95),l=n(18);class h{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class d{constructor(e,t,n){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return p(this,e)}}class f{constructor(e){this.decoders=e}or(e){return p(this,e)}decode(e){const t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const p=(e,t)=>new f(u(u({},e.decoders||{[e.prefix]:e}),t.decoders||{[t.prefix]:t}));class y{constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new h(e,t,n),this.decoder=new d(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const m=({name:e,prefix:t,encode:n,decode:r})=>new y(e,t,n,r);t.Codec=y,t.baseX=({prefix:e,name:t,alphabet:n})=>{const{encode:r,decode:i}=c(n,t);return m({prefix:e,name:t,encode:r,decode:e=>l.coerce(i(e))})},t.from=m,t.or=p,t.rfc4648=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>m({prefix:t,name:e,encode:e=>((e,t,n)=>{const r="="===t[t.length-1],i=(1<<n)-1;let o="",a=0,s=0;for(let r=0;r<e.length;++r)for(s=s<<8|e[r],a+=8;a>n;)a-=n,o+=t[i&s>>a];if(a&&(o+=t[i&s<<n-a]),r)for(;o.length*n&7;)o+="=";return o})(e,r,n),decode:t=>((e,t,n,r)=>{const i={};for(let e=0;e<t.length;++e)i[t[e]]=e;let o=e.length;for(;"="===e[o-1];)--o;const a=new Uint8Array(o*n/8|0);let s=0,u=0,c=0;for(let t=0;t<o;++t){const o=i[e[t]];if(void 0===o)throw new SyntaxError(`Non-${r} character`);u=u<<n|o,s+=n,s>=8&&(s-=8,a[c++]=255&u>>s)}if(s>=n||255&u<<8-s)throw new SyntaxError("Unexpected end of data");return a})(t,r,n,e)})},function(e,t,n){const r=n(86);e.exports=a;const i=function(){function e(e){return void 0!==e&&e}try{return"undefined"!=typeof globalThis||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(t){return e(self)||e(window)||e(this)||{}}}().console||{},o={mapHttpRequest:p,mapHttpResponse:p,wrapRequestSerializer:y,wrapResponseSerializer:y,wrapErrorSerializer:y,req:p,res:p,err:function(e){const t={type:e.constructor.name,msg:e.message,stack:e.stack};for(const n in e)void 0===t[n]&&(t[n]=e[n]);return t}};function a(e){(e=e||{}).browser=e.browser||{};const t=e.browser.transmit;if(t&&"function"!=typeof t.send)throw Error("pino: transmit option must have a send function");const n=e.browser.write||i;e.browser.write&&(e.browser.asObject=!0);const r=e.serializers||{},o=function(e,t){return Array.isArray(e)?e.filter((function(e){return"!stdSerializers.err"!==e})):!0===e&&Object.keys(t)}(e.browser.serialize,r);let u=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(u=!1),"function"==typeof n&&(n.error=n.fatal=n.warn=n.info=n.debug=n.trace=n),!1===e.enabled&&(e.level="silent");const h=e.level||"info",p=Object.create(n);p.log||(p.log=m),Object.defineProperty(p,"levelVal",{get:function(){return"silent"===this.level?1/0:this.levels.values[this.level]}}),Object.defineProperty(p,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,s(y,p,"error","log"),s(y,p,"fatal","error"),s(y,p,"warn","error"),s(y,p,"info","log"),s(y,p,"debug","log"),s(y,p,"trace","log")}});const y={transmit:t,serialize:o,asObject:e.browser.asObject,levels:["error","fatal","warn","info","debug","trace"],timestamp:f(e)};return p.levels=a.levels,p.level=h,p.setMaxListeners=p.getMaxListeners=p.emit=p.addListener=p.on=p.prependListener=p.once=p.prependOnceListener=p.removeListener=p.removeAllListeners=p.listeners=p.listenerCount=p.eventNames=p.write=p.flush=m,p.serializers=r,p._serialize=o,p._stdErrSerialize=u,p.child=function(n,i){if(!n)throw new Error("missing bindings for child Pino");i=i||{},o&&n.serializers&&(i.serializers=n.serializers);const a=i.serializers;if(o&&a){var s=Object.assign({},r,a),u=!0===e.browser.serialize?Object.keys(s):o;delete n.serializers,c([n],u,s,this._stdErrSerialize)}function h(e){this._childLevel=1+(0|e._childLevel),this.error=l(e,n,"error"),this.fatal=l(e,n,"fatal"),this.warn=l(e,n,"warn"),this.info=l(e,n,"info"),this.debug=l(e,n,"debug"),this.trace=l(e,n,"trace"),s&&(this.serializers=s,this._serialize=u),t&&(this._logEvent=d([].concat(e._logEvent.bindings,n)))}return h.prototype=this,new h(this)},t&&(p._logEvent=d()),p}function s(e,t,n,r){const o=Object.getPrototypeOf(t);t[n]=t.levelVal>t.levels.values[n]?m:o[n]?o[n]:i[n]||i[r]||m,function(e,t,n){var r;(e.transmit||t[n]!==m)&&(t[n]=(r=t[n],function(){const o=e.timestamp(),s=new Array(arguments.length),l=Object.getPrototypeOf&&Object.getPrototypeOf(this)===i?i:this;for(var d=0;d<s.length;d++)s[d]=arguments[d];if(e.serialize&&!e.asObject&&c(s,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?r.call(l,u(this,n,s,o)):r.apply(l,s),e.transmit){const r=e.transmit.level||t.level,i=a.levels.values[r],u=a.levels.values[n];if(u<i)return;h(this,{ts:o,methodLevel:n,methodValue:u,transmitLevel:r,transmitValue:a.levels.values[e.transmit.level||t.level],send:e.transmit.send,val:t.levelVal},s)}}))}(e,t,n)}function u(e,t,n,i){e._serialize&&c(n,e._serialize,e.serializers,e._stdErrSerialize);const o=n.slice();let s=o[0];const u={};i&&(u.time=i),u.level=a.levels.values[t];let l=1+(0|e._childLevel);if(l<1&&(l=1),null!==s&&"object"==typeof s){for(;l--&&"object"==typeof o[0];)Object.assign(u,o.shift());s=o.length?r(o.shift(),o):void 0}else"string"==typeof s&&(s=r(o.shift(),o));return void 0!==s&&(u.msg=s),u}function c(e,t,n,r){for(const i in e)if(r&&e[i]instanceof Error)e[i]=a.stdSerializers.err(e[i]);else if("object"==typeof e[i]&&!Array.isArray(e[i]))for(const r in e[i])t&&t.indexOf(r)>-1&&r in n&&(e[i][r]=n[r](e[i][r]))}function l(e,t,n){return function(){const r=new Array(1+arguments.length);r[0]=t;for(var i=1;i<r.length;i++)r[i]=arguments[i-1];return e[n].apply(this,r)}}function h(e,t,n){const r=t.send,i=t.ts,o=t.methodLevel,a=t.methodValue,s=t.val,u=e._logEvent.bindings;c(n,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=n.filter((function(e){return-1===u.indexOf(e)})),e._logEvent.level.label=o,e._logEvent.level.value=a,r(o,e._logEvent,s),e._logEvent=d(u)}function d(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function f(e){return"function"==typeof e.timestamp?e.timestamp:!1===e.timestamp?g:v}function p(){return{}}function y(e){return e}function m(){}function g(){return!1}function v(){return Date.now()}a.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},a.stdSerializers=o,a.stdTimeFunctions=Object.assign({},{nullTime:g,epochTime:v,unixTime:function(){return Math.round(Date.now()/1e3)},isoTime:function(){return new Date(Date.now()).toISOString()}})},function(e,t,n){n.r(t),n.d(t,"__extends",(function(){return i})),n.d(t,"__assign",(function(){return o})),n.d(t,"__rest",(function(){return a})),n.d(t,"__decorate",(function(){return s})),n.d(t,"__param",(function(){return u})),n.d(t,"__metadata",(function(){return c})),n.d(t,"__awaiter",(function(){return l})),n.d(t,"__generator",(function(){return h})),n.d(t,"__createBinding",(function(){return d})),n.d(t,"__exportStar",(function(){return f})),n.d(t,"__values",(function(){return p})),n.d(t,"__read",(function(){return y})),n.d(t,"__spread",(function(){return m})),n.d(t,"__spreadArrays",(function(){return g})),n.d(t,"__await",(function(){return v})),n.d(t,"__asyncGenerator",(function(){return w})),n.d(t,"__asyncDelegator",(function(){return b})),n.d(t,"__asyncValues",(function(){return M})),n.d(t,"__makeTemplateObject",(function(){return A})),n.d(t,"__importStar",(function(){return I})),n.d(t,"__importDefault",(function(){return N})),n.d(t,"__classPrivateFieldGet",(function(){return T})),n.d(t,"__classPrivateFieldSet",(function(){return E}));
12
12
  /*! *****************************************************************************
13
13
  Copyright (c) Microsoft Corporation.